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
redshift applied in the wrong direction in Spectrum1D object #820
Comments
Thanks @stephjuneau ! I think I worked out a more minimal example that demonstrates the issue :
Whereas @stephjuneau was expecting this to yield a rest wavelength from 3333 to 6000. however, this is also true:
Which is the behavior @stephjuneau says above is happening. But to get the behavior I think @stephjuneau wants the following works:
that is, if you give the redshift at spectrum creation time it does the right thing. But @stephjuneau is talking about a workflow where you load the spectrum, look at it, and only after that want to assign a redshift. I think there's three possible solutions to this:
I slightly favor 3 but can be convinced cc @astrofrog and @nmearl . I feel like we've talked about this before, but I couldn't find an issue about it so... |
(Oh, and I know |
The setters for Spectrum1d.redshift and Spectrum1d.radial_velocity shift the spectral axis, which from astropy#820 is not always what users expect. This adds three helpers, one which does the current shifting (and is explicitly documented to do that), and two which simply change the values of redshift and radial_velocity.
Hi, I just tried filling in the redshift value for a Spectrum1D object after the redshift information became available, and the spectral axis was immediately multiplied by (1+z). I would normally expect that the wavelength will be reported in observed frame by default and not changed when the user adds the measured redshift to the object but that the redshift allows the user to convert from observed frame to rest-frame. As a user, I would also expect that if there is a "to_rest" operation, it will apply to the spectral axis and to the flux and uncertainty as well, taking account the units to treat the f_lambda and f_nu units properly (the latter is already in issue #741 #741). I would also hope to be able to know whether the wavelength/fluxes are in rest or observed frame (maybe a keyword with rest=True or False ?).
Here is a simple code that I used in a Notebook based on a demo ran by Erik Tollerud:
The text was updated successfully, but these errors were encountered: