-
Notifications
You must be signed in to change notification settings - Fork 70
Add ImageStack.from_xarray() constructor for memory-efficient round processing #2155
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: shachafl <[email protected]>
…mutability Co-authored-by: shachafl <[email protected]>
Co-authored-by: shachafl <[email protected]>
|
I can confirm, that it works as expected for my use case (creating ImageStacks form xarrays I loaded from nc files, see here). This code works with the starfish version from this pr: import xarray as xr
from starfish.core.imagestack.imagestack import ImageStack
image_xr = xr.open_dataset("imgs.nc").__xarray_dataarray_variable__
image_stack = ImageStack.from_xarray(image_xr)
# just to check
(image_xr == image_stack.xarray).values.all()
# returns np.True_ |
|
I like this feature. I don't have any data sitting around, but @iimog's confirmation as current user is worth more anyway. @shachafl before merging this, can you add comments here and on the corresponding issue #2155 noting that the final implementation here is different from the GPT-generated code in the issue? like none of the |
|
As @berl mentioned, this PR is modest in scope, and doesn't add dask-backed DataArray functionality (although recommended by Copilot #1285 (comment)). If warranted by users, we can add in the near future better handling for large-stacks (so you can process without loading everything into memory.):
|
shachafl
left a comment
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.
Coding was done purely by Copilot agent.
Luckily this builds upon existing from_numpy constructor, so risk is low (without mentioning the extensive unit tests added, also by the agent).
Add ImageStack.from_xarray() method to enable ImageStack construction from xarray DataArrays:
Implementation details:
Original prompt
from_xarray#1285✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.