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

Final frame fix #82

Merged
merged 14 commits into from
Oct 15, 2024
Merged

Final frame fix #82

merged 14 commits into from
Oct 15, 2024

Conversation

DrLachie
Copy link
Contributor

@DrLachie DrLachie commented Sep 3, 2024

Dealing with issue #80
This branch also has the fixes for the other issues but all should be able to be merged once approved

Check final frame, if acquisition is stopped halfway through it causes failures
This validator will remove a bad final frame
"""
final_frame = v[-1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that v[-1] will just take the last index along the first axis, but not the other axes. Is this what you want here?

>>> arr
<xarray.DataArray (T: 2, C: 3, Z: 4, Y: 5, X: 6)>
>>> arr[-1]
<xarray.DataArray (C: 3, Z: 4, Y: 5, X: 6)>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's correct. I only want to check the final frame, that's the only one that should fail in this way, I could probably drop to a single channel as well to save processing time but it's a pretty marginal improvement and this is clearer I think

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, we could reduce the memory usage and possibly clarify what is happening by doing:

Suggested change
final_frame = v[-1]
final_frame = v.isel(T=-1, C=-1)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that is a bit more explicit, will make that change

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can click the "commit suggestion" button to use the change directly if you want.

@multimeric multimeric mentioned this pull request Sep 26, 2024
core/lls_core/models/lattice_data.py Outdated Show resolved Hide resolved
@@ -76,6 +77,21 @@ def read_image(cls, values: dict):
# Use the Deskew version of this validator, to do the actual image loading
return super().read_image(values)

@validator("input_image", pre=True, always=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@validator("input_image", pre=True, always=True)
@validator("input_image", pre=False, always=True)

@@ -191,7 +191,7 @@ def read_image(cls, values: dict):

# If the image was convertible to AICSImage, we should use the metadata from there
if aics:
values["input_image"] = aics.xarray_dask_data
values["input_image"] = aics.xarray_dask_data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
values["input_image"] = aics.xarray_dask_data
values["input_image"] = aics.xarray_dask_data

@DrLachie DrLachie merged commit 454d204 into master Oct 15, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors when final frame is incomplete Make the Python API and CLI parameters have uniform names
3 participants