Material
- class openmsimodel.entity.base.material.Material(name: str, *, template: ClassVar[MaterialTemplate] = None, notes: str | None = None, process: Process | None = None, properties: list[PropertyAndConditions] | None = None, sample_type: SampleType | None = None)
Bases:
BaseElementBase element for materials.
- property spec: MaterialSpec
The underlying material spec.
- property run: MaterialRun
The underlying material run.
- classmethod from_spec_or_run(name: str, *, notes: str | None = None, spec: MaterialSpec = None, run: MaterialRun = None) Material
Instantiate a Material from a spec or run with appropriate validation.
Note that the spec’s template will be set to the class template, and the run’s spec will be set to this spec.
if a
- get_process_dict()
Get the names of the spec’s and run’s process.
- set_process(process: Process | None) None
Set the process that produces this material.
- process: {Process, None}
Process instance whose spec and run will be set as the process for the material’s spec and run, respectively. If
None, the material’s spec and run process will beNone.
- get_properties_and_conditions_dict()
Return a
dictof material spec properties and conditions. The keys are the names of the properties. Each value is adictwith the keys'property'and'conditions'. Each'property'key corresponds to anotherdictcontaining a valuedictand originstr. Each'condition'key corresponds to adictin which the keys are the names of the conditions associated with a particular property and the values are value/origindicts.
- update_properties_and_conditions(*properties: PropertyAndConditions, replace_all: bool = False) None
Change or add expected properties (with conditions) of the material spec.
- Parameters:
properties (PropertyAndConditions) –
replace_all (bool) – If
True, remove any existing properties before adding new ones.
- Default replace_all:
False
- remove_properties(*property_names: str) None
Remove expected properties from the material spec by name.
- property_names: str
The names of properties to remove.
- get_sample_type() SampleType
Get the sample type of the material run. sample_type: SampleType