LinearInterpolatedResampler¶
-
class
specutils.manipulation.LinearInterpolatedResampler(extrapolation_treatment='nan_fill')[source]¶ Bases:
specutils.manipulation.ResamplerBaseResample a spectrum onto a new
spectral_axisusing linear interpolation.- Parameters
- extrapolation_treatmentstr
What to do when resampling off the edge of the spectrum. Can be
'nan_fill'to have points beyond the edges by set to NaN, or'zero_fill'to be set to zero.
Examples
To resample an input spectrum to a user specified dispersion grid using linear interpolation:
>>> import numpy as np >>> import astropy.units as u >>> from specutils import Spectrum1D >>> from specutils.manipulation import LinearInterpolatedResampler >>> input_spectra = Spectrum1D( ... flux=np.array([1, 3, 7, 6, 20]) * u.mJy, ... spectral_axis=np.array([2, 4, 12, 16, 20]) * u.nm) >>> resample_grid = [1, 5, 9, 13, 14, 17, 21, 22, 23] * u.nm >>> fluxc_resample = LinearInterpolatedResampler() >>> output_spectrum1D = fluxc_resample(input_spectra, resample_grid)
Methods Summary
resample1d(self, orig_spectrum, fin_spec_axis)Call interpolation, repackage new spectra
Methods Documentation
-
resample1d(self, orig_spectrum, fin_spec_axis)[source]¶ Call interpolation, repackage new spectra
- Parameters
- orig_spectrum
Spectrum1D The original 1D spectrum.
- fin_spec_axisndarray
The desired spectral axis array.
- orig_spectrum
- Returns
- resample_spectrum
Spectrum1D An output spectrum containing the resampled
Spectrum1D
- resample_spectrum