rail.creation.degradation.lsst_error_model module

The LSST Model for photometric errors.

class rail.creation.degradation.lsst_error_model.LSSTErrorModel(args, comm=None)[source]

Bases: Degrader

The LSST Model for photometric errors.

Implements the error model from the LSST Overview Paper: https://arxiv.org/abs/0805.2366 Note however that this paper gives the high SNR approximation. By default, this model uses the more accurate version of the error model where Eq. 5 = (N/S)^2, in flux, and the error is Gaussian in flux space. There is a flag allowing you to use the high SNR approximation instead. See the __init__ docstring.

In addition, this paper only gives the error estimation for point sources. To account for extended elliptical sources, we follow: http://arxiv.org/abs/2007.01846 We apply two methods to estimate the aperture sizes of the sources according to the definitation of measured fluxes: 1) ‘auto’ model given by http://arxiv.org/abs/2007.01846; 2) ‘gaap’ model given by https://arxiv.org/abs/1902.11265 In order to use these methods, your dataframe of galaxy data must include columns named “major” and “minor”, which are the semi-major and minor axes of the galaxies in arcseconds. For the cosmoDC2 catalog, they are the half-light radii.

Create an instance by calling the class, then use the instance as a callable on pandas DataFrames. Example usage: errModel = LSSTErrorModel() data_with_errs = errModel(data) Error model from the LSST Overview Paper: https://arxiv.org/abs/0805.2366

All parameters are optional. To see the default settings, do LSSTErrorModel().config_options()

Note that the dictionary bandNames sets the bands for which this model calculates photometric errors. The dictionary keys are the band names that the error model uses internally to search for parameters, and the corresponding dictionary values are the band names as they appear in your data set. By default, the LSST bands are named “u”, “g”, “r”, “i”, “z”, and “y”. You can use the bandNames dictionary to alias them differently.

For example, if in your DataFrame, the bands are named lsst_u, lsst_g, etc. you can set bandNames = {“u”: “lsst_u”, “g”: “lsst_g”, …}, and the error model will work automatically. You can also add other bands to bandNames. For example, if you want to use the same model to calculate photometric errors for Euclid bands, you can include {“euclid_y”: “euclid_y”, “euclid_j”: “euclid_j”, …}. In this case, you must include the additional information listed below…

IMPORTANT: For every band in bandNames, you must provide:
  • nVisYr

  • gamma

  • the single-visit 5-sigma limiting magnitude. You can do this either by (1) explicitly providing it in the m5 dictionary, or (2) by adding the corresponding parameters to Cm, msky, theta, and km, in which case the limiting magnitude will be calculated for you, using Eq. 6 from the LSST Overview Paper.

Note if for any bands, you explicitly pass a limiting magnitude in the m5 dictionary, the model will use the explicitly passed value, regardless of the values in Cm, msky, theta, and km.

Parameters:
  • bandNames (dict, optional) – A dictionary of bands for which to calculate errors. The dictionary keys are the band names that the Error Model uses internally to search for parameters, and the corresponding dictionary values are the names of those bands as they appear in your data set. Can be used to alias the default names of the LSST bands, or to add additional bands. See notes above.

  • tvis (float, optional) – Exposure time for a single visit

  • nYrObs (float, optional) – Number of years of observations

  • nVisYr (dict, optional) – Mean number of visits per year in each band

  • gamma (dict, optional) – A band dependent parameter defined in the LSST Overview Paper

  • airmass (float, optional) – The fiducial airmass

  • extendedSource (float, optional) – Constant to add to magnitudes of extended sources. The error model is designed to emulate magnitude errors for point sources. This constant provides a zeroth order correction accounting for the fact that extended sources have larger uncertainties. Note this is only meant to account for small, slightly extended sources. For typical LSST galaxies, this may be of order ~0.3.

  • sigmaSys (float, optional) – The irreducible error of the system in AB magnitudes. Set’s the minimum photometric error.

  • magLim (float, optional) – The dimmest magnitude allowed. All dimmer magnitudes are set to ndFlag.

  • ndFlag (float, optional) – The flag for non-detections. All magnitudes greater than magLim (and their corresponding errors) will be set to this value.

  • m5 (dict, optional) – A dictionary of single visit 5-sigma limiting magnitudes. For any bands for which you pass a value in m5, this will be the 5-sigma limiting magnitude used, and any values for that band in Cm, msky, theta, and km will be ignored.

  • Cm (dict, optional) – A band dependent parameter defined in the LSST Overview Paper

  • msky (dict, optional) – Median zenith sky brightness in each band

  • theta (dict, optional) – Median zenith seeing FWHM (in arcseconds) for each band

  • km (dict, optional) – Atmospheric extinction in each band

  • highSNR (bool, default=False) – Sets whether you use the high SNR approximation given in the LSST Overview Paper. If False, then Eq. 5 from the LSST Error Model is used to calculate (N/S)^2 in flux, and errors are Gaussian in flux space. If True, then Eq. 5 is used to calculate the squared error in magnitude space, and errors are Gaussian in magnitude space.

  • A_min (float, default=2.0) – The minimum GAaP aperture size (in arcmin).

  • A_max (float, default=0.7) – The maximum GAaP aperture size (in arcmin).

  • errorType (string, default="point") – Should be “point” for point source errors. For errors for extended sources, you can choose either “auto” or “gaap”. See the top of the docstring for more details.

config_options = {'A_max': 2.0, 'A_min': 0.7, 'Cm': {'g': 24.42, 'i': 24.32, 'r': 24.44, 'u': 23.09, 'y': 23.73, 'z': 24.16}, 'airmass': 1.2, 'bandNames': {'g': 'g', 'i': 'i', 'r': 'r', 'u': 'u', 'y': 'y', 'z': 'z'}, 'errorType': 'point', 'extendedSource': 0.0, 'gamma': {'g': 0.039, 'i': 0.039, 'r': 0.039, 'u': 0.038, 'y': 0.039, 'z': 0.039}, 'highSNR': False, 'km': {'g': 0.213, 'i': 0.096, 'r': 0.126, 'u': 0.491, 'y': 0.17, 'z': 0.069}, 'm5': {}, 'magLim': 30.0, 'msky': {'g': 22.26, 'i': 20.48, 'r': 21.2, 'u': 22.99, 'y': 18.61, 'z': 19.6}, 'nVisYr': {'g': 8.0, 'i': 18.4, 'r': 18.4, 'u': 5.6, 'y': 16.0, 'z': 16.0}, 'nYrObs': 10.0, 'ndFlag': nan, 'output_mode': <ceci.config.StageParameter object>, 'seed': 12345, 'sigmaSys': 0.005, 'theta': {'g': 0.77, 'i': 0.71, 'r': 0.73, 'u': 0.81, 'y': 0.68, 'z': 0.69}, 'tvis': 30.0}
get_limiting_mags(Nsigma: float = 5, coadded: bool = False) dict[source]

Return the limiting magnitudes for all bands.

This method essentially reverse engineers the _get_NSR() method so that we calculate what magnitude results in NSR = 1/Nsigma. (NSR is noise-to-signal ratio; NSR = 1/SNR)

Parameters:
  • Nsigma (float, default=5) – Sets which limiting magnitude to return, e.g. Nsigma = 1 returns the 1-sigma limiting magnitude. In other words, Nsigma is equal to the signal-to-noise ratio (SNR) of the limiting magnitudes.

  • coadded (bool, default=False) – Whether to return the limiting magnitudes for a single visit, or for a coadded image.

name = 'LSSTErrorModel'
run()[source]

Calculate errors for data, and save the results in a pandas DataFrame.