gemd 2.2.0__tar.gz → 2.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gemd-2.3.2/PKG-INFO +38 -0
- gemd-2.3.2/gemd/__init__.py +82 -0
- gemd-2.3.2/gemd/__version__.py +1 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/builders/__init__.py +6 -1
- {gemd-2.2.0 → gemd-2.3.2}/gemd/builders/impl.py +116 -101
- gemd-2.3.2/gemd/demo/cake.py +1060 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/demo/material_run_example.py +15 -21
- {gemd-2.2.0 → gemd-2.3.2}/gemd/demo/measurement_example.py +11 -12
- gemd-2.3.2/gemd/demo/strehlow_and_cook.py +563 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/demo/table_example.py +7 -4
- gemd-2.3.2/gemd/entity/__init__.py +83 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/attribute/__init__.py +1 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/attribute/base_attribute.py +19 -19
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/attribute/condition.py +3 -4
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/attribute/parameter.py +3 -4
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/attribute/property.py +3 -4
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/attribute/property_and_conditions.py +8 -9
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/base_entity.py +24 -26
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/bounds/__init__.py +8 -2
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/bounds/base_bounds.py +5 -7
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/bounds/categorical_bounds.py +17 -19
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/bounds/composition_bounds.py +20 -21
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/bounds/integer_bounds.py +20 -18
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/bounds/molecular_structure_bounds.py +18 -19
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/bounds/real_bounds.py +28 -29
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/bounds_validation.py +2 -3
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/case_insensitive_dict.py +12 -20
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/dict_serializable.py +34 -31
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/file_link.py +2 -2
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/has_dependencies.py +2 -1
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/link_by_uid.py +4 -5
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/__init__.py +11 -2
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/base_object.py +12 -13
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_conditions.py +6 -5
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_material.py +4 -3
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_parameters.py +6 -5
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_process.py +4 -3
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_properties.py +6 -5
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_quantities.py +15 -15
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_source.py +1 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_spec.py +7 -5
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_template.py +7 -5
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/has_template_check_generator.py +14 -15
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/ingredient_run.py +45 -38
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/ingredient_spec.py +41 -34
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/material_run.py +26 -23
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/material_spec.py +33 -29
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/measurement_run.py +42 -32
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/measurement_spec.py +26 -24
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/process_run.py +36 -28
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/object/process_spec.py +33 -26
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/setters.py +14 -13
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/source/performed_source.py +1 -2
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/__init__.py +9 -2
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/attribute_template.py +2 -2
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/base_template.py +27 -25
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/has_condition_templates.py +31 -24
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/has_parameter_templates.py +31 -24
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/has_property_templates.py +32 -27
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/material_template.py +4 -8
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/measurement_template.py +21 -10
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/process_template.py +18 -11
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/util.py +30 -31
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/valid_list.py +20 -24
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/__init__.py +14 -6
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/base_value.py +5 -6
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/categorical_value.py +5 -6
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/composition_value.py +4 -4
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/continuous_value.py +10 -9
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/discrete_categorical.py +5 -6
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/empirical_formula.py +8 -9
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/inchi_value.py +10 -11
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/integer_value.py +4 -4
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/molecular_value.py +4 -4
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/nominal_categorical.py +4 -5
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/nominal_composition.py +4 -5
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/nominal_integer.py +5 -6
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/nominal_real.py +8 -10
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/normal_real.py +5 -8
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/smiles_value.py +5 -6
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/uniform_integer.py +10 -13
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/value/uniform_real.py +8 -10
- {gemd-2.2.0 → gemd-2.3.2}/gemd/enumeration/base_enumeration.py +18 -18
- {gemd-2.2.0 → gemd-2.3.2}/gemd/enumeration/origin.py +1 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/enumeration/sample_type.py +1 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/json/__init__.py +5 -12
- {gemd-2.2.0 → gemd-2.3.2}/gemd/json/gemd_json.py +30 -36
- gemd-2.3.2/gemd/units/__init__.py +20 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/units/impl.py +76 -80
- gemd-2.3.2/gemd/util/__init__.py +24 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/util/impl.py +109 -81
- gemd-2.3.2/gemd.egg-info/PKG-INFO +38 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd.egg-info/SOURCES.txt +2 -6
- gemd-2.3.2/gemd.egg-info/requires.txt +5 -0
- gemd-2.3.2/gemd.egg-info/top_level.txt +1 -0
- gemd-2.3.2/pyproject.toml +106 -0
- {gemd-2.2.0 → gemd-2.3.2}/tests/test_examples.py +43 -48
- gemd-2.2.0/PKG-INFO +0 -18
- gemd-2.2.0/gemd/__init__.py +0 -30
- gemd-2.2.0/gemd/__version__.py +0 -1
- gemd-2.2.0/gemd/demo/cake.py +0 -1100
- gemd-2.2.0/gemd/demo/strehlow_and_cook.py +0 -497
- gemd-2.2.0/gemd/entity/__init__.py +0 -29
- gemd-2.2.0/gemd/units/__init__.py +0 -8
- gemd-2.2.0/gemd/util/__init__.py +0 -8
- gemd-2.2.0/gemd.egg-info/PKG-INFO +0 -18
- gemd-2.2.0/gemd.egg-info/requires.txt +0 -22
- gemd-2.2.0/gemd.egg-info/top_level.txt +0 -2
- gemd-2.2.0/setup.py +0 -67
- gemd-2.2.0/tests/__init__.py +0 -0
- gemd-2.2.0/tests/units/__init__.py +0 -0
- gemd-2.2.0/tests/units/test_parser.py +0 -233
- gemd-2.2.0/tests/units/test_units.txt +0 -4
- {gemd-2.2.0 → gemd-2.3.2}/LICENSE +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/README.md +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/demo/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/demo/strehlow_and_cook.pif +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/demo/strehlow_and_cook_small.pif +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/demo/toothpick.jpg +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/source/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/condition_template.py +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/parameter_template.py +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/entity/template/property_template.py +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/enumeration/__init__.py +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/json/gemd_encoder.py +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/units/citrine_en.txt +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd/units/constants_en.txt +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/gemd.egg-info/dependency_links.txt +0 -0
- {gemd-2.2.0 → gemd-2.3.2}/setup.cfg +0 -0
gemd-2.3.2/PKG-INFO
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gemd
|
|
3
|
+
Version: 2.3.2
|
|
4
|
+
Summary: Python binding for Citrine's GEMD data model
|
|
5
|
+
Author: Citrine Informatics
|
|
6
|
+
Project-URL: Homepage, http://github.com/CitrineInformatics/gemd-python
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: pint<0.25,>=0.24.4
|
|
17
|
+
Requires-Dist: deprecation<3,>=2.1.0
|
|
18
|
+
Requires-Dist: typing_extensions<5,>=4.8; python_version < "3.10"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# GEMD-python
|
|
22
|
+
Python binding for Citrine's data model, GEMD.
|
|
23
|
+
|
|
24
|
+
This package provides a framework for storing information about the processes that create materials, the materials themselves, and measurements performed on those materials.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
To install `gemd`, you can simply:
|
|
29
|
+
```bash
|
|
30
|
+
$ pip install gemd
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Detailed documentation of the `GEMD` data model can be found in the [language-agnostic documentation](https://citrineinformatics.github.io/gemd-docs/).
|
|
34
|
+
Documentation of this package can be found [here](https://citrineinformatics.github.io/gemd-python/).
|
|
35
|
+
|
|
36
|
+
## Developer instructions
|
|
37
|
+
|
|
38
|
+
See the [contributing guide](./CONTRIBUTING.md).
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""Data concepts library."""
|
|
2
|
+
|
|
3
|
+
from .__version__ import __version__ # noqa: F401
|
|
4
|
+
from .entity import (
|
|
5
|
+
CategoricalBounds,
|
|
6
|
+
CompositionBounds,
|
|
7
|
+
Condition,
|
|
8
|
+
ConditionTemplate,
|
|
9
|
+
DiscreteCategorical,
|
|
10
|
+
EmpiricalFormula,
|
|
11
|
+
FileLink, # noqa: F401
|
|
12
|
+
InChI,
|
|
13
|
+
IngredientRun,
|
|
14
|
+
IngredientSpec,
|
|
15
|
+
IntegerBounds,
|
|
16
|
+
LinkByUID,
|
|
17
|
+
MaterialRun,
|
|
18
|
+
MaterialSpec,
|
|
19
|
+
MaterialTemplate,
|
|
20
|
+
MeasurementRun,
|
|
21
|
+
MeasurementSpec,
|
|
22
|
+
MeasurementTemplate,
|
|
23
|
+
MolecularStructureBounds,
|
|
24
|
+
NominalCategorical,
|
|
25
|
+
NominalComposition,
|
|
26
|
+
NominalInteger,
|
|
27
|
+
NominalReal,
|
|
28
|
+
NormalReal,
|
|
29
|
+
Parameter,
|
|
30
|
+
ParameterTemplate,
|
|
31
|
+
PerformedSource,
|
|
32
|
+
ProcessRun,
|
|
33
|
+
ProcessSpec,
|
|
34
|
+
ProcessTemplate,
|
|
35
|
+
Property,
|
|
36
|
+
PropertyAndConditions,
|
|
37
|
+
PropertyTemplate,
|
|
38
|
+
RealBounds,
|
|
39
|
+
Smiles,
|
|
40
|
+
UniformInteger,
|
|
41
|
+
UniformReal,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"Condition",
|
|
46
|
+
"Parameter",
|
|
47
|
+
"Property",
|
|
48
|
+
"PropertyAndConditions",
|
|
49
|
+
"CategoricalBounds",
|
|
50
|
+
"CompositionBounds",
|
|
51
|
+
"IntegerBounds",
|
|
52
|
+
"MolecularStructureBounds",
|
|
53
|
+
"RealBounds",
|
|
54
|
+
"MaterialRun",
|
|
55
|
+
"MeasurementRun",
|
|
56
|
+
"ProcessRun",
|
|
57
|
+
"IngredientRun",
|
|
58
|
+
"MaterialSpec",
|
|
59
|
+
"MeasurementSpec",
|
|
60
|
+
"ProcessSpec",
|
|
61
|
+
"IngredientSpec",
|
|
62
|
+
"PerformedSource",
|
|
63
|
+
"PropertyTemplate",
|
|
64
|
+
"ConditionTemplate",
|
|
65
|
+
"ParameterTemplate",
|
|
66
|
+
"MaterialTemplate",
|
|
67
|
+
"MeasurementTemplate",
|
|
68
|
+
"ProcessTemplate",
|
|
69
|
+
"NominalReal",
|
|
70
|
+
"NormalReal",
|
|
71
|
+
"UniformReal",
|
|
72
|
+
"NominalInteger",
|
|
73
|
+
"UniformInteger",
|
|
74
|
+
"DiscreteCategorical",
|
|
75
|
+
"NominalCategorical",
|
|
76
|
+
"EmpiricalFormula",
|
|
77
|
+
"NominalComposition",
|
|
78
|
+
"InChI",
|
|
79
|
+
"Smiles",
|
|
80
|
+
"LinkByUID",
|
|
81
|
+
"FileLink",
|
|
82
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.3.2"
|
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
from .impl import make_node, add_edge, add_measurement, add_attribute, make_attribute, make_value
|
|
3
3
|
|
|
4
4
|
__all__ = [
|
|
5
|
-
"make_node",
|
|
5
|
+
"make_node",
|
|
6
|
+
"add_edge",
|
|
7
|
+
"add_measurement",
|
|
8
|
+
"add_attribute",
|
|
9
|
+
"make_attribute",
|
|
10
|
+
"make_value",
|
|
6
11
|
]
|
|
@@ -1,35 +1,66 @@
|
|
|
1
1
|
# Tools to help build GEMD objects
|
|
2
|
-
from
|
|
3
|
-
|
|
2
|
+
from typing import List, Union
|
|
3
|
+
|
|
4
|
+
from gemd.entity.attribute import Condition, Parameter, Property, PropertyAndConditions
|
|
5
|
+
from gemd.entity.attribute.base_attribute import BaseAttribute
|
|
6
|
+
from gemd.entity.bounds import (
|
|
7
|
+
CategoricalBounds,
|
|
8
|
+
CompositionBounds,
|
|
9
|
+
IntegerBounds,
|
|
10
|
+
MolecularStructureBounds,
|
|
11
|
+
RealBounds,
|
|
12
|
+
)
|
|
13
|
+
from gemd.entity.bounds.base_bounds import BaseBounds
|
|
14
|
+
from gemd.entity.object import (
|
|
15
|
+
IngredientRun,
|
|
16
|
+
IngredientSpec,
|
|
17
|
+
MaterialRun,
|
|
18
|
+
MaterialSpec,
|
|
19
|
+
MeasurementRun,
|
|
20
|
+
MeasurementSpec,
|
|
21
|
+
ProcessRun,
|
|
22
|
+
ProcessSpec,
|
|
23
|
+
)
|
|
4
24
|
from gemd.entity.object.has_conditions import HasConditions
|
|
5
25
|
from gemd.entity.object.has_parameters import HasParameters
|
|
6
26
|
from gemd.entity.object.has_properties import HasProperties
|
|
7
|
-
from gemd.entity.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
from gemd.entity.template import (
|
|
28
|
+
ConditionTemplate,
|
|
29
|
+
MaterialTemplate,
|
|
30
|
+
MeasurementTemplate,
|
|
31
|
+
ParameterTemplate,
|
|
32
|
+
ProcessTemplate,
|
|
33
|
+
PropertyTemplate,
|
|
34
|
+
)
|
|
35
|
+
from gemd.entity.value import (
|
|
36
|
+
EmpiricalFormula,
|
|
37
|
+
InChI,
|
|
38
|
+
NominalCategorical,
|
|
39
|
+
NominalInteger,
|
|
40
|
+
NominalReal,
|
|
41
|
+
Smiles,
|
|
42
|
+
)
|
|
17
43
|
from gemd.entity.value.base_value import BaseValue
|
|
18
|
-
|
|
19
|
-
from typing import Union, List
|
|
44
|
+
from gemd.entity.value.continuous_value import ContinuousValue
|
|
20
45
|
|
|
21
46
|
__all__ = [
|
|
22
|
-
"make_node",
|
|
47
|
+
"make_node",
|
|
48
|
+
"add_edge",
|
|
49
|
+
"add_measurement",
|
|
50
|
+
"add_attribute",
|
|
51
|
+
"make_attribute",
|
|
52
|
+
"make_value",
|
|
23
53
|
]
|
|
24
54
|
|
|
25
55
|
|
|
26
|
-
def make_node(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
56
|
+
def make_node(
|
|
57
|
+
name: str,
|
|
58
|
+
*,
|
|
59
|
+
process_name: str = None,
|
|
60
|
+
process_template: ProcessTemplate = None,
|
|
61
|
+
material_template: MaterialTemplate = None,
|
|
62
|
+
) -> MaterialRun:
|
|
63
|
+
"""Generate a material-process spec-run quadruple.
|
|
33
64
|
|
|
34
65
|
Parameters
|
|
35
66
|
----------
|
|
@@ -46,7 +77,7 @@ def make_node(name: str,
|
|
|
46
77
|
:class:`~gemd.entity.template.material_template.MaterialTemplate` for the quadruple.
|
|
47
78
|
|
|
48
79
|
Returns
|
|
49
|
-
|
|
80
|
+
-------
|
|
50
81
|
~gemd.entity.object.material_run.MaterialRun
|
|
51
82
|
A :class:`~gemd.entity.object.material_run.MaterialRun` with linked processes,
|
|
52
83
|
specs and templates
|
|
@@ -58,42 +89,28 @@ def make_node(name: str,
|
|
|
58
89
|
else:
|
|
59
90
|
process_name = process_template.name
|
|
60
91
|
|
|
61
|
-
my_process_spec = ProcessSpec(
|
|
62
|
-
name=process_name,
|
|
63
|
-
template=process_template
|
|
64
|
-
)
|
|
92
|
+
my_process_spec = ProcessSpec(name=process_name, template=process_template)
|
|
65
93
|
|
|
66
|
-
my_process_run = ProcessRun(
|
|
67
|
-
name=process_name,
|
|
68
|
-
spec=my_process_spec
|
|
69
|
-
)
|
|
94
|
+
my_process_run = ProcessRun(name=process_name, spec=my_process_spec)
|
|
70
95
|
|
|
71
|
-
my_mat_spec = MaterialSpec(
|
|
72
|
-
name=name,
|
|
73
|
-
process=my_process_spec,
|
|
74
|
-
template=material_template
|
|
75
|
-
)
|
|
96
|
+
my_mat_spec = MaterialSpec(name=name, process=my_process_spec, template=material_template)
|
|
76
97
|
|
|
77
|
-
my_mat_run = MaterialRun(
|
|
78
|
-
name=name,
|
|
79
|
-
process=my_process_run,
|
|
80
|
-
spec=my_mat_spec
|
|
81
|
-
)
|
|
98
|
+
my_mat_run = MaterialRun(name=name, process=my_process_run, spec=my_mat_spec)
|
|
82
99
|
return my_mat_run
|
|
83
100
|
|
|
84
101
|
|
|
85
|
-
def add_edge(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Connect two material-process spec-run quadruples with ingredients.
|
|
102
|
+
def add_edge(
|
|
103
|
+
input_material: MaterialRun,
|
|
104
|
+
output_material: MaterialRun,
|
|
105
|
+
*,
|
|
106
|
+
name: str = None,
|
|
107
|
+
mass_fraction: Union[float, ContinuousValue] = None,
|
|
108
|
+
number_fraction: Union[float, ContinuousValue] = None,
|
|
109
|
+
volume_fraction: Union[float, ContinuousValue] = None,
|
|
110
|
+
absolute_quantity: Union[int, float, ContinuousValue] = None,
|
|
111
|
+
absolute_units: str = None,
|
|
112
|
+
) -> IngredientRun:
|
|
113
|
+
"""Connect two material-process spec-run quadruples with ingredients.
|
|
97
114
|
|
|
98
115
|
Parameters
|
|
99
116
|
----------
|
|
@@ -132,45 +149,43 @@ def add_edge(input_material: MaterialRun,
|
|
|
132
149
|
The absolute units. Required if absolute_quantity is provided as a float
|
|
133
150
|
|
|
134
151
|
Returns
|
|
135
|
-
|
|
152
|
+
-------
|
|
136
153
|
~gemd.entity.object.ingredient_run.IngredientRun
|
|
137
154
|
A :class:`~gemd.entity.object.ingredient_run.IngredientRun`
|
|
138
155
|
with linked processes, specs and materials
|
|
139
156
|
|
|
140
157
|
"""
|
|
141
158
|
output_spec = output_material.spec
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
spec_linked = isinstance(output_spec, MaterialSpec) and output_spec.process is not None
|
|
160
|
+
if not spec_linked or output_material.process is None:
|
|
161
|
+
raise ValueError(
|
|
162
|
+
"Output Material must be a MaterialRun with connected Specs and Processes."
|
|
163
|
+
)
|
|
147
164
|
if input_material.spec is None:
|
|
148
165
|
raise ValueError("Input Material must be a MaterialRun with connected Spec.")
|
|
149
166
|
|
|
150
167
|
if name is None:
|
|
151
168
|
name = input_material.name
|
|
152
|
-
my_ingredient_spec = IngredientSpec(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
material=input_material
|
|
159
|
-
)
|
|
169
|
+
my_ingredient_spec = IngredientSpec(
|
|
170
|
+
name=name, process=output_spec.process, material=input_material.spec
|
|
171
|
+
)
|
|
172
|
+
my_ingredient_run = IngredientRun(
|
|
173
|
+
spec=my_ingredient_spec, process=output_material.process, material=input_material
|
|
174
|
+
)
|
|
160
175
|
|
|
161
176
|
if mass_fraction is not None:
|
|
162
177
|
if isinstance(mass_fraction, float):
|
|
163
|
-
mass_fraction = NominalReal(nominal=mass_fraction, units=
|
|
178
|
+
mass_fraction = NominalReal(nominal=mass_fraction, units="")
|
|
164
179
|
my_ingredient_run.mass_fraction = mass_fraction
|
|
165
180
|
|
|
166
181
|
if number_fraction is not None:
|
|
167
182
|
if isinstance(number_fraction, float):
|
|
168
|
-
number_fraction = NominalReal(nominal=number_fraction, units=
|
|
183
|
+
number_fraction = NominalReal(nominal=number_fraction, units="")
|
|
169
184
|
my_ingredient_run.number_fraction = number_fraction
|
|
170
185
|
|
|
171
186
|
if volume_fraction is not None:
|
|
172
187
|
if isinstance(volume_fraction, float):
|
|
173
|
-
volume_fraction = NominalReal(nominal=volume_fraction, units=
|
|
188
|
+
volume_fraction = NominalReal(nominal=volume_fraction, units="")
|
|
174
189
|
my_ingredient_run.volume_fraction = volume_fraction
|
|
175
190
|
|
|
176
191
|
if absolute_quantity is not None:
|
|
@@ -182,20 +197,21 @@ def add_edge(input_material: MaterialRun,
|
|
|
182
197
|
my_ingredient_run.absolute_quantity = absolute_quantity
|
|
183
198
|
|
|
184
199
|
if absolute_units is not None:
|
|
185
|
-
raise ValueError(
|
|
186
|
-
|
|
200
|
+
raise ValueError(
|
|
201
|
+
"Absolute Units are only used if Absolute Quantity is given as is a float."
|
|
202
|
+
)
|
|
187
203
|
|
|
188
204
|
return my_ingredient_run
|
|
189
205
|
|
|
190
206
|
|
|
191
|
-
def add_measurement(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
Add a measurement run-spec set to a :class:`~gemd.entity.object.material_run.MaterialRun`.
|
|
207
|
+
def add_measurement(
|
|
208
|
+
material: MaterialRun,
|
|
209
|
+
*,
|
|
210
|
+
name: str = None,
|
|
211
|
+
template: MeasurementTemplate = None,
|
|
212
|
+
attributes: List[BaseAttribute] = None,
|
|
213
|
+
) -> MeasurementRun:
|
|
214
|
+
"""Add a measurement run-spec set to a :class:`~gemd.entity.object.material_run.MaterialRun`.
|
|
199
215
|
|
|
200
216
|
Parameters
|
|
201
217
|
----------
|
|
@@ -218,7 +234,7 @@ def add_measurement(material: MaterialRun,
|
|
|
218
234
|
and/or :class:`Properties <gemd.entity.attribute.property.Property>`.
|
|
219
235
|
|
|
220
236
|
Returns
|
|
221
|
-
|
|
237
|
+
-------
|
|
222
238
|
~gemd.entity.object.measurement_run.MeasurementRun
|
|
223
239
|
A :class:`~gemd.entity.object.measurement_run.MeasurementRun`
|
|
224
240
|
with linked material, spec and template
|
|
@@ -247,12 +263,12 @@ def add_measurement(material: MaterialRun,
|
|
|
247
263
|
return my_measurement_run
|
|
248
264
|
|
|
249
265
|
|
|
250
|
-
def add_attribute(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
Generate an attribute, and then add it attribute to a GEMD object.
|
|
266
|
+
def add_attribute(
|
|
267
|
+
target: Union[HasProperties, HasConditions, HasParameters],
|
|
268
|
+
template: Union[PropertyTemplate, ConditionTemplate, ParameterTemplate],
|
|
269
|
+
value: Union[BaseValue, str, float, int],
|
|
270
|
+
) -> Union[Property, Condition, Parameter]:
|
|
271
|
+
"""Generate an attribute, and then add it attribute to a GEMD object.
|
|
256
272
|
|
|
257
273
|
Parameters
|
|
258
274
|
----------
|
|
@@ -265,7 +281,7 @@ def add_attribute(target: Union[HasProperties, HasConditions, HasParameters],
|
|
|
265
281
|
attempt to generate an appropriate :class:`BaseValue` subclass given a str, float or int.
|
|
266
282
|
|
|
267
283
|
Returns
|
|
268
|
-
|
|
284
|
+
-------
|
|
269
285
|
BaseAttribute
|
|
270
286
|
The generated attribute
|
|
271
287
|
|
|
@@ -278,8 +294,9 @@ def add_attribute(target: Union[HasProperties, HasConditions, HasParameters],
|
|
|
278
294
|
target.properties.append(PropertyAndConditions(property=attribute))
|
|
279
295
|
elif attr_class is Condition:
|
|
280
296
|
if len(target.properties) == 0:
|
|
281
|
-
raise ValueError(
|
|
282
|
-
|
|
297
|
+
raise ValueError(
|
|
298
|
+
"Cannot add a condition to a MaterialSpec before it has at least one property."
|
|
299
|
+
)
|
|
283
300
|
target.properties[-1].conditions.append(attribute)
|
|
284
301
|
else:
|
|
285
302
|
raise ValueError(f"Attribute {attr_class} is incompatible with target {type(target)}.")
|
|
@@ -296,11 +313,11 @@ def add_attribute(target: Union[HasProperties, HasConditions, HasParameters],
|
|
|
296
313
|
return attribute
|
|
297
314
|
|
|
298
315
|
|
|
299
|
-
def make_attribute(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
Generate an Attribute and the contained Value.
|
|
316
|
+
def make_attribute(
|
|
317
|
+
template: Union[PropertyTemplate, ConditionTemplate, ParameterTemplate],
|
|
318
|
+
value: Union[BaseValue, str, float, int],
|
|
319
|
+
) -> Union[Property, Condition, Parameter]:
|
|
320
|
+
"""Generate an Attribute and the contained Value.
|
|
304
321
|
|
|
305
322
|
Parameters
|
|
306
323
|
----------
|
|
@@ -311,7 +328,7 @@ def make_attribute(template: Union[PropertyTemplate, ConditionTemplate, Paramete
|
|
|
311
328
|
attempt to generate an appropriate Value given a str, float or int.
|
|
312
329
|
|
|
313
330
|
Returns
|
|
314
|
-
|
|
331
|
+
-------
|
|
315
332
|
BaseAttribute
|
|
316
333
|
The generated attribute
|
|
317
334
|
|
|
@@ -333,10 +350,8 @@ def make_attribute(template: Union[PropertyTemplate, ConditionTemplate, Paramete
|
|
|
333
350
|
return attribute
|
|
334
351
|
|
|
335
352
|
|
|
336
|
-
def make_value(value: Union[str, float, int],
|
|
337
|
-
|
|
338
|
-
"""
|
|
339
|
-
Generate a Value object based upon a number or string and a particular bounds.
|
|
353
|
+
def make_value(value: Union[str, float, int], bounds: BaseBounds) -> BaseValue:
|
|
354
|
+
"""Generate a Value object based upon a number or string and a particular bounds.
|
|
340
355
|
|
|
341
356
|
Parameters
|
|
342
357
|
----------
|
|
@@ -346,7 +361,7 @@ def make_value(value: Union[str, float, int],
|
|
|
346
361
|
The bounds type to determine which value type we want to coerce the value into
|
|
347
362
|
|
|
348
363
|
Returns
|
|
349
|
-
|
|
364
|
+
-------
|
|
350
365
|
BaseValue
|
|
351
366
|
The generated value
|
|
352
367
|
|