Specification¶
- class lsst.verify.Specification(name, **kwargs)¶
- Bases: - JsonSerializationMixin- Specification base class. - Specification classes must implement: - Subclasses should also call - Specification.__init__to initialize the specifications- nameattribute (a- Nameinstance).- Attributes Summary - dictthat can be serialized as semantic JSON, compatible with the SQUASH metric service.- Name of the metric this specification corresponds to ( - lsst.verify.Name).- Specification name ( - lsst.verify.Name).- 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 - abstract check(measurement)¶
- Check if a measurement passes this specification. - Parameters:
- measurementastropy.units.Quantity
- The measurement value. The measurement - Quantitymust have units compatible with the specification.
 
- measurement
- Returns:
 
 - static jsonify_dict(d)¶
- Recursively build JSON-renderable objects on all values in a dict. - Parameters:
- ddict
- Dictionary to convert into a JSON-serializable object. Values are recursively JSON-ified. 
 
- d
- Returns:
- json_dictdict
- Dictionary that can be serialized to JSON. 
 
- json_dict
 - 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, }) 
 - query_metadata(metadata, arg_driven=False)¶
- Query a Job’s metadata to determine if this specification applies. - Parameters:
- metadatalsst.verify.Metadataordict-type
- Metadata mapping. Typically this is the - lsst.verify.Job.metaattribute.
- arg_drivenbool, optional
- If - False(default),- metadatamatches the- MetadataQueryif- metadatahas all the terms defined in- MetadataQuery, and those terms match. If- metadatahas more terms than- MetadataQuery, 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. Now- metadatamatches the- MetadataQueryif- MetadataQueryhas all the terms defined in- metadataand those terms match. If- MetadataQueryhas more terms than- metadata, it can still match. This behavior is appropriate for discovering specifications.
 
- metadata
- Returns:
 - See also