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.JsonSerializationMixinA specification level, or threshold, associated with a
Metric.Parameters: name :
strName of the specification level for a metric. LPM-17, for example, uses
'design','minimum'and'stretch'terminology.quantity :
astropy.units.Quantity,float, orintThe specification threshold level.
unit :
str, optionalastropy.units.Unit-compatiblestrdescribing the units ofvalue(only necessary ifquantityis 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
Datumvalues 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
datumRepresentation of this Specificationas aDatum.dependenciesdictof namedDatumvalues that must be known when making afilter_nameslistof names of optical filters that this Specification leveljsondictthat can be serialized as semantic JSON, compatible withlatex_unitUnits as a LaTeX string, wrapped in $.nameName of the specification level for a metric. quantityThe specification threshold level ( astropy.units.Quantity).unitRead-only astropy.units.Unitof thequantity.unit_strRead-only astropy.units.Unit-compatiblestrindicating 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
Specificationas aDatum.
-
dependencies= None¶ dictof namedDatumvalues that must be known when making a measurement against a specification level.Dependencies can also be accessed as attributes of the
Specificationobject. The names of class attributes match keys independencies.
-
filter_names= None¶ listof names of optical filters that this Specification level applies to.Default is
Noneif theSpecificationis 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.Unitof thequantity.
-
unit_str¶ Read-only
astropy.units.Unit-compatiblestrindicating units ofquantity.
Methods Documentation
-
classmethod
from_json(json_data)[source]¶ Construct a Specification from a JSON document.
Parameters: json_data :
dictSpecification JSON object.
Returns: specification :
SpecificationSpecification from JSON.
-
jsonify_dict(d)¶ Recursively build JSON-renderable objects on all values in a dict.
Parameters: d :
dictDictionary ito convert into a JSON-serializable object. Values are recursively JSON-ified.
Returns: json_dict :
dictDictionary 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, })
-