MeasurementSet¶
-
class
lsst.verify.MeasurementSet(measurements=None)[source]¶ Bases:
lsst.verify.jsonmixin.JsonSerializationMixinA collection of
Measurements ofMetrics.MeasurementSetprovides a dict-like interface for getting, setting, and iterating overMeasurements.Parameters: measurements :
listoflsst.verify.MeasurementsMeasurements to include in the set.
Attributes Summary
jsonA 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 inMeasurements 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)[source]¶ Create a measurement set from a parsed JSON dataset.
Parameters: measurements :
list, optionalA list of
MeasurementJSON serializations.blob_set :
BlobSet, optionalA
BlobSetinstance that support measurement deserialization.metric_set :
MetricSet, optionalA
MetricSetthat supports measurement deserialization. If provided, measurements are validated for unit consistency with metric definitions.Measurementinstances also gain aMeasurement.metricattribute.Returns: instance :
MeasurementSetA
MeasurementSetinstance.
-
items()[source]¶ Iterete over (
Name,Measurement) pairs in the set.Yields: item :
tupleTuple containing:
Nameof the measurement’sMetric.Measurementinstance.
-
jsonify_dict(d)¶ Recursively build JSON-renderable objects on all values in a dict.
Parameters: d :
dictDictionary to 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, })
-
keys()[source]¶ Get a sequence of metric names contained in the measurement set.
Returns: keys : sequence of
NameSequence of names of metrics for measurements in the set.
-
refresh_metrics(metric_set)[source]¶ Refresh
Measurement.metricattributes inMeasurements contained by this set.Parameters: metric_set :
MetricSetMetrics from this set are inserted into correspondingMeasurements contained in thisMeasurementSet.Notes
This method is especially useful for inserting
Metricinstances intoMeasurements that weren’t originally created withMetricinstances. By including aMetricin aMeasurement, the serialized units of a measurment are normalized to the metric’s definition.
-
update(other)[source]¶ Merge another
MeasurementSetinto this one.Parameters: other :
MeasurementSetAnother
MeasurementSet. Measurements inotherthat do exist in this set are added to this one. Measurements inotherreplace measurements of the same metric in this one.
-
classmethod