lsst.analysis.tools

The Analysis Tools package is designed to assist in the creation of quality assurance (QA) plots and metrics from the outputs of a data reduction pipeline. The intention is that users have the flexibility to construct complex data analysis tasks from a set of simple building blocks. In this sense, a series of consistent, repeatable and high-quality plots and metrics can be generated for any given dataset.

Using Analysis Tools

For a tutorial on working with analysis_tools please see the getting started guide.

Need Help?

The first place to check for more information is the FAQs page which contains some helpful hints. More will be added to this page over time; if you find something that you think should be added here then please do!

Project members and in-kind contributors may ask for further help via the #rubinobs-analysis-tools channel on the LSSTC Slack workspace. All users of the analysis tools package, including community members, are also welcome to post any questions you might have on the Community Forum.

Contributing

The lsst.analysis.tools package is developed at github.com/lsst/analysis_tools.

Jira issues relating to this package can be found using the analysis_tools component.

Script reference

Python API Reference

lsst.analysis.tools Package

This package contains various analysis tools and the PipelineTasks which run them.

The primary tool in this package is the AnalysisTool class. An AnalysisTool class has three stages: prep, process, and produce. Creating a new AnalysisTool involves choosing (through configuration) one or more AnalysisAction classes to run for each of those stages.

Both AnalysisTool and AnalysisAction are subclasses of the ConfigurableAction class. These objects are special types that are configured prior to any code execution, and behave as functions at runtime. The configuration state of a ConfigurableAction is saved separately from the object itself.

Variables

nansigmaMad(x[, axis, center, scale, nan_policy])

Compute the median absolute deviation of the data along the given axis.

sigmaMad(x[, axis, center, scale, nan_policy])

Compute the median absolute deviation of the data along the given axis.

lsst.analysis.tools.actions.plot Package

Classes

BarPanel(*args, **kw)

A configurable class describing a panel in a bar plot.

BarPlot(*args, **kw)

A plotting tool which can take multiple keyed data inputs and can create one or more bar graphs.

ColorColorFitPlot(*args, **kw)

Makes a color-color plot and overplots a prefited line to the specified area of the plot.

DiaSkyPanel(*args, **kw)

Configuration options for DiaSkyPlot panels.

DiaSkyPlot(*args, **kw)

Generic pseudo base class for plotting DiaSources (or DiaObjects) on the sky.

FocalPlanePlot(*args, **kw)

Plots the focal plane distribution of a parameter.

HistPanel(*args, **kw)

A Config class that holds parameters to configure a single panel of a histogram plot.

HistPlot(*args, **kw)

Make an N-panel plot with a configurable number of histograms displayed in each panel.

HistStatsPanel(*args, **kw)

A Config class that holds parameters to configure a the stats panel shown for histPlot.

MultiVisitCoveragePlot(*args, **kw)

Plot the coverage for a set of visits.

RhoStatisticsPlot(*args, **kw)

Make multiple plots of rho statistics.

ScatterPlotStatsAction(*args, **kw)

Calculates the statistics needed for the scatter plot with two hists.

ScatterPlotWithTwoHists(*args, **kw)

Makes a scatter plot of the data with a marginal histogram for each axis.

SkyPlot(*args, **kw)

Plots the on sky distribution of a parameter.

XYPlot(*args, **kw)

Make a plot (with errorbars) of one quantity (X) vs another (Y).

Class Inheritance Diagram

Inheritance diagram of lsst.analysis.tools.actions.plot.barPlots.BarPanel, lsst.analysis.tools.actions.plot.barPlots.BarPlot, lsst.analysis.tools.actions.plot.colorColorFitPlot.ColorColorFitPlot, lsst.analysis.tools.actions.plot.diaSkyPlot.DiaSkyPanel, lsst.analysis.tools.actions.plot.diaSkyPlot.DiaSkyPlot, lsst.analysis.tools.actions.plot.focalPlanePlot.FocalPlanePlot, lsst.analysis.tools.actions.plot.histPlot.HistPanel, lsst.analysis.tools.actions.plot.histPlot.HistPlot, lsst.analysis.tools.actions.plot.histPlot.HistStatsPanel, lsst.analysis.tools.actions.plot.multiVisitCoveragePlot.MultiVisitCoveragePlot, lsst.analysis.tools.actions.plot.rhoStatisticsPlot.RhoStatisticsPlot, lsst.analysis.tools.actions.plot.scatterplotWithTwoHists.ScatterPlotStatsAction, lsst.analysis.tools.actions.plot.scatterplotWithTwoHists.ScatterPlotWithTwoHists, lsst.analysis.tools.actions.plot.skyPlot.SkyPlot, lsst.analysis.tools.actions.plot.xyPlot.XYPlot

lsst.analysis.tools.actions.scalar Package

Classes

ApproxFloor(*args, **kw)

Returns the median of the lowest ten values of the sorted input.

CountAction(*args, **kw)

Returns the number of non-NaN entries in the given column.

CountUniqueAction(*args, **kw)

Counts the number of unique rows in a given column.

FracInRange(*args, **kw)

Compute the fraction of a distribution that is between specified minimum and maximum values, and is not NaN.

FracNan(*args, **kw)

Compute the fraction of vector entries that are NaN.

FracThreshold(*args, **kw)

Compute the fraction of a distribution that is above or below a specified threshold.

MaxAction(*args, **kw)

Returns the maximum of the given data.

MeanAction(*args, **kw)

Calculates the mean of the given data.

MedianAction(*args, **kw)

Calculates the median of the given data.

MinAction(*args, **kw)

Returns the minimum of the given data.

SigmaMadAction(*args, **kw)

Calculates the sigma mad of the given data.

StdevAction(*args, **kw)

Calculates the standard deviation of the given data.

Class Inheritance Diagram

Inheritance diagram of lsst.analysis.tools.actions.scalar.scalarActions.ApproxFloor, lsst.analysis.tools.actions.scalar.scalarActions.CountAction, lsst.analysis.tools.actions.scalar.scalarActions.CountUniqueAction, lsst.analysis.tools.actions.scalar.scalarActions.FracInRange, lsst.analysis.tools.actions.scalar.scalarActions.FracNan, lsst.analysis.tools.actions.scalar.scalarActions.FracThreshold, lsst.analysis.tools.actions.scalar.scalarActions.MaxAction, lsst.analysis.tools.actions.scalar.scalarActions.MeanAction, lsst.analysis.tools.actions.scalar.scalarActions.MedianAction, lsst.analysis.tools.actions.scalar.scalarActions.MinAction, lsst.analysis.tools.actions.scalar.scalarActions.SigmaMadAction, lsst.analysis.tools.actions.scalar.scalarActions.StdevAction

lsst.analysis.tools.actions.vector Package

Classes

AddVector(*args, **kw)

Calculate (A+B).

BandSelector(*args, **kw)

Makes a mask for sources observed in a specified set of bands.

BinnedCorr2Config(*args, **kw)

A Config class that holds some of the parameters supported by treecorr.

CalcBinnedStatsAction(*args, **kw)

CalcE(*args, **kw)

Calculate a complex value representation of the ellipticity.

CalcE1(*args, **kw)

Calculate \(e_1\) (distortion-type) or \(g_1\) (shear-type).

CalcE2(*args, **kw)

Calculate \(e_2\) (distortion-type) or \(g_2\) (shear-type).

CalcEDiff(*args, **kw)

Calculate the difference of two ellipticities as a complex quantity.

CalcRhoStatistics(*args, **kw)

Calculate rho statistics.

CalcShapeSize(*args, **kw)

Calculate a size: \((I_{xx}I_{yy}-I_{xy}^2)^{\frac{1}{4}}\) (determinant radius) or \(\sqrt{(I_{xx}+I_{yy})/2}\) (trace radius).

CalcSn(*args, **kw)

Calculate the signal-to-noise ratio from a single flux vector.

CoaddPlotFlagSelector(*args, **kw)

This default setting makes it take the band from the kwargs.

ConstantValue(*args, **kw)

Return a constant scalar value.

ConvertFluxToMag(*args, **kw)

Turn nano janskies into magnitudes.

ConvertUnits(*args, **kw)

Convert the units of a vector.

DivideVector(*args, **kw)

Calculate (A/B)

DownselectVector(*args, **kw)

Get a vector from KeyedData, apply specified selector, return the shorter Vector.

ExtendednessSelector(*args, **kw)

A selector that picks between extended and point sources.

ExtinctionCorrectedMagDiff(*args, **kw)

Compute the difference between two magnitudes and correct for extinction By default bands are derived from the <band>_ prefix on flux columns, per the naming convention in the Object Table: e.g.

FlagSelector(*args, **kw)

The base flag selector to use to select valid sources for QA.

FractionalDifference(*args, **kw)

Calculate (A-B)/B.

GalaxySelector(*args, **kw)

A selector that picks out galaxies based off of their extendedness values.

GoodDiaSourceSelector(*args, **kw)

Selects good DIA sources from diaSourceTables.

LoadVector(*args, **kw)

Load and return a Vector from KeyedData.

MagDiff(*args, **kw)

Calculate the difference between two magnitudes; each magnitude is derived from a flux column.

MultiCriteriaDownselectVector(*args, **kw)

Get a vector from KeyedData, apply specified set of selectors with AND logic, and return the shorter Vector.

MultiplyVector(*args, **kw)

Calculate (A*B)

PerGroupStatistic(*args, **kw)

Compute per-group statistic values and return result as a vector with one element per group.

RAcosDec(*args, **kw)

Construct a vector of RA*cos(Dec) in order to have commensurate values between RA and Dec.

RangeSelector(*args, **kw)

Selects rows within a range, inclusive of min/exclusive of max.

ResidualWithPerGroupStatistic(*args, **kw)

Compute residual between individual elements of group and the per-group statistic.

SkyObjectSelector(*args, **kw)

Selects sky objects in the given band(s).

SkySourceSelector(*args, **kw)

Selects sky sources from sourceTables.

SnSelector(*args, **kw)

Selects points that have S/N > threshold in the given flux type.

StarSelector(*args, **kw)

A selector that picks out stars based off of their extendedness values.

SubtractVector(*args, **kw)

Calculate (A-B).

ThresholdSelector(*args, **kw)

Return a mask corresponding to an applied threshold.

UnknownSelector(*args, **kw)

A selector that picks out unclassified objects based off of their extendedness values.

VectorSelector(*args, **kw)

Load a boolean vector from KeyedData and return it for use as a selector.

VisitPlotFlagSelector(*args, **kw)

Select on a set of flags appropriate for making visit-level plots (i.e., using sourceTable_visit catalogs).

Class Inheritance Diagram

Inheritance diagram of lsst.analysis.tools.actions.vector.mathActions.AddVector, lsst.analysis.tools.actions.vector.selectors.BandSelector, lsst.analysis.tools.actions.vector.calcRhoStatistics.BinnedCorr2Config, lsst.analysis.tools.actions.vector.calcBinnedStats.CalcBinnedStatsAction, lsst.analysis.tools.actions.vector.ellipticity.CalcE, lsst.analysis.tools.actions.vector.ellipticity.CalcE1, lsst.analysis.tools.actions.vector.ellipticity.CalcE2, lsst.analysis.tools.actions.vector.ellipticity.CalcEDiff, lsst.analysis.tools.actions.vector.calcRhoStatistics.CalcRhoStatistics, lsst.analysis.tools.actions.vector.calcShapeSize.CalcShapeSize, lsst.analysis.tools.actions.vector.vectorActions.CalcSn, lsst.analysis.tools.actions.vector.selectors.CoaddPlotFlagSelector, lsst.analysis.tools.actions.vector.mathActions.ConstantValue, lsst.analysis.tools.actions.vector.vectorActions.ConvertFluxToMag, lsst.analysis.tools.actions.vector.vectorActions.ConvertUnits, lsst.analysis.tools.actions.vector.mathActions.DivideVector, lsst.analysis.tools.actions.vector.vectorActions.DownselectVector, lsst.analysis.tools.actions.vector.selectors.ExtendednessSelector, lsst.analysis.tools.actions.vector.vectorActions.ExtinctionCorrectedMagDiff, lsst.analysis.tools.actions.vector.selectors.FlagSelector, lsst.analysis.tools.actions.vector.mathActions.FractionalDifference, lsst.analysis.tools.actions.vector.selectors.GalaxySelector, lsst.analysis.tools.actions.vector.selectors.GoodDiaSourceSelector, lsst.analysis.tools.actions.vector.vectorActions.LoadVector, lsst.analysis.tools.actions.vector.vectorActions.MagDiff, lsst.analysis.tools.actions.vector.vectorActions.MultiCriteriaDownselectVector, lsst.analysis.tools.actions.vector.mathActions.MultiplyVector, lsst.analysis.tools.actions.vector.vectorActions.PerGroupStatistic, lsst.analysis.tools.actions.vector.vectorActions.RAcosDec, lsst.analysis.tools.actions.vector.selectors.RangeSelector, lsst.analysis.tools.actions.vector.vectorActions.ResidualWithPerGroupStatistic, lsst.analysis.tools.actions.vector.selectors.SkyObjectSelector, lsst.analysis.tools.actions.vector.selectors.SkySourceSelector, lsst.analysis.tools.actions.vector.selectors.SnSelector, lsst.analysis.tools.actions.vector.selectors.StarSelector, lsst.analysis.tools.actions.vector.mathActions.SubtractVector, lsst.analysis.tools.actions.vector.selectors.ThresholdSelector, lsst.analysis.tools.actions.vector.selectors.UnknownSelector, lsst.analysis.tools.actions.vector.selectors.VectorSelector, lsst.analysis.tools.actions.vector.selectors.VisitPlotFlagSelector

lsst.analysis.tools.actions.keyedData Package

Classes

AddComputedVector(*args, **kw)

Compute a Vector from the specified VectorAction and add it to a copy of the KeyedData, returning the result.

CalcRelativeDistances(*args, **kw)

Calculate relative distances in a matched catalog.

ChainedKeyedDataActions(*args, **kw)

Run a series of KeyedDataActions and accumulated their output into one KeyedData result.

KeyedDataSelectorAction(*args, **kw)

Extract Vector specified by vectorKeys from input KeyedData and optionally apply selectors to down select extracted vectors.

KeyedScalars(*args, **kw)

Creates an output of type KeyedData, where the keys are given by the identifiers in scalarActions and the values are the results of the corresponding ScalarAction.

StellarLocusFitAction(*args, **kw)

Determine Stellar Locus fit parameters from given input Vectors.

Class Inheritance Diagram

Inheritance diagram of lsst.analysis.tools.actions.keyedData.keyedDataActions.AddComputedVector, lsst.analysis.tools.actions.keyedData.calcDistances.CalcRelativeDistances, lsst.analysis.tools.actions.keyedData.keyedDataActions.ChainedKeyedDataActions, lsst.analysis.tools.actions.keyedData.keyedDataActions.KeyedDataSelectorAction, lsst.analysis.tools.actions.keyedData.keyedDataActions.KeyedScalars, lsst.analysis.tools.actions.keyedData.stellarLocusFit.StellarLocusFitAction