Skip to content
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 redshift correction to velocity conversions. #491

Merged
merged 12 commits into from
Sep 18, 2019
Merged

Add redshift correction to velocity conversions. #491

merged 12 commits into from
Sep 18, 2019

Conversation

ibusko
Copy link
Contributor

@ibusko ibusko commented Jul 24, 2019

This PR addresses in part issue #258. It might, or might not be the correct interpretation of what this issue was intended to address in the first place. I understood the goal is to apply a known redshift correction to the velocity attribute of Spectrum1D instances.

The implementation uses the simple low-z approximate definition of redshift. It remains to be seen if this is what is actually intended. And, if not, we need more specific requirements on how to interpret redshift values, and what to do with them.

@eteq
Copy link
Member

eteq commented Sep 12, 2019

Leaving a quick follow-up: as discussed in #455 this (along with a few others) triggered a discussion of where redshift should live. #455 (comment) has the conclusion.

One way that's specifically relevant to this PR is that we won't have redshift_rv in functions and so on, but rather various opreations will yield Spectrum1D objects with .redshift and .radial_velocity attributes. So this could would need to be re-worked to look like that instead of the unified redshift_rv concept.

@eteq
Copy link
Member

eteq commented Sep 12, 2019

More concretely: I think the main change required to this PR is to implement redshift and radial_velocity as properties with getters and setters that both work with a single "internal" data object. The internal representation could be either since they're just a factor of c apart... But I think it's probably more natural to have the "true" data be in _radial_velocity, because it's usually velocity applications that have more stringent precision requirements.

@eteq eteq added this to the v0.6 milestone Sep 12, 2019
@eteq eteq self-assigned this Sep 13, 2019
@eteq
Copy link
Member

eteq commented Sep 13, 2019

I updated this to reflect #455, as we want to try to get this into 0.6 (and @ibusko indicated he didn't have time to do that).

Copy link
Contributor

@nmearl nmearl left a comment

Choose a reason for hiding this comment

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

Looks good, although I think we may wish to add a test where the Spectrum1D is initialized with the spectral_axis as a velocity to test the behavior when it's not converting.

(like template fitting) that set this attribute when they are run on
a spectrum.
"""
return self._radial_velocity/cnst.c
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return self._radial_velocity/cnst.c
return self._radial_velocity/cnst.c

if val is None:
self._radial_velocity = None
else:
self.radial_velocity = val * cnst.c
Copy link
Contributor

Choose a reason for hiding this comment

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

This assumption is really only true for small redshifts. Should we use the stricter definition?

(like template fitting) that set this attribute when they are run on
a spectrum.
"""
return self._radial_velocity
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return self._radial_velocity
return self._radial_velocity

@nmearl nmearl merged commit a5139a9 into astropy:master Sep 18, 2019
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.

None yet

3 participants