Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix single field issue in _compute_z_spacing #141

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/faim_ipa/hcs/imagexpress/StackAcquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def _compute_z_spacing(self, files: pd.DataFrame) -> Optional[float]:
channel_with_stack = np.sort(files[files["z"] == "2"]["channel"].unique())[0]
subset = files[files["channel"] == channel_with_stack]
subset = subset[subset["well"] == np.sort(subset["well"].unique())[0]]
subset = subset[subset["field"] == np.sort(subset["field"].unique())[0]]
first_field = np.sort(subset["field"].unique())[0]
if first_field is not None:
subset = subset[subset["field"] == np.sort(subset["field"].unique())[0]]

plane_positions = []

Expand Down
15 changes: 15 additions & 0 deletions tests/hcs/imagexpress/test_ImageXpress.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,18 @@ def test_time_lapse_acquistion(time_lapse_acquisition: PlateAcquisition):
assert tile.position.y in [0, 256]
assert tile.position.x in [0]
assert tile.shape == (256, 256)


def test_single_field_stack_acquistion(stack_acquisition: PlateAcquisition):
# Regular z spacing in dataset
files = stack_acquisition._parse_files()
z_step = stack_acquisition._compute_z_spacing(files)
assert z_step == 5

# Select the subset of only a single field to process
files = files[files["field"] == "s1"]
# When only a single field is available per well, the files dataframe
# has it set to None
files["field"] = None
z_step = stack_acquisition._compute_z_spacing(files)
assert z_step == 5
Loading