Measurement¶
- class lsst.verify.Measurement(metric, quantity=None, blobs=None, extras=None, notes=None)¶
- Bases: - JsonSerializationMixin- A measurement of a single - Metric.- A measurement is associated with a single - Metricand consists of a- astropy.units.Quantityvalue. In addition, a measurement can be augmented with- Blobs (either shared, or directly associated with the measurement’s- Measurement.extras) and metadata (- Measurement.notes).- Parameters:
- metricstr,lsst.verify.Name, orlsst.verify.Metric
- The name of this metric or the corresponding - Metricinstance. If a- Metricis provided then the units of the- quantityargument are automatically validated.
- quantityastropy.units.Quantity, optional
- The measured value as an Astropy - Quantity. If a- Metricinstance is provided, the units of- quantityare compared to the- Metric‘s units for compatibility. The- quantitycan also be set, updated, or read with the- Measurement.quantityattribute.
- blobslistofBlobs, optional
- List of - lsst.verify.Blobinstances that are associated with a measurement. Blobs are datasets that can be associated with many measurements and provide context to a measurement.
- extrasdictoflsst.verify.Datuminstances, optional
- Datuminstances can be attached to a measurement. Extras can be accessed from the- Measurement.extrasattribute.
- notesdict, optional
- Measurement annotations. These key-value pairs are automatically available from - Job.meta, though keys are prefixed with the metric’s name. This metadata can be queried by specifications, so that specifications can be written to test only certain types of measurements.
 
- metric
- Raises:
- TypeError
- Raised if arguments are not valid types. 
 
 - Attributes Summary - dictof- lsst.verify.Blobs associated with this measurement.- Representation of this measurement as a - Datum.- Description of the metric ( - str, or- Noneif- Measurement.metricis not set).- Blobassociated solely to this measurement.- Unique UUID4-based identifier for this measurement ( - str, immutable).- A - dictthat can be serialized as semantic SQUASH JSON.- Metric associated with the measurement ( - lsst.verify.Metricor- None, mutable).- Name of the corresponding metric ( - lsst.verify.Name, mutable).- Measurement annotations as key-value pairs ( - dict).- astropy.units.Quantitycomponent of the measurement (mutable).- Methods Summary - deserialize([metric, identifier, value, ...])- Create a Measurement instance from a parsed YAML/JSON document. - jsonify_dict(d)- Recursively build JSON-renderable objects on all values in a dict. - link_blob(blob)- Link a - Blobto this measurement.- write_json(filepath)- Write JSON to a file. - Attributes Documentation - blobs = None¶
- dictof- lsst.verify.Blobs associated with this measurement.- See also 
 - description¶
- Description of the metric ( - str, or- Noneif- Measurement.metricis not set).
 - extras = None¶
- Blobassociated solely to this measurement.- Notes - extraswork just like- Blobs, but they’re automatically created with each- Measurement. Add- Datums to- extrasif those- Datums only make sense in the context of that- Measurement. If- Datums are relevant to multiple measurements, add them to an external- Blobinstance and attach them to each measurements’s- Measurement.blobsattribute through the- Measurement.link_blobmethod.
 - json¶
- A - dictthat can be serialized as semantic SQUASH JSON.- Fields: - metric(- str) Name of the metric the measurement measures.
- identifier(- str) Unique identifier for this measurement.
- value(- float) Value of the measurement.
- unit(- str) Units of the- value, as an- astropy.units-compatible string.
- blob_refs(- listof- str) List of- Blob.identifiers for Blobs associated with this measurement.
 - Note - Blobs are not serialized with a measurement, only their identifiers. The- lsst.verify.Jobclass handles serialization of blobs alongside measurements.- Likewise, - Measurement.notesare not serialized with the measurement. They are included with- lsst.verify.Job‘s serialization, alongside job-level metadata.
 - metric¶
- Metric associated with the measurement ( - lsst.verify.Metricor- None, mutable).
 - metric_name¶
- Name of the corresponding metric ( - lsst.verify.Name, mutable).
 - notes¶
- Measurement annotations as key-value pairs ( - dict).- These key-value pairs are automatically available from - Job.meta, though keys are prefixed with the- Metric‘s name. This metadata can be queried by- Specifications, so that- Specifications can be written to test only certain types of- Measurements.
 - quantity¶
- astropy.units.Quantitycomponent of the measurement (mutable).
 - Methods Documentation - classmethod deserialize(metric=None, identifier=None, value=None, unit=None, blob_refs=None, blobs=None, **kwargs)¶
- Create a Measurement instance from a parsed YAML/JSON document. - Parameters:
- metricstr
- Name of the metric the measurement measures. 
- identifierstr
- Unique identifier for this measurement. 
- valuefloat
- Value of the measurement. 
- unitstr
- Units of the - value, as an- astropy.units-compatible string.
- blob_refslistofstr
- List of - Blob.identifiers for Blob associated with this measurement.
- blobsBlobSet
- BlobSetcontaining all- Blobs referenced by the measurement’s- blob_refsfield. Note that the- BlobSetmust be created separately, prior to deserializing measurement objects.
 
- metric
- Returns:
- measurementMeasurement
- Measurement instance. 
 
- measurement
 
 - 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, }) 
 - link_blob(blob)¶
- Link a - Blobto this measurement.- Blobs can be linked to a measurement so that they can be retrieved by analysis and visualization tools post-serialization. Blob data is not copied, and one blob can be linked to multiple measurements. - Parameters:
- bloblsst.verify.Blob
- A - Blobinstance.
 
- blob
 - Notes - After linking, the - Blobinstance can be accessed by name (- Blob.name) through the- Measurement.blobs- dict.