ogstools.materiallib.core.material module#
- class ogstools.materiallib.core.material.Material[source]#
Bases:
Mapping[str,MaterialProperty]Represents a single material.
Can be constructed directly from YAML raw data.
Provides access to all properties.
Supports filtering by process schemas or property names.
- classmethod from_file(file_path)[source]#
Create a Material from a YAML file or return None if invalid.
- filter_process(process_schema)[source]#
Filter self, to only contain properties required by a given process.
- Return type:
- filter_properties(allowed, key='name')[source]#
Filter self, to only contain properties in ‘allowed’, preserving all extra fields (e.g. scope, unit).
- property duplicates: list[MaterialProperty]#
Returns all material properties with multiple definitions.
- copy(selection=None)[source]#
Return a deep copy, optionally with a filtered selection.
- Parameters:
selection (
dict[str,dict[str,str|Pattern]] |None) –Maps restrictions to different properties. They will be only present in the resulting copy, if the properties named in selection adhere to the given constraint. The values can be regular expressions. Shape: {“propertynames”: {“attributes”: “values”}}
Example:
{“saturation”: {“type”: re.compile(“SaturationVan.*”)}, “density”: {“type”: “Constant”, “source”: re.compile(“.*2018.*”)}}
- Return type: