MeasurementSet¶
- class lsst.verify.MeasurementSet(measurements=None)¶
- Bases: - JsonSerializationMixin- A collection of - Measurements of- Metrics.- MeasurementSetprovides a dict-like interface for getting, setting, and iterating over- Measurements.- Parameters:
- measurementslistoflsst.verify.Measurements
- Measurements to include in the set. 
 
- measurements
 - Attributes Summary - A - dictthat can be serialized as JSON.- Methods Summary - deserialize([measurements, blob_set, metric_set])- Create a measurement set from a parsed JSON dataset. - insert(measurement)- Insert a measurement into the set. - items()- Iterete over ( - Name,- Measurement) pairs in the set.- jsonify_dict(d)- Recursively build JSON-renderable objects on all values in a dict. - keys()- Get a sequence of metric names contained in the measurement set. - refresh_metrics(metric_set)- Refresh - Measurement.metricattributes in- Measurements contained by this set.- update(other)- Merge another - MeasurementSetinto this one.- write_json(filepath)- Write JSON to a file. - Attributes Documentation - Methods Documentation - classmethod deserialize(measurements=None, blob_set=None, metric_set=None)¶
- Create a measurement set from a parsed JSON dataset. - Parameters:
- measurementslist, optional
- A list of - MeasurementJSON serializations.
- blob_setBlobSet, optional
- A - BlobSetinstance that support measurement deserialization.
- metric_setMetricSet, optional
- A - MetricSetthat supports measurement deserialization. If provided, measurements are validated for unit consistency with metric definitions.- Measurementinstances also gain a- Measurement.metricattribute.
 
- measurements
- Returns:
- instanceMeasurementSet
- A - MeasurementSetinstance.
 
- instance
 
 - insert(measurement)¶
- Insert a measurement into the set. 
 - items()¶
- Iterete over ( - Name,- Measurement) pairs in the set.- Yields:
- itemtuple
- Tuple containing: 
- Measurementinstance.
 
 
- item
 
 - 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, }) 
 - keys()¶
- Get a sequence of metric names contained in the measurement set. - Returns:
- keyssequence of Name
- Sequence of names of metrics for measurements in the set. 
 
- keyssequence of 
 
 - refresh_metrics(metric_set)¶
- Refresh - Measurement.metricattributes in- Measurements contained by this set.- Parameters:
- metric_setMetricSet
- Metrics from this set are inserted into corresponding- Measurements contained in this- MeasurementSet.
 
- metric_set
 - Notes - This method is especially useful for inserting - Metricinstances into- Measurements that weren’t originally created with- Metricinstances. By including a- Metricin a- Measurement, the serialized units of a measurment are normalized to the metric’s definition.
 - update(other)¶
- Merge another - MeasurementSetinto this one.- Parameters:
- otherMeasurementSet
- Another - MeasurementSet. Measurements in- otherthat do exist in this set are added to this one. Measurements in- otherreplace measurements of the same metric in this one.
 
- other