gemd.entity.object.ingredient_spec module
- class gemd.entity.object.ingredient_spec.IngredientSpec(name: str, *, material: Optional[Union[MaterialSpec, LinkByUID]] = None, process: Optional[Union[ProcessSpec, LinkByUID]] = None, labels: Optional[Iterable[str]] = None, mass_fraction: Optional[ContinuousValue] = None, volume_fraction: Optional[ContinuousValue] = None, number_fraction: Optional[ContinuousValue] = None, absolute_quantity: Optional[ContinuousValue] = None, uids: Optional[Mapping[str, str]] = None, tags: Optional[Iterable[str]] = None, notes: Optional[str] = None, file_links: Optional[Union[Iterable[FileLink], FileLink]] = None)
Bases:
BaseObject
,HasQuantities
,HasTemplate
,HasMaterial
,HasProcess
An ingredient specification.
Ingredients annotate a material with information about its usage in a process.
- Parameters
name (str, required) – Label on the ingredient that is unique within the process that contains it.
uids (Map[str, str], optional) – A collection of unique IDs.
tags (List[str], optional) – Tags are hierarchical strings that store information about an entity. They can be used for filtering and discoverability.
notes (str, optional) – Long-form notes about the ingredient spec.
material (MaterialSpec) – Material that this ingredient is.
process (ProcessSpec) – Process that this ingredient is used in.
mass_fraction (ContinuousValue, optional) – The mass fraction of the ingredient in the process.
volume_fraction (ContinuousValue, optional) – The volume fraction of the ingredient in the process.
number_fraction (ContinuousValue, optional) – The number fraction of the ingredient in the process.
absolute_quantity (ContinuousValue, optional) – The absolute quantity of the ingredient in the process.
labels (List[str], optional) – Additional labels on the ingredient that must be unique.
file_links (List[FileLink], optional) – Links to associated files, with resource paths into the files API.
- add_uid(scope: str, uid: str)
Add a uid.
- Parameters
scope (str) – scope of the uid
uid (str) – Unique identifier
- all_dependencies() Set[Union[BaseEntityType, LinkByUIDType]]
Return a set of all immediate dependencies (no recursion).
- 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
- to_link(scope: Optional[str] = None, *, allow_fallback: bool = False) LinkByUIDType
Generate a ~gemd.entity.link_by_uid.LinkByUID for this object.
- Parameters
scope (str, optional) – scope of the uid to get
allow_fallback (bool) – whether to grab another scope/id if chosen scope is missing (Default: False).
- Return type
- property absolute_quantity: ContinuousValue
The absolute quantity of the material.
- property file_links: List[FileLink]
Links to associated files, with resource paths into the files API.
- property labels: List[str]
Get labels.
- property mass_fraction: ContinuousValue
The mass fraction of the material.
- property material: Union[MaterialSpec, LinkByUID]
Get the material spec.
- property name: str
Name of the object.
- property number_fraction: ContinuousValue
The number fraction (commonly called mole fraction) of the material.
- property process: Union[ProcessSpec, LinkByUID]
Get the process.
- skip = {}
- property tags: List[str]
A collection of structured labels.
Tags are hierarchical strings that store information about an entity. They can be used for filtering and discoverability.
- property template
Ingredients do not have templates, so this method always returns None.
- typ = 'ingredient_spec'
- property uids: Dict[str, str]
A collection of unique IDs.
Requirements for and the value of unique IDs are discussed here.
- property volume_fraction: ContinuousValue
The volume fraction of the material.