get_SNR_map¶
- threadcount.fit.get_SNR_map(cube, signal_idx=None, signal_Angstrom=None, nsigma=5, plot=False)[source]¶
Create Image of signal to noise ratio in a given bandwidth.
This bandwidth may be selected in 3 different ways:
Choose the indices of the wavlength array to include (signal_idx)
Choose the wavelengths to include (signal_Angstrom)
Have the program fit a gaussian to the data, and choose how many sigmas to include (nsigma). (Uses function:
get_SignalBW_idx())
If multiple of signal_idx, signal_Angstrom, and nsigma are given, the order of preference is as follows: signal_idx overrides all others, then signal_Angstrom, and finally the least preferenced is nsigma, which will only be used if either signal_idx or signal_Angstrom are not specified.
- Parameters:
cube (
mpdaf.obj.Cube) – The cube containing data, var, and wave attributessignal_idx (array [int, int], optional) – The indices of the wavelength array to use, by default None
signal_Angstrom (array [float, float], optional) – The wavelengths in Angstroms to use, by default None
nsigma (float, optional) – Fit a gaussian, and use center wavelength +/- nsigma * sigma, by default 5
plot (bool, optional) – Plot the whole image spectrum and highlight the SNR bandwidth, by default False. A tool for troubleshooting/setup.
- Returns:
An Image where the pixel values indicate the signal to noise in the selected bandwidth. Given a Spectrum for each spaxel, the SNR for the spaxel is calculated by sum(Spectrum.data)/sqrt(sum(Spectrum.var)).
- Return type:
Examples
Given a Cube with name this_cube, then the default bandwidth selection is to fit a gaussian, and use the gaussian center +/- 5*sigma. This is implemented by the following command:
>>> import threadcount as tc >>> snr_image = tc.fit.get_SNR_map(this_cube)
To use the same method but change the width to, for example, gaussian center +/- 3*sigma, (meaning nsigma=3), then use the following:
>>> snr_image = tc.fit.get_SNR_map(this_cube, nsigma=3)
If you know the specific wavelengths of the bandwidth you would like to use, (for example, 5000-5020 A) then use the following:
>>> snr_image = tc.fit.get_SNR_map(this_cube, signal_Angstrom=[5000,5020])
And finally, if you know the pixel indices (for example, indices 31-60). Note, this is an inclusive range, meaning in this case pixel 60 will be included in the SNR calculation.
>>> snr_image = tc.fit.get_SNR_map(this_cube, signal_idx=[31,60])