lsst.sims.maf.metrics package

Submodules

lsst.sims.maf.metrics.areaSummaryMetrics module

class lsst.sims.maf.metrics.areaSummaryMetrics.AreaSummaryMetric(col='metricdata', metricName='AreaSummary', area=18000.0, decreasing=True, reduce_func=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Find the min/max of a value in the best area. This is a handy substitute for when users want to know “the WFD value”.

Parameters
  • area (float (18000)) – The area to consider (sq degrees)

  • decreasing (bool (True)) – Should the values be sorted by increasing or decreasing order. For values where “larger is better”, decreasing is probably what you want. For metrics where “smaller is better” (e.g., astrometric precission), set decreasing to False.

  • reduce_func (None) – The function to reduce the clipped values by. Will default to min/max depending on the bool val of the decreasing kwarg.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.baseMetric module

class lsst.sims.maf.metrics.baseMetric.BaseMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: object

Base class for the metrics. Sets up some basic functionality for the MAF framework: after __init__ every metric will record the columns (and stackers) it requires into the column registry, and the metricName, metricDtype, and units for the metric will be set.

Parameters
  • col (str or list) – Names of the data columns that the metric will use. The columns required for each metric is tracked in the ColRegistry, and used to retrieve data from the opsim database. Can be a single string or a list.

  • metricName (str) – Name to use for the metric (optional - if not set, will be derived).

  • maps (list of lsst.sims.maf.maps objects) – The maps that the metric will need (passed from the slicer).

  • units (str) – The units for the value returned by the metric (optional - if not set, will be derived from the ColInfo).

  • metricDtype (str) – The type of value returned by the metric - ‘int’, ‘float’, ‘object’. If not set, will be derived by introspection.

  • badval (float) – The value indicating “bad” values calculated by the metric.

colInfo
colRegistry
registry
run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.baseMetric.MetricRegistry(name, bases, dict)[source]

Bases: type

Meta class for metrics, to build a registry of metric classes.

getClass(metricname)[source]
help(doc=False)[source]
help_metric(metricname)[source]

lsst.sims.maf.metrics.cadenceMetrics module

class lsst.sims.maf.metrics.cadenceMetrics.InterNightGapsMetric(mjdCol='observationStartMJD', nightCol='night', reduceFunc=<function median>, metricName='Median Inter-Night Gap', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the gap between consecutive observations in different nights, in days.

Parameters

reduceFunc (function, optional) – Function that can operate on array-like structures. Typically numpy function. Default np.median.

run(dataSlice, slicePoint=None)[source]

Calculate the (reduceFunc) of the gap between consecutive nights of observations. :param dataSlice: Numpy structured array containing the data related to the visits provided by the slicer. :type dataSlice: numpy.array :param slicePoint: Dictionary containing information about the slicepoint currently active in the slicer. :type slicePoint: dict, optional

Returns

The (reduceFunc) of the gap between consecutive nights of observations, in days.

Return type

float

class lsst.sims.maf.metrics.cadenceMetrics.IntraNightGapsMetric(mjdCol='observationStartMJD', nightCol='night', reduceFunc=<function median>, metricName='Median Intra-Night Gap', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the gap between consecutive observations within a night, in hours.

Parameters

reduceFunc (function, optional) – Function that can operate on array-like structures. Typically numpy function. Default np.median.

run(dataSlice, slicePoint=None)[source]

Calculate the (reduceFunc) of the gap between consecutive obervations within a night.

Parameters
  • dataSlice (numpy.array) – Numpy structured array containing the data related to the visits provided by the slicer.

  • slicePoint (dict, optional) – Dictionary containing information about the slicepoint currently active in the slicer.

Returns

The (reduceFunc) value of the gap, in hours.

Return type

float

class lsst.sims.maf.metrics.cadenceMetrics.NRevisitsMetric(mjdCol='observationStartMJD', dT=30.0, normed=False, metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the number of consecutive visits with time differences less than dT.

Parameters
  • dT (float, optional) – The time interval to consider (in minutes). Default 30.

  • normed (bool, optional) – Flag to indicate whether to return the total number of consecutive visits with time differences less than dT (False), or the fraction of overall visits (True). Note that we would expect (if all visits occur in pairs within dT) this fraction would be 0.5!

run(dataSlice, slicePoint=None)[source]

Count the number of consecutive visits occuring within time intervals dT.

Parameters
  • dataSlice (numpy.array) – Numpy structured array containing the data related to the visits provided by the slicer.

  • slicePoint (dict, optional) – Dictionary containing information about the slicepoint currently active in the slicer.

Returns

Either the total number of consecutive visits within dT or the fraction compared to overall visits.

Return type

float

class lsst.sims.maf.metrics.cadenceMetrics.RapidRevisitMetric(mjdCol='observationStartMJD', metricName='RapidRevisit', dTmin=0.0004629629629629629, dTpairs=0.013888888888888888, dTmax=0.020833333333333332, minN1=28, minN2=82, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.cadenceMetrics.RapidRevisitUniformityMetric(mjdCol='observationStartMJD', minNvisits=100, dTmin=0.0004629629629629629, dTmax=0.020833333333333332, metricName='RapidRevisitUniformity', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate uniformity of time between consecutive visits on short timescales (for RAV1).

Parameters
  • mjdCol (str, optional) – The column containing the ‘time’ value. Default observationStartMJD.

  • minNvisits (int, optional) – The minimum number of visits required within the time interval (dTmin to dTmax). Default 100.

  • dTmin (float, optional) – The minimum dTime to consider (in days). Default 40 seconds.

  • dTmax (float, optional) – The maximum dTime to consider (in days). Default 30 minutes.

run(dataSlice, slicePoint=None)[source]

Calculate the uniformity of visits within dTmin to dTmax.

Uses a the same ‘uniformity’ calculation as the UniformityMetric, based on the KS-test. A value of 0 is perfectly uniform; a value of 1 is purely non-uniform.

Parameters
  • dataSlice (numpy.array) – Numpy structured array containing the data related to the visits provided by the slicer.

  • slicePoint (dict, optional) – Dictionary containing information about the slicepoint currently active in the slicer.

Returns

The uniformity measurement of the visits within time interval dTmin to dTmax.

Return type

float

class lsst.sims.maf.metrics.cadenceMetrics.TemplateExistsMetric(seeingCol='seeingFwhmGeom', observationStartMJDCol='observationStartMJD', metricName='TemplateExistsMetric', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the fraction of images with a previous template image of desired quality.

run(dataSlice, slicePoint=None)[source]

“Calculate the fraction of images with a previous template image of desired quality.

Parameters
  • dataSlice (numpy.array) – Numpy structured array containing the data related to the visits provided by the slicer.

  • slicePoint (dict, optional) – Dictionary containing information about the slicepoint currently active in the slicer.

Returns

The fraction of images with a ‘good’ previous template image.

Return type

float

class lsst.sims.maf.metrics.cadenceMetrics.UniformityMetric(mjdCol='observationStartMJD', units='', surveyLength=10.0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate how uniformly the observations are spaced in time. Returns a value between -1 and 1. A value of zero means the observations are perfectly uniform.

Parameters

surveyLength (float, optional) – The overall duration of the survey. Default 10.

run(dataSlice, slicePoint=None)[source]

“Calculate the survey uniformity.

This is based on how a KS-test works: look at the cumulative distribution of observation dates, and compare to a perfectly uniform cumulative distribution. Perfectly uniform observations = 0, perfectly non-uniform = 1.

Parameters
  • dataSlice (numpy.array) – Numpy structured array containing the data related to the visits provided by the slicer.

  • slicePoint (dict, optional) – Dictionary containing information about the slicepoint currently active in the slicer.

Returns

Uniformity of ‘observationStartMJDCol’.

Return type

float

class lsst.sims.maf.metrics.cadenceMetrics.VisitGapMetric(mjdCol='observationStartMJD', nightCol='night', reduceFunc=<function median>, metricName='VisitGap', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the gap between any consecutive observations, in hours, regardless of night boundaries.

Parameters

reduceFunc (function, optional) – Function that can operate on array-like structures. Typically numpy function. Default np.median.

run(dataSlice, slicePoint=None)[source]

Calculate the (reduceFunc) of the gap between consecutive observations.

Different from inter-night and intra-night gaps, between this is really just counting all of the times between consecutive observations (not time between nights or time within a night).

Parameters
  • dataSlice (numpy.array) – Numpy structured array containing the data related to the visits provided by the slicer.

  • slicePoint (dict, optional) – Dictionary containing information about the slicepoint currently active in the slicer.

Returns

The (reduceFunc) of the time between consecutive observations, in hours.

Return type

float

lsst.sims.maf.metrics.calibrationMetrics module

class lsst.sims.maf.metrics.calibrationMetrics.ParallaxCoverageMetric(metricName='ParallaxCoverageMetric', m5Col='fiveSigmaDepth', mjdCol='observationStartMJD', filterCol='filter', seeingCol='seeingFwhmGeom', rmag=20.0, SedTemplate='flat', atm_err=0.01, thetaRange=0.0, snrLimit=5, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Check how well the parallax factor is distributed. Subtracts the weighted mean position of the parallax offsets, then computes the weighted mean radius of the points. If points are well distributed, the mean radius will be near 1. If phase coverage is bad, radius will be close to zero.

For points on the Ecliptic, uniform sampling should result in a metric value of ~0.5. At the poles, uniform sampling would result in a metric value of ~1. Conceptually, it is helpful to remember that the parallax motion of a star at the pole is a (nearly circular) ellipse while the motion of a star on the ecliptic is a straight line. Thus, any pair of observations separated by 6 months will give the full parallax range for a star on the pole but only observations on very specific dates will give the full range for a star on the ecliptic.

Optionally also demand that there are observations above the snrLimit kwarg spanning thetaRange radians.

Parameters
  • m5Col (str, opt) – Column name for individual visit m5. Default fiveSigmaDepth.

  • mjdCol (str, opt) – Column name for exposure time dates. Default observationStartMJD.

  • filterCol (str, opt) – Column name for filter. Default filter.

  • seeingCol (str, opt) – Column name for seeing (assumed FWHM). Default seeingFwhmGeom.

  • rmag (float, opt) – Magnitude of fiducial star in r filter. Other filters are scaled using sedTemplate keyword. Default 20.0

  • sedTemplate (str, opt) – Template to use (can be ‘flat’ or ‘O’,’B’,’A’,’F’,’G’,’K’,’M’). Default ‘flat’.

  • atm_err (float, opt) – Centroiding error due to atmosphere in arcsec. Default 0.01 (arcseconds).

  • thetaRange (float, opt) – Range of parallax offset angles to demand (in radians). Default=0 (means no range requirement).

  • snrLimit (float, opt) – Only include points above the snrLimit when computing thetaRange. Default 5.

Returns

metricValue – Returns a weighted mean of the length of the parallax factor vectors. Values near 1 imply that the points are well distributed. Values near 0 imply that the parallax phase coverage is bad. Near the ecliptic, uniform sampling results in metric values of about 0.5.

Return type

float

Notes

Uses the ParallaxFactor stacker to calculate ra_pi_amp and dec_pi_amp.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.calibrationMetrics.ParallaxDcrDegenMetric(metricName='ParallaxDcrDegenMetric', seeingCol='seeingFwhmGeom', m5Col='fiveSigmaDepth', atm_err=0.01, rmag=20.0, SedTemplate='flat', filterCol='filter', tol=0.05, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Use the full parallax and DCR displacement vectors to find if they are degenerate.

Parameters
  • metricName (str, opt) – Default ‘ParallaxDcrDegenMetric’.

  • seeingCol (str, opt) – Default ‘FWHMgeom’

  • m5Col (str, opt) – Default ‘fiveSigmaDepth’

  • filterCol (str) – Default ‘filter’

  • atm_err (float) – Minimum error in photometry centroids introduced by the atmosphere (arcseconds). Default 0.01.

  • rmag (float) – r-band magnitude of the fiducual star that is being used (mag).

  • SedTemplate (str) – The SED template to use for fiducia star colors, passed to lsst.sims.utils.stellarMags. Default ‘flat’

  • tol (float) – Tolerance for how well curve_fit needs to work before believing the covariance result. Default 0.05.

Returns

metricValue – Returns the correlation coefficient between the best-fit parallax amplitude and DCR amplitude. The RA and Dec offsets are fit simultaneously. Values close to zero are good, values close to +/- 1 are bad. Experience with fitting Monte Carlo simulations suggests the astrometric fits start becoming poor around a correlation of 0.7.

Return type

float

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.calibrationMetrics.ParallaxMetric(metricName='parallax', m5Col='fiveSigmaDepth', filterCol='filter', seeingCol='seeingFwhmGeom', rmag=20.0, SedTemplate='flat', badval=- 666, atm_err=0.01, normalize=False, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the uncertainty in a parallax measurement given a series of observations.

Uses columns ra_pi_amp and dec_pi_amp, calculated by the ParallaxFactorStacker.

Parameters
  • metricName (str, opt) – Default ‘parallax’.

  • m5Col (str, opt) – The default column name for m5 information in the input data. Default fiveSigmaDepth.

  • filterCol (str, opt) – The column name for the filter information. Default filter.

  • seeingCol (str, opt) – The column name for the seeing information. Since the astrometry errors are based on the physical size of the PSF, this should be the FWHM of the physical psf. Default seeingFwhmGeom.

  • rmag (float, opt) – The r magnitude of the fiducial star in r band. Other filters are sclaed using sedTemplate keyword. Default 20.0

  • SedTemplate (str, opt) – The template to use. This can be ‘flat’ or ‘O’,’B’,’A’,’F’,’G’,’K’,’M’. Default flat.

  • atm_err (float, opt) – The expected centroiding error due to the atmosphere, in arcseconds. Default 0.01.

  • normalize (boolean, opt) – Compare the astrometric uncertainty to the uncertainty that would result if half the observations were taken at the start and half at the end. A perfect survey will have a value close to 1, while a poorly scheduled survey will be close to 0. Default False.

  • badval (float, opt) – The value to return when the metric value cannot be calculated. Default -666.

run(dataslice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.calibrationMetrics.ProperMotionMetric(metricName='properMotion', m5Col='fiveSigmaDepth', mjdCol='observationStartMJD', filterCol='filter', seeingCol='seeingFwhmGeom', rmag=20.0, SedTemplate='flat', badval=- 666, atm_err=0.01, normalize=False, baseline=10.0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the uncertainty in the returned proper motion.

This metric assumes gaussian errors in the astrometry measurements.

Parameters
  • metricName (str, opt) – Default ‘properMotion’.

  • m5Col (str, opt) – The default column name for m5 information in the input data. Default fiveSigmaDepth.

  • mjdCol (str, opt) – The column name for the exposure time. Default observationStartMJD.

  • filterCol (str, opt) – The column name for the filter information. Default filter.

  • seeingCol (str, opt) – The column name for the seeing information. Since the astrometry errors are based on the physical size of the PSF, this should be the FWHM of the physical psf. Default seeingFwhmGeom.

  • rmag (float, opt) – The r magnitude of the fiducial star in r band. Other filters are sclaed using sedTemplate keyword. Default 20.0

  • SedTemplate (str, opt) – The template to use. This can be ‘flat’ or ‘O’,’B’,’A’,’F’,’G’,’K’,’M’. Default flat.

  • atm_err (float, opt) – The expected centroiding error due to the atmosphere, in arcseconds. Default 0.01.

  • normalize (boolean, opt) – Compare the astrometric uncertainty to the uncertainty that would result if half the observations were taken at the start and half at the end. A perfect survey will have a value close to 1, while a poorly scheduled survey will be close to 0. Default False.

  • baseline (float, opt) – The length of the survey used for the normalization, in years. Default 10.

  • badval (float, opt) – The value to return when the metric value cannot be calculated. Default -666.

run(dataslice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.calibrationMetrics.RadiusObsMetric(metricName='radiusObs', raCol='fieldRA', decCol='fieldDec', units='radians', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

find the radius in the focal plane. returns things in degrees.

reduceFullRange(distances)[source]
reduceMean(distances)[source]
reduceRMS(distances)[source]
run(dataSlice, slicePoint)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.chipVendorMetric module

class lsst.sims.maf.metrics.chipVendorMetric.ChipVendorMetric(cols=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

See what happens if we have chips from different vendors

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.coverageMetric module

class lsst.sims.maf.metrics.coverageMetric.YearCoverageMetric(nightCol='night', bins=None, units=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count the number of bins covered by nightCol – default bins are ‘years’. Handy for checking that a point on the sky gets observed every year, as the default settings result in the metric returning the number years in the dataslice (when used with a HealpixSlicer).

Parameters
  • nightCol (str, opt) – Data column to histogram. Default ‘night’.

  • bins (numpy.ndarray, opt) – Bins to use in the histogram. Default corresponds to years 0-10 (with 365.25 nights per year).

  • units (str, opt) – Units to use for the metric result. Default ‘N years’.

Returns

Number of histogram bins where the histogram value is greater than 0. Typically this will be the number of years in the ‘nightCol’.

Return type

integer

run(dataSlice, slicePoint)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.crowdingMetric module

class lsst.sims.maf.metrics.crowdingMetric.CrowdingM5Metric(crowding_error=0.1, filtername='r', seeingCol='seeingFwhmGeom', metricName=None, maps=['StellarDensityMap'], **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return the magnitude at which the photometric error exceeds crowding_error threshold.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.crowdingMetric.CrowdingMagUncertMetric(rmag=20.0, seeingCol='seeingFwhmGeom', units='mag', metricName=None, filtername='r', maps=['StellarDensityMap'], **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Given a stellar magnitude, calculate the mean uncertainty on the magnitude from crowding.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.crowdingMetric.NstarsMetric(crowding_error=0.1, filtername='r', seeingCol='seeingFwhmGeom', m5Col='fiveSigmaDepth', metricName=None, maps=['StellarDensityMap'], ignore_crowding=False, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return the number of stars visible above some uncertainty limit, taking image depth and crowding into account.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.dcrMetric module

class lsst.sims.maf.metrics.dcrMetric.DcrPrecisionMetric(metricName='DCRprecision', seeingCol='seeingFwhmGeom', m5Col='fiveSigmaDepth', HACol='HA', PACol='paraAngle', filterCol='filter', atm_err=0.01, SedTemplate='flat', rmag=20.0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Determine how precise a DCR correction could be made

Parameters

atm_err (float) – Minimum error in photometry centroids introduced by the atmosphere (arcseconds). Default 0.01.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.exgalM5 module

class lsst.sims.maf.metrics.exgalM5.ExgalM5(m5Col='fiveSigmaDepth', metricName='ExgalM5', units='mag', filterCol='filter', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate co-added five-sigma limiting depth after dust extinction.

Uses photUtils to calculate dust extinction.

Parameters
  • m5Col (str, opt) – Column name for five sigma depth. Default ‘fiveSigmaDepth’.

  • unit (str, opt) – Label for units. Default ‘mag’.

run(dataSlice, slicePoint)[source]

Compute the co-added m5 depth and then apply dust extinction to that magnitude.

lsst.sims.maf.metrics.fftMetric module

class lsst.sims.maf.metrics.fftMetric.FftMetric(timesCol='expmjd', metricName='Fft', nCoeffs=100, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate a truncated FFT of the exposure times.

reducePeak(fftCoeff)[source]
run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.hourglassMetric module

class lsst.sims.maf.metrics.hourglassMetric.HourglassMetric(telescope='LSST', mjdCol='observationStartMJD', filterCol='filter', nightCol='night', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Plot the filters used as a function of time. Must be used with the Hourglass Slicer.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.kuiperMetrics module

class lsst.sims.maf.metrics.kuiperMetrics.KuiperMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Find the Kuiper V statistic for a distribution, useful for angles.

Value of 0 means perfecty uniform, 1 means delta function

run(dataSlice, slicePoint=None)[source]

lsst.sims.maf.metrics.longGapAGNMetric module

class lsst.sims.maf.metrics.longGapAGNMetric.LongGapAGNMetric(metricName='longGapAGNMetric', mjdcol='observationStartMJD', units='days', xgaps=10, badval=- 666, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

max delta-t and average of the top-10 longest gaps.

reduceAverageLongestXGaps(metricval)[source]
reduceMaxGap(metricval)[source]
run(dataslice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.moMetrics module

class lsst.sims.maf.metrics.moMetrics.ActivityOverPeriodMetric(binsize, snrLimit=5, qCol='q', eCol='e', aCol='a', tPeriCol='tPeri', anomalyCol='meanAnomaly', metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Count fraction of object period we could identify activity for an SSobject.

Count the fraction of the orbit (when split into nBins) that receive observations, in order to have a chance to detect activity.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.ActivityOverTimeMetric(window, snrLimit=5, surveyYears=10.0, metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Count fraction of survey we could identify activity for an SSobject.

Counts the time periods where we would have a chance to detect activity on a moving object. Splits observations into time periods set by ‘window’, then looks for observations within each window, and reports what fraction of the total windows receive ‘nObs’ visits.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.BaseMoMetric(cols=None, metricName=None, units='#', badval=0, comment=None, childMetrics=None, appMagCol='appMag', appMagVCol='appMagV', m5Col='fiveSigmaDepth', nightCol='night', mjdCol='observationStartMJD', snrCol='SNR', visCol='vis', raCol='ra', decCol='dec', seeingCol='seeingFwhmGeom', expTimeCol='visitExposureTime', filterCol='filter')[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Base class for the moving object metrics. Intended to be used with the Moving Object Slicer.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.Color_AsteroidMetric(weightDet=10, snrMax=20, snrLimit=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

This metric is appropriate for MBAs and NEOs, and other inner solar system objects.

The metric evaluates if the SNR-weighted number of observations are enough to determine an approximate lightcurve and phase function – and from this, then a color for the asteroid can be determined. The assumption is that you must fit the lightcurve/phase function in each bandpass, and could do this well-enough if you have at least weightDet SNR-weighted observations in the bandpass. e.g. to find a g-r color, you must have 10 (SNR-weighted) obs in g and 10 in r.

For more details, see https://docs.google.com/document/d/1GAriM7trpTS08uanjUF7PyKALB2JBTjVT7Y6R30i0-8/edit?usp=sharing Contributed by Wes Fraser, Steven Chesley & the inner solar system working group.

Parameters
  • weightDet (float, opt) – The SNR-weighted number of detections required (per bandpass in any ONE of the filters in filterlist). Default 10.

  • snrLimit (float or None, opt) – If snrLimit is set as a float, then requires object to be above snrLimit SNR in the image. If snrLimit is None, this uses the probabilistic ‘visibility’ calculated by the vis stacker, which means SNR ~ 5. Default is None.

  • snrMax (float, opt) – Maximum value toward the SNR-weighting to consider. Default 20.

Returns

An integer ‘flag’ that indicates whether the mean magnitude (and thus a color) was determined in: 0 = no bands 1 = g and (r or i) and (z or y). i.e. obtain colors g-r or g-i PLUS g-z or g-y 2 = Any 4 different filters (from grizy). i.e. colors = g-r, r-i, i-z, OR r-i, i-z, z-y.. 3 = All 5 from grizy. i.e. colors g-r, r-i, i-z, z-y. 4 = All 6 filters (ugrizy) – best possible! add u-g.

Return type

int

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.DiscoveryMetric(nObsPerNight=2, tMin=0.003472222222222222, tMax=0.0625, nNightsPerWindow=3, tWindow=15, snrLimit=None, badval=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Identify the discovery opportunities for an SSobject.

Parameters
  • nObsPerNight (int, opt) – Number of observations required within a single night. Default 2.

  • tMin (float, opt) – Minimum time span between observations in a single night, in days. Default 5 minutes (5/60/24).

  • tMax (float, opt) – Maximum time span between observations in a single night, in days. Default 90 minutes.

  • nNightsPerWindow (int, opt) – Number of nights required with observations, within the track window. Default 3.

  • tWindow (int, opt) – Number of nights included in the track window. Default 15.

  • snrLimit (None or float, opt) – SNR limit to use for observations. If snrLimit is None, (default), then it uses the completeness calculation added to the ‘vis’ column (probabilistic visibility, based on 5-sigma limit). If snrLimit is not None, it uses this SNR value as a cutoff.

  • metricName (str, opt) – The metric name to use. Default will be to construct Discovery_nObsPerNightxnNightsPerWindowintWindow.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.Discovery_DistanceMetric(parentDiscoveryMetric, i=0, distanceCol='geo_dist', badval=- 999, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseChildMetric

Returns the distance of the i-th discovery track of an SSobject.

run(ssoObs, orb, Hval, metricValues)[source]

Calculate the child metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

  • metricValues (dict or np.ndarray) – The return value from the parent metric.

Returns

Return type

float

class lsst.sims.maf.metrics.moMetrics.Discovery_EcLonLatMetric(parentDiscoveryMetric, i=0, badval=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseChildMetric

Returns the ecliptic lon/lat and solar elong of the i-th discovery track of an SSobject.

run(ssoObs, orb, Hval, metricValues)[source]

Calculate the child metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

  • metricValues (dict or np.ndarray) – The return value from the parent metric.

Returns

Return type

float

class lsst.sims.maf.metrics.moMetrics.Discovery_N_ChancesMetric(parentDiscoveryMetric, nightStart=None, nightEnd=None, badval=0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseChildMetric

Calculate total number of discovery opportunities for an SSobject.

Calculates total number of discovery opportunities between nightStart / nightEnd. Child metric to be used with the Discovery Metric.

run(ssoObs, orb, Hval, metricValues)[source]

Return the number of different discovery chances we had for each object/H combination.

class lsst.sims.maf.metrics.moMetrics.Discovery_N_ObsMetric(parentDiscoveryMetric, i=0, badval=0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseChildMetric

Calculates the number of observations in the i-th discovery track of an SSobject.

run(ssoObs, orb, Hval, metricValues)[source]

Calculate the child metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

  • metricValues (dict or np.ndarray) – The return value from the parent metric.

Returns

Return type

float

class lsst.sims.maf.metrics.moMetrics.Discovery_RADecMetric(parentDiscoveryMetric, i=0, badval=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseChildMetric

Returns the RA/Dec of the i-th discovery track of an SSobject.

run(ssoObs, orb, Hval, metricValues)[source]

Calculate the child metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

  • metricValues (dict or np.ndarray) – The return value from the parent metric.

Returns

Return type

float

class lsst.sims.maf.metrics.moMetrics.Discovery_TimeMetric(parentDiscoveryMetric, i=0, tStart=None, badval=- 999, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseChildMetric

Returns the time of the i-th discovery track of an SSobject.

run(ssoObs, orb, Hval, metricValues)[source]

Calculate the child metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

  • metricValues (dict or np.ndarray) – The return value from the parent metric.

Returns

Return type

float

class lsst.sims.maf.metrics.moMetrics.Discovery_VelocityMetric(parentDiscoveryMetric, i=0, badval=- 999, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseChildMetric

Returns the sky velocity of the i-th discovery track of an SSobject.

run(ssoObs, orb, Hval, metricValues)[source]

Calculate the child metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

  • metricValues (dict or np.ndarray) – The return value from the parent metric.

Returns

Return type

float

class lsst.sims.maf.metrics.moMetrics.HighVelocityMetric(psfFactor=2.0, snrLimit=None, velocityCol='velocity', **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Count number of times an SSobject appears trailed.

Count the number of times an asteroid is observed with a velocity high enough to make it appear trailed by a factor of (psfFactor)*PSF - i.e. velocity >= psfFactor * seeing / visitExpTime. Simply counts the total number of observations with high velocity.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.HighVelocityNightsMetric(psfFactor=2.0, nObsPerNight=2, snrLimit=None, velocityCol='velocity', **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Count the number of discovery opportunities (via trailing) for an SSobject.

Determine the first time an asteroid is observed is observed with a velocity high enough to make it appear trailed by a factor of psfFactor*PSF with nObsPerNight observations within a given night.

Parameters
  • psfFactor (float, opt) – Object velocity (deg/day) must be >= 24 * psfFactor * seeingGeom (“) / visitExpTime (s). Default is 2 (i.e. object trailed over 2 psf’s).

  • nObsPerNight (int, opt) – Number of observations per night required. Default 2.

  • snrLimit (float or None) – If snrLimit is set as a float, then requires object to be above snrLimit SNR in the image. If snrLimit is None, this uses the probabilistic ‘visibility’ calculated by the vis stacker, which means SNR ~ 5. Default is None.

  • velocityCol (str, opt) – Name of the velocity column in the obs file. Default ‘velocity’. (note this is deg/day).

Returns

The time of the first detection where the conditions are satisifed.

Return type

float

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.InstantaneousColorMetric(nPairs=1, snrLimit=10, nHours=0.5, bOne='g', bTwo='r', **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Identify SSobjects which could have observations suitable to determine colors.

Generally, this is not the mode LSST would work in - the lightcurves of the objects mean that the time interval would have to be quite short.

This is roughly defined as objects which have more than nPairs pairs of observations with SNR greater than snrLimit, in bands bandOne and bandTwo, within nHours.

Parameters
  • nPairs (int, opt) – The number of pairs of observations (in each band) that must be within nHours Default 1

  • snrLimit (float, opt) – The SNR limit for the observations. Default 10.

  • nHours (float, opt) – The time interval between observations in the two bandpasses (hours). Default 0.5 hours.

  • bOne (str, opt) – The first bandpass for the color. Default ‘g’.

  • bTwo (str, opt) – The second bandpass for the color. Default ‘r’.

Returns

0 (no color possible under these constraints) or 1 (color possible).

Return type

int

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.KnownObjectsMetric(elongThresh=100.0, vMagThresh1=20.0, eff1=0.1, tSwitch1=53371, vMagThresh2=21.5, eff2=0.1, tSwitch2=57023, vMagThresh3=22.0, eff3=0.1, tSwitch3=59580, vMagThresh4=22.0, eff4=0.2, elongCol='Elongation', mjdCol='MJD(UTC)', **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Identify SSobjects which could be classified as ‘previously known’ based on their peak V magnitude. This is most appropriate for NEO surveys, where most of the sky has been covered so the exact location (beyond being in the visible sky) is not as important.

Default parameters tuned to match NEO survey capabilities. Returns the time at which each first reached that threshold V magnitude. The default values are calibrated using the NEOs larger than 140m discovered in the last 20 years and assuming a 30% completeness in 2017.

Parameters
  • elongThresh (float, opt) – The cutoff in solar elongation to consider an object ‘visible’. Default 100 deg.

  • vMagThresh1 (float, opt) – The magnitude threshold for previously known objects. Default 20.0.

  • eff1 (float, opt) – The likelihood of actually achieving each individual input observation. If the input observations include one observation per day, an ‘eff’ value of 0.3 would mean that (on average) only one third of these observations would be achieved. This is similar to the level for LSST, which can cover the visible sky every 3-4 days. Default 0.1

  • tSwitch1 (float, opt) – The (MJD) time to switch between vMagThresh1 + eff1 to vMagThresh2 + eff2, e.g. the end of the first period. Default 53371 (2005).

  • vMagThresh2 (float, opt) – The magnitude threshhold for previously known objects. Default 22.0. This is based on assuming PS and other surveys will be efficient down to V=22.

  • eff2 (float, opt) – The efficiency of observations during the second period of time. Default 0.1

  • tSwitch2 (float, opt) – The (MJD) time to switch between vMagThresh2 + eff2 to vMagThresh3 + eff3. Default 57023 (2015).

  • vMagThresh3 (float, opt) – The magnitude threshold during the third period. Default 22.0, based on PS1 + Catalina.

  • eff3 (float, opt) – The efficiency of observations during the third period. Default 0.1

  • tSwitch3 (float, opt) – The (MJD) time to switch between vMagThresh3 + eff3 to vMagThresh4 + eff4. Default 59580 (2022).

  • vMagThresh4 (float, opt) – The magnitude threshhold during the fourth (last) period. Default 22.0, based on PS1 + Catalina.

  • eff4 (float, opt) – The efficiency of observations during the fourth (last) period. Default 0.2

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.LightcurveColor_OuterMetric(snrLimit=None, numReq=30, numSecFilt=20, filterlist=('u', 'g', 'r', 'i', 'z', 'y'), **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

This metric is appropriate for outer solar system objects, such as TNOs and SDOs.

This metric evaluates whether the number of observations is sufficient to fit a lightcurve in a primary and secondary bandpass. The primary bandpass requires more observations than the secondary. Essentially, it’s a complete lightcurve in one or both bandpasses, with at least a semi-complete lightcurve in the secondary band.

The lightcurve/color can be calculated with any two of the bandpasses in filterlist. Contributed by Wes Fraser.

Parameters
  • snrLimit (float or None, opt) – If snrLimit is set as a float, then requires object to be above snrLimit SNR in the image. If snrLimit is None, this uses the probabilistic ‘visibility’ calculated by the vis stacker, which means SNR ~ 5. Default is None.

  • numReq (int, opt) – Number of observations required for a lightcurve fitting. Default 30.

  • numSecFilt (int, opt) – Number of observations required in a secondary band for color only. Default 20.

  • filterlist (list of str, opt) – Filters that the primary/secondary measurements can be in.

Returns

A flag that indicates whether a color/lightcurve was generated in: 0 = no lightcurve (although may have had ‘color’ in one or more band) 1 = a lightcurve in a single filter (but no additional color information) 2+ = lightcurves in more than one filter (or lightcurve + color) e.g. lightcurve in 2 bands, with additional color information in another = 3.

Return type

int

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.LightcurveInversion_AsteroidMetric(weightDet=50, snrLimit=None, snrMax=100, filterlist=('u', 'g', 'r', 'i', 'z', 'y'), **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

This metric is generally applicable to NEOs and MBAs - inner solar system objects.

Determine if the cumulative sum of observations of a target are enough to enable lightcurve inversion for shape modeling. For this to be true, multiple conditions need to be satisfied:

1) The SNR-weighted number of observations (each observation is weighted by its SNR, up to a max of 100) must be larger than the threshhold weightDet (default 50) 2) Ecliptic longitudinal coverage needs to be at least 90 degrees, and the absolute deviation needs to be at least 1/8th the longitudinal coverage. 3) The phase angle coverage needs to span at least 5 degrees.

For evaluation of condition 2, the median ecliptic longitude is subtracted from all longitudes, and the modulo 360 of those values is taken. This ensures that the wrap around 360 is handled correctly.

For more information on the above conditions, please see https://docs.google.com/document/d/1GAriM7trpTS08uanjUF7PyKALB2JBTjVT7Y6R30i0-8/edit?usp=sharing Contributed by Steve Chesley, Wes Fraser, Josef Durech, and the inner solar system working group.

Parameters
  • weightDet (float, opt) – The SNR-weighted number of detections required (per bandpass in any ONE of the filters in filterlist). Default 50.

  • snrLimit (float or None, opt) – If snrLimit is set as a float, then requires object to be above snrLimit SNR in the image. If snrLimit is None, this uses the probabilistic ‘visibility’ calculated by the vis stacker, which means SNR ~ 5. Default is None.

  • snrMax (float, opt) – Maximum value toward the SNR-weighting to consider. Default 100.

  • filterlist (list of str, opt) – The filters which the lightcurve inversion could be based on. Requirements must be met in one of these filters.

Returns

0 (could not perform lightcurve inversion) or 1 (could)

Return type

int

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.MagicDiscoveryMetric(nObs=6, tWindow=60, snrLimit=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Count the number of discovery opportunities with very good software for an SSobject.

run(ssoObs, orb, Hval)[source]

SsoObs = Dataframe, orb=Dataframe, Hval=single number.

class lsst.sims.maf.metrics.moMetrics.NNightsMetric(snrLimit=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Count the number of distinct nights an SSobject is observed.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.NObsMetric(snrLimit=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Count the total number of observations where an SSobject was ‘visible’.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.NObsNoSinglesMetric(snrLimit=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Count the number of observations for an SSobject, without singles. Don’t include any observations where it was a single observation on a night.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.ObsArcMetric(snrLimit=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Calculate the difference between the first and last observation of an SSobject.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moMetrics.PeakVMagMetric(**kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Pull out the peak V magnitude of all observations of the SSobject.

run(ssoObs, orb, Hval)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

lsst.sims.maf.metrics.moSummaryMetrics module

class lsst.sims.maf.metrics.moSummaryMetrics.MeanValueAtHMetric(Hmark=22, reduceFunc=<function mean>, metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Return the mean value of a metric at a given H.

Allows the metric values to be multi-dimensional (i.e. use a cloned H distribution).

Parameters

Hmark (float, opt) – The H value at which to look up the metric value. Default = 22.

run(metricVals, Hvals)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moSummaryMetrics.MoCompletenessAtTimeMetric(times, Hval=None, cumulative=None, Hindex=0.33, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Calculate the completeness (relative to the entire population) <= a given H as a function of time, given the times of each discovery.

Input values of the discovery times can come from the Discovery_Time (child) metric or the KnownObjects metric.

Parameters
  • times (numpy.ndarray like) – The bins to distribute the discovery times into. Same units as the discovery time (typically MJD).

  • Hval (float, opt) – The value of H to count completeness at (or cumulative completeness to). Default None, in which case a value halfway through Hvals (the slicer H range) will be chosen.

  • cumulative (bool, opt) – If True, calculate the cumulative completeness (completeness <= H). If False, calculate the differential completeness (completeness @ H). Default None which becomes ‘True’ unless metricName starts with ‘differential’.

  • Hindex (float, opt) – Use Hindex as the power law to integrate over H, if cumulative is True. Default 0.3.

run(discoveryTimes, Hvals)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moSummaryMetrics.MoCompletenessMetric(threshold=1, nbins=20, minHrange=1.0, cumulative=None, Hindex=0.33, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Calculate the fraction of the population that meets threshold value or higher. This is equivalent to calculating the completeness (relative to the entire population) given the output of a Discovery_N_Chances metric, or the fraction of the population that meets a given cutoff value for Color determination metrics.

Any moving object metric that outputs a float value can thus have the ‘fraction of the population’ with greater than X value calculated here, as a summary statistic.

Parameters
  • threshold (int, opt) – Count the fraction of the population that exceeds this value. Default = 1.

  • nbins (int, opt) – If the H values for the metric are not a cloned distribution, then split up H into this many bins. Default 20.

  • minHrange (float, opt) – If the H values for the metric are not a cloned distribution, then split up H into at least this range (otherwise just use the min/max of the H values). Default 1.0

  • cumulative (bool, opt) – If False, simply report the differential fractional value (or differential completeness). If True, integrate over the H distribution (using IntegrateOverH) to report a cumulative fraction. Default None which becomes True; if metricName is set and starts with ‘Differential’ this will then set to False.

  • Hindex (float, opt) – Use Hindex as the power law to integrate over H, if cumulative is True. Default 0.3.

run(metricValues, Hvals)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

class lsst.sims.maf.metrics.moSummaryMetrics.ValueAtHMetric(Hmark=22, **kwargs)[source]

Bases: lsst.sims.maf.metrics.moMetrics.BaseMoMetric

Return the metric value at a given H value.

Requires the metric values to be one-dimensional (typically, completeness values).

Parameters

Hmark (float, opt) – The H value at which to look up the metric value. Default = 22.

run(metricVals, Hvals)[source]

Calculate the metric value.

Parameters
  • ssoObs (np.ndarray) – The input data to the metric (same as the parent metric).

  • orb (np.ndarray) – The information about the orbit for which the metric is being calculated.

  • Hval (float) – The H value for which the metric is being calculated.

Returns

Return type

float or np.ndarray or dict

lsst.sims.maf.metrics.moSummaryMetrics.integrateOverH(Mvalues, Hvalues, Hindex=0.33)[source]

Function to calculate a metric value integrated over an Hrange, assuming a power-law distribution.

Parameters
  • Mvalues (numpy.ndarray) – The metric values at each H value.

  • Hvalues (numpy.ndarray) – The H values corresponding to each Mvalue (must be the same length).

  • Hindex (float, opt) – The power-law index expected for the H value distribution. Default is 0.33 (dN/dH = 10^(Hindex * H) ).

Returns

The integrated or cumulative metric values.

Return type

numpy.ndarray

lsst.sims.maf.metrics.nightPointingMetric module

class lsst.sims.maf.metrics.nightPointingMetric.NightPointingMetric(altCol='altitude', azCol='azimuth', filterCol='filter', mjdCol='observationStartMJD', metricName='NightPointing', telescope='LSST', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Gather relevant information for a night to plot.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.optimalM5Metric module

class lsst.sims.maf.metrics.optimalM5Metric.OptimalM5Metric(m5Col='fiveSigmaDepth', optM5Col='m5Optimal', filterCol='filter', magDiff=False, normalize=False, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Compare the co-added depth of the survey to one where all the observations were taken on the meridian.

Parameters
  • m5Col (str ('fiveSigmaDepth')) – Column name that contains the five-sigma limiting depth of each observation

  • optM5Col (str ('m5Optimal')) – The column name of the five-sigma-limiting depth if the observation had been taken on the meridian.

  • normalize (bool (False)) – If False, metric returns how many more observations would need to be taken to reach the optimal depth. If True, the number is normalized by the total number of observations already taken at that position.

  • magDiff (bool (False)) – If True, metric returns the magnitude difference between the achieved coadded depth and the optimal coadded depth.

Returns

  • numpy.array

  • If magDiff is True, returns the magnitude difference between the

  • optimal and actual coadded depth. If normalize is False

  • (default), the result is the number of additional observations

  • (taken at the median depth) the survey needs to catch up to

  • optimal. If normalize is True, the result is divided by the

  • number of observations already taken. So if a 10-year survey

  • returns 20%, it would need to run for 12 years to reach the same

  • depth as a 10-year meridian survey.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.pairMetric module

class lsst.sims.maf.metrics.pairMetric.PairMetric(mjdCol='observationStartMJD', metricName='Pairs', match_min=20.0, match_max=40.0, binsize=5.0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count the number of pairs that could be used for Solar System object detection

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.periodicDetectMetric module

class lsst.sims.maf.metrics.periodicDetectMetric.PeriodicDetectMetric(mjdCol='observationStartMJD', periods=2.0, amplitudes=0.1, m5Col='fiveSigmaDepth', metricName='PeriodicDetectMetric', filterCol='filter', starMags=20, sig_level=0.05, SedTemplate='F', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Determine if we would be able to classify an object as periodic/non-uniform, using an F-test The idea here is that if a periodic source is aliased, it will be indistinguishable from a constant source, so we can find a best-fit constant, and if the reduced chi-squared is ~1, we know we are aliased.

Parameters
  • period (float (2) or array) – The period of the star (days). Can be a single value, or an array. If an array, amplitude and starMag should be arrays of equal length.

  • amplitude (floar (0.1)) – The amplitude of the stellar variablility (mags).

  • starMag (float (20.)) – The mean magnitude of the star in r (mags).

  • sig_level (float (0.05)) – The value to use to compare to the p-value when deciding if we can reject the null hypothesis.

  • SedTemplate (str ('F')) – The stellar SED template to use to generate realistic colors (default is an F star, so RR Lyrae-like)

Returns

  • 1 if we would detect star is variable, 0 if it is well-fit by a constant value. If using arrays to test multiple

  • period-amplitude-mag combinations, will be the sum of the number of detected stars.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.phaseGapMetric module

class lsst.sims.maf.metrics.phaseGapMetric.PeriodicQualityMetric(mjdCol='observationStartMJD', period=2.0, m5Col='fiveSigmaDepth', metricName='PhaseCoverageMetric', starMag=20, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.phaseGapMetric.PhaseGapMetric(col='observationStartMJD', nPeriods=5, periodMin=3.0, periodMax=35.0, nVisitsMin=3, metricName='Phase Gap', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Measure the maximum gap in phase coverage for observations of periodic variables.

Parameters
  • col (str, opt) – Name of the column to use for the observation times (MJD)

  • nPeriods (int, opt) – Number of periods to test

  • periodMin (float, opt) – Minimum period to test, in days.

  • periodMax (float, opt) – Maximum period to test, in days

  • nVisitsMin (int, opt) – Minimum number of visits necessary before looking for the phase gap.

reduceLargestGap(metricVal)[source]

At each slicepoint, return the largest phase gap value.

reduceMeanGap(metricVal)[source]

At each slicepoint, return the mean gap value.

reduceMedianGap(metricVal)[source]

At each slicepoint, return the median gap value.

reduceWorstPeriod(metricVal)[source]

At each slicepoint, return the period with the largest phase gap.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.seasonMetrics module

A group of metrics that work together to evaluate season characteristics (length, number, etc). In addition, these supports the time delay metric calculation for strong lensing.

class lsst.sims.maf.metrics.seasonMetrics.CampaignLengthMetric(mjdCol='observationStartMJD', expTimeCol='visitExposureTime', minExpTime=20, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the number of seasons (roughly, years) a pointing is observed for. This corresponds to the ‘campaign length’ for lensed quasar time delays.

run(dataSlice, slicePoint)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.seasonMetrics.MeanCampaignFrequencyMetric(mjdCol='observationStartMJD', expTimeCol='visitExposureTime', minExpTime=20, nightCol='night', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the mean separation between nights, within a season - then the mean over the campaign. Calculate per season, to avoid any influence from season gaps.

run(dataSlice, slicePoint)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.seasonMetrics.SeasonLengthMetric(mjdCol='observationStartMJD', expTimeCol='visitExposureTime', minExpTime=20, reduceFunc=<function median>, metricName='SeasonLength', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the length of LSST seasons, in days.

Parameters
  • minExpTime (float, opt) – Minimum visit exposure time to count for a ‘visit’, in seconds. Default 20.

  • reduceFunc (function, optional) – Function that can operate on array-like structures. Typically numpy function. This reduces the season length in each season from 10 separate values to a single value. Default np.median.

run(dataSlice, slicePoint)[source]

Calculate the (reduceFunc) of the length of each season. Uses the slicePoint RA/Dec to calculate the position in question, then uses the times of the visits to assign them into seasons (based on where the sun is relative to the slicePoint RA).

Parameters
  • dataSlice (numpy.array) – Numpy structured array containing the data related to the visits provided by the slicer.

  • slicePoint (dict) – Dictionary containing information about the slicepoint currently active in the slicer.

Returns

The (reduceFunc) of the length of each season, in days.

Return type

float

class lsst.sims.maf.metrics.seasonMetrics.TdcMetric(mjdCol='observationStartMJD', nightCol='night', filterCol='filter', m5Col='fiveSigmaDepth', magCuts=None, metricName='TDC', cadNorm=3.0, seaNorm=4.0, campNorm=5.0, badval=- 999, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the Time Delay Challenge metric, as described in Liao et al 2015 (https://arxiv.org/pdf/1409.1254.pdf).

This combines the MeanCampaignFrequency/MeanNightSeparation, the SeasonLength, and the CampaignLength metrics above, but rewritten to calculate season information only once.

cadNorm = in units of days seaNorm = in units of months campNorm = in units of years

This metric also adds a requirement to achieve limiting magnitudes after galactic dust extinction, in various bandpasses, in order to exclude visits which are not useful for detecting quasars (due to being short or having high sky brightness, etc.) and to reject regions with high galactic dust extinction.

Parameters
  • mjdCol (str, opt) – Column name for mjd. Default observationStartMJD.

  • nightCol (str, opt) – Column name for night. Default night.

  • filterCol (str, opt) – Column name for filter. Default filter.

  • m5Col (str, opt) – Column name for five-sigma depth. Default fiveSigmaDepth.

  • magCuts (dict, opt) – Dictionary with filtername:mag limit (after dust extinction). Default None in kwarg. Defaults set within metric: {‘u’: 22.7, ‘g’: 24.1, ‘r’: 23.7, ‘i’: 23.1, ‘z’: 22.2, ‘y’: 21.4}

  • metricName (str, opt) – Metric Name. Default TDC.

  • cadNorm (float, opt) – Cadence normalization constant, in units of days. Default 3.

  • seaNorm (float, opt) – Season normalization constant, in units of months. Default 4.

  • campNorm (float, opt) – Campaign length normalization constant, in units of years. Default 5.

  • badval (float, opt) – Return this value instead of the dictionary for bad points.

Returns

Dictionary of values for {‘rate’, ‘precision’, ‘accuracy’} at this point in the sky.

Return type

dictionary

reduceAccuracy(metricValue)[source]
reduceCadence(metricValue)[source]
reduceCampaign(metricValue)[source]
reducePrecision(metricValue)[source]
reduceRate(metricValue)[source]
reduceSeason(metricValue)[source]
run(dataSlice, slicePoint)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.seasonMetrics.calcSeason(ra, time)[source]

Calculate the ‘season’ in the survey for a series of ra/dec/time values of an observation. Based only on the RA of the point on the sky, it calculates the ‘season’ based on when this point would be overhead .. the season is considered +/- 0.5 years around this time.

Parameters
  • ra (float) – The RA (in degrees) of the point on the sky

  • time (np.ndarray) – The times of the observations, in MJD

Returns

The season values

Return type

np.ndarray

lsst.sims.maf.metrics.seasonMetrics.findSeasonEdges(seasons)[source]

Given the seasons, return the indexes of each start/end of the season.

Parameters

seasons (np.ndarray) – Seasons, such as calculated by calcSeason. Note that seasons should be sorted!!

Returns

The indexes of the first and last date in the season.

Return type

np.ndarray, np.ndarray

lsst.sims.maf.metrics.simpleMetrics module

class lsst.sims.maf.metrics.simpleMetrics.AbsMaxMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the max of the absolute value of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.AbsMaxPercentMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return the percent of the data which has the absolute value of the max value of the data.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.AbsMeanMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the mean of the absolute value of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.AbsMedianMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the median of the absolute value of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.BinaryMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return 1 if there is data.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.Coaddm5Metric(m5Col='fiveSigmaDepth', metricName='CoaddM5', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the coadded m5 value at this gridpoint.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.CountExplimMetric(col=None, minExp=20.0, expectedExp=30.0, expCol='visitExposureTime', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count the number of x second visits. Useful for rejecting very short exposures and counting 60s exposures as 2 visits.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.CountMetric(col=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count the length of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.CountRatioMetric(col=None, normVal=1.0, metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count the length of a simData column slice, then divide by ‘normVal’.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.CountSubsetMetric(col=None, subset=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count the length of a simData column slice which matches ‘subset’.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.CountUniqueMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return the number of unique values.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.FracAboveMetric(col=None, cutoff=0.5, scale=1, metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Find the fraction of data values above a given value.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.FracBelowMetric(col=None, cutoff=0.5, scale=1, metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Find the fraction of data values below a given value.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.FullRangeAngleMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the full range of an angular (degrees) simData column slice.

‘FullRangeAngle’ differs from ‘FullRange’ in that it accounts for wraparound at 2pi.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.FullRangeMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the range of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.MaxMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the maximum of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.MaxPercentMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return the percent of the data which has the maximum value.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.MeanAngleMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the mean of an angular (degree) simData column slice.

‘MeanAngle’ differs from ‘Mean’ in that it accounts for wraparound at 2pi.

run(dataSlice, slicePoint=None)[source]

Calculate mean angle via unit vectors. If unit vector ‘strength’ is less than 0.1, then just set mean to 180 degrees (as this indicates nearly uniformly distributed angles).

class lsst.sims.maf.metrics.simpleMetrics.MeanMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the mean of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.MedianMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the median of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.MinMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the minimum of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.NoutliersNsigmaMetric(col=None, nSigma=3.0, metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the # of visits less than nSigma below the mean (nSigma<0) or more than nSigma above the mean of ‘col’.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.PassMetric(cols=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Just pass the entire array through

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.PercentileMetric(col=None, percentile=90, metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Find the value of a column at a given percentile.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.RmsAngleMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the standard deviation of an angular (degrees) simData column slice.

‘RmsAngle’ differs from ‘Rms’ in that it accounts for wraparound at 2pi.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.RmsMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the standard deviation of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.RobustRmsMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Use the inter-quartile range of the data to estimate the RMS. Robust since this calculation does not include outliers in the distribution.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.SumMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the sum of a simData column slice.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.simpleMetrics.UniqueRatioMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return the number of unique values divided by the total number of values.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.slewMetrics module

class lsst.sims.maf.metrics.slewMetrics.AveSlewFracMetric(col='actDelay', activity=None, activeCol='activity', idCol='SlewHistory_slewCount', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.slewMetrics.SlewContributionMetric(col='actDelay', activity=None, activeCol='activity', inCritCol='inCriticalPath', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.snCadenceMetric module

class lsst.sims.maf.metrics.snCadenceMetric.SNCadenceMetric(metricName='SNCadenceMetric', mjdCol='observationStartMJD', RaCol='fieldRA', DecCol='fieldDec', filterCol='filter', m5Col='fiveSigmaDepth', exptimeCol='visitExposureTime', nightCol='night', obsidCol='observationId', nexpCol='numExposures', vistimeCol='visitTime', coadd=True, lim_sn=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Metric to estimate the redshift limit for faint supernovae (x1,color) = (-2.0,0.2)

Parameters
  • list (str, opt) – Name of the columns used to estimate the metric

  • coadd (bool, opt) – to make “coaddition” per night (uses snStacker) Default True

  • lim_sn (class, opt) – Reference data used to estimate redshift values (interpolation)

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.snNSNMetric module

class lsst.sims.maf.metrics.snNSNMetric.SNNSNMetric(metricName='SNNSNMetric', mjdCol='observationStartMJD', RACol='fieldRA', DecCol='fieldDec', filterCol='filter', m5Col='fiveSigmaDepth', exptimeCol='visitExposureTime', nightCol='night', obsidCol='observationId', nexpCol='numExposures', vistimeCol='visitTime', season=[- 1], zmin=0.0, zmax=1.2, pixArea=9.6, verbose=False, ploteffi=False, n_bef=4, n_aft=10, snr_min=5.0, n_phase_min=1, n_phase_max=1, templateDir=None, zlim_coeff=- 1.0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Estimate (nSN,zlim) of type Ia supernovae.

metricNamestr, opt

metric name (default : SNSNRMetric)

mjdColstr, opt

mjd column name (default : observationStartMJD)

RAColstr,opt

Right Ascension column name (default : fieldRA)

DecColstr,opt

Declinaison column name (default : fieldDec)

filterColstr,opt

filter column name (default: filter)

m5Colstr, opt

five-sigma depth column name (default : fiveSigmaDepth)

exptimeColstr,opt

exposure time column name (default : visitExposureTime)

nightColstr,opt

night column name (default : night)

obsidColstr,opt

observation id column name (default : observationId)

nexpColstr,opt

number of exposure column name (default : numExposures)

vistimeColstr,opt

visit time column name (default : visitTime)

seasonlist,opt

list of seasons to process (float)(default: -1 = all seasons)

zminfloat,opt

min redshift for the study (default: 0.0)

zmaxfloat,opt

max redshift for the study (default: 1.2)

pixArea: float, opt

pixel area (default: 9.6)

verbose: bool,opt

verbose mode (default: False)

ploteffi: bool,opt

to plot observing efficiencies vs z (default: False)

n_bef: int, opt

number of LC points LC before T0 (default:5)

n_aft: int, opt

number of LC points after T0 (default: 10)

snr_min: float, opt

minimal SNR of LC points (default: 5.0)

n_phase_min: int, opt

number of LC points with phase<= -5(default:1)

n_phase_max: int, opt

number of LC points with phase>= 20 (default: 1)

calcDaymax(grp)[source]

Method to estimate T0 (daymax) values for simulation. :param grp:

group of data to process with the following cols:

T0_min: T0 min value (per season) T0_max: T0 max value (per season)

Returns

Return type

pandas df with daymax, min_rf_phase, max_rf_phase values

coadd(data)[source]

Method to coadd data per band and per night

Parameters

data (pandas df of observations) –

Returns

Return type

coadded data (pandas df)

duration_z(grp)[source]

Method to estimate the season length vs redshift This is necessary to take into account boundary effects when estimating the number of SN that can be detected daymin, daymax = min and max MJD of a season T0_min(z) = daymin-(1+z)*min_rf_phase_qual T0_max(z) = daymax-(1+z)*max_rf_phase_qual season_length(z) = T0_max(z)-T0_min(z) :param grp: data to process: season infos :type grp: pandas df group

Returns

Return type

pandas df with season_length, z, T0_min and T0_max cols

effiObsdf(data, color_cut=0.04)[source]

Method to estimate observing efficiencies for supernovae :param data: data to process :type data: pandas df - grp

Returns

  • cols used to make the group

  • effi, effi_err: observing efficiency and associated error

Return type

pandas df with the following cols

effidf(sn_tot, color_cut=0.04)[source]

Method estimating efficiency vs z for a sigma_color cut :param sn_tot: data used to estimate efficiencies :type sn_tot: pandas df :param color_cut: color selection cut(default: 0.04) :type color_cut: float, opt

Returns

effi – season: season pixRA: RA of the pixel pixDec: Dec of the pixel healpixID: pixel ID x1: SN stretch color: SN color z: redshift effi: efficiency effi_err: efficiency error(binomial)

Return type

pandas df with the following cols:

genSN(obs, gen_par)[source]

Method to simulate LC and supernovae :param obs: array of observations(from scheduler) :type obs: numpy array :param gen_par: array of parameters for simulation :type gen_par: numpy array

getseason(obs, season_gap=80.0, mjdCol='observationStartMJD')[source]

Method to estimate seasons :param obs: array of observations :type obs: numpy array :param season_gap: minimal gap required to define a season (default: 80 days) :type season_gap: float, opt :param mjdCol: :type mjdCol: str, opt :param col name for MJD infos (default: :type col name for MJD infos (default: observationStartMJD)

Returns

Return type

original numpy array with seasonnumber appended

nsn(effi, zlim, duration_z)[source]

Method to estimate the number of supernovae :param effi: season: season

pixRA: RA of the pixel pixDec: Dec of the pixel healpixID: pixel ID x1: SN stretch color: SN color z: redshift effi: efficiency effi_err: efficiency error (binomial)

Parameters
  • zlim (float) – redshift limit value

  • duration_z (pandas df with the following cols:) –

    season: season z: redshift T0_min: min daymax T0_max: max daymax

    season_length: season length

Returns

nsn, var_nsn – number of supernovae (and variance) with z<zlim

Return type

float

nsn_typedf(grp, x1, color, effi_tot, duration_z, search=True)[source]

Method to estimate the number of supernovae for a given type of SN :param grp: pixRA: pixelRA

pixDec: pixel Dec healpixID: pixel ID season: season x1: SN stretch color: SN color zlim: redshift limit

Parameters
  • x1 (SN params to estimate the number) –

  • color (SN params to estimate the number) –

  • effi_tot (pandas df with columns:) – season: season pixRA: RA of the pixel pixDec: Dec of the pixel healpixID: pixel ID x1: SN stretch color: SN color z: redshift effi: efficiency effi_err: efficiency error (binomial)

  • duration_z (pandas df with the following cols:) –

    season: season z: redshift T0_min: min daymax T0_max: max daymax

    season_length: season length

Returns

nsn – number of supernovae

Return type

float

plot(ax, effi, vary, erry=None, legy='', ls='None')[source]

Simple method to plot vs z :param ax: axis where to plot :param effi: data to plot :type effi: pandas df :param vary: variable(column of effi) to plot :type vary: str :param erry: error on y-axis(default: None) :type erry: str, opt :param legy: y-axis legend(default: ‘’) :type legy: str, opt

plot_NSN_cumul(grp, nsn_cum_norm, zplot)[source]

Method to plot the NSN cumulative vs redshift :param grp: data to process :type grp: pandas group

process(tab)[source]

Method to process LC: sigma_color estimation and LC selection :param tab: flux: flux

fluxerr: flux error phase: phase snr_m5: Signal-to-Noise Ratio time: time(MJD) mag: magnitude m5: five-sigma depth magerr: magnitude error exposuretime: exposure time band: filter zp: zero-point season: season number healpixID: pixel ID pixRA: pixel RA pixDec: pixel Dec z: redshift daymax: T0 flux_e_sec: flux(in photoelec/sec) flux_5: 5-sigma flux(in photoelec/sec) F_x0x0, …F_colorcolor: Fisher matrix elements x1: x1 SN color: color SN n_aft: number of LC points before daymax n_bef: number of LC points after daymax n_phmin: number of LC points with a phase < -5 n_phmax: number of LC points with a phase > 20

reducenSN(metricVal)[source]
reducezlim(metricVal)[source]
run(dataSlice, slicePoint=None)[source]

run method of the metric

Parameters

dataSlice (array) – data to process

run_season(dataSlice, season, gen_par, dura_z)[source]

Method to run on seasons :param dataSlice: data to process (scheduler simulations) :type dataSlice: numpy array, opt :param seasons: list of seasons to process :type seasons: list(int)

Returns

  • effi_seasondf (pandas df) – efficiency curves

  • zlimsdf (pandas df) – redshift limits and number of supernovae

seasonInfo(grp)[source]

Method to estimate seasonal info (cadence, season length, …) :param grp: :type grp: pandas df group

Returns

Return type

pandas df with the cfollowing cols

zlim_from_cumul(grp, duration_z, effiInterp, zplot, rate='cte')[source]

Method to estimate the redshift limit from the cumulative The redshift limit is estimated to be the z value corresponding to: frac(NSN(z<zlimit))=zlimi_coeff

Parameters
  • grp (pandas group) – data to process

  • duration_z (array) – duration as a function of the redshift

  • effiInterp (interp1d) – interpolator for efficiencies

  • zplot (interp1d) – interpolator for redshift values

  • rate (str, opt) – rate to estimate the number of SN to estimate zlimit rate = cte: rate independent of z rate = SN_rate: rate from SN_Rate class

Returns

zlimit – the redshift limit

Return type

float

zlim_from_effi(effiInterp, zplot)[source]

Method to estimate the redshift limit from efficiency curves The redshift limit is defined here as the redshift value beyond which efficiency decreases up to zero. :param effiInterp: use to get efficiencies :type effiInterp: interpolator :param zplot: redshift values :type zplot: numpy array

Returns

zlimit – the redshift limit

Return type

float

zlimdf(grp, duration_z)[source]

Method to estimate redshift limits :param grp: efficiencies to estimate redshift limits;

columns:

season: season pixRA: RA of the pixel pixDec: Dec of the pixel healpixID: pixel ID x1: SN stretch color: SN color z: redshift effi: efficiency effi_err: efficiency error (binomial)

Parameters

duration_z (pandas df with the following cols:) –

season: season z: redshift T0_min: min daymax T0_max: max daymax

season_length: season length

Returns

zlimit: redshift limit

Return type

pandas df with the following cols

zlimdf_deprecated(grp, duration_z)[source]

Method to estimate redshift limits :param grp: efficiencies to estimate redshift limits;

columns:

season: season pixRA: RA of the pixel pixDec: Dec of the pixel healpixID: pixel ID x1: SN stretch color: SN color z: redshift effi: efficiency effi_err: efficiency error (binomial)

Parameters

duration_z (pandas df with the following cols:) –

season: season z: redshift T0_min: min daymax T0_max: max daymax

season_length: season length

Returns

zlimit: redshift limit

Return type

pandas df with the following cols

zlims(effi_seasondf, dur_z, groupnames)[source]

Method to estimate redshift limits :param effi_seasondf: season: season

pixRA: RA of the pixel pixDec: Dec of the pixel healpixID: pixel ID x1: SN stretch color: SN color z: redshift effi: efficiency effi_err: efficiency error (binomial)

Parameters
  • dur_z (pandas df with the following cols:) –

    season: season z: redshift T0_min: min daymax T0_max: max daymax

    season_length: season length

  • groupnames (list(str)) – list of columns to use to define the groups

Returns

pandas df with the following cols – pixDec: Dec of the pixel healpixID: pixel ID season: season number x1: SN stretch color: SN color zlim: redshift limit

Return type

pixRA: RA of the pixel

lsst.sims.maf.metrics.snSLMetric module

class lsst.sims.maf.metrics.snSLMetric.SNSLMetric(metricName='SNSLMetric', mjdCol='observationStartMJD', RaCol='fieldRA', DecCol='fieldDec', filterCol='filter', exptimeCol='visitExposureTime', nightCol='night', obsidCol='observationId', nexpCol='numExposures', vistimeCol='visitTime', m5Col='fiveSigmaDepth', season=[- 1], night_collapse=False, nfilters_min=4, min_season_obs=5, m5mins={'g': 24.1, 'i': 23.1, 'r': 23.7, 'u': 22.7, 'y': 21.4, 'z': 22.2}, maps=['DustMap'], **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

run(dataSlice, slicePoint=None)[source]

Runs the metric for each dataSlice

Parameters
  • dataSlice (simulation data) –

  • slicePoint (slicePoint(default None)) –

Returns

Return type

number of SL time delay supernovae

lsst.sims.maf.metrics.snSNRMetric module

class lsst.sims.maf.metrics.snSNRMetric.SNSNRMetric(metricName='SNSNRMetric', mjdCol='observationStartMJD', RaCol='fieldRA', DecCol='fieldDec', filterCol='filter', m5Col='fiveSigmaDepth', exptimeCol='visitExposureTime', nightCol='night', obsidCol='observationId', nexpCol='numExposures', vistimeCol='visitTime', coadd=True, lim_sn=None, names_ref=None, season=1, z=0.01, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Metric to estimate the detection rate for faint supernovae (x1,color) = (-2.0,0.2)

Parameters
  • list (str, opt) –

    Name of the columns used to estimate the metric Default : ‘observationStartMJD’, ‘fieldRA’, ‘fieldDec’,’filter’,’fiveSigmaDepth’,

    ’visitExposureTime’,’night’,’observationId’, ‘numExposures’,’visitTime’

  • coadd (bool, opt) – to make “coaddition” per night (uses snStacker) Default : True

  • lim_sn (class, opt) – Reference data used to simulate LC points (interpolation)

  • names_ref (str,opt) – names of the simulator used to produce reference data

  • season (flota,opt) – season num Default : 1.

  • z (float,opt) – redshift for this study Default : 0.01

PlotHistory(fluxes, mjd, flag, snr, T0_lc, dates)[source]

Plot history of Plot For each MJD, fluxes and snr are plotted Each plot may be saved as a png to make a video afterwards

Parameters
  • fluxes (list(float)) – LC fluxes

  • mjd (list(float)) – mjds of the fluxes

  • flag (array) – flag for selection of fluxes

  • snr (list) – signal-to-noise ratio

  • T0_lc (list(float)) – list of T0 supernovae

  • dates (list(float)) – date of the display (mjd)

check_seasons(tab)[source]

Check wether seasons have no overlap if it is the case: modify MJD_min and season length of the corresponding season return only seasons with season_length > 30 days

Parameters

tab (array with the following fields:) –

Returns

tab

Return type

array with the following fields:

detection_rate(snr_obs, snr_fakes)[source]

Estimate the time fraction(per season) for which snr_obs > snr_fakes = detection rate For regular cadences one should get a result close to 1

Parameters

snr_obs (array) –

array estimated using snr_slice(observations)

snr_fakes: array

array estimated using snr_slice(fakes)

Returns

fieldRA (float)

fieldDec (float) season (float)

band (str) frac_obs_name_ref (float)

Return type

record array with the following fields

gen_fakes(slice_sel, band)[source]

Generate fake observations according to observing values extracted from simulations

Parameters
  • slice_sel (array) – array of observations

  • band (str) – band to consider

Returns

fake_obs_season – array of observations with the following fields observationStartMJD (float) fieldRA (float) fieldDec (float) filter (U1) fiveSigmaDepth (float) numExposures (float) visitExposureTime (float) season (int)

Return type

array

get_season(T0)[source]

Estimate the seasons corresponding to T0 values

Parameters

T0 (list(float)) – set of T0 values

Returns

Return type

list (float) of corresponding seasons

plot(snr_obs, snr_fakes)[source]

Plot SNR vs time

Parameters
  • snr_obs (array) – array estimated using snr_slice(observations)

  • snr_obs – array estimated using snr_slice(fakes)

process(sel)[source]

Process one season

Parameters
  • sel (array) – array of observations

  • season (int) – season number

Returns

fieldRA (float)

fieldDec (float) season (float)

band (str) frac_obs_name_ref (float)

Return type

record array with the following fields

run(dataSlice, slicePoint=None)[source]

run the metric

Parameters

dataSlice (array) – simulation data under study

Returns

detection rate

Return type

float

season_info(dataSlice, season)[source]

Get info on seasons for each dataSlice

Parameters

dataSlice (array) – array of observations

Returns

  • recordarray with the following fields

  • season, cadence, season_length, MJDmin, MJDmax

snr(time_lc, m5_vals, flag, season_vals, T0_lc)[source]

Estimate SNR vs time

Parameters
  • time_lc

  • m5_vals (list(float)) – five-sigme depth values

  • flag (array(bool)) – flag to be applied (example: selection from phase cut)

  • season_vals (array(float)) – season values

  • T0_lc (array(float)) – array of T0 for supernovae

Returns

  • fluxes_tot (list(float)) – list of (interpolated) fluxes

  • snr_tab (array with the following fields:) – snr_name_ref (float) : Signal-to-Noise values season (float) : season num.

snr_fakes(dataSlice)[source]

Estimate SNR for fake observations in the same way as for observations (using SNR_Season)

dataSlicearray

array of observations

Returns

snr_tab – snr_name_ref (float) : Signal-to-Noise values season (float) : season num.

Return type

array with the following fields:

snr_slice(dataSlice, j=- 1, output_q=None)[source]

Estimate SNR for a given dataSlice

Parameters

Input (dataSlice) –

Returns

  • array with the following fields (all are of f8 type, except band which is of U1)

  • SNR_name_ref (Signal-To-Noise Ratio estimator)

  • season (season)

  • cadence (cadence of the season)

  • season_length (length of the season)

  • MJD_min (min MJD of the season)

  • DayMax (SN max luminosity MJD (aka T0))

  • MJD

  • m5_eff (mean m5 of obs passing the min_phase, max_phase cut)

  • fieldRA (mean field RA)

  • fieldDec (mean field Dec)

  • band (band)

  • m5 (mean m5 (over the season))

  • Nvisits (median number of visits (per observation) (over the season))

  • ExposureTime (median exposure time (per observation) (over the season))

lsst.sims.maf.metrics.starDensity module

class lsst.sims.maf.metrics.starDensity.StarDensityMetric(rmagLimit=25.0, units='stars/sq arcsec', filtername='r', maps=['StellarDensityMap'], **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Interpolate the stellar luminosity function to return the number of stars per square arcsecond brighter than the rmagLimit. Note that the map is built from CatSim stars in the range 20 < r < 28.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.stringCountMetric module

class lsst.sims.maf.metrics.stringCountMetric.StringCountMetric(metricName='stringCountMetric', col='filter', percent=False, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count up the number of times each string appears in a column.

Dynamically builds reduce functions for each unique string value, so summary sats can be named the same as strings in the simData array without knowing the values of those trings ahead of time.

run(dataslice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.summaryMetrics module

class lsst.sims.maf.metrics.summaryMetrics.IdentityMetric(col=None, metricName=None, maps=None, units=None, metricDtype=None, badval=- 666, maskVal=None)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return the metric value itself .. this is primarily useful as a summary statistic for UniSlicer metrics.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.summaryMetrics.NormalizeMetric(col='metricdata', normVal=1, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return a metric values divided by ‘normVal’. Useful for turning summary statistics into fractions.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.summaryMetrics.StaticProbesFoMEmulatorMetricSimple(nside=128, year=10, col=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

This calculates the Figure of Merit for the combined static probes (3x2pt, i.e., Weak Lensing, LSS, Clustering). This FoM is purely statistical and does not factor in systematics.

This version of the emulator was used to generate the results in https://ui.adsabs.harvard.edu/abs/2018arXiv181200515L/abstract

A newer version is being created. This version has been renamed Simple in anticipation of the newer, more sophisticated metric replacing it.

Note that this is truly a summary metric and should be run on the output of Exgalm5_with_cuts.

run(dataSlice, slicePoint=None)[source]
Args:
dataSlice (ndarray): Values passed to metric by the slicer,

which the metric will use to calculate metric values at each slicePoint.

slicePoint (Dict): Dictionary of slicePoint metadata passed

to each metric.

Returns:

float: Interpolated static-probe statistical Figure-of-Merit.

Raises:

ValueError: If year is not one of the 4 for which a FoM is calculated

class lsst.sims.maf.metrics.summaryMetrics.TableFractionMetric(col='metricdata', nbins=10, maskVal=0.0)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count the completeness (for many fields) and summarize how many fields have given completeness levels (within a series of bins). Works with completenessMetric only.

This metric is meant to be used as a summary statistic on something like the completeness metric. The output is DIFFERENT FROM SSTAR and is: element matching values 0 0 == P 1 0 < P < .1 2 .1 <= P < .2 3 .2 <= P < .3 … 10 .9 <= P < 1 11 1 == P 12 1 < P Note the 1st and last elements do NOT obey the numpy histogram conventions.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.summaryMetrics.TotalPowerMetric(col='metricdata', lmin=100.0, lmax=300.0, removeDipole=True, maskVal=- 1.6375e+30, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate the total power in the angular power spectrum between lmin/lmax.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.summaryMetrics.ZeropointMetric(col='metricdata', zp=0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Return a metric values with the addition of ‘zp’. Useful for altering the zeropoint for summary statistics.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.summaryMetrics.fOArea(col='metricdata', Nvisit=825, Asky=18000.0, nside=128, norm=False, metricName='fOArea', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Metrics based on a specified number of visits, but returning AREA related to Nvisits: given Nvisit, what amount of sky is covered with at least that many visits?

Parameters
  • col (str or list of strs, opt) – Name of the column in the numpy recarray passed to the summary metric.

  • Nvisit (int, opt) – Number of visits to use as the minimum required – metric calculated area that has this many visits. Default 825.

  • Asky (float, opt) – Area to use as the benchmark value, if choosing to returned a normalized Area value. Default 18,0000 sq deg.

  • nside (int, opt) – Nside parameter from healpix slicer, used to set the physical relationship between on-sky area and number of healpixels. Default 128.

  • norm (boolean, opt) – Normalize the returned “area” (area with minimum Nvisit visits) value by Asky, if true. Default False.

  • metricName (str, opt) – Name of the summary metric. Default fOArea.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.summaryMetrics.fONv(col='metricdata', Asky=18000.0, nside=128, Nvisit=825, norm=False, metricName='fONv', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Metrics based on a specified area, but returning NVISITS related to area: given Asky, what is the minimum and median number of visits obtained over that much area? (choose the portion of the sky with the highest number of visits first).

Parameters
  • col (str or list of strs, opt) – Name of the column in the numpy recarray passed to the summary metric.

  • Asky (float, opt) – Area of the sky to base the evaluation of number of visits over. Default 18,0000 sq deg.

  • nside (int, opt) – Nside parameter from healpix slicer, used to set the physical relationship between on-sky area and number of healpixels. Default 128.

  • Nvisit (int, opt) – Number of visits to use as the benchmark value, if choosing to return a normalized Nvisit value.

  • norm (boolean, opt) – Normalize the returned “nvisit” (min / median) values by Nvisit, if true. Default False.

  • metricName (str, opt) – Name of the summary metric. Default fONv.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.technicalMetrics module

class lsst.sims.maf.metrics.technicalMetrics.BruteOSFMetric(metricName='BruteOSFMetric', expTimeCol='visitExposureTime', mjdCol='observationStartMJD', maxgap=10.0, fudge=0.0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Assume I can’t trust the slewtime or visittime colums. This computes the fraction of time the shutter is open, with no penalty for the first exposure after a long gap (e.g., 1st exposure of the night). Presumably, the telescope will need to focus, so there’s not much a scheduler could do to optimize keeping the shutter open after a closure.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.technicalMetrics.CompletenessMetric(filterColName='filter', metricName='Completeness', u=0, g=0, r=0, i=0, z=0, y=0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Compute the completeness and joint completeness

reduceJoint(completeness)[source]

The joint completeness is just the minimum completeness for a point/field.

reduceg(completeness)[source]
reducei(completeness)[source]
reducer(completeness)[source]
reduceu(completeness)[source]
reducey(completeness)[source]
reducez(completeness)[source]
run(dataSlice, slicePoint=None)[source]

Compute the completeness for each filter, and then the minimum (joint) completeness for each slice.

class lsst.sims.maf.metrics.technicalMetrics.FilterColorsMetric(rRGB='rRGB', gRGB='gRGB', bRGB='bRGB', timeCol='observationStartMJD', t0=None, tStep=0.0004629629629629629, metricName='FilterColors', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate an RGBA value that accounts for the filters used up to time t0.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.technicalMetrics.MaxStateChangesWithinMetric(changeCol='filter', timeCol='observationStartMJD', metricName=None, timespan=20, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Compute the maximum number of changes of state that occur within a given timespan. (useful for calculating time between filter changes in particular). ‘timespan’ should be in minutes.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.technicalMetrics.MinTimeBetweenStatesMetric(changeCol='filter', timeCol='observationStartMJD', metricName=None, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Compute the minimum time between changes of state in a column value. (useful for calculating fastest time between filter changes in particular). Returns delta time in minutes!

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.technicalMetrics.NChangesMetric(col='filter', orderBy='observationStartMJD', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Compute the number of times a column value changes. (useful for filter changes in particular).

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.technicalMetrics.NStateChangesFasterThanMetric(changeCol='filter', timeCol='observationStartMJD', metricName=None, cutoff=20, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Compute the number of changes of state that happen faster than ‘cutoff’. (useful for calculating time between filter changes in particular). ‘cutoff’ should be in minutes.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.technicalMetrics.OpenShutterFractionMetric(metricName='OpenShutterFraction', slewTimeCol='slewTime', expTimeCol='visitExposureTime', visitTimeCol='visitTime', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Compute the fraction of time the shutter is open compared to the total time spent observing.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.technicalMetrics.TeffMetric(m5Col='fiveSigmaDepth', filterCol='filter', metricName='tEff', fiducialDepth=None, teffBase=30.0, normed=False, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Effective time equivalent for a given set of visits.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.tgaps module

class lsst.sims.maf.metrics.tgaps.MaxGapMetric(mjdCol='observationStartMJD', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Find the maximum gap in observations. Useful for making sure there is an image within the last year that would make a good template image.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.tgaps.NVisitsPerNightMetric(nightCol='night', bins=array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), units='#', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Histogram the number of visits in each night.

Splits the visits by night, then histograms how many visits occur in each night.

Parameters
  • nightCol (str, opt) – The column name for the night of each observation. Default ‘night’.

  • bins (np.ndarray, opt) – The bins to use for the histogram of time gaps (in days, or same units as timesCol). Default values are bins from 0 to 5 visits, in steps of 1.

  • a histogram at each slice point; these histograms can be combined and plotted using the (Returns) –

  • plotter'. ('SummaryHistogram) –

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.tgaps.NightgapsMetric(nightCol='night', allGaps=False, bins=array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), units='nights', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Histogram the number of nights between observations.

Measure the gaps between observations. By default, only gaps between neighboring visits are computed. If allGaps is set to true, all gaps are computed (i.e., if there are observations at 10, 20, 30 and 40 the default will histogram [10,10,10] while allGaps histograms [10,10,10,20,20,30])

Parameters
  • nightCol (str, opt) – The column name for the night of each observation. Default ‘night’.

  • allGaps (bool, opt) – Histogram the gaps between all observations (True) or just successive observations (False)? Default is False. If all gaps are used, this metric can become significantly slower.

  • bins (np.ndarray, opt) – The bins to use for the histogram of time gaps (in days, or same units as timesCol). Default values are bins from 0 to 10 days, in 1 day intervals.

  • a histogram at each slice point; these histograms can be combined and plotted using the (Returns) –

  • plotter'. ('SummaryHistogram) –

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.tgaps.TgapsMetric(timesCol='observationStartMJD', allGaps=False, bins=array([0., 0.00347222, 0.00694444, 0.01041667, 0.01388889, 0.01736111, 0.02083333, 0.02430556, 0.02777778, 0.03125, 0.03472222, 0.03819444, 0.04166667, 0.04513889, 0.04861111, 0.05208333, 0.05555556, 0.05902778, 0.0625, 0.06597222, 0.06944444, 0.07291667, 0.07638889, 0.07986111]), units='days', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Histogram the times of the gaps between observations.

Measure the gaps between observations. By default, only gaps between neighboring visits are computed. If allGaps is set to true, all gaps are computed (i.e., if there are observations at 10, 20, 30 and 40 the default will return a histogram of [10,10,10] while allGaps returns a histogram of [10,10,10,20,20,30])

Parameters
  • timesCol (str, opt) – The column name for the exposure times. Values assumed to be in days. Default observationStartMJD.

  • allGaps (bool, opt) – Histogram the gaps between all observations (True) or just successive observations (False)? Default is False. If all gaps are used, this metric can become significantly slower.

  • bins (np.ndarray, opt) – The bins to use for the histogram of time gaps (in days, or same units as timesCol). Default values are bins from 0 to 2 hours, in 5 minute intervals.

  • a histogram at each slice point; these histograms can be combined and plotted using the (Returns) –

  • plotter'. ('SummaryHistogram) –

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.transientMetrics module

class lsst.sims.maf.metrics.transientMetrics.TransientMetric(metricName='TransientDetectMetric', mjdCol='observationStartMJD', m5Col='fiveSigmaDepth', filterCol='filter', transDuration=10.0, peakTime=5.0, riseSlope=0.0, declineSlope=0.0, surveyDuration=10.0, surveyStart=None, detectM5Plus=0.0, uPeak=20, gPeak=20, rPeak=20, iPeak=20, zPeak=20, yPeak=20, nPrePeak=0, nPerLC=1, nFilters=1, nPhaseCheck=1, countMethod='full', **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate what fraction of the transients would be detected. Best paired with a spatial slicer. We are assuming simple light curves with no color evolution.

Parameters
  • transDuration (float, optional) – How long the transient lasts (days). Default 10.

  • peakTime (float, optional) – How long it takes to reach the peak magnitude (days). Default 5.

  • riseSlope (float, optional) – Slope of the light curve before peak time (mags/day). This should be negative since mags are backwards (magnitudes decrease towards brighter fluxes). Default 0.

  • declineSlope (float, optional) – Slope of the light curve after peak time (mags/day). This should be positive since mags are backwards. Default 0.

  • uPeak (float, optional) – Peak magnitude in u band. Default 20.

  • gPeak (float, optional) – Peak magnitude in g band. Default 20.

  • rPeak (float, optional) – Peak magnitude in r band. Default 20.

  • iPeak (float, optional) – Peak magnitude in i band. Default 20.

  • zPeak (float, optional) – Peak magnitude in z band. Default 20.

  • yPeak (float, optional) – Peak magnitude in y band. Default 20.

  • surveyDuration (float, optional) – Length of survey (years). Default 10.

  • surveyStart (float, optional) – MJD for the survey start date. Default None (uses the time of the first observation).

  • detectM5Plus (float, optional) – An observation will be used if the light curve magnitude is brighter than m5+detectM5Plus. Default 0.

  • nPrePeak (int, optional) – Number of observations (in any filter(s)) to demand before peakTime, before saying a transient has been detected. Default 0.

  • nPerLC (int, optional) – Number of sections of the light curve that must be sampled above the detectM5Plus theshold (in a single filter) for the light curve to be counted. For example, setting nPerLC = 2 means a light curve is only considered detected if there is at least 1 observation in the first half of the LC, and at least one in the second half of the LC. nPerLC = 4 means each quarter of the light curve must be detected to count. Default 1.

  • nFilters (int, optional) – Number of filters that need to be observed for an object to be counted as detected. Default 1.

  • nPhaseCheck (int, optional) – Sets the number of phases that should be checked. One can imagine pathological cadences where many objects pass the detection criteria, but would not if the observations were offset by a phase-shift. Default 1.

  • countMethod ({'full' 'partialLC'}, defaults to 'full') – Sets the method of counting max number of transients. if ‘full’, the only full light curves that fit the survey duration are counted. If ‘partialLC’, then the max number of possible transients is taken to be the integer floor

lightCurve(time, filters)[source]

Calculate the magnitude of the object at each time, in each filter.

Parameters
  • time (numpy.ndarray) – The times of the observations.

  • filters (numpy.ndarray) – The filters of the observations.

Returns

The magnitudes of the object at each time, in each filter.

Return type

numpy.ndarray

run(dataSlice, slicePoint=None)[source]

” Calculate the detectability of a transient with the specified lightcurve.

Parameters
  • dataSlice (numpy.array) – Numpy structured array containing the data related to the visits provided by the slicer.

  • slicePoint (dict, optional) – Dictionary containing information about the slicepoint currently active in the slicer.

Returns

The total number of transients that could be detected.

Return type

float

lsst.sims.maf.metrics.vectorMetrics module

class lsst.sims.maf.metrics.vectorMetrics.AccumulateCountMetric(col='night', bins=None, binCol='night', function=<ufunc 'add'>, metricDtype=<class 'float'>, **kwargs)[source]

Bases: lsst.sims.maf.metrics.vectorMetrics.AccumulateMetric

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.vectorMetrics.AccumulateM5Metric(bins=None, binCol='night', m5Col='fiveSigmaDepth', metricName='AccumulateM5Metric', **kwargs)[source]

Bases: lsst.sims.maf.metrics.vectorMetrics.AccumulateMetric

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.vectorMetrics.AccumulateMetric(col='night', bins=None, binCol='night', function=<ufunc 'add'>, metricDtype=<class 'float'>, **kwargs)[source]

Bases: lsst.sims.maf.metrics.vectorMetrics.VectorMetric

Calculate the accumulated stat

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.vectorMetrics.AccumulateUniformityMetric(bins=None, binCol='night', expMJDCol='observationStartMJD', metricName='AccumulateUniformityMetric', surveyLength=10.0, units='Fraction', **kwargs)[source]

Bases: lsst.sims.maf.metrics.vectorMetrics.AccumulateMetric

Make a 2D version of UniformityMetric

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.vectorMetrics.HistogramM5Metric(bins=None, binCol='night', m5Col='fiveSigmaDepth', units='mag', metricName='HistogramM5Metric', **kwargs)[source]

Bases: lsst.sims.maf.metrics.vectorMetrics.HistogramMetric

Calculate the coadded depth for each bin (e.g., per night).

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.vectorMetrics.HistogramMetric(bins=None, binCol='night', col='night', units='Count', statistic='count', metricDtype=<class 'float'>, **kwargs)[source]

Bases: lsst.sims.maf.metrics.vectorMetrics.VectorMetric

A wrapper to stats.binned_statistic

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

lsst.sims.maf.metrics.visitGroupsMetric module

class lsst.sims.maf.metrics.visitGroupsMetric.PairFractionMetric(mjdCol='observationStartMJD', metricName='PairFraction', minGap=15.0, maxGap=90.0, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

What fraction of observations are part of a pair.

Note, an observation can be a member of more than one “pair”. For example, t=[0, 5, 30], all observations would be considered part of a pair because they all have an observation within the given window to pair with (the observation at t=30 pairs twice).

Parameters
  • minGap (float, opt) – Minimum time to consider something part of a pair (minutes). Default 15.

  • maxGap (float, opt) – Maximum time to consider something part of a pair (minutes). Default 90.

run(dataSlice, slicePoint=None)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.visitGroupsMetric.VisitGroupsMetric(timeCol='observationStartMJD', nightsCol='night', metricName='VisitGroups', deltaTmin=0.010416666666666666, deltaTmax=0.0625, minNVisits=2, window=30, minNNights=3, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Count the number of visits per night within deltaTmin and deltaTmax.

reduceMaxSeqLunations(metricval)[source]

Count the max number of sequential lunations (unique 30 day windows) that contain at least one ‘group’: a set of more than minNVisits per night, with more than minNNights of visits within ‘window’ time period.

reduceMedian(metricval)[source]

Reduce to median number of visits per night.

reduceNLunations(metricval)[source]

Reduce to number of lunations (unique 30 day windows) that contain at least one ‘group’: a set of more than minNVisits per night, with more than minNNights of visits within ‘window’ time period.

reduceNNightsInWindow(metricval)[source]

Reduce to max number of nights with more than minNVisits, within ‘window’ over all windows.

reduceNNightsWithNVisits(metricval)[source]

Reduce to total number of nights with more than ‘minNVisits’ visits.

reduceNVisitsInWindow(metricval)[source]

Reduce to max number of total visits on all nights with more than minNVisits, within any ‘window’ (default=30 nights).

run(dataSlice, slicePoint=None)[source]

Return a dictionary of: the number of visits within a night (within delta tmin/tmax of another visit), and the nights with visits > minNVisits. Count two visits which are within tmin of each other, but which have another visit within tmin/tmax interval, as one and a half (instead of two).

So for example: 4 visits, where 1, 2, 3 were all within deltaTMax of each other, and 4 was later but within deltaTmax of visit 3 – would give you 4 visits. If visit 1 and 2 were closer together than deltaTmin, the two would be counted as 1.5 visits together (if only 1 and 2 existed, then there would be 0 visits as none would be within the qualifying time interval).

lsst.sims.maf.metrics.weakLensingSystematicsMetric module

class lsst.sims.maf.metrics.weakLensingSystematicsMetric.ExgalM5_with_cuts(m5Col='fiveSigmaDepth', filterCol='filter', metricName='ExgalM5_with_cuts', units='mag', lsstFilter='i', wavelen_min=None, wavelen_max=None, extinction_cut=0.2, depth_cut=25.9, nFilters=6, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

Calculate co-added five-sigma limiting depth, but apply dust extinction and depth cuts. This means that places on the sky that don’t meet the dust extinction, coadded depth, or filter coverage cuts will have masked values on those places.

This metric is useful for DESC static science and weak lensing metrics. In particular, it is required as input for the StaticProbesFoMEmulatorMetricSimple (a summary metric to emulate a 3x2pt FOM).

Note: this metric calculates the depth after dust extinction in band ‘lsstFilter’, but because it looks for coverage in all bands, there should generally be no filter-constraint on the sql query.

run(dataSlice, slicePoint)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

class lsst.sims.maf.metrics.weakLensingSystematicsMetric.WeakLensingNvisits(m5Col='fiveSigmaDepth', expTimeCol='visitExposureTime', lsstFilter='i', filterCol='filter', depthlim=24.5, ebvlim=0.2, min_expTime=15, **kwargs)[source]

Bases: lsst.sims.maf.metrics.baseMetric.BaseMetric

A proxy metric for WL systematics. Higher values indicate better systematics mitigation.

Weak Lensing systematics metric : Computes the average number of visits per point on a HEALPix grid after a maximum E(B-V) cut and a minimum co-added depth cut. Intended to be used with a single filter.

run(dataSlice, slicePoint)[source]

Calculate metric values.

Parameters
  • dataSlice (numpy.NDarray) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slicePoint.

  • slicePoint (Dict) – Dictionary of slicePoint metadata passed to each metric. E.g. the ra/dec of the healpix pixel or opsim fieldId.

Returns

The metric value at each slicePoint.

Return type

int, float or object

Module contents