-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
What is the intended and actual result of spectrum.with_spectral_unit
?
#676
Comments
Good catch. It seems that this is a victim of the transition to the APE 14 implementation. Before, we actually had wrapper classes around gwcs and fits wcs objects that included extra functionality (like exposed unit attributes), but this is no longer the case. We will have to revisit this implementation to fix it up. Clearly, a failure of the unit test coverage... The intention is to allow changing the stored spectral axis unit, which is maintained by the wcs (whether gwcs or fits wcs). This was a method to easily alter the wcs information to reflect the desired unit change (i.e. it would also alter the values stored in the wcs to reflect the conversion to the new unit). |
Looks like changing the call to |
Still would need to work out what to do with spectra with WCS without lookup_table and unit, like those loaded with |
From the docstring, it clearly seems to indicate that I can change spectral units to e.g. velocity. There is even a
Instead of a new spectrum in velocity units relative to the wavelength of Halpha, I get:
|
Closed by #1119. |
When reviewing the handling of units inside of
Spectrum1D
for #673 (to ensure things likespectral_axis.to('GHz')
work as expected), I noticed thewith_spectral_unit
method, which also has a test intest_spectral_axis_conversions
verifying that it functions, but not really what its function should be.From the docstring one might expect it to return a
Spectrum1D
copy withspectral_axis
converted to the specified unit, but from the code it becomes quickly clear that to only modifiesspectrum.wcs
. Or rather tries to:for a lookup-table WCS. A "true" (
CRVAL
/CD1_1
-constructed) WCS raisesBut the first use case does not seem to have any effect other than adding a
to the copied spectrum, since
_new_spectral_wcs
internally is creating the newwcs
asgwcs_from_array(self.spectral_axis)
which discards any modifications to
wcs.unit
made up to that point.Any insights on the use case for this?
The text was updated successfully, but these errors were encountered: