Batches

rubin_sim.maf.batches.allMetadata(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None, slicer=None)[source]

Generate a large set of metrics about the metadata of each visit - distributions of airmass, normalized airmass, seeing, sky brightness, single visit depth, hour angle, distance to the moon, and solar elongation. The exact metadata which is analyzed is set by the colmap[‘metadataList’].

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Sql constraint (such as WFD only).

  • extraInfoLabel (str, optional) – Metadata to identify the sql constraint (such as WFD).

  • slicer (rubin_sim.maf.slicer.BaseSlicer or None, optional) – Optionally use something other than an nside=64 healpix slicer.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.altazHealpix(colmap=None, run_name='run name', extraSql=None, extraInfoLabel=None, metric_name='NVisits Alt/Az')[source]

Generate a set of metrics measuring the number visits as a function of alt/az plotted on a HealpixSkyMap.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • run_name (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

  • metric_name (str, optional) – Unique name to assign to metric

Returns:

metric_bundleDict

Return type:

dict of {str: maf.MetricBundle}

rubin_sim.maf.batches.altazLambert(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None, metric_name='Nvisits as function of Alt/Az')[source]

Generate a set of metrics measuring the number visits as a function of alt/az plotted on a LambertSkyMap.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

  • metric_name (str, optional) – Unique name to assign to metric

Returns:

metric_bundleDict

Return type:

dict of {str: maf.MetricBundle}

rubin_sim.maf.batches.astrometryBatch(colmap=None, run_name='opsim', extra_sql=None, extra_info=None, slicer=None)[source]

Metrics for evaluating proper motion and parallax.

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • run_name (str, optional) – The name of the simulated survey.

  • extra_sql (str or None, optional) – Additional sql constraint to apply to all metrics.

  • extra_info (str or None, optional) – Additional info_label to apply to all results.

  • slicer (rubin_sim.maf.slicer or None, optional) – Optionally, specify something other than an nside=64 healpix slicer.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.characterization_inner_batch(slicer, colmap=None, run_name='run_name', objtype='', albedo=None, h_mark=None, constraint_info_label='', constraint=None, npReduce=<function mean>, windows=None, bins=None)[source]

Characterization metrics for inner solar system objects.

rubin_sim.maf.batches.characterization_outer_batch(slicer, colmap=None, run_name='run_name', objtype='', albedo=None, h_mark=None, constraint_info_label='', constraint=None, npReduce=<function mean>, windows=None, bins=None)[source]

Characterization metrics for outer solar system objects.

rubin_sim.maf.batches.ddfBatch(run_name='run_name', nside=512, radius=2.5, nside_sne=128, extra_sql=None, extra_info_label=None)[source]

A set of metrics to evaluate DDF fields.

Parameters:
  • run_name (str, optional) – The name of the simulation (for plot titles and file outputs).

  • nside (int, optional) – The HEALpix nside to run most of the metrics on.

  • radius (float) – The radius to select around each ddf (degrees). The default value of 2.5 degrees has been chosen to balance selecting a large enough area to ensure gathering all of the double Euclid field or a run with large dithers, while not including too much background area (which can skew metrics of the median number of visits, etc.).

  • nside_sne (int, optional) – The HEALpix nside to use with the SNe metric. The default is lower than the default nside for other metrics, as the SNe metric is more computationally expensive.

  • extra_sql (str, optional) – Additional sql constraint (such as night<=365) to add to the necessary sql constraints for each metric.

  • extra_info_label (str, optional) – Additional description information to add (alongside the extra_sql)

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.eastWestBias(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None)[source]

Plot the number of observations to the east vs to the west, per night.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints (e.g. ‘night<365’)

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.extended_metrics(colname, replace_colname=None)[source]

An extended set of simple metrics for some quantity. Typically applied with unislicer.

Parameters:
  • colname (str) – The column name to apply the metrics to.

  • replace_colname (str or None, optional) – Value to replace colname with in the metric_name. i.e. if replace_colname=’’ then metric name is Mean, instead of Mean Airmass, or if replace_colname=’seeingGeom’, then metric name is Mean seeingGeom instead of Mean seeingFwhmGeom.

Returns:

extendedMetrics – List of appropriate MAF metrics to evaluate a distribution.

Return type:

list [maf.BaseMetric]

rubin_sim.maf.batches.extended_summary()[source]

An extended set of summary metrics, to calculate all that is in the standard summary stats, plus 25/75 percentiles.

Returns:

extendedSummary – List of metrics appropriate to use to summarize the results from another metric.

Return type:

list [maf.BaseMetric]

rubin_sim.maf.batches.fOBatch(colmap=None, run_name='run_name', extra_sql=None, extra_info=None, slicer=None, benchmark_area=18000, benchmark_n_visits=825, min_n_visits=750)[source]

Metrics for calculating fO.

Parameters:
  • colmap (dict or None, opt) – A dictionary with a mapping of column names.

  • run_name (str, opt) – The name of the simulated survey.

  • extra_sql (str or None, opt) – Additional sql constraint to apply to all metrics.

  • extra_Info (str or None, opt) – Additional info_label to apply to all results.

  • slicer (rubin_sim.maf.slicer.HealpixSlicer or None, opt) – This must be a HealpixSlicer or some kind, although could be a HealpixSubsetSlicer. None will default to HealpixSlicer with nside=64.

  • benchmark_area (float, opt) – Area to use when calculating fO_Nvis, for design.

  • benchmark_n_visits (float, opt) – Nvisits minimum to use when calculating fO_Area, for design.

  • min_n_visits (float, opt) – Nvisits minimum to use when calculating fO_Area, for minimum.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.filter_list(all=True, extra_sql=None, extra_info_label=None)[source]

Return a list of filters, plot colors and orders.

Parameters:
  • all (bool, optional) – Include ‘all’ in the list of filters and as part of the colors/orders dictionaries.

  • extra_sql (str, optional) – Additional sql constraint to add to constraints returned per filter.

  • extra_info_label (str, optional) – Substitute info_label to add to info_label strings composed per band.

Returns:

  • filterlist (list [`str])

  • colors (dict {str: str})

  • orders (dict {str: int})

  • sqls (dict {str: str})

  • info_labels (dict {str: `str})

rubin_sim.maf.batches.filtersPerNight(colmap=None, runName='opsim', nights=1, extraSql=None, extraInfoLabel=None)[source]

Generate a set of metrics measuring the number and rate of filter changes over a given span of nights.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • run_name (str, optional) – The name of the simulated survey.

  • nights (int, optional) – Size of night bin to use when calculating metrics.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.filtersWholeSurvey(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None)[source]

Generate a set of metrics measuring the number and rate of filter changes over the entire survey.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • run_name (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.firstYearMetadata(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None, slicer=None)[source]

Measure the distribution of some basic metadata in the first year of operations - distributions of airmass, seeing, sky brightness, single visit depth.

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Sql constraint (such as WFD only).

  • extraInfoLabel (str, optional) – Metadata to identify the sql constraint (such as WFD).

  • slicer (rubin_sim.maf.slicer.BaseSlicer or None, optional) – Optionally use something other than an nside=64 healpix slicer.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.fraction_population_at_threshold(thresholds, optnames=None)[source]

Creates a list of summary metrics to be applied to any moving object metric which reports a float value, calculating the fraction of the population above X.

Parameters:
  • thresholds (list [float]) – The thresholds at which to calculate what fraction of the population exceeds these values.

  • optnames (list [str], optional) – If provided, these names will be used instead of the threshold values when constructing the metric names. This allows more descriptive summary statistic names.

Returns:

fracMetrics – List of moving object MoCompleteness metrics (differential fractions of the population).

Return type:

list [maf.MoCompletenessMetric]

rubin_sim.maf.batches.glanceBatch(colmap=None, run_name='run_name', nside=64, filternames=('u', 'g', 'r', 'i', 'z', 'y'), nyears=10, pairnside=32, sql_constraint=None, slicer_camera='LSST')[source]

Generate a handy set of metrics that give a quick overview of how well a survey performed. This is a meta-set of other batches, to some extent.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • run_name (str, optional) – The name of the simulated survey.

  • nside (int, optional) – The nside for the healpix slicers.

  • filternames (list of str, optional) – The list of individual filters to use when running metrics. There is always an all-visits version of the metrics run as well.

  • nyears (int, optional) – How many years to attempt to make hourglass plots for

  • pairnside (int, optional) – nside to use for the pair fraction metric (it’s slow, so nice to use lower resolution)

  • sql_constraint (str or None, optional) – Additional SQL constraint to apply to all metrics.

  • slicer_camera (str) – Sets which spatial slicer to use. options are ‘LSST’ and ‘ComCam’

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.hourglassPlots(colmap=None, runName='opsim', nyears=10, extraSql=None, extraInfoLabel=None)[source]

Run the hourglass metric, for each individual year.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • run_name (str, optional) – The name of the simulated survey.

  • nyears (int, optional) – How many years to attempt to make hourglass plots for.

  • extraSql (str, optional) – Add an extra sql constraint before running metrics.

  • extraInfoLabel (str, optional) – Add an extra piece of info_label before running metrics.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.interNight(colmap=None, runName='opsim', nside=64, extraSql=None, extraInfoLabel=None, slicer=None, display_group='InterNight', subgroup='Night gaps')[source]

Generate a set of statistics about the spacing between nights with observations.

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • nside (int, optional) – Nside for the healpix slicer.

  • extraSql (str or None, optional) – Additional sql constraint to apply to all metrics.

  • extraInfoLabel (str or None, optional) – Additional info_label to use for all outputs.

  • slicer (maf.BaseSlicer or None) – Optionally use something other than a HealpixSlicer

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.intraNight(colmap=None, runName='opsim', nside=64, extraSql=None, extraInfoLabel=None, slicer=None, display_group='IntraNight', subgroup='Pairs')[source]

Generate a set of statistics about the pair/triplet/etc. rate within a night.

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • nside (int, optional) – Nside for the healpix slicer.

  • extraSql (str or None, optional) – Additional sql constraint to apply to all metrics.

  • extraInfoLabel (str or None, optional) – Additional info_label to apply to all results.

  • slicer (maf.BaseSlicer or None) – Optionally use something other than a HealpixSlicer

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.meanRADec(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None)[source]

Plot the range of RA/Dec as a function of night.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints (e.g. ‘night<365’)

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.metadataBasics(value, colmap=None, runName='opsim', valueName=None, groupName=None, extraSql=None, extraInfoLabel=None, slicer=None)[source]

Calculate basic metrics on visit metadata ‘value’ (e.g. airmass, normalized airmass, seeing..). Calculates this around the sky (HealpixSlicer), makes histograms of all visits (OneDSlicer), and calculates statistics on all visits (UniSlicer) for the quantity,

in all visits and per filter.

Currently have a hack for HA & normairmass.

Parameters:
  • value (str) –

    The column name for the quantity to evaluate.

    (column name in the database or created by a stacker).

  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • valueName (str, optional) – The name of the value to be reported in the results_db and added to the metric. This is intended to help standardize metric comparison between sim versions. value = name as it is in the database (seeingFwhmGeom, etc). valueName = name to be recorded (‘seeingGeom’, etc.).

  • groupName (str, optional) – The group name for this quantity in the display_dict. None will default to the same as ‘valueName’, capitalized.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_labels to add before any below (i.e. “WFD”).

  • slicer (rubin_sim.maf.slicers.BaseSlicer, optional) – Optionally use a different slicer than an nside=64 healpix slicer.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.metadataBasicsAngle(value, colmap=None, runName='opsim', valueName=None, groupName=None, extraSql=None, extraInfoLabel=None, slicer=None)[source]

Calculate basic metrics on visit metadata ‘value’, where value is a wrap-around angle.

Calculates extended standard metrics (with unislicer) on the quantity (all visits and per filter), makes histogram of the value (all visits and per filter),

Parameters:
  • value (str) – The column name for the quantity to evaluate. (column name in the database or created by a stacker).

  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • valueName (str, optional) – The name of the value to be reported in the results_db and added to the metric. This is intended to help standardize metric comparison between sim versions. value = name as it is in the database (seeingFwhmGeom, etc). valueName = name to be recorded (‘seeingGeom’, etc.).

  • groupName (str, optional) – The group name for this quantity in the display_dict. None will default to the same as ‘valueName’, capitalized.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

  • slicer (rubin_sim.maf.slicer.BaseSlicer or None, optional)

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.metadataMaps(value, colmap=None, runName='opsim', valueName=None, groupName=None, extraSql=None, extraInfoLabel=None, slicer=None)[source]

Calculate 25/50/75 percentile values on maps across sky for a single metadata value.

Parameters:
  • value (str) – The column name for the quantity to evaluate. (column name in the database or created by a stacker).

  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • valueName (str, optional) – The name of the value to be reported in the results_db and added to the metric. This is intended to help standardize metric comparison between sim versions. value = name as it is in the database (seeingFwhmGeom, etc). valueName = name to be recorded (‘seeingGeom’, etc.).

  • groupName (str, optional) – The group name for this quantity in the display_dict.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

  • slicer (rubin_sim.maf.slicer.BaseSlicer or None, optional) – Optionally use something other than an nside=64 HealpixSlicer

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.microlensing_summary(metric_type, npts_required=10, Fisher_sigmatE_tE_cutoff=0.1)[source]

Calculate summary metrics for the microlensing population metrics.

Parameters:
  • metric_type (str) – Identify whether the metric is “Npts” or Fisher”

  • npts_required (int, optional) – Count the fraction of microlensing events with more than npts_required observations

  • Fisher_sigmatE_tE_cutoff (float, optional) – Count the fraction of microlensing events with characterization uncertainty less than this

Returns:

microlensingSummary – List of appropriate MAF metrics for this type of microlensing metric with the specified threshold values.

Return type:

list [maf.BaseMetric]

rubin_sim.maf.batches.nvisitsM5Maps(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None, slicer=None, runLength=10.0)[source]

Generate maps of the number of visits and coadded depth (with and without dust extinction) in all bands and per filter.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

  • slicer (rubin_sim.maf.slicer or None, optional) – Optionally, use something other than an nside=64 healpix slicer

  • runLength (float, optional) – Length of the simulated survey, for scaling values for the plot limits.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.nvisitsPerNight(colmap=None, runName='opsim', binNights=1, extraSql=None, extraInfoLabel=None, subgroup=None)[source]

Count the number of visits per night through the survey.

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey. Default is “opsim”.

  • binNights (int, optional) – Number of nights to count in each bin.

  • extraSql (str or None, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str or None, optional) – Additional info_label to add before any below (i.e. “WFD”).

  • subgroup (str or None, optional) – Use this for the ‘subgroup’ in the display_dict, instead of info_label.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.nvisitsPerSubset(colmap=None, runName='opsim', binNights=1, constraint=None, footprintConstraint=None, extraInfoLabel=None)[source]

Look at the distribution of a given sql constraint or footprint constraint’s visits, total number and distribution over time (# per night), if possible.

Parameters:
  • opsdb (str or database connection) – Name of the opsim sqlite database.

  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • binNights (int, optional) – Number of nights to count in each bin.

  • constraint (str or None, optional) – SQL constraint to add to all metrics. This would be the way to select only a given “Note”.

  • footprintConstraint (np.ndarray or None, optional) – Footprint to look for visits within (and then identify via WFDlabelStacker). The footprint = a full length heapix array, filled with 0/1 values.

  • extraInfoLabel (str or None, optional) – Additional info_label to add before any below (i.e. “WFD”).

Returns:

metric_bundleDict

Return type:

dict of rubin_sim.maf.MetricBundle

rubin_sim.maf.batches.openshutterFractions(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None)[source]

Evaluate open shutter fraction over whole survey and per night.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints (e.g. ‘night<365’)

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.plot_completeness(bdictCompleteness, figroot=None, run_name=None, results_db=None, out_dir='.', fig_format='pdf')[source]

Plot a minor subset of the completeness results.

rubin_sim.maf.batches.plot_single(bundle, results_db=None, out_dir='.', fig_format='pdf')[source]

Plot 5%/25%/50%/75%/95% iles for a metric value.

rubin_sim.maf.batches.radar_limited(runName='run name', nside=64, benchmarkArea=18000, benchmarkNvisits=825, minNvisits=750, long_microlensing=True, srd_only=False, mjd0=None)[source]

A batch of metrics for looking at survey performance relative to the SRD and the main science drivers of LSST.

Parameters:
  • runName (str, optional) – The simulation run name that should appear as plot titles.

  • benchmarkArea (float, optional) – The area to use for SRD metrics (sq degrees)

  • benchmarkNvisits (int, optional) – The number of visits to use for SRD metrics.

  • minNvisits (int, optional) – The minimum number of visits to use for SRD metrics.

  • long_microlensing (bool, optional) – Add the longer running microlensing metrics to the batch (a subset of crossing times only)

  • srd_only (bool, optional) – Only return the SRD metrics

  • mjd0 (float, optional) – The modified Julian date start date of the survey.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.rapidRevisitBatch(colmap=None, run_name='opsim', extra_sql=None, extra_info=None, slicer=None)[source]

Metrics for evaluating proper motion and parallax.

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • run_name (str, optional) – The name of the simulated survey.

  • extra_sql (str or None, optional) – Additional sql constraint to apply to all metrics.

  • extra_info (str or None, optional) – Additional info_label to apply to all results.

  • slicer (rubin_sim_maf.slicers.HealpixSlicer or None, optional) – Optionally, specify something other than an nside=64 healpix slicer. (must be a healpix slicer)

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.read_and_combine(orbitRoot, baseDir, splits, metricfile)[source]

Read and combine the metric results from split locations, returning a single bundle.

This will read the files from baseDir/orbitRoot_[split]/metricfile where split = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], etc. (the subsets the original orbit file was split into).

Parameters:
  • orbitRoot (str) – The root of the orbit file - l7_5k, mbas_5k, etc.

  • baseDir (str) – The root directory containing the subset directories. (e.g. ‘.’ often)

  • splits (` np.ndarray` or list of ints) – The integers describing the split directories (e.g. [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

  • metricfile (str) – The metric filename.

Returns:

  • metric_bundle (MoMetricBundle) – A single metric bundle containing the combined data from the subsets.

  • Note that this won’t work for particularly complex metric values,

  • such as the parent Discovery metrics. However, you can read and combine

  • their child metrics, as for these we can propagate the data masks.

rubin_sim.maf.batches.run_completeness_summary(bdict, h_mark, times, out_dir, results_db)[source]

Calculate completeness and create completeness bundles from all N_Chances and Time (child) metrics of the (discovery) bundles in bdict, and write completeness at h_mark to results_db, save bundle to disk.

This should be done after combining any sub-sets of the metric results.

Parameters:
  • bdict (dict of maf.MetricBundle) – Dict containing ~rubin_sim.maf.MoMetricBundles, including bundles we’re expecting to contain completeness.

  • h_mark (float) –

    h_mark value to add to completeness plotting dict. If not defined (None), then the h_mark from the plotdict from the metric bundle will be used if available. If None and h_mark not in plot_dict, then median of h_range values

    will be used.

  • times (np.ndarray) – The times at which to calculate completeness (over time).

  • out_dir (str) – Output directory to save completeness bundles to disk.

  • results_db (maf.ResultsDb) – Results database to save information about completeness bundle.

Returns:

metricDict – A dictionary of the new completeness bundles. Keys match original keys, with additions of “[Differential,Cumulative]Completeness@Time” and “[Differential,Cumulative]Completeness” to distinguish new entries.

Return type:

dict of maf.MetricBundles

rubin_sim.maf.batches.run_fraction_summary(bdict, h_mark, out_dir, results_db)[source]

Calculate fractional completeness of the population for color and lightcurve metrics.

This should be done after combining any sub-sets of the metric results.

Parameters:
  • bdict (dict of maf.MoMetricBundle) – Dict containing bundles contianing lightcurve/color evaluations.

  • h_mark (float) – h_mark value to add to completeness plotting dict. If defined, this value is used. If None, but h_mark in plot_dict for metric, then this value (-2) is used. If h_mark not in plotdict, then use the median h_range value-2.

  • times (np.ndarray) – The times at which to calculate completeness (over time).

  • out_dir (str) – Output directory to save completeness bundles to disk.

  • results_db (maf.ResultsDb) – Results database to save information about completeness bundle.

Returns:

metricDict – Dictionary of the metric bundles for the fractional evaluation of the population.

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.science_radar_batch(runName='run name', nside=64, benchmarkArea=18000, benchmarkNvisits=825, minNvisits=750, long_microlensing=True, srd_only=False, mjd0=None)[source]

A batch of metrics for looking at survey performance relative to the SRD and the main science drivers of LSST.

Parameters:
  • runName (str, optional) – The name of the opsim run.

  • nside (int, optional) – The nside to use for the HealpixSlicer (where relevant).

  • benchmarkArea (float, optional) – The benchmark value to use for fO_Area comparison.

  • benchmarkNvisits (float, optional) – The benchmark value to use for fO_Nvisits comparisons.

  • minNvisits (float, optional) – The value to use to establish the area covered by at least minNvis.

  • long_microlensing (bool, optional) – Add the longer running microlensing metrics to the batch (at a subset of crossing times only)

  • srd_only (bool , optional) – Only return the SRD metrics

  • mjd0 (float, optional) – Set the start time for the survey, for metrics which need this information.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.seasons(colmap=None, runName='opsim', nside=64, extraSql=None, extraInfoLabel=None, slicer=None)[source]

Generate a set of statistics about the length and number of seasons.

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • nside (int, optional) – Nside for the healpix slicer.

  • extraSql (str or None, optional) – Additional sql constraint to apply to all metrics.

  • extraInfoLabel (str or None, optional) – Additional info_label to use for all outputs.

  • slicer (maf.BaseSlicer or None`) – Optionally use something other than a HealpixSlicer

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.slewBasics(colmap=None, run_name='opsim', sql_constraint=None)[source]

Generate a simple set of statistics about the slew times and distances.

Parameters:
  • colmap (dict or None, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • sqlConstraint (str or None, optional) – SQL constraint to add to metrics.

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.ss_population_defaults(objtype)[source]

Provide useful default ranges for H, based on objtype of population type.

rubin_sim.maf.batches.standard_angle_metrics(colname, replace_colname=None)[source]

A set of standard simple metrics for a wrap-around angle quantity.

Parameters:
  • colname (str) – The column name to apply the metrics to.

  • replace_colname (str or None, optional) – Value to replace colname with in the metric_name. i.e. if replace_colname=’’ then metric name is Mean, instead of Mean Airmass, or if replace_colname=’seeingGeom’, then metric name is Mean seeingGeom instead of Mean seeingFwhmGeom.

Returns:

standardAngleMetrics – List of appropriate MAF metrics for angle distributions.

Return type:

list [maf.BaseMetric]

rubin_sim.maf.batches.standard_metrics(colname, replace_colname=None)[source]

A set of standard simple metrics for some quantity. Typically would be applied with unislicer.

Parameters:
  • colname (str) – The column name to apply the metrics to.

  • replace_colname (str or None, optional) – Value to replace colname with in the metric_name. i.e. if replace_colname=’’ then metric name is Mean, instead of Mean Airmass, or if replace_colname=’seeingGeom’, then metric name is Mean seeingGeom instead of Mean seeingFwhmGeom.

Returns:

standardMetrics – List of appropriate MAF metrics to evaluate a distribution.

Return type:

list [maf.BaseMetric]

rubin_sim.maf.batches.standard_summary(with_count=True)[source]

A set of standard summary metrics, to calculate Mean, RMS, Median, #, Max/Min, and # 3-sigma outliers.

Parameters:

with_count (bool, optional) – Include the “Count” metric in the set of summary metrics or not.

Returns:

standardSummary – List of metrics appropriate to use to summarize the results from another metric.

Return type:

list [maf.BaseMetric]

rubin_sim.maf.batches.summary_completeness_at_time(times, h_val, h_index=0.33)[source]

A simple list of summary metrics to be applied to the Discovery_Time or PreviouslyKnown metrics. (can be used with any moving object metric which returns the time of discovery).

Parameters:
  • times (np.ndarray `or list [float]) – The times at which to evaluate the completeness @ Hval.

  • h_val (float) – The H value at which to evaluate the completeness (cumulative and differential).

  • h_index (float, optional) – The index of the power law to integrate H over (for cumulative completeness).

Returns:

summaryMetrics – List of completeness metrics to be evaluated at the specified times.

Return type:

list [maf.MoCompletenessAtTimeMetric]

rubin_sim.maf.batches.summary_completeness_over_h(requiredChances=1, Hindex=0.33)[source]

A simple list of summary metrics to be applied to the Discovery_N_Chances metric.

Parameters:
  • requiredChances (int, optional) – Number of discovery opportunities required to consider an object ‘discovered’.

  • Hindex (float, optional) – The index of the power law to integrate H over (for cumulative completeness).

Returns:

summaryMetrics – List of moving object MoCompleteness metrics (cumulative and differential)

Return type:

list [maf.MoCompletenessMetric]

rubin_sim.maf.batches.tEffMetrics(colmap=None, runName='opsim', extraSql=None, extraInfoLabel=None, slicer=None)[source]

Generate a series of Teff metrics. Teff total, per night, and sky maps (all and per filter).

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • extraSql (str, optional) – Additional constraint to add to any sql constraints.

  • extraInfoLabel (str, optional) – Additional info_label to add before any below (i.e. “WFD”).

  • slicer (rubin_sim.maf.BaseSlicer or None, optional) – Optionally, use something other than an nside=64 healpix slicer

Returns:

metric_bundleDict

Return type:

dict of maf.MetricBundle

rubin_sim.maf.batches.timeGaps(colmap=None, runName='opsim', nside=64, extraSql=None, extraInfoLabel=None, slicer=None, display_group='Time Coverage', subgroup=None)[source]

Generate a set of statistics about the spacing between nights with observations.

Parameters:
  • colmap (dict, optional) – A dictionary with a mapping of column names.

  • runName (str, optional) – The name of the simulated survey.

  • nside (int, optional) – Nside for the healpix slicer.

  • extraSql (str, optional) – Additional sql constraint to apply to all metrics.

  • extraInfoLabel (str, optional) – Additional info_label to use for all outputs.

  • slicer (rubin_sim.maf.slicer.BaseSlicer, optional) – Optionally use something other than a HealpixSlicer

Returns:

bundle_dict

Return type:

dict of rubin_sim.maf.MetricBundle