Library

class ionworkspipeline.Library

A class to store a library of materials and their parameter values. The library is a dictionary of materials, each of which should be a dictionary with the following keys:

  • “name” (str): the name of the material

  • “description” (str): a description of the material

  • “parameter values” (dict): a dictionary of parameter values for the material

The “parameter values” dictionary should have the parameter names as keys, and the parameter values as values.

The library provides methods to search for materials and parameters.

See also: ionworks_schema.Library — field-level documentation.

classmethod from_schema(schema)

Construct from a validated ionworks_schema.library.Library instance.

The schema is a marker (no fields), since the pipeline Library loads its registered materials from installed entry points and has no caller-supplied state.

Parameters

schemaionworks_schema.library.Library

Validated schema instance (carries no state).

Returns

Library

A fresh pipeline Library.

property materials

Return a list of the materials in the library.

search_materials(name)

Search for materials in the library.

search_parameters(name)

Search for parameters in the library. This will print the parameter values matching the search term for each material in the library.

class ionworkspipeline.Material(material)

A class to store a information about material and its parameter values.

Parameters

materialdict or string

Explicit material dict or string reference to an material in the ionworkspipeline library. If a string is given, the material will be searched for in the library.

The material dict is a dictionary with the following keys:
  • “name” (str): the name of the material

  • “description” (str): a description of the material

  • “parameter values” (dict): a dictionary of parameter values for the material

See also: ionworks_schema.Material — field-level documentation.

classmethod from_schema(schema)

Construct from a validated ionworks_schema.library.Material instance.

The schema field is named parameter_values (underscore), but the pipeline Material constructor expects the dict key "parameter values" (with a space), so we map between them here.

Parameters

schemaionworks_schema.library.Material

Validated schema describing the material’s name, description, and parameter values.

Returns

Material

Pipeline Material initialised from the schema’s data.