class rubin_sim.maf.metrics.TransientMetric(metric_name='TransientDetectMetric', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', trans_duration=10.0, peak_time=5.0, rise_slope=0.0, decline_slope=0.0, survey_duration=10.0, survey_start=None, detect_m5_plus=0.0, u_peak=20, g_peak=20, r_peak=20, i_peak=20, z_peak=20, y_peak=20, n_pre_peak=0, n_per_lc=1, n_filters=1, n_phase_check=1, count_method='full', **kwargs)

Bases: 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.

trans_durationfloat, optional

How long the transient lasts (days). Default 10.

peak_timefloat, optional

How long it takes to reach the peak magnitude (days). Default 5.

rise_slopefloat, 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.

decline_slopefloat, optional

Slope of the light curve after peak time (mags/day). This should be positive since mags are backwards. Default 0.

uPeakfloat, optional

Peak magnitude in u band. Default 20.

gPeakfloat, optional

Peak magnitude in g band. Default 20.

rPeakfloat, optional

Peak magnitude in r band. Default 20.

iPeakfloat, optional

Peak magnitude in i band. Default 20.

zPeakfloat, optional

Peak magnitude in z band. Default 20.

yPeakfloat, optional

Peak magnitude in y band. Default 20.

survey_durationfloat, optional

Length of survey (years). Default 10.

survey_startfloat, optional

MJD for the survey start date. Default None (uses the time of the first observation).

detect_m5_plusfloat, optional

An observation will be used if the light curve magnitude is brighter than m5+detect_m5_plus. Default 0.

n_pre_peakint, optional

Number of observations (in any filter(s)) to demand before peak_time, before saying a transient has been detected. Default 0.

n_per_lcint, optional

Number of sections of the light curve that must be sampled above the detect_m5_plus theshold (in a single filter) for the light curve to be counted. For example, setting n_per_lc = 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. n_per_lc = 4 means each quarter of the light curve must be detected to count. Default 1.

n_filtersint, optional

Number of filters that need to be observed for an object to be counted as detected. Default 1.

n_phase_checkint, 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.

count_method{‘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

Methods Summary

light_curve(time, filters)

Calculate the magnitude of the object at each time, in each filter.

run(data_slice[, slice_point])


Methods Documentation

light_curve(time, filters)

Calculate the magnitude of the object at each time, in each filter.


The times of the observations.


The filters of the observations.


The magnitudes of the object at each time, in each filter.

run(data_slice, slice_point=None)

” Calculate the detectability of a transient with the specified lightcurve.


Numpy structured array containing the data related to the visits provided by the slicer.

slice_pointdict, optional

Dictionary containing information about the slice_point currently active in the slicer.


The total number of transients that could be detected.