gemd.entity.value.nominal_composition module
A nominal composition value.
- class gemd.entity.value.nominal_composition.NominalComposition(quantities=None)
Bases:
CompositionValue
Nominal composition, represented as a map from the component names to the quantities.
The quantities do not express an uncertainty but also do not imply that there is absolute certainty to their values.
- Parameters
quantities (Map[String, Number]) –
A map from each component to its amount. The quantities are not required to be expressed on a unit or fractional basis. The following are all acceptable:
dict(acetone=0.25, methanol=0.75)
dict(acetone=1, methanol=3)
dict(acetone=3.5, methanol=10.5)
- 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
- 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
- property quantities: dict
Get a map from the components to their quantities.
- skip = {}
- typ = 'nominal_composition'