Maf Contrib

class rubin_sim.maf.maf_contrib.DepthLimitedNumGalMetric(m5_col='fiveSigmaDepth', filter_col='filter', nside=128, filter_band='i', redshift_bin='all', nfilters_needed=6, lim_mag_i_ptsrc=26.0, lim_ebv=0.2, metric_name='DepthLimitedNumGalaxiesMetric', units='Galaxy Counts', **kwargs)[source]

Bases: BaseMetric

This metric calculates the number of galaxies while accounting for the extragalactic footprint.

Parameters:
  • m5_col (str, optional) – Name of column for depth in the data. Default: ‘fiveSigmaDepth’

  • filter_col (str, optional) – Name of column for filter in the data. Default: ‘filter’

  • maps (list [str], optional) – List of map names. Default: [‘DustMap’]

  • nside (int, optional) – HEALpix resolution parameter. Default: 256. This should match slicer nside.

  • filter_band (str, optional) – Filter to use to calculate galaxy counts. Any one of ‘u’, ‘g’, ‘r’, ‘i’, ‘z’, ‘y’. Default: ‘i’

  • redshiftBin (str, optional) – options include ‘0.<z<0.15’, ‘0.15<z<0.37’, ‘0.37<z<0.66, ‘0.66<z<1.0’, ‘1.0<z<1.5’, ‘1.5<z<2.0’, ‘2.0<z<2.5’, ‘2.5<z<3.0’,’3.0<z<3.5’, ‘3.5<z<4.0’, ‘all’ for no redshift restriction (so consider 0.<z<4.0) Default: ‘all’

  • nfilters_needed (int, optional) – Number of filters in which to require coverage. Default: 6

  • lim_mag_i_ptsrc (float, optional) – Point-source limiting mag for the i-band coadded dust-corrected depth. Default: 26.0

  • lim_ebv (float, optional) – Limiting EBV value. Default: 0.2

Returns:

ngal – Number of galaxies in healpix if the slice_point passes the extragalactic cuts; otherwise self.badval

Return type:

float

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.FilterPairTGapsMetric(mjd_col='observationStartMJD', filter_col='filter', m5_col='fiveSigmaDepth', fltpairs=['uu', 'ug', 'ur', 'ui', 'uz', 'uy', 'gg', 'gr', 'gi', 'gz', 'gy', 'rr', 'ri', 'rz', 'ry', 'ii', 'iz', 'iy', 'zz', 'zy', 'yy'], mag_lim={'g': 18, 'i': 18, 'r': 18, 'u': 18, 'y': 18, 'z': 18}, bins_same=array([5.78703704e-05, 8.34904113e-05, 1.20452811e-04, 1.73778994e-04, 2.50713441e-04, 3.61707868e-04, 5.21841117e-04, 7.52867645e-04, 1.08617292e-03, 1.56703722e-03, 2.26078702e-03, 3.26166977e-03, 4.70565765e-03, 6.78891962e-03, 9.79447147e-03, 1.41306241e-02, 2.03864536e-02, 2.94118283e-02, 4.24328655e-02, 6.12185022e-02, 8.83208090e-02, 1.27421695e-01, 1.83833102e-01, 2.65218647e-01, 3.82634736e-01, 5.52032609e-01, 7.96425343e-01, 1.14901424e+00, 1.65769928e+00, 2.39158647e+00, 3.45037602e+00, 4.97790685e+00, 7.18169744e+00, 1.03611376e+01, 1.49481615e+01, 2.15659265e+01, 3.11134707e+01, 4.48878494e+01, 6.47603426e+01, 9.34306728e+01, 1.34793768e+02, 1.94468898e+02, 2.80563062e+02, 4.04772344e+02, 5.83970852e+02, 8.42503103e+02, 1.21549128e+03, 1.75360666e+03, 2.52995342e+03, 3.65000000e+03]), bins_diff=array([5.78703704e-05, 7.16275696e-05, 8.86551909e-05, 1.09730693e-04, 1.35816357e-04, 1.68103219e-04, 2.08065457e-04, 2.57527693e-04, 3.18748311e-04, 3.94522563e-04, 4.88310204e-04, 6.04393456e-04, 7.48072529e-04, 9.25907625e-04, 1.14601846e-03, 1.41845502e-03, 1.75565639e-03, 2.17301876e-03, 2.68959835e-03, 3.32898151e-03, 4.12036166e-03, 5.09987217e-03, 6.31223624e-03, 7.81280884e-03, 9.67010416e-03, 1.19689239e-02, 1.48142292e-02, 1.83359330e-02, 2.26948317e-02, 2.80899471e-02, 3.47676130e-02, 4.30327230e-02, 5.32626514e-02, 6.59244835e-02, 8.15963420e-02, 1.00993784e-01, 1.25002471e-01, 1.54718608e-01, 1.91498997e-01, 2.37022982e-01, 2.93369129e-01, 3.63110131e-01, 4.49430270e-01, 5.56270813e-01, 6.88509960e-01, 8.52185579e-01, 1.05477089e+00, 1.30551567e+00, 1.61586860e+00, 2.00000000e+00]), nv_clip={'gg': 69, 'gi': 30, 'gr': 30, 'gy': 30, 'gz': 30, 'ii': 355, 'iy': 30, 'iz': 30, 'ri': 30, 'rr': 344, 'ry': 30, 'rz': 30, 'ug': 30, 'ui': 30, 'ur': 30, 'uu': 30, 'uy': 30, 'uz': 30, 'yy': 288, 'zy': 30, 'zz': 282}, allgaps=True, **kwargs)[source]

Bases: BaseMetric

Figure of merit to measure the coverage the time gaps in same and different filter pairs;

FoM is defined as sum of Nv / standard deviation after a clip;

Parameters:
  • fltpairs (list [str], optional) – List of filter pair sets to search for.

  • mag_lim (list [float]) – FiveSigmaDepth threshold each filter, default {‘u’:18, ‘g’:18, ‘r’:18, ‘i’:18, ‘z’:18, ‘y’:18}

  • bins_same (np.ndarray, (N,)) – Bins to get histogram for same-filter pair.

  • bins_diff (np.ndarray, (N,)) – Bins to get histogram for diff-filter pair.

  • nv_clip (int, optional) – Number of visits of pairs to clip, std is calculated below nv_clip.

  • allgaps (bool`, optional) – All possible pairs if True, else consider only nearest

Returns:

result – sum of fom for all filterpairs,

Return type:

float

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.GRBTransientMetric(alpha=1, apparent_mag_1min_mean=15.35, apparent_mag_1min_sigma=1.59, metric_name='GRBTransientMetric', mjd_col='expMJD', m5_col='fiveSigmaDepth', filter_col='filter', trans_duration=10.0, survey_duration=10.0, survey_start=None, detect_m5_plus=0.0, n_per_filter=1, n_filters=1, min_delta_mag=0.0, n_phase_check=1, **kwargs)[source]

Bases: BaseMetric

Evaluate the likelihood of detecting a GRB optical counterpart.

Detections for an on-axis GRB afterglows decaying as F(t) = F(1min)((t-t0)/1min)^-alpha. No jet break, for now.

Derived from TransientMetric, but calculated with reduce functions to enable-band specific counts. Burst parameters taken from 2011PASP..123.1034J.

Simplifications: * no color variation or evolution encoded yet. * no jet breaks. * not treating off-axis events.

Parameters:
  • alpha (float,) – temporal decay index Default = 1.0

  • apparent_mag_1min_mean (float,) – mean magnitude at 1 minute after burst Default = 15.35

  • apparent_mag_1min_sigma (float,) – std of magnitudes at 1 minute after burst Default = 1.59

  • trans_duration (float, optional) – How long the transient lasts (days). Default 10.

  • survey_duration (float, optional) – Length of survey (years). Default 10.

  • survey_start (float, optional) – MJD for the survey start date. Default None (uses the time of the first observation).

  • detect_m5_plus (float, optional) – An observation will be used if the light curve magnitude is brighter than m5+detect_m5_plus. Default 0.

  • n_per_filter (int, optional) – Number of separate detections of the light curve above the detect_m5_plus theshold (in a single filter) for the light curve to be counted. Default 1.

  • n_filters (int, optional) – Number of filters that need to be observed n_per_filter times, with differences min_delta_mag, for an object to be counted as detected. Default 1.

  • min_delta_mag (float, optional) – magnitude difference between detections in the same filter required for second+ detection to be counted. For example, if min_delta_mag = 0.1 mag and two consecutive observations differ only by 0.05 mag, those two detections will only count as one. (Better would be a SNR-based discrimination of lightcurve change.) Default 0.

  • n_phase_check (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.

light_curve(time, filters)[source]

given the times and filters of an observation, return the magnitudes.

reduce_band1_filt_avg(bandfraction)[source]

Average fraction detected in single filter

reduce_bandany_nfilters(bandfraction)[source]

Fraction of events detected in Nfilters or more

run(data_slice, slice_point=None)[source]

Calculate the detectability of a transient with the specified lightcurve.

class rubin_sim.maf.maf_contrib.GW170817DetMetric(ascii_file=PosixPath('/home/runner/miniconda3/envs/test/lib/python3.11/site-packages/rubin_sim/maf/data/DECAMGemini_SED.txt'), metric_name='GW170817DetMetric', z=0.08, num_filters=2, filter_time=25.0, num_phases_to_run=5, **kwargs)[source]

Bases: TransientAsciiSEDMetric

Wrapper metric class for GW170817-like kilonovae based on the TransientAsciiSEDMetric. Defaults are set to those corresponding to similar detection criteria used in Scolnic et al. 2018 and Setzer et al. 2019. However, due to the simplified nature of transient distribution for computing this metric, the criteria have been altered to only include criteria two and three. The chosen redshift is at the approximate mean redshift of the detected cosmological redshift distribution shown in Setzer et al. 2019.

Parameters:
  • ascii_file (str, optional) – The ascii file containing the inputs for the SED. The file must contain three columns - [‘phase’, ‘wave’, ‘flux’] - of phase/epoch (in days), wavelength (Angstroms), and flux (ergs/s/Angstrom). Default, data provided with sims_maf_contrib.

  • metric_name (str, optional) – Name of the metric, can be overwritten by user or child metric.

  • z (float, optional) – Cosmological redshift at which to consider observations of the tranisent SED. Default 0.08.

  • num_filters (int, optional) – Number of filters that need to be observed for an object to be counted as detected. Default 2. (if num_per_lightcurve is 0, then this will be reset to 0).

  • filter_time (float, optional) – The time within which observations in at least num_filters are required (in days). Default 25.0 days.

  • num_phases_to_run (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 5.

class rubin_sim.maf.maf_contrib.GalaxyCountsMetric(m5_col='fiveSigmaDepth', nside=128, metric_name='GalaxyCounts', **kwargs)[source]

Bases: BaseMetric

Estimate the number of galaxies expected at a particular (extragalactic) coadded depth.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.GalaxyCountsMetricExtended(m5_col='fiveSigmaDepth', filter_col='filter', nside=128, metric_name='GalaxyCountsMetricExtended', units='Galaxy Counts', upper_mag_limit=32.0, include_dust_extinction=True, filter_band='i', redshift_bin='all', cfht_ls_counts=False, normalized_mock_catalog_counts=True, **kwargs)[source]

Bases: BaseMetric

Estimate galaxy counts per HEALpix pixel.

Accommodates for dust extinction, magnitude cuts, and specification of the galaxy LF to specific redshift bin to consider. Dependency (aside from MAF): constantsForPipeline.py

Parameters:
  • m5_col (str) – name of column for depth in the data. Default: ‘fiveSigmaDepth’

  • nside (int, opt) – HEALpix resolution parameter. Default: 128

  • upper_mag_limit (float) – upper limit on magnitude when calculating the galaxy counts. Default: 32.0

  • include_dust_extinction (bool) – set to False if do not want to include dust extinction. Default: True

  • filter_band (str, opt) – any one of ‘u’, ‘g’, ‘r’, ‘i’, ‘z’, ‘y’. Default: ‘i’

  • redshift_bin (str, opt) – options include ‘0.<z<0.15’, ‘0.15<z<0.37’, ‘0.37<z<0.66, ‘0.66<z<1.0’, ‘1.0<z<1.5’, ‘1.5<z<2.0’, ‘2.0<z<2.5’, ‘2.5<z<3.0’,’3.0<z<3.5’, ‘3.5<z<4.0’, ‘all’ for no redshift restriction (i.e. 0.<z<4.0) Default: ‘all’

  • cfht_ls_counts (bool, opt) – set to True if want to calculate the total galaxy counts from CFHTLS powerlaw from LSST Science Book. Must be run with redshift_bin= ‘all’ Default: False

  • normalized_mock_catalog_counts (bool, opt) – set to False if want the raw/un-normalized galaxy counts from mock catalogs. Default: True

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.KNePopMetric(metric_name='KNePopMetric', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', night_col='night', pts_needed=2, file_list=None, mjd0=60796.0, output_lc=False, badval=-666, **kwargs)[source]

Bases: BaseMetric

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.KnLc(file_list=None)[source]

Bases: object

Read in some KNe lightcurves

Parameters:

file_list (list [str] or None) – List of file paths to load. If None, loads up all the files from data/bns/

interp(t, filtername, lc_indx=0)[source]

Do the interpolation of the lightcurve for a given time and filter.

Parameters:
  • t (np.ndarray, (N,)) – The times to interpolate the light curve to.

  • filtername (str) – The filter. one of ugrizy

  • lc_index (int, optional) – Which file to use.

Returns:

result – Array of lightcurve brightnesses at the times of t.=

Return type:

np.ndarray, (N,)

class rubin_sim.maf.maf_contrib.LVDwarfsMetric(radius=2.45, distlim=None, cmd_frac=0.1, stargal_contamination=0.4, nsigma=10.0, metric_name='LVDwarfs', seed=505, **kwargs)[source]

Bases: BaseMetric

Estimate the detection limit in total dwarf luminosity for resolved dwarf galaxies at a given distance.

This metric class uses simulated luminosity functions of dwarf galaxies with known (assumed) luminosities to estimate the detection limit (in total dwarf luminosity, M_V) for resolved dwarf galaxies at a given distance. It can be applied to either known galaxies with their discrete positions and distances, or an entire survey simulation with a fixed distance limit.

In the default use (with the KnownLvDwarfsSlicer), it returns detection limits for a catalog of known local volume dwarfs, from the Karachentsev+ catalog of nearby galaxies.

Parameters:
  • radius (float) – Radius of the field being considered (for discrete fields only). By default, UserPointSlicer uses a 2.45-deg field radius.

  • distlim (float) – Distance threshold in Mpc for which to calculate the limiting dwarf detection luminosity. Only needed for healpix slicers, but required if healpix is used.

  • cmd_frac (float) – Fraction of the total area of the color-magnitude diagram that is spanned by the tracer selection criteria. (e.g., the size of a box in color and magnitude to select RGB-star candidates)

  • stargal_contamination (float) – Fraction of objects in CMD selection region that are actually unresolved galaxies that were mis-classified as stars.

  • nsigma (float) – Required detection significance to declare a simulated dwarf “detected.”

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.MicrolensingMetric(metric_name='MicrolensingMetric', metric_calc='detect', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', night_col='night', pts_needed=2, mag_dict=None, detect_sigma=3.0, time_before_peak=0, detect=False, **kwargs)[source]

Bases: BaseMetric

Quantifies detectability of Microlensing events. Can also return the number of datapoints within two crossing times of the peak of event.

Parameters:
  • metric_calc (str) – Type of metric. If metric_calc == ‘detect’, returns the number of microlensing events detected within certain parameters. If metric_calc == ‘Npts’, returns the number of points within two crossing times of the peak of the vent.

  • pts_needed (int) – Number of an object’s lightcurve points required to be above the 5-sigma limiting depth before it is considered detected.

  • time_before_peak (int or str) – Number of days before lightcurve peak to qualify event as triggered. If time_before_peak == ‘optimal’, the number of days before the lightcurve peak is the time of maximal information.

  • detect (bool) – By default we trigger which only looks at points before the peak of the lightcurve. When detect = True, observations on either side of the lightcurve are considered.

Notes

Expects slice_point to have keys of:

peak_time : float (days) crossing_time : float (days) impact_parameter : float (positive) blending_factors (optional): float (between 0 and 1)

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.NYoungStarsMetric(metric_name='young_stars', m5_col='fiveSigmaDepth', filter_col='filter', seeing_col='seeingFwhmGeom', mags={'g': 10.32, 'i': 7.97, 'r': 9.28}, snrs={'g': 5.0, 'i': 5.0, 'r': 5.0}, galb_limit=90.0, badval=0, return_distance=False, crowding_error=0.25, use_2D_extinction=False, **kwargs)[source]

Bases: BaseMetric

Calculate the distance or number of stars with color uncertainty defined by mags/snrs.

Parameters:
  • metric_name (str, opt) – Default ‘young_stars’.

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

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

  • mags (dict, opt) – The absolute magnitude of the object in question. Keys of filter name, values in mags. Default is for a 0.3 solar mass star at age = 100 Myr.

  • snrs (dict, opt) – The SNR to demand for each filter.

  • galb_limit (float, opt) – The galactic latitude above which to return zero (degrees). Default 90.

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

  • return_distance (bool, opt) – Whether the metric will return the maximum distance that can be reached for each slice_point, or the total number of stars down to mags/snrs.

  • crowding_error (float, opt) – Crowding error that gets passed to CrowdingM5Metric. Default 0.25.

  • use_2D_extinction (bool, opt) – Uses the 2D extinction map instead of the 3D one. Default False.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.OrderedDict[source]

Bases: dict

Dictionary that remembers insertion order

clear() None.  Remove all items from od.
copy() a shallow copy of od
fromkeys(value=None)

Create a new ordered dictionary with keys from iterable and values set to value.

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
move_to_end(key, last=True)

Move an existing element to the end (or beginning if last is false).

Raise KeyError if the element does not exist.

pop(key[, default]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem(last=True)

Remove and return a (key, value) pair from the dictionary.

Pairs are returned in LIFO order if last is true or FIFO order if false.

setdefault(key, default=None)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values
class rubin_sim.maf.maf_contrib.PeriodicMetric(time_col='expMJD', **kwargs)[source]

Bases: BaseMetric

From a set of observation times, uses code provided by Robert Siverd (LCOGT) to calculate the spectral window function.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.PeriodicStarMetric(metric_name='PeriodicStarMetric', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', period=10.0, amplitude=0.5, phase=2.0, n_monte=1000, period_tol=0.05, amp_tol=0.1, means=[20.0, 20.0, 20.0, 20.0, 20.0, 20.0], mag_tol=0.1, n_bands=3, seed=42, **kwargs)[source]

Bases: BaseMetric

At each slice_point, run a Monte Carlo simulation to see how well a periodic source can be fit. Assumes a simple sin-wave light-curve, and generates Gaussain noise based in the 5-sigma limiting depth of each observation.

Parameters:
  • period (float) – The period to check, in days.

  • amplitude (float) – The amplitude of the sinusoidal light curve, in mags.

  • phase (float) – The phase of the lightcurve at the time of the first observation.

  • n_monte (int) – The number of noise realizations to make in the Monte Carlo.

  • period_tol (float) – The fractional tolerance on the period to require in order for a star to be considered well-fit

  • amp_tol (float) – The fractional tolerance on the amplitude.

  • means (list [float]) – The mean magnitudes in ugrizy of the star.

  • mag_tol (float) – The mean magnitude tolerance, in magnitudes, for the star to be considered well-fit.

  • n_bands (int) – Number of bands that must be within mag_tol.

  • seed (int) – Random number seed for the noise realizations.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.PeriodicStarModulationMetric(metric_name='PeriodicStarModulationMetric', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', period=10.0, amplitude=0.5, phase=2.0, random_phase=False, time_interval=50, n_monte=1000, period_tol=0.05, amp_tol=0.1, means=[20.0, 20.0, 20.0, 20.0, 20.0, 20.0], mag_tol=0.1, n_bands=3, seed=42, **kwargs)[source]

Bases: BaseMetric

Evaluate how well a periodic source can be fit on a short baseline, using a Monte Carlo simulation.

At each slice_point, run a Monte Carlo simulation to see how well a periodic source can be fit. Assumes a simple sin-wave light-curve, and generates Gaussain noise based in the 5-sigma limiting depth of each observation. Light curves are evaluated piecewise to test how well we can recover the period, phase and amplitude from shorter baselines. We allow for a random phase offset to mimic observation starting at random phase. Also, we vary the periods and amplitudes within +/- 10 % to allow for a more realistic sample of variable stars.

Parameters:
  • period (float, opt) – days (default 10)

  • amplitude (float, opt) – mags (default 0.5)

  • phase (float, opt) – days (default 2.)

  • random_phase (bool, opt) – a random phase is assigned (default False)

  • time_interval (float, opt) – days (default 50); the interval over which we want to evaluate the light curve

  • n_monte (int, opt) – number of noise realizations to make in the Monte Carlo (default 1000)

  • period_tol (float, opt) – fractional tolerance on the period to demand for a star to be considered well-fit (default 0.05)

  • amp_tol (float, opt) – fractional tolerance on the amplitude to demand (default 0.10)

  • means (list of float, opt) – mean magnitudes for ugrizy (default all 20)

  • mag_tol (float, opt) – Mean magnitude tolerance (mags) (default 0.1)

  • n_bands (int, opt) – Number of bands that must be within mag_tol (default 3)

  • seed (int, opt) – random number seed (default 42)

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.PhotometricSelfCalUniformityMetric(nside_residual=128, highglat_cut=30.0, outlier_nsig=4.0, metric_name='PhotometricSelfCalUniformityMetric', filter_name='r')[source]

Bases: BaseMetric

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.PrestoColorKNePopMetric(metric_name='KNePopMetric', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', night_col='night', pts_needed=2, file_list=None, mjd0=60796.0, output_lc=False, skyregion='galactic', thr=0.003, **kwargs)[source]

Bases: BaseMetric

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.StarCountMassMetric(m1=0.9, m2=1.0, band='i', **kwargs)[source]

Bases: BaseMetric

Find the number of stars in a given field in the mass range fainter than magnitude 16 and bright enough to have noise less than 0.03 in a given band. M1 and m2 are the upper and lower limits of the mass range. ‘band’ is the band to be observed.

This metric uses the stellar distance and luminosity equations contributed by Mike Lund, which are based on the Galfast model. There are some imposed limitations on the expected magnitudes of the stars included for the metric, based on assuming saturation at 16th magnitude and not considering stars with magnitude uncertainties greater than 0.03 (based on photometry/m5 alone).

Parameters:
  • m1 (float) – Lower limit of the mass range.

  • m2 (float) – Upper limit of the mass range.

  • band (str) – Bandpass to consider.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.StarCountMetric(d1=100, d2=1000, **kwargs)[source]

Bases: BaseMetric

Find the number of stars in a given field between d1 and d2 in parsecs.

This metric uses the stellar distance and luminosity equations contributed by Mike Lund, which are based on the Galfast model. There are some imposed limitations on the expected magnitudes of the stars included for the metric, based on assuming saturation at 16th magnitude and not considering stars with magnitude uncertainties greater than 0.03 (based on photometry/m5 alone).

Parameters:
  • d1 (float) – d1 in parsecs

  • d2 (float) – d2 in parsecs

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.StaticProbesFoMEmulatorMetric(nside=128, shear_m=0.003, sigma_z=0.05, sig_delta_z=0.001, sig_sigma_z=0.003, col=None, **kwargs)[source]

Bases: BaseMetric

This calculates the Figure of Merit for the combined static probes (3x2pt, i.e., Weak Lensing, LSS, Clustering).

This metric should be run as a summary metric on ExgalM5_with_cuts. This FoM takes into account the effects of the following systematics: - multiplicative shear bias - intrinsic alignments - galaxy bias - baryonic physics effects - photometric redshift uncertainties Default values for these systematics are provided

The Emulator is uses a Gaussian Process to effectively interpolate between a grid of FoM values.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.TdeLc(file_list=None)[source]

Bases: object

Read in some TDE lightcurves

Parameters:

file_list (list [str], opt) – List of file paths to load. If None, loads up all the files from $RUBIN_SIM_DATA/maf/tde/

interp(t, filtername, lc_indx=0)[source]
tarray of floats

The times to interpolate the light curve to.

filternamestr

The filter. one of ugrizy

lc_index : int (0)   Which file to use.

class rubin_sim.maf.maf_contrib.TdePopMetric(metric_name='TDEsPopMetric', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', night_col='night', pts_needed=2, file_list=None, mjd0=60796.0, **kwargs)[source]

Bases: BaseMetric

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.TdePopMetricQuality(metric_name='TDEsPopMetricQuality', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', night_col='night', tmin=-30, tmax=100, file_list=None, mjd0=60796.0, **kwargs)[source]

Bases: BaseMetric

Evaluate the likelihood of detecting a specific TDE. Works with the TDEPopSlicer, which adds TDE events to the slice_points.

Returns 0 (not detected) or 1 (detected) for TDEs with various detection criteria. ‘some_color’ requires 1 detection pre-peak, 3 detections in different filters within 10 days of the peak, and 2 detections in different bands within tmax post-peak. Averages 1 detection every other night. ‘some_color_pu’ has similar requirements, but constrains one of the near-peak detections to be in u band and 1 of the post-peak detections to be in u band.

Parameters:
  • tmin (float, opt) – Minimum time for first detection (days)

  • tmax (float, opt) – Maximum time in the lightcurve for detection (days).

  • file_list (list [str], opt) – The names of the TDE lightcurve data files.

  • mjd0 (float, opt) – The start of the survey.

run(data_slice, slice_point)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.TripletBandMetric(time_col='expMJD', filter_col='filter', **kwargs)[source]

Bases: BaseMetric

Find the number of ‘triplets’ of three images taken in the same band, based on user-selected minimum and maximum intervals (in hours), as well as constraining the ratio of the two exposures intervals. Triplets are not required to be consecutive observations and may be overlapping.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.TripletMetric(time_col='expMJD', **kwargs)[source]

Bases: BaseMetric

Find the number of ‘triplets’ of three images taken in any band, based on user-selected minimum and maximum intervals (in hours), as well as constraining the ratio of the two exposures intervals. Triplets are not required to be consecutive observations and may be overlapping.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.VarDepth(m5_col='fiveSigmaDepth', metric_name='variability depth', completeness=0.95, contamination=0.05, numruns=10000, signal=0.01, magres=0.01, **kwargs)[source]

Bases: BaseMetric

Calculate the survey depth that a variable star can be reliably identified.

Parameters:
  • completeness (float, opt) – Fractional desired completeness of recovered variable sample.

  • contamination (float, opt) – Fractional allowed incompleteness of recovered nonvariables.

  • numruns (int, opt) – Number of simulated realizations of noise. Most computationally expensive part of metric.

  • signal (float, opt) – Sqrt total pulsational power meant to be recovered.

  • magres (float, opt) – desired resolution of variability depth result.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.XRBPopMetric(metric_name='XRBPopMetric', mjd_col='observationStartMJD', m5_col='fiveSigmaDepth', filter_col='filter', night_col='night', pts_needed=2, pts_early=2, t_early=7, mjd0=60796.0, output_lc=False, badval=-666, **kwargs)[source]

Bases: BaseMetric

Evaluate whether a given XRB would be detectable.

Includes a variety of detection criteria options, including if the XRB is possible to detect, if it is detected at least pts_needed times, or if it is detected pts_early times within t_early days of the start of the outburst.

Parameters:
  • pts_needed (int, opt) – Minimum number of detections, for simple detected option.

  • mjd0 (float, opt) – Start of survey.

  • output_lc (bool, opt) – If True, output lightcurve points. If False, just return metric values.

run(data_slice, slice_point=None)[source]

Calculate metric values.

Parameters:
  • data_slice (numpy.ndarray, (N,)) – Values passed to metric by the slicer, which the metric will use to calculate metric values at each slice_point.

  • slice_point (dict or None) – Dictionary of slice_point metadata passed to each metric. E.g. the ra/dec of the healpix pixel.

Returns:

metricValue – The metric value at each slice_point.

Return type:

int float or object

class rubin_sim.maf.maf_contrib.XrbLc(seed=42)[source]

Bases: object

Synthesize XRB outburst lightcurves.

detectable_duration(params, ebv, distance)[source]

Determine time range an outburst is detectable with perfect sampling.

Does not consider visibility constraints.

Parameters:
  • params (dict) – lightcurve parameters for XrbLc

  • ebv (float) – E(B-V)

  • distance (float) – distance in kpc

Returns:

  • visible_start_time (float) – first time relative to outburst start that the outburst could be detected

  • visible_end_time (float) – last time relative to outburst start that the outburst could be detected

fred(t, amplitude, tau_rise, tau_decay)[source]

Fast-rise, exponential decay function.

Amplitude is defined at the peak time = sqrt(tau_rise*tau_decay).

See e.g., Tarnopolski 2021 for discussion.

Parameters:
  • t (array [float]) – The times relative to the start of the outburst

  • amplitude (float) – Peak amplitude

  • tau_rise (float) – E-folding time for the rise

  • tau_decay (float) – E-folding time for the decay

lightcurve(t, filtername, params)[source]

Generate an XRB outburst lightcurve for given times and a single filter.

Uses a simple fast-rise, exponential decay with parameters taken from Chen, Shrader, & Livio 1997 (ApJ 491, 312).

For now we ignore the late time linear decay (Tetarenko+2018a,b, and references therein.)

Parameters:
  • t (array [float]) – The times relative to the start of the outburst

  • filtername (str) – The filter. one of ugrizy

  • params (dict) – parameters for the FRED lightcurve.

Returns:

lc – Magnitudes of the outburst at the specified times in the given filter

Return type:

array

lmxb_abs_mags(size=1)[source]

Return LMXB absolute magnitudes per LSST filter.

Absolute magnitude relation is taken from Casares 2018 (2018MNRAS.473.5195C) Colors are taken from M. Johnson+ 2019 (2019MNRAS.484…19J)

Parameters:

size (int) – Number of samples to generate.

Returns:

  • abs_mags (list [dict]) – Absolute magnitudes for each LSST filter.

  • Porbs (array [float]) – Randomized orbital periods in days

outburst_params(size=1)[source]

Return a parameters at random characterizing the outburst.

Uses distributions from Chen, Shrader, & Livio 1997 (ApJ 491, 312).

Returns:

params – Rise, decay, and amplitude parameters.

Return type:

list [dict]

rubin_sim.maf.maf_contrib.calculate_lsst_field_visibility(ra, dec, start_date, end_date, min_alt=30.0, sun_alt_limit=18.0, sample_rate=0.0007, verbose=False)[source]

Method to calculate the visibility of a given RA and Dec from LSST over the course of a year

Adapted from an example in the Astropy docs.

Parameters:
  • ra (float) – RA in decimal degrees.

  • dec (float) – Declination in decimal degrees

  • start_date (astropy.time.Time) – Start date for calculations

  • end_date (astropy.time.Time) – End date for calculations

  • min_alt (float, optional) – Minimal altitude for field

  • sun_alt_limit (float, optional) – Maximum sun altitude to consider for visibility

  • sample_rate (float, optional) – Time spacing between visibility tests (days)

  • verbose (bool, optional) – Output extra information, including debugging

rubin_sim.maf.maf_contrib.calculate_lsst_field_visibility_fast(ra, dec, start_date, end_date, min_alt=30.0, sun_alt_limit=18.0, sample_rate=0.0007)[source]

Method to calculate the visibility of a given RA and Dec from LSST over the course of a year

Skips astropy calculation of alt/az which is slow and uses approximate transform from rubin_scheduler.

Parameters:
  • ra (float) – RA in decimal degrees.

  • dec (float) – Declination in decimal degrees

  • start_date (astropy.time.Time) – Start date for calculations

  • end_date (astropy.time.Time) – End date for calculations

  • min_alt (float, optional) – Minimal altitude for field

  • sun_alt_limit (float, optional) – Maximum sun altitude to consider for visibility

  • cadence (float, optional) – Time spacing between visibility tests (days)

Returns:

  • tvisible (float) – Total time target is visible (days)

  • dates_visible (np.ndarray, (N,)) – Dates that target is above min_alt and sun is below sun_alt_limit, within start_date to end_date.

rubin_sim.maf.maf_contrib.coefficients_fsfb(t, t0, te, u0, fs, fb)[source]

Coefficients for calculating the first derivatives wrt fs,fb in the Fisher (information) matrix in an effective way, optimized with sympy and cse this function needs to be evaluated for each passband respectively. via Markus Hundertmark markus.hundertmark@uni-heidelberg.de

Parameters:
  • t (float) – The time of observation (days usually as JD or HJD)

  • u0 (float) – The impact parameter (0 means high magnification)

  • te (float) – Einstein crossing time (days)

  • t0 (float) – Time of peak (days usually as JD or HJD)

  • fs (float) – Source flux (counts/s but here fs = 10.**(-0.4*mag_source) in the respective passband)

  • fb (float) – Blend flux (counts/s but here fs = 10.**(-0.4*mag_blend) in the respective passband)

rubin_sim.maf.maf_contrib.coefficients_pspl(t, t0, te, u0, fs, fb)[source]

Coefficients for calculating the first derivatives wrt t0,te,u0 in the Fisher matrix in an effective way, optimized with sympy and cse via Markus Hundertmark markus.hundertmark@uni-heidelberg.de

Parameters:
  • t (float) – The time of observation (days usually as JD or HJD)

  • u0 (float) – The impact parameter (0 means high magnification)

  • te (float) – Einstein crossing time (days)

  • t0 (float) – Time of peak (days usually as JD or HJD)

  • fs (float) – Source flux (counts/s but here fs = 10.**(-0.4*mag_source) in the respective passband)

  • fb (float) – Blend flux (counts/s but here fs = 10.**(-0.4*mag_blend) in the respective passband)

rubin_sim.maf.maf_contrib.fisher_matrix(t, t0, te, u0, fs, fb, snr, filters='ugriz', filter_name='i')[source]

The Fisher (information) matrix relying on first derivatives wrt t0,te,u0,fs,fb, relying on with cse optimized coefficents. This implementation for the non-linear magnification is subject to the respective underlying assumptions, i.e. relatively small uncertainties. NB the Fisher matrix is using first derivatives, alternatively one could consider second derivatives the resulting covariance matrix as inverse of the Fisher matrix is a Cramer Rao lower bound of the respective uncertainty. The function returns the full information matrix for all t.

via Markus Hundertmark markus.hundertmark@uni-heidelberg.de

Parameters:
  • t (float) – The time of observation (days usually as JD or HJD)

  • u0 (float) – The impact parameter (0 means high magnification)

  • te (float) – Einstein crossing time (days)

  • t0 (float) – Time of peak (days usually as JD or HJD)

  • fs (float) – Source flux (counts/s but here fs = 10.**(-0.4*mag_source) in the respective passband)

  • fb (float) – Blend flux (counts/s but here fs = 10.**(-0.4*mag_blend) in the respective passband)

  • snr (float) – Signal to noise ratio in order to infer the flux uncertainty

rubin_sim.maf.maf_contrib.galaxy_counts_with_pixel_calibration(coaddm5, upper_mag_limit, nside=128, filter_band='i', redshift_bin='all', cfhtls_counts=False, normalized_mock_catalog_counts=True)[source]

Estimate galaxy counts for a given HEALpix pixel directly (without a slicer).

Parameters:
  • coaddm5 (float) – coadded 5sigma limiting magnitude for the pixel.

  • upper_mag_limit (float) – upper limit on the magnitude, used to calculate num_gal.

  • nside (int, opt) – HEALpix resolution parameter. Default: 128

  • filter_band (str, opt) – Any one of ‘u’, ‘g’, ‘r’, ‘i’, ‘z’, ‘y’. Default: ‘i’

  • redshift_bin (str, opt) – options include ‘0.<z<0.15’, ‘0.15<z<0.37’, ‘0.37<z<0.66, ‘0.66<z<1.0’, ‘1.0<z<1.5’, ‘1.5<z<2.0’, ‘2.0<z<2.5’, ‘2.5<z<3.0’,’3.0<z<3.5’, ‘3.5<z<4.0’, ‘all’ for no redshift restriction (i.e. 0.<z<4.0) Default: ‘all’

  • cfhtls_counts (bool, opt) – set to True if want to calculate the total galaxy counts from CFHTLS powerlaw from LSST Science Book. Must be run with redshift_bin= ‘all’ Default: False

  • normalized_mock_catalog_counts (bool, opt) – set to False if want the raw/un-normalized galaxy counts from mock catalogs. Default: True

rubin_sim.maf.maf_contrib.generate_kn_pop_slicer(t_start=1, t_end=3652, n_events=10000, seed=42, n_files=308, d_min=10, d_max=300, ra=None, dec=None)[source]

Generate a population of KNe events, and put the info about them into a UserPointSlicer object

Parameters:
  • t_start (float, optional) – The night to start kilonova events on (days)

  • t_end (float, optional) – The final night of kilonova events

  • n_events (int, optional) – The number of kilonova events to generate

  • seed (float, optional) – The seed passed to np.random

  • n_files (int, optional) – The number of different kilonova lightcurves to use This should match the length of the filenames list passed to the KNePopMetric directly.

  • d_min (float or int, optional) – Minimum luminosity distance (Mpc)

  • d_max (float or int, optional) – Maximum luminosity distance (Mpc)

  • ra (np.ndarray, (N,) or None) – The ra and dec to use for event positions. Generates uniformly on the spehere if None. (degrees)

  • dec (np.ndarray, (N,) or None) – The ra and dec to use for event positions. Generates uniformly on the spehere if None. (degrees)

rubin_sim.maf.maf_contrib.generate_known_lv_dwarf_slicer()[source]

Read the Karachentsev+ catalog of nearby galaxies, and put the info about them into a UserPointSlicer object.

rubin_sim.maf.maf_contrib.generate_microlensing_slicer(min_crossing_time=1, max_crossing_time=10, t_start=1, t_end=3652, n_events=10000, seed=42, nside=128, filtername='r')[source]

Generate a UserPointSlicer with a population of microlensing events. To be used with MicrolensingMetric

Parameters:
  • min_crossing_time (float) – The minimum crossing time for the events generated (days)

  • max_crossing_time (float) – The max crossing time for the events generated (days)

  • t_start (float) – The night to start generating peaks (days)

  • t_end (float) – The night to end generating peaks (days)

  • n_events (int) – Number of microlensing events to generate

  • seed (float) – Random number seed

  • nside (int) – HEALpix nside, used to pick which stellar density map to load

  • filtername (str) – The filter to use for the stellar density map

Returns:

slicer – A slicer populated by microlensing events (each slice_point is a different event)

Return type:

maf.UserPointsSlicer

rubin_sim.maf.maf_contrib.generate_presto_pop_slicer(skyregion='galactic', t_start=1, t_end=3652, n_events=10000, seed=42, n_files=100, d_min=10, d_max=300, gb_cut=20)[source]

Generate a population of KNe events, and put the info about them into a UserPointSlicer object

Parameters:
  • skyregion (str) – The skyregion of interest. Only two options: ‘galactic’ and ‘extragalactic’

  • t_start (float) – The night to start kilonova events on (days)

  • t_end (float) – The final night of kilonova events

  • n_events (int) – The number of kilonova events to generate

  • seed (float) – The seed passed to np.random

  • n_files (int) – The number of different kilonova lightcurves to use

  • d_min (float or int) – Minimum luminosity distance (Mpc)

  • d_max (float or int) – Maximum luminosity distance (Mpc)

Returns:

kne_slicer

Return type:

UserPointsSlicer

rubin_sim.maf.maf_contrib.generate_tde_pop_slicer(t_start=1, t_end=3652, n_events=10000, seed=42, n_files=7)[source]

Generate a population of TDE events, and put the info about them into a UserPointSlicer object.

Parameters:
  • t_start (float, opt) – The night to start tde events on (days)

  • t_end (float, opt) – The final night of TDE events

  • n_events (int, opt) – The number of TDE events to generate

  • seed (float, opt) – The seed passed to np.random

  • n_files (int, opt) – The number of different TDE lightcurves to use

rubin_sim.maf.maf_contrib.generate_xrb_pop_slicer(t_start=1, t_end=3652, n_events=10000, seed=42)[source]

Generate a population of XRB events, and put the info about them into a UserPointSlicer object.

Parameters:
  • t_start (float) – The night to start an XRB outburst on (days; default 1)

  • t_end (float) – The final night of XRBs events (days; default 3652)

  • n_events (int) – The number of XRB outbursts to generate (default 10000)

  • seed (float) – The seed passed to np.random (default 42)

rubin_sim.maf.maf_contrib.get_kne_filename(inj_params_list=None)[source]

Given kilonova parameters, get the filename from the grid of models developed by M. Bulla

Parameters:

inj_params_list (list [dict]) – parameters for the kilonova model such as mass of the dynamical ejecta (mej_dyn), mass of the disk wind ejecta (mej_wind), semi opening angle of the cylindrically-symmetric ejecta fan (‘phi’), and viewing angle (‘theta’). For example inj_params_list = [{‘mej_dyn’: 0.005, ‘mej_wind’: 0.050, ‘phi’: 30, ‘theta’: 25.8}]

rubin_sim.maf.maf_contrib.info_peak_before_t0(impact_parameter=1, crossing_time=100.0)[source]

Time of Maximum Information before peak

The point of maximum information before peak indicates when in a lightcurve with constant snr the contribution to the characterization of the event timescale tE is at maximum. After that point in timem the timescale characterization is decisively improved. via Markus Hundertmark markus.hundertmark@uni-heidelberg.de

Parameters:
  • impact_parameter (float) – The impact paramter (0 means big amplification)

  • crossing_time (float) – Einstein crossing time (days)

rubin_sim.maf.maf_contrib.make__fake_old_galaxy_lf(int_b, mu, filtername)[source]

Make a simulated luminosity function for an old (10 Gyr) dwarf galaxy of given integrated B magnitude, at a given distance modulus, in any of the filters ugrizy.

Parameters:
  • int_b (float) – Integrated B-band magnitude of the dwarf to simulate.

  • mu (float) – Distance modulus at which to place the simulated dwarf.

  • filternams (str) – Filter in which to produce the simulated luminosity function.

rubin_sim.maf.maf_contrib.make_dwarf_lf_dicts()[source]

Create dicts containing g- and i-band LFs for simulated dwarfs between -10 < M_B < +3, so they can simply be looked up rather than having to recreate them each time. Dict is keyed on M_B value.

rubin_sim.maf.maf_contrib.microlensing_amplification(t, impact_parameter=1, crossing_time=1825.0, peak_time=100, blending_factor=1)[source]

The microlensing amplification

Parameters:
  • t (float) – The time of observation (days)

  • impact_parameter (float) – The impact paramter (0 means big amplification)

  • crossing_time (float) – Einstein crossing time (days)

  • peak_time (float) – The peak time (days)

  • blending_factor (float) – The blending factor where 1 is unblended

rubin_sim.maf.maf_contrib.microlensing_amplification_fsfb(t, impact_parameter=1, crossing_time=1825.0, peak_time=100, fs=20, fb=20)[source]

The microlensing amplification in terms of source flux and blend flux

Parameters:
  • t (float) – The time of observation (days)

  • impact_parameter (float) – The impact paramter (0 means big amplification)

  • crossing_time (float) – Einstein crossing time (days)

  • peak_time (float) – The peak time (days)