material_solvated
DEFAULTS = {'solvent_fraction': {'description': 'Fraction of solvent in layer.', 'value': 0.2, 'unit': 'dimensionless', 'min': 0, 'max': 1, 'fixed': True}}
module-attribute
Material
Bases: BaseCore
Source code in src/easyreflectometry/sample/elements/materials/material.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
__init__(sld=None, isld=None, name='EasyMaterial', unique_name=None, interface=None)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unique_name
|
Optional[str]
|
By default, None. |
None
|
sld
|
Union[Parameter, float, None]
|
Real scattering length density. By default, None. |
None
|
isld
|
Union[Parameter, float, None]
|
Imaginary scattering length density. By default, None. |
None
|
name
|
str
|
Name of the material. By default, 'EasyMaterial'. |
'EasyMaterial'
|
interface
|
Calculator interface. By default, None. |
None
|
Source code in src/easyreflectometry/sample/elements/materials/material.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
MaterialMixture
Bases: BaseCore
Source code in src/easyreflectometry/sample/elements/materials/material_mixture.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
fraction
property
writable
The Parameter that controls the mixing fraction of material_b in material_a.
__init__(material_a=None, material_b=None, fraction=None, name=None, unique_name=None, interface=None)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unique_name
|
Optional[str]
|
By default, None. |
None
|
material_a
|
Union[Material, None]
|
The first material. By default, None. |
None
|
material_b
|
Union[Material, None]
|
The second material. By default, None. |
None
|
fraction
|
Union[Parameter, float, None]
|
The fraction of material_b in material_a. By default, None. |
None
|
name
|
Union[str, None]
|
Name of the material. By default, None. |
None
|
interface
|
Calculator interface. By default, None. |
None
|
Source code in src/easyreflectometry/sample/elements/materials/material_mixture.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
from_dict(obj_dict)
classmethod
Re-attach mixed-sld dependencies after :class:ModelBase swaps in
the saved _fraction Parameter.
:class:ModelBase.from_dict runs __init__ (which builds the
_sld / _isld constraints against the temporary _fraction
created from the float kwargs) and then re-points self._fraction
at the persisted Parameter. The constraint graph still references the
temporary object, so subsequent mm.fraction = X mutations don't
propagate to _sld / _isld. Re-running _materials_constraints
here points the graph at the live objects.
Source code in src/easyreflectometry/sample/elements/materials/material_mixture.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
MaterialSolvated
Bases: MaterialMixture
Source code in src/easyreflectometry/sample/elements/materials/material_solvated.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |
material
property
writable
Get material.
solvent
property
writable
Get solvent.
solvent_fraction_parameter
property
Get the parameter for the fraction of layer described by the solvent.
solvent_fraction
property
writable
The Parameter for the fraction of the layer described by the solvent.
This might be the fraction of: - solvation where solvent is within the layer, or - patches of solvent in the layer where no material is present.
__init__(material=None, solvent=None, solvent_fraction=None, name=None, unique_name=None, interface=None)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unique_name
|
Optional[str]
|
By default, None. |
None
|
material
|
Union[Material, None]
|
The material being solvated. By default, None. |
None
|
solvent
|
Union[Material, None]
|
The solvent material. By default, None. |
None
|
solvent_fraction
|
Union[Parameter, float, None]
|
Fraction of solvent in layer. E.g. solvation or surface coverage. By default, None. |
None
|
name
|
Name of the material. By default, None. |
None
|
|
interface
|
Calculator interface. By default, None. |
None
|
Source code in src/easyreflectometry/sample/elements/materials/material_solvated.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
from_dict(obj_dict)
classmethod
Re-route the saved solvent_fraction Parameter onto _fraction.
:class:ModelBase.from_dict writes the saved Parameter to
_solvent_fraction because that's the constructor-arg name, but
the live solvent_fraction property returns self._fraction
(the field MaterialMixture maintains). Without this override the
saved fit metadata (fixed/bounds/etc.) is stranded on the unused
_solvent_fraction attribute and the active parameter keeps the
defaults from __init__.
Also re-runs _materials_constraints so the parent MaterialMixture's
mixed _sld / _isld depend on the live _fraction, not the
temporary Parameter created from the float kwarg.
Source code in src/easyreflectometry/sample/elements/materials/material_solvated.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
get_as_parameter(name, value, default_dict, unique_name_prefix=None)
This function creates a parameter for the variable name.
A parameter has a value and metadata.
If the value already is a parameter, it is returned. If the value is a number, a parameter is created with this value and metadata from the dictionary. If the value is None, a parameter is created with the default value and metadata from the dictionary.
param value: The value to use for the parameter. If None, the default value in the dictionary is used.
param name: The name of the parameter
param default_dict: Dictionary with entry for `name` containing the default value and metadata for the parameter
Source code in src/easyreflectometry/utils.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |