gemd.entity.template.measurement_template module

A measurement template.

class gemd.entity.template.measurement_template.MeasurementTemplate(name, *, description=None, properties=None, conditions=None, parameters=None, uids=None, tags=None)

Bases: BaseTemplate, HasPropertyTemplates, HasConditionTemplates, HasParameterTemplates

A measurement template.

Measurement templates are collections of condition, parameter and property templates that constrain the values of a measurement’s condition, parameter and property attributes, and provide a common structure for describing similar measurements.

Parameters
  • name (str, required) – The name of the measurement template.

  • description (str, optional) – Long-form description of the measurement template.

  • 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.

  • conditions (List[ConditionTemplate] or List[ConditionTemplate, BaseBounds], optional) – Templates for associated conditions. Each template can be provided by itself, or as a list with the second entry being a separate, more restrictive Bounds object that defines the limits of the value for this condition.

  • parameters (List[ParameterTemplate] or List[ParameterTemplate, BaseBounds], optional) – Templates for associated parameters. Each template can be provided by itself, or as a list with the second entry being a separate, more restrictive Bounds object that defines the limits of the value for this parameter.

  • properties (List[PropertyTemplate] or List[PropertyTemplate, BaseBounds], optional) – Templates for associated properties. Each template can be provided by itself, or as a list with the second entry being a separate, more restrictive Bounds object that defines the limits of the value for this property.

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

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

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

LinkByUID

validate_condition(condition: ConditionType) bool

Check if the condition is consistent w/ this template.

validate_parameter(parameter: ParameterType) bool

Check if the parameter is consistent w/ this template.

validate_property(prop: Union[PropertyType, PropertyAndConditionsType]) bool

Check if the property is consistent w/ this template.

property conditions: List[Union[ConditionTemplate, LinkByUID]]

Get the list of condition template/bounds tuples.

Returns

List of this entity’s condition template/bounds pairs

Return type

List[(ConditionTemplate, BaseBounds)]

property parameters: List[Union[ParameterTemplate, LinkByUID]]

Get the list of parameter template/bounds tuples.

Returns

List of this entity’s parameter template/bounds pairs

Return type

List[(ParameterTemplate, BaseBounds)]

property properties: List[Tuple[Union[PropertyTemplate, LinkByUID], Optional[BaseBounds]]]

Get the list of property template/bounds tuples.

Returns

List of this entity’s property template/bounds pairs

Return type

List[(PropertyTemplate, BaseBounds)]

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.

typ = 'measurement_template'
property uids: Dict[str, str]

A collection of unique IDs.

Requirements for and the value of unique IDs are discussed here.