Skip to content

COO-256 Multiple image planes in DetImage._data (data, std, count) - #20

Merged
Yashvi-Sharma merged 7 commits into
mainfrom
COO-256-imageplanes
Oct 12, 2026
Merged

Yashvi-Sharma merged 7 commits into
mainfrom
COO-256-imageplanes

Conversation

@Yashvi-Sharma

Copy link
Copy Markdown
Collaborator

Refactored DetImage _data attribute to hold a xarray.Dataset instead of array.DataArray.

  • Dataset stores the main array in 'data' variable, DetImage init and set_data() handle conversion from DataArray to Dataset. But if a Dataset is passed to be set it should contain 'data' variable.

  • all image_utils.py helpers were modified to work with both DataArray and Dataset

  • DetImage.data property behaves the same as before, returns 'data' variable from Dataset

  • DetImage.get_data() can be used to access full Dataset or a specific data_var

  • Output, FocalPlaneImage methods similarly refactored with extra convenience methods.

  • MasterCombine now returns DetImage with three image planes (data, std, count)

Comment thread src/eregion/datamodels/image.py Outdated
Comment thread src/eregion/datamodels/focalplaneimage.py Outdated
Comment thread src/eregion/datamodels/focalplaneimage.py Outdated
weatherhead99
weatherhead99 previously approved these changes Sep 23, 2026

@weatherhead99 weatherhead99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

couple of comments, nothing major. Nothing that really needs fixing immediately but some QoL stuff to go down the line. Merge already if you need this urgently for Welford combination stuff elsewhere (superflat etc).

Comment thread src/eregion/core/image_operations.py Outdated
Comment thread src/eregion/core/image_operations.py Outdated
temp = xr.DataArray(data=arr, coords=self.data.coords, dims=self.data.dims)
temp = xr.DataArray(data=arr, coords=temp.coords, dims=temp.dims)
else:
logger.warning("Mask key '%s' not found in masks. Showing unmasked data.", mask_key)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe not for this PR but I think it's time to move more semantic mask functionality into DetImage (e.g. all combined masks and maybe a couple other things, like a .get_masked() function that takes a duck typed input which can be like a string in which case it masks by key or raises on KeyError, or like by default all masks combined or similar. This is something we want in quite a few places

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added equivalents of get_mask(), get_masked_data() methods and combined_mask property in Output, DetImage and FocalPlaneImage

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks nice!

…dated combined mask helpers, ran thru PTC notebook and fixed any remaining bugs
weatherhead99
weatherhead99 previously approved these changes Oct 12, 2026

@weatherhead99 weatherhead99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks good!

@weatherhead99 weatherhead99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ahhhh

@Yashvi-Sharma
Yashvi-Sharma merged commit 0ee7a89 into main Oct 12, 2026
4 checks passed
@Yashvi-Sharma
Yashvi-Sharma deleted the COO-256-imageplanes branch October 12, 2026 21:00
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.

3 participants