Specification¶
-
class
lsst.validate.base.
Specification
(name, quantity, unit=None, filter_names=None, dependencies=None)[source]¶ Bases:
lsst.validate.base.QuantityAttributeMixin
,lsst.validate.base.jsonmixin.JsonSerializationMixin
A specification level, or threshold, associated with a
Metric
.Parameters: name :
str
Name of the specification level for a metric. LPM-17, for example, uses
'design'
,'minimum'
and'stretch'
terminology.quantity :
astropy.units.Quantity
,float
, orint
The specification threshold level.
unit :
str
, optionalastropy.units.Unit
-compatiblestr
describing the units ofvalue
(only necessary ifquantity
is afloat
). An empty string (''
) describes a unitless quantity.filter_names :
list
, optionalA list of optical filter names that this specification applies to. Set only if the specification level is dependent on the filter.
dependencies :
dict
, optionalA dictionary of named
Datum
values that must be known when making a measurement against a specification level. Dependencies can be accessed as attributes of the specification object. The names of class attributes match keys independencies
.Attributes Summary
datum
Representation of this Specification
as aDatum
.dependencies
dict
of namedDatum
values that must be known when making afilter_names
list
of names of optical filters that this Specification leveljson
dict
that can be serialized as semantic JSON, compatible withlatex_unit
Units as a LaTeX string, wrapped in $
.name
Name of the specification level for a metric. quantity
The specification threshold level ( astropy.units.Quantity
).unit
Read-only astropy.units.Unit
of thequantity
.unit_str
Read-only astropy.units.Unit
-compatiblestr
indicating units ofquantity
.Methods Summary
from_json
(json_data)Construct a Specification from a JSON document. jsonify_dict
(d)Recursively build JSON-renderable objects on all values in a dict. write_json
(filepath)Write JSON to a file. Attributes Documentation
-
datum
¶ Representation of this
Specification
as aDatum
.
-
dependencies
= None¶ dict
of namedDatum
values that must be known when making a measurement against a specification level.Dependencies can also be accessed as attributes of the
Specification
object. The names of class attributes match keys independencies
.
-
filter_names
= None¶ list
of names of optical filters that this Specification level applies to.Default is
None
if theSpecification
is filter-independent.
-
latex_unit
¶ Units as a LaTeX string, wrapped in
$
.
-
name
= None¶ Name of the specification level for a metric.
LPM-17, for example, uses
'design'
,'minimum'
and'stretch'
terminology.
-
quantity
= None¶ The specification threshold level (
astropy.units.Quantity
).
-
unit
¶ Read-only
astropy.units.Unit
of thequantity
.
-
unit_str
¶ Read-only
astropy.units.Unit
-compatiblestr
indicating units ofquantity
.
Methods Documentation
-
classmethod
from_json
(json_data)[source]¶ Construct a Specification from a JSON document.
Parameters: json_data :
dict
Specification JSON object.
Returns: specification :
Specification
Specification from JSON.
-
jsonify_dict
(d)¶ Recursively build JSON-renderable objects on all values in a dict.
Parameters: d :
dict
Dictionary ito convert into a JSON-serializable object. Values are recursively JSON-ified.
Returns: json_dict :
dict
Dictionary that can be serialized to JSON.
Examples
Subclasses can use this method to prepare output in their
json
-method implementation. For example:def json(self): return JsonSerializationMixin.jsonify_dict({ 'value': self.value, })
-