-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add basic Affine Grid Coordinates to xarray Datasets #35
Conversation
elif result := self.ctype[dim]: | ||
return result | ||
else: | ||
return None |
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.
Tries to find the axis CNAME first, else falls back to CTYPE
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.
Couple of niggles but I don't see any showstoppers here. Happy to approve but I would also like to close the loop with ratt-ru/tigger#146 so let's keep fits viewers in mind as well
We could open a separate issue regarding Tigger integration? |
Yeah, totally separate just wanted to link it |
def test_multiple_unnamed_hdus(multiple_hdu_file): | ||
"""Test hdu requests with hdu indexes""" | ||
(ds,) = xds_from_fits(multiple_hdu_file, hdus=0) | ||
assert len(ds.data_vars) == 1 | ||
assert ds.hdu.shape == (10, 10) | ||
assert ds.hdu.dims == ("X", "Y") | ||
|
||
(ds,) = xds_from_fits(multiple_hdu_file, hdus=[0, 2]) | ||
assert len(ds.data_vars) == 2 | ||
|
||
assert ds.hdu0.shape == (10, 10) | ||
assert ds.hdu0.dims == ("hdu0-X", "hdu0-Y") | ||
|
||
assert ds.hdu2.shape == (30, 40, 50) | ||
assert ds.hdu2.dims == ("hdu2-X", "hdu2-Y", "hdu2-FREQ") | ||
|
||
|
||
def test_multiple_named_hdus(multiple_hdu_file): | ||
"""Test hdu requests with named hdus""" | ||
(ds,) = xds_from_fits(multiple_hdu_file, hdus={0: "beam"}) | ||
assert ds.beam.dims == ("X", "Y") | ||
assert ds.beam.shape == (10, 10) | ||
|
||
(ds,) = xds_from_fits(multiple_hdu_file, hdus=["beam"]) | ||
assert ds.beam.dims == ("X", "Y") | ||
assert ds.beam.shape == (10, 10) | ||
|
||
(ds,) = xds_from_fits(multiple_hdu_file, hdus={0: "beam", 2: "3C147"}) | ||
assert ds.beam.dims == ("beam-X", "beam-Y") | ||
assert ds.beam.shape == (10, 10) | ||
assert ds["3C147"].dims == ("3C147-X", "3C147-Y", "3C147-FREQ") | ||
assert ds["3C147"].shape == (30, 40, 50) | ||
|
||
(ds,) = xds_from_fits(multiple_hdu_file, hdus=["beam", "3C147"]) | ||
assert ds.beam.dims == ("beam-X", "beam-Y") | ||
assert ds.beam.shape == (10, 10) | ||
assert ds["3C147"].dims == ("3C147-X", "3C147-Y", "3C147-FREQ") | ||
assert ds["3C147"].shape == (10, 20, 30) |
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.
@o-smirnov @landmanbester Sorry, I didn't highlight everything in my previous comment. This illustrates the naming schemas for hdus and dimensions.
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.
Excellent, all looks very neat and friendly now!
Note that the signature for
@o-smirnov I think you're the only one impacted by this. I should create some proper documentation for this. |
Closes #27
This PR adds basic Affine coordinates to xarray Datasets. This is similar to the galsim's AffineTransform.
This linear transformation only approximates more complex WCS coordinate systems, but may be useful for developers to reason about their data cubes