Setting the Signal/Noise¶
The S/N of the observation is set through the InstConfig.set_snr()
method:
-
InstConfig.
set_snr
(snr_input: Union[int, float, numpy.ndarray, chemicalc.s2n.Sig2NoiseQuery], fill_value=None) → None¶ Sets S/N for instrument configuration.
If snr_input is an int or float, a constant S/N is set for all pixels.
If snr_input is a 2D array, the first row is the wavelength grid and the second row is the S/N per pixel. The S/N is then interpolated onto the instrument’s wavelength grid.
If snr_input is a 1D array, the wavelength grid is assumed to be linearly spaced from the instruments starting and ending wavelength. The S/N is then interpolated onto the instrument’s wavelength grid.
If snr_input is a Sig2NoiseQuery, the relevant ETC is queried and the S/N is interpolated onto the instrument’s wavelength grid.
- Parameters
snr_input – Signal-to-Noise Ratio.
fill_value – Argument passed on to scipy.interpolate.interp1d to handle S/N for wavelength regions that extend beyond the coverage of snr_input. Common choices are “extrapolate” (to linearly extrapolate) or 0 (to set S/N to zero). If None, an error will be raised if snr_input does not span the full wavelength range of the instrument.
- Returns
Constant S/N¶
If snr_input
is an int
, float
, or numpy.float64
,
a constant S/N is set for all pixels in the wavelength array.
from chemicalc.instruments import AllInst
d1200g_constant = AllInst.get_spectrograph("DEIMOS 1200G")
d1200g_constant.set_snr(100) # Set constant S/N of 100
S/N Array¶
If snr_input
is a 2D numpy.ndarray
, the first row is the wavelength grid and the second row is the S/N per pixel.
The S/N is then interpolated onto the instrument’s wavelength grid.
If snr_input
is a 1D numpy.ndarray
, the wavelength grid is assumed to be linearly spaced from the instruments starting and ending wavelength.
The S/N is then interpolated onto the instrument’s wavelength grid.
from chemicalc.instruments import AllInst
d1200g_1Darray = AllInst.get_spectrograph("DEIMOS 1200G")
d1200g_2Darray = AllInst.get_spectrograph("DEIMOS 1200G")
wave_array = np.array([6500, 7000, 7500, 8000, 9000])
snr_array = np.array([20, 30, 30, 35, 25])
d1200g_1Darray.set_snr(snr_array)
d1200g_2Darray.set_snr(np.vstack([wave_array, snr_array]))