-
Notifications
You must be signed in to change notification settings - Fork 4
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
Final frame fix #82
Conversation
core/lls_core/models/lattice_data.py
Outdated
Check final frame, if acquisition is stopped halfway through it causes failures | ||
This validator will remove a bad final frame | ||
""" | ||
final_frame = v[-1] |
There was a problem hiding this comment.
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)>
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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:
final_frame = v[-1] | |
final_frame = v.isel(T=-1, C=-1) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
values["input_image"] = aics.xarray_dask_data | |
values["input_image"] = aics.xarray_dask_data |
Dealing with issue #80
This branch also has the fixes for the other issues but all should be able to be merged once approved