Skip to content

Commit

Permalink
membrne bump
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlab committed Mar 15, 2024
1 parent a73cf02 commit c2b5077
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
47 changes: 27 additions & 20 deletions src/napatrackmater/Trackvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,18 @@ def get_shape_dynamic_feature_dataframe(self):
"Cell_Axis_Mask",
],
)

cols_to_replace = [
"Radius",
"Volume",
"Eccentricity Comp First",
"Eccentricity Comp Second",
"Eccentricity Comp Third",
"Surface Area",
]
shape_dynamic_dataframe[cols_to_replace] = shape_dynamic_dataframe[
cols_to_replace
].apply(lambda x: np.where(x < 0, np.nan, x))
if len(latent_shape_features) > 0:
new_columns = [
f"latent_feature_number_{i}"
Expand Down Expand Up @@ -738,6 +750,13 @@ def _iterate_over_tracklets(
shape_dynamic_dataframe = pd.concat(
[shape_dynamic_dataframe, latent_features], axis=1
)

# Drop rows with NaN values
shape_dynamic_dataframe.dropna(inplace=True)
shape_dataframe.dropna(inplace=True)
dynamic_dataframe.dropna(inplace=True)
full_dataframe.dropna(inplace=True)

shape_dynamic_dataframe_list = shape_dynamic_dataframe.to_dict(orient="records")
shape_dataframe_list = shape_dataframe.to_dict(orient="records")
dynamic_dataframe_list = dynamic_dataframe.to_dict(orient="records")
Expand Down Expand Up @@ -1922,11 +1941,6 @@ def convert_tracks_to_arrays(
[[item for item in record.values()] for record in dynamic_dataframe_list]
)

assert (
shape_dynamic_track_array.shape[0]
== shape_track_array.shape[0]
== dynamic_track_array.shape[0]
), "Shape dynamic, shape and dynamic track arrays must have the same length."
if (
shape_dynamic_track_array.shape[0] > 1
and shape_dynamic_track_array.shape[0] >= min_length
Expand Down Expand Up @@ -2012,12 +2026,11 @@ def local_track_covaraince(analysis_vectors):
dynamic_track_array = np.array(
[[item for item in record.values()] for record in dynamic_dataframe_list]
)
assert (
shape_dynamic_track_array.shape[0]
== shape_track_array.shape[0]
== dynamic_track_array.shape[0]
), "Shape dynamic, shape and dynamic track arrays must have the same length."
if shape_dynamic_track_array.shape[0] > 1:

if (
shape_dynamic_track_array.shape[0] > 1
and len(shape_dynamic_track_array.shape) > 1
):

(
covariance_shape_dynamic,
Expand Down Expand Up @@ -2104,22 +2117,15 @@ def convert_tracks_to_simple_arrays(
for record in full_dataframe_list
]
)
assert (
shape_dynamic_track_array.shape[0]
== shape_track_array.shape[0]
== dynamic_track_array.shape[0]
), "Shape dynamic, shape and dynamic track arrays must have the same length."

if (
shape_dynamic_track_array.shape[0] > 1
and shape_dynamic_track_array.shape[0] >= min_length
if min_length is not None
else True
and len(shape_dynamic_track_array.shape) > 1
):

covariance_shape_dynamic = compute_raw_matrix(
shape_dynamic_track_array, t_delta=t_delta
)

covariance_shape = compute_raw_matrix(shape_track_array, t_delta=t_delta)

covariance_dynamic = compute_raw_matrix(
Expand All @@ -2129,6 +2135,7 @@ def convert_tracks_to_simple_arrays(
position_computation = compute_raw_matrix(
position_track_array, t_delta=t_delta, take_center=True
)

if (
covariance_shape_dynamic is not None
and covariance_shape is not None
Expand Down
4 changes: 2 additions & 2 deletions src/napatrackmater/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = version = "4.9.1"
__version_tuple__ = version_tuple = (4, 9, 1)
__version__ = version = "4.9.2"
__version_tuple__ = version_tuple = (4, 9, 2)

0 comments on commit c2b5077

Please sign in to comment.