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.

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

Adding new materials

New materials can be added to ionworkspipeline by creating a python package, and registering a entry point to iwp_materials. At a minimum, the package (cell_materials) should consist of the following:

cell_materials
├── pyproject.toml        # and/or setup.cfg, setup.py
└── src
    └── cell_materials
        └── cell_alpha.py

The actual parameter set is defined within cell_alpha.py, as shown below:

1CELL_ALPHA = {
2    "name": "Cell alpha",
3    "description": "My new material",
4    "parameter values": {
5        "a": 1,
6        "b": 2,
7        "c": 3,
8    },
9}

Then register CELL_ALPHA to iwp_materials in pyproject.toml:

[project.entry-points.iwp_materials]
cell_alpha = "cell_materials.cell_alpha:CELL_ALPHA"

If you are using setup.py or setup.cfg to setup your package, please see SetupTools’ documentation for registering entry points.