lsst.sims.maf.web package

Submodules

lsst.sims.maf.web.mafRunResults module

class lsst.sims.maf.web.mafRunResults.MafRunResults(outDir, runName=None, resultsDb=None)[source]

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 resultsDb) only.

allStatNames(metrics)[source]

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

captionForMetric(metric)[source]

Return the caption for a given metric.

convertSelectToMetrics(groupList, metricIdList)[source]

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

getJson(metric)[source]

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

getNpz(metric)[source]

Return the npz data.

getPlotfile(plot)[source]

Return the filename for a given plot.

getResultsDb()[source]

Return the summary results sqlite filename.

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

getSkyMaps(metrics=None, plotType='SkyMap')[source]

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

getThumbfile(plot)[source]

Return the thumbnail file name for a given plot.

metricIdsInSubgroup(group, subgroup)[source]

Return the metricIds within a given group/subgroup.

metricIdsToMetrics(metricIds, metrics=None)[source]

Return an ordered numpy array of metrics matching metricIds.

metricInfo(metric=None, withDataLink=True, withSlicerName=True)[source]

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

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

metricsInGroup(group, metrics=None, sort=True)[source]

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

metricsInSubgroup(group, subgroup, metrics=None)[source]

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.

metricsToMetricIds(metrics)[source]

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

metricsToSubgroups(metrics)[source]

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

metricsWithMetadata(metadata, metrics=None)[source]

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

metricsWithMetricName(metricName, metrics=None, baseonly=True)[source]

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

metricsWithPlotType(plotType='SkyMap', metrics=None)[source]

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

metricsWithSlicer(slicer, metrics=None)[source]

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

metricsWithStats(metrics=None)[source]

Return metrics that have any summary stat.

metricsWithSummaryStat(summaryStatName='Identity', metrics=None)[source]

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

orderPlots(skyPlots)[source]

skyPlots = 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 skyPlots includes multiple plots in the same filter, just goes back to displayOrder.

orderStatNames(stats)[source]

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

plotDict(plots=None)[source]

Given an array of plots (for a single metric usually). Returns an ordered dict with ‘plotType’ for interfacing with jinja2 templates. plotDict == {‘SkyMap’: {‘plotFile’: [], ‘thumbFile’, []}, ‘Histogram’: {}..}

If no plot of a particular type, the plotFile and thumbFile are empty lists. Calling with plots=None returns a blank plotDict.

plotsForMetric(metric)[source]

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

sortMetrics(metrics, order=('displayGroup', 'displaySubgroup', 'baseMetricNames', 'slicerName', 'displayOrder', 'metricMetadata'))[source]

Sort the metrics by order specified by ‘order’.

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

statDict(stats)[source]

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 summaryNames.

statsForMetric(metric, statName=None)[source]

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

Optionally specify a particular statName that you want to match.

uniqueMetricMetadata(metrics=None)[source]

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

uniqueMetricNameAndMetadata(metrics=None)[source]

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

uniqueMetricNames(metrics=None, baseonly=True)[source]

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

uniqueSlicerNames(metrics=None)[source]

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

lsst.sims.maf.web.mafTracking module

class lsst.sims.maf.web.mafTracking.MafTracking(database=None)[source]

Bases: object

Class to read MAF’s tracking SQLite database (tracking a set of MAF runs) and handle the output for web display.

getRun(mafRunId)[source]

Set up a mafRunResults object to read and handle the data from an individual run. Caches the mafRunResults object, meaning the metric information from a particular run is only read once from disk.

Parameters:mafRunId (int) – mafRunId value in the tracking database corresponding to a particular MAF run.
Returns:A MafRunResults object containing the information about a particular run. Stored internally in self.runsPage dict, but also passed back to the tornado server.
Return type:MafRunResults
runInfo(run)[source]

Provide the tracking database information relevant for a given run in a format that the jinja2 templates can use.

Parameters:run (numpy.NDarray) – One line from self.runs
Returns:Ordered dict version of the numpy structured array.
Return type:OrderedDict
sortRuns(runs, order=['opsimRun', 'mafComment', 'mafRunId'])[source]

Sort the numpy array of run data.

Parameters:
  • runs (numpy.NDarray) – The runs from self.runs to sort.
  • order (list) – The fields to use to sort the runs array.
Returns:

A sorted numpy array.

Return type:

numpy.NDarray

Module contents