Specification¶
-
class
lsst.verify.
Specification
(name, **kwargs)¶ Bases:
lsst.verify.jsonmixin.JsonSerializationMixin
Specification base class.
Specification classes must implement:
Subclasses should also call
Specification.__init__
to initialize the specificationsname
attribute (aName
instance).Attributes Summary
json
dict
that can be serialized as semantic JSON, compatible with the SQUASH metric service.metric_name
Name of the metric this specification corresponds to ( lsst.verify.Name
).name
Specification name ( lsst.verify.Name
).tags
Tag labels ( set
ofstr
).type
Specification type ( str
).Methods Summary
check
(measurement)Check if a measurement passes this specification. jsonify_dict
(d)Recursively build JSON-renderable objects on all values in a dict. query_metadata
(metadata[, arg_driven])Query a Job’s metadata to determine if this specification applies. write_json
(filepath)Write JSON to a file. Attributes Documentation
-
metric_name
¶ Name of the metric this specification corresponds to (
lsst.verify.Name
).
-
name
¶ Specification name (
lsst.verify.Name
).
Methods Documentation
-
check
(measurement)¶ Check if a measurement passes this specification.
Parameters: - measurement :
astropy.units.Quantity
The measurement value. The measurement
Quantity
must have units compatible with the specification.
Returns: - measurement :
-
static
jsonify_dict
(d)¶ Recursively build JSON-renderable objects on all values in a dict.
Parameters: - d :
dict
Dictionary to 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, })
- d :
-
query_metadata
(metadata, arg_driven=False)¶ Query a Job’s metadata to determine if this specification applies.
Parameters: - metadata :
lsst.verify.Metadata
ordict
-type Metadata mapping. Typically this is the
lsst.verify.Job.meta
attribute.- arg_driven :
bool
, optional If
False
(default),metadata
matches theMetadataQuery
ifmetadata
has all the terms defined inMetadataQuery
, and those terms match. Ifmetadata
has more terms thanMetadataQuery
, it can still match. This behavior is appropriate for finding if a specification applies to a Job given metadata.If
True
, the orientation of the matching is reversed. Nowmetadata
matches theMetadataQuery
ifMetadataQuery
has all the terms defined inmetadata
and those terms match. IfMetadataQuery
has more terms thanmetadata
, it can still match. This behavior is appropriate for discovering specifications.
Returns: See also
- metadata :
-