Metric#
- class lsst.verify.Metric(name, description, unit, tags=None, reference_doc=None, reference_url=None, reference_page=None)#
Bases:
JsonSerializationMixinContainer for the definition of a metric.
Metrics can either be instantiated programatically, or from a metric YAML file through
lsst.verify.MetricSet.Parameters#
- name
str Name of the metric (e.g.,
'PA1').- description
str Short description about the metric.
- unit
strorastropy.units.Unit Units of the metric.
Measurements of this metric must be in an equivalent (that is, convertable) unit. Argument can either be anastropy.unit.Unitinstance, or aUnit-compatible string representation. Use an empty string,'', orastropy.units.dimensionless_unscaledfor a unitless quantity.- tags
listofstr Tags associated with this metric. Tags are user-submitted string tokens that are used to group metrics.
- reference_doc
str, optional The document handle that originally defined the metric (e.g.,
'LPM-17').- reference_url
str, optional The document’s URL.
- reference_page
str, optional Page where metric in defined in the reference document.
Attributes Summary
Short description of the metric (
str).dictthat can be serialized as semantic JSON, compatible with the SQUASH metric service.Metric's name (
Name).Documentation reference as human-readable text (
str, read-only).Name of the document that specifies this metric (
str).Page number in the document that specifies this metric (
int).URL of the document that specifies this metric (
str).Tag labels (
setofstr).The metric's unit (
astropy.units.Unit).The string representation of the metric's unit (
Unit-compatiblestr).Methods Summary
check_unit(quantity)Check that a
Quantityhas equivalent units to this metric.deserialize([name, description, unit, tags, ...])Create a Metric instance from a parsed YAML/JSON document.
Attributes Documentation
- description = None#
Short description of the metric (
str).
- json#
dictthat can be serialized as semantic JSON, compatible with the SQUASH metric service.
- reference#
Documentation reference as human-readable text (
str, read-only).Uses
reference_doc,reference_page, andreference_url, as available.
- reference_doc = None#
Name of the document that specifies this metric (
str).
- reference_page = None#
Page number in the document that specifies this metric (
int).
- reference_url = None#
URL of the document that specifies this metric (
str).
- tags#
Tag labels (
setofstr).
- unit#
The metric’s unit (
astropy.units.Unit).
- unit_str#
The string representation of the metric’s unit (
Unit-compatiblestr).
Methods Documentation
- check_unit(quantity)#
Check that a
Quantityhas equivalent units to this metric.Parameters#
- quantity
astropy.units.Quantity Quantity to be tested.
Returns#
- is_equivalent
bool Trueif the units are equivalent, meaning that the quantity can be presented in the units of this metric.Falseif not.
- quantity
- classmethod deserialize(name=None, description=None, unit=None, tags=None, reference=None)#
Create a Metric instance from a parsed YAML/JSON document.
Parameters#
- kwargs
dict Keyword arguments that match fields from the
Metric.jsonserialization.
Returns#
- metric
Metric A Metric instance.
- kwargs
- name