MafRunResults

class rubin_sim.maf.web.MafRunResults(out_dir, run_name=None, results_db=None)

Bases: object

Class to read MAF’s resultsDb_sqlite.db and organize the output for display on web pages.

Deals with a single MAF run (one output directory, one results_db) only.

Methods Summary

all_stat_names(metrics)

Given an array of metrics, return a list containing all the unique 'summary_metric' names in a default ordering.

caption_for_metric(metric)

Return the caption for a given metric.

convert_select_to_metrics(group_list, ...)

Convert the lists of values returned by 'select metrics' template page into an appropriate dataframe of metrics (in sorted order).

get_json(metric)

Return the JSON string containing the data for a particular metric.

get_npz(metric)

Return the npz data.

get_plot_file(plot)

Return the filename for a given plot.

get_results_db()

Return the summary results sqlite filename.

get_sky_maps([metrics, plot_type])

Return a numpy array of the plots with plot_type=plot_type, optionally for subset of metrics.

get_thumb_file(plot)

Return the thumbnail file name for a given plot.

metric_ids_in_subgroup(group, subgroup)

Return the metric_ids within a given group/subgroup.

metric_ids_to_metrics(metric_ids[, metrics])

Return an ordered numpy array of metrics matching metric_ids.

metric_info([metric, with_data_link, ...])

Return a dict with the metric info we want to show on the webpages.

metrics_in_group(group[, metrics, sort])

Given a group, return the metrics belonging to this group, in display order.

metrics_in_subgroup(group, subgroup[, metrics])

Given a group and subgroup, return a dataframe of the metrics belonging to these group/subgroups, in display order.

metrics_to_metric_ids(metrics)

Return a list of the metric Ids corresponding to a subset of metrics.

metrics_to_subgroups(metrics)

Given an array of metrics, return an ordered dict of their group/subgroups.

metrics_with_info_label(info_label[, metrics])

For an array of metrics, return the subset which match a particular 'info_label' value.

metrics_with_metric_name(metric_name[, ...])

Return all metrics which match metric_name (default, only the 'base' metric name).

metrics_with_plot_type([plot_type, metrics])

Return an array of metrics with plot=plot_type (optional, metric subset).

metrics_with_slicer(slicer[, metrics])

For an array of metrics, return the subset which match a particular 'slicername' value.

metrics_with_stats([metrics])

Return metrics that have any summary stat.

metrics_with_summary_stat([...])

Return metrics with summary stat matching 'summary_stat_name' (optional, metric subset).

order_plots(sky_plots)

sky_plots = numpy array of skymap plots.

order_stat_names(stats)

Given an array of stats, return a list containing all the unique 'summary_metric' names in a default ordering (identity-count-mean-median-rms..).

plot_dict([plots])

Given an array of plots (for a single metric usually).

plots_for_metric(metric)

Return a numpy array of the plots which match a given metric.

sort_metrics(metrics[, order])

Sort the metrics by order specified by 'order'.

stat_dict(stats)

Returns an ordered dictionary with statName:statValue for an array of stats.

stats_for_metric(metric[, stat_name])

Return a numpy array of summary statistics which match a given metric(s).

unique_metric_info_label([metrics])

For an array of metrics, return a list of the unique info_label.

unique_metric_name_and_info_label([metrics])

For an array of metrics, return the unique metric names + info_label combo in same order.

unique_metric_names([metrics, baseonly])

Return a list of the unique metric names, preserving the order of 'metrics'.

unique_slicer_names([metrics])

For an array of metrics, return the unique slicer names.

Methods Documentation

all_stat_names(metrics)

Given an array of metrics, return a list containing all the unique ‘summary_metric’ names in a default ordering.

caption_for_metric(metric)

Return the caption for a given metric.

convert_select_to_metrics(group_list, metric_id_list)

Convert the lists of values returned by ‘select metrics’ template page into an appropriate dataframe of metrics (in sorted order).

get_json(metric)

Return the JSON string containing the data for a particular metric.

get_npz(metric)

Return the npz data.

get_plot_file(plot)

Return the filename for a given plot.

get_results_db()

Return the summary results sqlite filename.

Note that this assumes the resultsDB is stored in ‘resultsDB_sqlite.db’.

get_sky_maps(metrics=None, plot_type='SkyMap')

Return a numpy array of the plots with plot_type=plot_type, optionally for subset of metrics.

get_thumb_file(plot)

Return the thumbnail file name for a given plot.

metric_ids_in_subgroup(group, subgroup)

Return the metric_ids within a given group/subgroup.

metric_ids_to_metrics(metric_ids, metrics=None)

Return an ordered numpy array of metrics matching metric_ids.

metric_info(metric=None, with_data_link=False, with_slicer_name=True)

Return a dict with the metric info we want to show on the webpages.

Currently : MetricName / Slicer/ InfoLabel / datafile (for download) Used to build a lot of tables in showMaf.

metrics_in_group(group, metrics=None, sort=True)

Given a group, return the metrics belonging to this group, in display order.

metrics_in_subgroup(group, subgroup, metrics=None)

Given a group and subgroup, return a dataframe of the metrics belonging to these group/subgroups, in display order.

If ‘metrics’ is provided, then only consider this subset of metrics.

metrics_to_metric_ids(metrics)

Return a list of the metric Ids corresponding to a subset of metrics.

metrics_to_subgroups(metrics)

Given an array of metrics, return an ordered dict of their group/subgroups.

metrics_with_info_label(info_label, metrics=None)

For an array of metrics, return the subset which match a particular ‘info_label’ value.

metrics_with_metric_name(metric_name, metrics=None, baseonly=True)

Return all metrics which match metric_name (default, only the ‘base’ metric name).

metrics_with_plot_type(plot_type='SkyMap', metrics=None)

Return an array of metrics with plot=plot_type (optional, metric subset).

metrics_with_slicer(slicer, metrics=None)

For an array of metrics, return the subset which match a particular ‘slicername’ value.

metrics_with_stats(metrics=None)

Return metrics that have any summary stat.

metrics_with_summary_stat(summary_stat_name='Identity', metrics=None)

Return metrics with summary stat matching ‘summary_stat_name’ (optional, metric subset).

order_plots(sky_plots)

sky_plots = numpy array of skymap plots.

Returns an ordered list of plotDicts.

The goal is to lay out the skymaps in a 3x2 grid on the MultiColor page, in ugrizy order. If a plot for a filter is missing, add a gap. (i.e. if there is no u, keep a blank spot). If there are other plots, with multiple filters or no filter info, they are added to the end. If sky_plots includes multiple plots in the same filter, just goes back to displayOrder.

order_stat_names(stats)

Given an array of stats, return a list containing all the unique ‘summary_metric’ names in a default ordering (identity-count-mean-median-rms..).

plot_dict(plots=None)

Given an array of plots (for a single metric usually). Returns an ordered dict with ‘plot_type’ for interfacing with jinja2 templates. plot_dict == {‘SkyMap’: {‘plot_file’: [], ‘thumb_file’, []}, ‘Histogram’: {}..}

If no plot of a particular type, the plot_file and thumb_file are empty lists. Calling with plots=None returns a blank plot_dict.

plots_for_metric(metric)

Return a numpy array of the plots which match a given metric.

sort_metrics(metrics, order=('display_group', 'display_subgroup', 'base_metric_name', 'slicer_name', 'display_order', 'metric_info_label'))

Sort the metrics by order specified by ‘order’.

Default is to sort by group, subgroup, metric name, slicer, display order, then info_label. Returns sorted numpy array.

stat_dict(stats)

Returns an ordered dictionary with statName:statValue for an array of stats.

Note that if you pass ‘stats’ from multiple metrics with the same summary names, they will be overwritten in the resulting dictionary! So just use stats from one metric, with unique summary_metric names.

stats_for_metric(metric, stat_name=None)

Return a numpy array of summary statistics which match a given metric(s).

Optionally specify a particular stat_name that you want to match.

unique_metric_info_label(metrics=None)

For an array of metrics, return a list of the unique info_label.

unique_metric_name_and_info_label(metrics=None)

For an array of metrics, return the unique metric names + info_label combo in same order.

unique_metric_names(metrics=None, baseonly=True)

Return a list of the unique metric names, preserving the order of ‘metrics’.

unique_slicer_names(metrics=None)

For an array of metrics, return the unique slicer names.