Datum#

class lsst.verify.Datum(quantity=None, unit=None, label=None, description=None)#

Bases: QuantityAttributeMixin, JsonSerializationMixin

A value annotated with units, a plot label and description.

Datum supports natively support Astropy Quantity and units. In addition, a Datum can also wrap strings, booleans and integers. A Datums’s value can also be None.

Parameters#

quantityastropy.units.Quantity, int, float or iterable.

Value of the Datum.

unitstr

Units of quantity as a str if quantity is not supplied as an astropy.units.Quantity. See http://docs.astropy.org/en/stable/units/. Units are not used by str, bool, int or None types.

labelstr, optional

Label suitable for plot axes (without units).

descriptionstr, optional

Extended description of the Datum.

Attributes Summary

description

Extended description.

json

Datum as a dict compatible with overall Job JSON schema.

label

Label for plotting (without units).

Methods Summary

deserialize([label, description, value, unit])

Deserialize fields from a Datum JSON object into a Datum instance.

Attributes Documentation

description#

Extended description.

json#

Datum as a dict compatible with overall Job JSON schema.

label#

Label for plotting (without units).

Methods Documentation

classmethod deserialize(label=None, description=None, value=None, unit=None)#

Deserialize fields from a Datum JSON object into a Datum instance.

Parameters#

valuefloat, int, bool, str, or list

Values, which may be scalars or lists of scalars.

unitstr or None

An astropy.units-compatible string with units of value, or None if the value does not have physical units.

labelstr, optional

Label suitable for plot axes (without units).

descriptionstr, optional

Extended description of the Datum.

Returns#

datumDatum

Datum instantiated from provided JSON fields.

Examples#

With this class method, a Datum may be round-tripped from its JSON serialized form.

>>> datum = Datum(50. * u.mmag, label='sigma',
...               description="Photometric uncertainty.")
>>> print(datum)
sigma = 50.0 mmag
Photometric uncertainty.
>>> json_data = datum.json
>>> new_datum = datum.deserialize(**json_data)
>>> print(new_datum)
sigma = 50.0 mmag
Photometric uncertainty.