Skip to content
Snippets Groups Projects
Commit 1764c7e0 authored by Peter Swain's avatar Peter Swain
Browse files

change: set to list for new pandas version

parent 787ef6d8
No related branches found
No related tags found
No related merge requests found
...@@ -178,8 +178,8 @@ class Signal(BridgeH5): ...@@ -178,8 +178,8 @@ class Signal(BridgeH5):
else: else:
return merged return merged
if len(picks): if len(picks):
picked_indices = set(picks).intersection( picked_indices = list(
[tuple(x) for x in merged.index] set(picks).intersection([tuple(x) for x in merged.index])
) )
return merged.loc[picked_indices] return merged.loc[picked_indices]
else: else:
......
...@@ -595,7 +595,7 @@ class Writer(BridgeH5): ...@@ -595,7 +595,7 @@ class Writer(BridgeH5):
new_tps = set(df.columns) new_tps = set(df.columns)
if path + "/timepoint" in f: if path + "/timepoint" in f:
new_tps = new_tps.difference(f[path + "/timepoint"][()]) new_tps = new_tps.difference(f[path + "/timepoint"][()])
df = df[new_tps] df = df[list(new_tps)]
if ( if (
not hasattr(self, "id_cache") not hasattr(self, "id_cache")
......
...@@ -57,7 +57,7 @@ class buddings(LineageProcess): ...@@ -57,7 +57,7 @@ class buddings(LineageProcess):
traps_mothers[(trap, mother)].append(daughter) traps_mothers[(trap, mother)].append(daughter)
# a new dataframe with dimensions (n_mother_cells * n_tps) # a new dataframe with dimensions (n_mother_cells * n_tps)
mothers = signal.loc[ mothers = signal.loc[
set(signal.index).intersection(traps_mothers.keys()) list(set(signal.index).intersection(traps_mothers.keys()))
] ]
buddings = pd.DataFrame( buddings = pd.DataFrame(
np.zeros(mothers.shape).astype(bool), np.zeros(mothers.shape).astype(bool),
...@@ -76,6 +76,6 @@ class buddings(LineageProcess): ...@@ -76,6 +76,6 @@ class buddings(LineageProcess):
fvi.index.intersection(trap_daughter_ids) fvi.index.intersection(trap_daughter_ids)
].values ].values
# ignore zeros - buds in first image are not budding events # ignore zeros - buds in first image are not budding events
daughters_idx = set(times_of_bud_appearance).difference({0}) daughters_idx = list(set(times_of_bud_appearance).difference({0}))
buddings.loc[trap_mother_id, daughters_idx] = True buddings.loc[trap_mother_id, daughters_idx] = True
return buddings return buddings
...@@ -62,7 +62,9 @@ def get_merges(tracks, smooth=False, tol=0.2, window=5, degree=3) -> dict: ...@@ -62,7 +62,9 @@ def get_merges(tracks, smooth=False, tol=0.2, window=5, degree=3) -> dict:
# remove traps with no contiguous tracks # remove traps with no contiguous tracks
contigs = contigs.loc[contigs.apply(len) > 0] contigs = contigs.loc[contigs.apply(len) > 0]
# flatten to (trap, cell_id) pairs # flatten to (trap, cell_id) pairs
flat = set([k for v in contigs.values for i in v for j in i for k in j]) flat = list(
set([k for v in contigs.values for i in v for j in i for k in j])
)
# make a data frame of contiguous tracks with the tracks as arrays # make a data frame of contiguous tracks with the tracks as arrays
if smooth: if smooth:
smoothed_tracks = clean.loc[flat].apply( smoothed_tracks = clean.loc[flat].apply(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment