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_spectrum
Spectrum1D
The observed spectrum.
- template_spectrum
Spectrum1D
The template spectrum, which will have it’s redshift calculated.
- redshift
float
,int
,list
,tuple
, ‘numpy.array` A scalar or iterable with the redshift values to test.
- resample_method
string
Three resample options: flux_conserving, linear_interpolated, and spline_interpolated. Anything else does not resample the spectrum.
- extrapolation_treatment
string
Three options for what to do if the template spectrum and observed spectrum have regions that do not overlap:
nan_fill
andzero_fill
to fill the non-overlapping bins, ortruncate
to remove the non-overlapping bins. Passed to the resampler, defaults totruncate
.
- observed_spectrum
- 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_redshift
float
The best-fit redshift for template_spectrum to match the observed_spectrum.
- normalized_template_spectrum
Spectrum1D
The normalized spectrum template.
- chi2_min:
float
The smallest chi2 value that was found.
- chi2_list
list
A list with the chi2 values corresponding to each input redshift value.
- redshifted_spectrum: