template_redshift

specutils.analysis.template_redshift(observed_spectrum, template_spectrum, redshift, resample_method='flux_conserving', extrapolation_treatment='truncate')[source]

Find the best-fit redshift for template_spectrum to match observed_spectrum using chi2.

Parameters:
observed_spectrumSpectrum1D

The observed spectrum.

template_spectrumSpectrum1D

The template spectrum, which will have it’s redshift calculated.

redshiftfloat, int, list, tuple, ‘numpy.array`

A scalar or iterable with the redshift values to test.

resample_methodstring

Three resample options: flux_conserving, linear_interpolated, and spline_interpolated. Anything else does not resample the spectrum.

extrapolation_treatmentstring

Three options for what to do if the template spectrum and observed spectrum have regions that do not overlap: nan_fill and zero_fill to fill the non-overlapping bins, or truncate to remove the non-overlapping bins. Passed to the resampler, defaults to truncate.

Returns:
redshifted_spectrum: Spectrum1D

A new Spectrum1D object which incorporates the template_spectrum with a spectral_axis that has been redshifted using the final_redshift, and resampled to that of the observed spectrum.

final_redshiftfloat

The best-fit redshift for template_spectrum to match the observed_spectrum.

normalized_template_spectrumSpectrum1D

The normalized spectrum template.

chi2_min: float

The smallest chi2 value that was found.

chi2_listlist

A list with the chi2 values corresponding to each input redshift value.