FluxConservingResampler¶
-
class
specutils.manipulation.FluxConservingResampler(extrapolation_treatment='nan_fill')[source]¶ Bases:
specutils.manipulation.ResamplerBaseThis resampling algorithm conserves overall integrated flux (as opposed to flux density). Algorithm based on the equations documented in the following paper: https://ui.adsabs.harvard.edu/abs/2017arXiv170505165C/abstract
- 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 spectral grid using a flux conserving algorithm:
>>> import numpy as np >>> import astropy.units as u >>> from specutils import Spectrum1D >>> from specutils.manipulation import FluxConservingResampler >>> 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 = FluxConservingResampler() >>> output_spectrum1D = fluxc_resample(input_spectra, resample_grid)
Methods Summary
resample1d(self, orig_spectrum, fin_spec_axis)Create a re-sampling matrix to be used in re-sampling spectra in a way that conserves flux.
Methods Documentation
-
resample1d(self, orig_spectrum, fin_spec_axis)[source]¶ Create a re-sampling matrix to be used in re-sampling spectra in a way that conserves flux. If an uncertainty is present in the input spectra it will be propagated through to the final resampled output spectra as an InverseVariance uncertainty.
- Parameters
- orig_spectrum
Spectrum1D The original 1D spectrum.
- fin_spec_axisQuantity
The desired spectral axis array.
- orig_spectrum
- Returns
- resample_spectrum
Spectrum1D An output spectrum containing the resampled
Spectrum1D
- resample_spectrum