gemd.entity.value.uniform_real module

A uniformly distributed real value.

class gemd.entity.value.uniform_real.UniformReal(lower_bound=None, upper_bound=None, units=None)

Bases: ContinuousValue

Uniform continuous distribution, with inclusive lower and upper bounds.

Note

These are especially useful for expressing uncertainty when the number of digits is truncated. For example, a measured value of 1.3 could be represented as a uniform real with a lower bound of 1.25 and an upper bound of 1.35.

Parameters
  • lower_bound (float) – Inclusive lower bound of the distribution.

  • upper_bound (float) – Inclusive upper bound of the distribution.

  • units (str) – A string describing the units. Units must be present and they must be parseable by Pint. An empty string can be used for the units of a dimensionless quantity.

as_dict() Dict[str, Any]

Convert the object to a dictionary.

Returns

A dictionary representation of the object, where the keys are its fields.

Return type

dict

static build(d: Mapping[str, Any]) DictSerializableType

Build an object from a JSON dictionary.

This differs from from_dict in that the values themselves may also be dictionaries corresponding to serialized DictSerializable objects.

Parameters

d (dict) – The object as a serialized dictionary.

Returns

The deserialized object.

Return type

DictSerializable

dump() Dict[str, Any]

Convert the object to a JSON dictionary, so that every entry is serialized.

Uses the json encoder client, so objects with uids are converted to LinkByUID dictionaries.

Returns

A string representation of the object as a dictionary.

Return type

str

classmethod from_dict(d: Mapping[str, Any]) DictSerializableType

Reconstitute the object from a dictionary.

Parameters

d (dict) – The object as a dictionary of key-value pairs that correspond to the object’s fields.

Returns

The deserialized object.

Return type

DictSerializable

skip = {}
typ = 'uniform_real'
property units: str

Get the units of the value.