ColorColorFitPlot

class lsst.analysis.tools.actions.plot.ColorColorFitPlot(*args, **kw)

Bases: PlotAction

Make a color-color plot and overplot a prefited line to the fit region.

This is mostly used for the stellar locus plots and also includes panels that illustrate the goodness of the given fit.

Attributes Summary

doPlotDistVsColor

Plot distance from fit as a function of color in lower right panel? (bool, default True)

doPlotRedBlueHists

Plot distance from fit histograms separated into blue and red star subsamples? (bool, default False)

magLabel

Label to use for the magnitudes used to color code by (str)

minPointsForFit

Minimum number of valid objects to bother attempting a fit.

plotName

The name for the plot.

plotTypes

Selection of types of objects to plot.

xAxisLabel

Label to use for the x axis (str)

xLims

Minimum and maximum x-axis limit to force (provided as a list of [xMin, xMax]).

yAxisLabel

Label to use for the y axis (str)

yLims

Minimum and maximum y-axis limit to force (provided as a list of [yMin, yMax]).

Methods Summary

__call__(data, **kwargs)

Call self as a function.

getInputSchema(**kwargs)

Return the schema an AnalysisAction expects to be present in the arguments supplied to the __call__ method.

makePlot(data, plotInfo, **kwargs)

Make stellar locus plots using pre fitted values.

Attributes Documentation

doPlotDistVsColor

Plot distance from fit as a function of color in lower right panel? (bool, default True)

doPlotRedBlueHists

Plot distance from fit histograms separated into blue and red star subsamples? (bool, default False)

magLabel

Label to use for the magnitudes used to color code by (str)

minPointsForFit

Minimum number of valid objects to bother attempting a fit. Deprecated: This field is no longer used. The value should go as an entry to the paramsDict keyed as minObjectForFit. Will be removed after v27. (int, default 5)

Valid Range = [1,inf)

plotName

The name for the plot. (str)

plotTypes

Selection of types of objects to plot. Can take any combination of stars, galaxies, unknown, mag, any. (List, default ['stars'])

xAxisLabel

Label to use for the x axis (str)

xLims

Minimum and maximum x-axis limit to force (provided as a list of [xMin, xMax]). If None, limits will be computed and set based on the data. (List, default None)

yAxisLabel

Label to use for the y axis (str)

yLims

Minimum and maximum y-axis limit to force (provided as a list of [yMin, yMax]). If None, limits will be computed and set based on the data. (List, default None)

Methods Documentation

__call__(data: MutableMapping[str, ndarray[Any, dtype[_ScalarType_co]] | Scalar | HealSparseMap | Tensor | Mapping], **kwargs) Mapping[str, Figure] | Figure

Call self as a function.

getInputSchema(**kwargs) Mapping]]]

Return the schema an AnalysisAction expects to be present in the arguments supplied to the __call__ method.

Returns:
resultKeyedDataSchema

The schema this action requires to be present when calling this action, keys are unformatted.

makePlot(data: MutableMapping[str, ndarray[Any, dtype[_ScalarType_co]] | Scalar | HealSparseMap | Tensor | Mapping], plotInfo: Mapping[str, str], **kwargs) Figure

Make stellar locus plots using pre fitted values.

Parameters:
dataKeyedData

The data to plot the points from, for more information please see the notes section.

plotInfodict

A dictionary of information about the data being plotted with keys:

  • "run"

    The output run for the plots (str).

  • "skymap"

    The type of skymap used for the data (str).

  • "filter"

    The filter used for this data (str).

  • "tract"

    The tract that the data comes from (str).

Returns:
figmatplotlib.figure.Figure

The resulting figure.

Notes

The axis labels are given by self.xAxisLabel and self.yAxisLabel. The perpendicular distance of the points to the fit line is given in a histogram in the second panel.

For the code to work it expects various quantities to be present in the data that it is given.

The quantities that are expected to be present are:

  • Statistics that are shown on the plot or used by the plotting code:
    • approxMagDepth

      The approximate magnitude corresponding to the SN cut used.

    • f"{self.plotName}_sigmaMAD"

      The sigma mad of the distances to the line fit.

    • f"{self.plotName or ''}_median"

      The median of the distances to the line fit.

  • Parameters from the fitting code that are illustrated on the plot:
    • "bFixed"

      The fixed intercept to fall back on.

    • "mFixed"

      The fixed gradient to fall back on.

    • "bODR"

      The intercept calculated by the final orthogonal distance regression fitting.

    • "mODR"

      The gradient calculated by the final orthogonal distance regression fitting.

    • "xMin`"

      The x minimum of the box used in the fit.

    • "xMax"

      The x maximum of the box used in the fit.

    • "yMin"

      The y minimum of the box used in the fit.

    • "yMax"

      The y maximum of the box used in the fit.

    • "mPerp"

      The gradient of the line perpendicular to the line from the second ODR fit.

    • "bPerpMin"

      The intercept of the perpendicular line that goes through xMin.

    • "bPerpMax"

      The intercept of the perpendicular line that goes through xMax.

    • "goodPoints"

      The points that passed the initial set of cuts (typically in fluxType S/N, extendedness, magnitude, and isfinite).

    • "fitPoints"

      The points use in the final fit.

  • The main inputs to plot:

    x, y, mag

Examples

An example of the plot produced from this code is here:

../_images/stellarLocusExample.png

For a detailed example of how to make a plot from the command line please see the getting started guide.