astropy / specutils

An Astropy coordinated package for astronomical spectroscopy. Maintainers: @nmearl @rosteen @keflavich @eteq
http://specutils.readthedocs.io/en/latest/
164 stars 126 forks source link

Cross-correlation peak-finding functions #638

Open eteq opened 4 years ago

eteq commented 4 years ago

As highlighted in this notebook: https://github.com/spacetelescope/jdat_notebooks/blob/c22a9856ac5ce1af947b1f5361b7f425e86625ad/notebooks/redshift_crosscorr/redshift_with_crosscorr.ipynb the machinery added in #544 to allow cross-correlation redshift currently does not come with any way to actually get an answer for the redshift from the lag peaks. We should add a (some?) functions to specutils.analysis that uses standard methods used in astronomy for this form of peak-finding. The most "traditional" one I know of is the Tonroy&Davis approach, written up here: https://ui.adsabs.harvard.edu/abs/1979AJ.....84.1511T/abstract , but there are plenty of more complete approaches - a nice write-up of that is here: Statler 1995 (https://ui.adsabs.harvard.edu/abs/1995AJ....109.1371S).

The Tonroy&Davis version might just be a function that does something like:

... all the prep work for cross-correlation...
>>> correlation_peak_td(correlation.template_correlate(p_obs, p_template), p_obs)

which would then set the redshift/radial_velocity attributes on p_obs with the peak location (and the uncertainty could just be an attribute added by hand like p_obs.radial_velocity.uncertainty and p_obs.redshift.uncertainty).

Alternatively/additionally, it could be peak_rv = correlation_peak_td(correlation.template_correlate(p_obs, p_template), although then we have to manage the logic for "rv or redshift?" as part of the function call, which SpectralCoord alread does in my first case.

I'd say the best thing to do is start with tonry&davis to work out the API and add more approaches as time/interest permits.

kakirastern commented 4 years ago

Actually I have been looking for some software that would do exactly this. I have read Tonry & Davis (1979) and have used the good old RVSAO package of IRAF for their XCSAO task for some radial velocity analysis previously. The proposed cross-correlation peak-finding features would be really good to have.