Skip to content

Commit 11d423e

Browse files
authored
Strip the slash on fov_name for valid anchors on the triplet (#313)
* strip the slash on the triplet * remove the copy(). not related to this PR * test was assuming a forward slash
1 parent 29b7247 commit 11d423e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/data/test_triplet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def test_datamodule_setup_fit(
4545
assert len(dm.train_dataset) == len_train
4646
assert len(dm.val_dataset) == len_val
4747
all_tracks = pd.concat([dm.train_dataset.tracks, dm.val_dataset.tracks])
48-
filtered_fov_names = all_tracks["fov_name"].str[1:].unique()
48+
filtered_fov_names = all_tracks["fov_name"].unique()
4949
for fov_name in filtered_fov_names:
5050
well_name, _ = fov_name.rsplit("/", 1)
5151
if include_wells is not None:

viscy/data/triplet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _filter_tracks(self, tracks_tables: list[pd.DataFrame]) -> pd.DataFrame:
180180
y_exclude, x_exclude = (self.yx_patch_size[0] // 2, self.yx_patch_size[1] // 2)
181181
for pos, tracks in zip(self.positions, tracks_tables, strict=True):
182182
tracks["position"] = [pos] * len(tracks)
183-
tracks["fov_name"] = pos.zgroup.name
183+
tracks["fov_name"] = pos.zgroup.name.strip("/")
184184
tracks["global_track_id"] = tracks["fov_name"].str.cat(
185185
tracks["track_id"].astype(str), sep="_"
186186
)

0 commit comments

Comments
 (0)