Job¶
-
class
lsst.validate.base.Job(measurements=None, blobs=None)[source]¶ Bases:
lsst.validate.base.jsonmixin.JsonSerializationMixinA
Jobwraps all measurements and blob metadata associated with a validation run.Measurements and blobs can be added both during initialization, or anytime afterwards with the
register_measurementandregister_blobmethods.The
get_measurementmethod lets you search for a stored measurement based on theMetricname (and filter or specification name, if the measurement is dependent on those).Use the
Job.jsonattribute to access a json-serializabledictof all measurements and blobs associated with theJob.A
Jobcan only contain measurements against one dataset at a time. Typically,Jobs are uploaded to SQUASH separately for each tested dataset.Parameters: measurements :
list, optionalList of
MeasurementBase-derived objects. Additional measurements can be added with theregister_measurementmethod.blobs :
list, optionalList of
BlobBase-derived objects. Additional blobs can be added with theregister_blobmethod.Attributes Summary
blobsBlob iterator. jsonJobdata as a JSON-serialiabledict.measurementsMeasurement iterator. metric_namesNames of Metrics measured in thisJob(list).spec_levelslistof names of specification levels that are available forMethods Summary
from_json(json_data)Construct a Job and constituent objects from a JSON dataset. get_measurement(metric_name[, spec_name, ...])Get a measurement corresponding to the given criteria. jsonify_dict(d)Recursively build JSON-renderable objects on all values in a dict. register_blob(b)Add a blob object to the Job.register_measurement(m)Add a measurement object to the Job.write_json(filepath)Write JSON to a file. Attributes Documentation
-
blobs¶ Blob iterator.
-
measurements¶ Measurement iterator.
-
spec_levels¶ listof names of specification levels that are available forMetrics measured in thisJob.
Methods Documentation
-
classmethod
from_json(json_data)[source]¶ Construct a Job and constituent objects from a JSON dataset.
Parameters: json_data :
dictJob JSON object (as produced by
json).Returns: job :
Job-typeJob from JSON.
-
get_measurement(metric_name, spec_name=None, filter_name=None)[source]¶ Get a measurement corresponding to the given criteria.
Parameters: metric_name :
strName of the
Metricfor the requested measurement.spec_name :
str, optionalName of the specification level if the measurement algorithm is dependent on the specification level of a metric.
filter_name :
str, optionalName of the optical filter if the measurement is specific to a filter.
Returns: measurement :
MeasurementBase-type objectThe single measurement instance that fulfills the search criteria.
Raises: RuntimeError
Raised when a measurement cannot be found, either because no such measurement exists or because the request is ambiguous (
spec_nameorfilter_nameneed to be set).
-
jsonify_dict(d)¶ Recursively build JSON-renderable objects on all values in a dict.
Parameters: d :
dictDictionary ito 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, })
-
register_blob(b)[source]¶ Add a blob object to the
Job.Parameters: b :
BlobBase-type objectA blob object.
-
register_measurement(m)[source]¶ Add a measurement object to the
Job.Registering a measurement also automatically registers all linked blobs.
Parameters: m :
MeasurementBase-type objectA measurement object.
-