template_correlate

specutils.analysis.template_correlate(observed_spectrum, template_spectrum, lag_units=Unit('km / s'), apodization_window=0.5, resample=True)[source]

Compute cross-correlation of the observed and template spectra.

After re-sampling into log-wavelength, both observed and template spectra are apodized by a Tukey window in order to minimize edge and consequent non-periodicity effects and thus decrease high-frequency power in the correlation function. To turn off the apodization, use alpha=0.

Parameters
observed_spectrumSpectrum1D

The observed spectrum.

template_spectrumSpectrum1D

The template spectrum, which will be correlated with the observed spectrum.

lag_units: `~astropy.units.Unit`

Must be a unit with velocity physical type for lags in velocity. To output the lags in redshift, use u.dimensionless_unscaled.

apodization_window: float, callable, or None

If a callable, will be treated as a window function for apodization of the cross-correlation (should behave like a windows window function, with sym=True). If a float, will be treated as the alpha parameter for a Tukey window (tukey), in units of pixels. If None, no apodization will be performed

resample: bool or dict

If True or a dictionary, resamples the spectrum and template following the process in template_logwl_resample. If a dictionary, it will be used as the keywords for template_logwl_resample. For example, resample=dict(delta_log_wavelength=.1) would be the same as calling template_logwl_resample(spectrum, template, delta_log_wavelength=.1). If False, no resampling is performed (and the user is responsible for a sensible resampling).

Returns
(Quantity, Quantity)

Arrays with correlation values and lags in km/s