volume_fraction
Volume fraction (occupancy) profiles of the components of a sample.
A volume fraction profile shows how much of the sample volume each component
(each distinct material) occupies as a function of depth. It is the natural
companion of the scattering length density (SLD) profile: where the SLD
profile shows one blended curve, the volume fraction profile separates it into
the lipid heads, the tails, the solvent, the substrate and so on, in the style
of refnx.reflect.create_occupancy.
The profile is built directly from the sample tree, without a calculator:
- every layer is decomposed into its constituent materials
(:class:
~easyreflectometry.sample.MaterialSolvatedand :class:~easyreflectometry.sample.MaterialMixtureare split with their fraction, repeating multilayers are expanded, gradient layers are read as a linear mixing gradient between their two end materials), and - the per-slab fractions are smeared across each interface with the same
error-function kernel the plotted SLD profile uses, so the fractions sum to
one at every depth and
sum_c rho_c * phi_c(z)reproduces the SLD profile whenever each component has the same SLD in every slab it occupies.
Conventions and caveats:
z = 0is the interface between the superphase and the first film layer andzincreases into the sample, the same convention as the refnx calculator's SLD profile.- The error-function kernel is the plotting convention shared with the SLD profile, not the Névot-Croce factor the reflectivity calculation uses; the curves are a model-derived in-plane average, not a measured concentration profile.
- Smearing is a sum of independent steps, so with very different roughness on
the two sides of a thin layer a fraction can dip below zero. The values are
returned unchanged (clipping or renormalising would change the model) and a
:class:
VolumeFractionWarningreports the excursion. - A
solvent_fractionmay describe lateral patchiness rather than solvation; the in-plane average is drawn either way. - For a :class:
~easyreflectometry.sample.LayerAreaPerMoleculethe fractions are those of the current material model, in which the solvent fraction acts as coverage of a layer whose molecule SLD isb / (thickness * area).
__all__ = ['DEFAULT_POINTS', 'NEGATIVE_FRACTION_TOLERANCE', 'VolumeFractionProfile', 'VolumeFractionWarning', 'volume_fraction_profile']
module-attribute
DEFAULT_POINTS = 500
module-attribute
NEGATIVE_FRACTION_TOLERANCE = 1e-06
module-attribute
_GRADIENT_RELATIVE_TOLERANCE = 1e-09
module-attribute
_GRADIENT_ABSOLUTE_TOLERANCE = 1e-12
module-attribute
_EQUIVALENCE_DECIMALS = 10
module-attribute
GradientLayer
Bases: BaseAssembly
A set of discrete gradient layers changing from the front to the back material.
The front layer is where the neutron beam starts in, it has an index of 0.
Source code in src/easyreflectometry/sample/assemblies/gradient_layer.py
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 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 | |
thickness
property
writable
Get the thickness of the gradient layer in Angstrom.
roughness
property
writable
Get the Roughness of the gradient layer in Angstrom.
__init__(front_material=None, back_material=None, thickness=2.0, roughness=0.2, discretisation_elements=10, name='EasyGradienLayer', unique_name=None, interface=None)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unique_name
|
Optional[str]
|
By default, None. |
None
|
front_material
|
Optional[Material]
|
Material of front of the layer. By default, None. |
None
|
back_material
|
Optional[Material]
|
Material of back of the layer. By default, None. |
None
|
thickness
|
Optional[float]
|
Thicknkess of the layer. By default, 2.0. |
2.0
|
roughness
|
Optional[float]
|
Roughness of the layer. By default, 0.2. |
0.2
|
discretisation_elements
|
int
|
Number of discrete layers. By default, 10. |
10
|
name
|
str
|
Name for gradient layer. By default, 'EasyGradienLayer'. |
'EasyGradienLayer'
|
interface
|
Calculator interface. By default, None. |
None
|
Source code in src/easyreflectometry/sample/assemblies/gradient_layer.py
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 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 | |
to_dict(skip=None)
Produces a cleaned dict using a custom to_dict method to skip necessary things.
The resulting dict matches the parameters in init: layers are derived
in __init__ from front_material/back_material/discretisation_elements
so they are excluded from the serialized representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skip
|
Optional[list[str]]
|
List of keys to skip. By default, None. |
None
|
Source code in src/easyreflectometry/sample/assemblies/gradient_layer.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | |
as_dict(skip=None)
Compatibility alias for :meth:to_dict.
Source code in src/easyreflectometry/sample/assemblies/gradient_layer.py
168 169 170 | |
RepeatingMultilayer
Bases: Multilayer
A repeating multi layer is build from a Multilayer and which it repeats
for a given number of times. This enables a computational efficiency in many
reflectometry engines as the operation can be performed for a single
Multilayer and cheaply combined for the appropriate number of
repetitions.
More information about the usage of this assembly is available in the
repeating multilayer documentation_
.. _repeating multilayer documentation: ../sample/assemblies_library.html#repeatingmultilayer
Source code in src/easyreflectometry/sample/assemblies/repeating_multilayer.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 | |
__init__(layers=None, repetitions=None, name='EasyRepeatingMultilayer', unique_name=None, interface=None, populate_if_none=True, conformal_thickness=False, conformal_roughness=False)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
populate_if_none
|
bool
|
By default, True. |
True
|
unique_name
|
Optional[str]
|
By default, None. |
None
|
layers
|
Union[LayerCollection, Layer, list[Layer], None]
|
The layers that make up the multi-layer that will be repeated. By default, None. |
None
|
repetitions
|
Union[Parameter, int, None]
|
Number of repetitions of the given series of layers. By default, None. |
None
|
name
|
str
|
Name for the repeating multi layer. By default, 'EasyRepeatingMultilayer'. |
'EasyRepeatingMultilayer'
|
interface
|
Calculator interface. By default, None. |
None
|
|
conformal_thickness
|
bool
|
Tie every layer's thickness to the front layer's (persisted). By default, False. |
False
|
conformal_roughness
|
bool
|
Tie every layer's roughness to the front layer's (persisted). By default, False. |
False
|
Source code in src/easyreflectometry/sample/assemblies/repeating_multilayer.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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
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 | |
Sample
Bases: BaseCollection
A sample is a collection of assemblies that represent the structure for which experimental measurements exist.
Source code in src/easyreflectometry/sample/collections/sample.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 | |
superphase
property
The superphase of the sample.
subphase
property
The subphase of the sample.
__init__(*assemblies, name='EasySample', interface=None, unique_name=None, populate_if_none=True, **kwargs)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
|
{}
|
|
populate_if_none
|
bool
|
By default, True. |
True
|
unique_name
|
Optional[str]
|
By default, None. |
None
|
*assemblies
|
Optional[List[BaseAssembly]]
|
The assemblies in the sample. |
()
|
name
|
str
|
Name of the sample. By default, 'EasySample'. |
'EasySample'
|
interface
|
Calculator interface. By default, None. |
None
|
Source code in src/easyreflectometry/sample/collections/sample.py
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 | |
add_assembly(assembly=None)
Add an assembly to the sample.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
assembly
|
Optional[BaseAssembly]
|
Assembly to add. By default, None. |
None
|
Source code in src/easyreflectometry/sample/collections/sample.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
duplicate_assembly(index)
Duplicate an assembly of the sample.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Index of the assembly to duplicate. |
required |
Source code in src/easyreflectometry/sample/collections/sample.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
move_up(index)
Move the assembly at the given index up in the sample.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Index of the assembly to move up. |
required |
Source code in src/easyreflectometry/sample/collections/sample.py
120 121 122 123 124 125 126 127 128 | |
move_down(index)
Move the assembly at the given index down in the sample.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Index of the assembly to move down. |
required |
Source code in src/easyreflectometry/sample/collections/sample.py
130 131 132 133 134 135 136 137 138 | |
remove_assembly(index)
Remove the assembly at the given index from the sample.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
int
|
Index of the assembly to remove. |
required |
Source code in src/easyreflectometry/sample/collections/sample.py
140 141 142 143 144 145 146 147 148 | |
volume_fraction_profile(z=None, *, max_delta_z=None, merge_equivalent=True)
Volume fraction (occupancy) of every component of the sample versus depth.
A thin wrapper around :func:easyreflectometry.sample.volume_fraction.volume_fraction_profile;
see there for the parameters, the depth convention and the caveats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
np.ndarray
|
Depths (Å) to evaluate at; |
None
|
max_delta_z
|
float
|
Maximum spacing of the default grid. Cannot be combined with |
None
|
merge_equivalent
|
bool
|
Merge materials with equal name and SLD into one component. By default, True. |
True
|
Returns:
| Type | Description |
|---|---|
VolumeFractionProfile
|
The per-component profiles, summing to one at every depth. |
Source code in src/easyreflectometry/sample/collections/sample.py
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 | |
Layer
Bases: BaseCore
Source code in src/easyreflectometry/sample/elements/layers/layer.py
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 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
rho_m_coupled
property
writable
Whether the layer's magnetic SLD is the material's rho_m
(a :class:~easyreflectometry.sample.MaterialMagnetic).
When True, magnetism.rho_m is a dependent parameter following the
current material; the layer keeps its own theta_m. Opt-in: layers of
one material may carry different net moments. Setting it attaches a
default :class:LayerMagnetism when the layer has none, and requires a
material with rho_m. Uncoupling keeps the current value. Removing
the magnetism, or a user unconstrain of rho_m, uncouples.
Only the layer's own wiring counts: a user constraint placed on
rho_m (:func:~easyreflectometry.constraints.constrain) reads as
uncoupled, is saved as the user constraint it is, and is left alone
when the material is later replaced. Setting this to True explicitly
replaces such a constraint with the coupling.
__init__(material=None, thickness=None, roughness=None, name='EasyLayer', unique_name=None, interface=None, magnetism=None, rho_m_coupled=False)
Constructor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unique_name
|
Optional[str]
|
By default, None. |
None
|
material
|
Union[Material, None]
|
The material for the layer. By default, None. |
None
|
thickness
|
Union[Parameter, float, None]
|
Layer thickness in Angstrom. By default, None. |
None
|
roughness
|
Union[Parameter, float, None]
|
Upper roughness on the layer in Angstrom. By default, None. |
None
|
magnetism
|
Union[LayerMagnetism, None]
|
Magnetic properties of the layer; None for a non-magnetic layer. By default, None. |
None
|
rho_m_coupled
|
bool
|
Take the magnetic SLD from the material (see :attr: |
False
|
name
|
str
|
Name of the layer. By default, 'EasyLayer'. |
'EasyLayer'
|
interface
|
Interface object. By default, None. |
None
|
Source code in src/easyreflectometry/sample/elements/layers/layer.py
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 | |
interface(new_interface)
Set the interface; runs generate_bindings and, for a magnetic layer,
enables magnetism on the calculator (raising if it does not support it).
Source code in src/easyreflectometry/sample/elements/layers/layer.py
115 116 117 118 119 120 121 122 | |
assign_material(material)
Assign a material to the layer interface.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material
|
Material
|
The material to assign to the layer. |
required |
Source code in src/easyreflectometry/sample/elements/layers/layer.py
258 259 260 261 262 263 264 265 266 267 268 269 270 | |
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 | |
VolumeFractionWarning
Bases: UserWarning
A volume fraction profile left the physically admissible range [0, 1].
Emitted by :func:volume_fraction_profile when the smeared fraction of a
component dips below zero, which happens when the roughness on the two
sides of a thin layer is very different. The values are reported
unchanged: the slab model, not the plot, is inadmissible there.
Source code in src/easyreflectometry/sample/volume_fraction.py
87 88 89 90 91 92 93 94 | |
_Slab
dataclass
One flat layer as the occupancy calculation sees it.
roughness is the roughness of the interface above the slab (between it
and the previous slab), which is what Layer.roughness stores and what
refnx's slab column 3 means.
Source code in src/easyreflectometry/sample/volume_fraction.py
97 98 99 100 101 102 103 104 105 106 107 108 109 | |
VolumeFractionProfile
dataclass
Volume fraction of every component of a sample versus depth.
Attributes:
| Name | Type | Description |
|---|---|---|
z |
np.ndarray
|
Depth in Å; |
fractions |
dict
|
Component key -> |
labels |
dict
|
Component key -> display label, unique within the profile. |
Source code in src/easyreflectometry/sample/volume_fraction.py
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 | |
components
property
The component keys, front to back.
total
property
sum_c phi_c(z); ones up to floating point error.
grouped(groups)
Merge components into named groups for presentation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
groups
|
Mapping[str, Sequence[str]]
|
Group label -> members, given as component keys or labels, e.g.
|
required |
Returns:
| Type | Description |
|---|---|
VolumeFractionProfile
|
A new profile; this one is left unchanged. |
Raises:
| Type | Description |
|---|---|
ValueError
|
A member is unknown, a component is listed twice, a group is empty, or a group label collides with a retained component. |
Source code in src/easyreflectometry/sample/volume_fraction.py
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 | |
_ComponentRegistry
Assigns stable keys and unique labels to the leaf materials of a sample.
Source code in src/easyreflectometry/sample/volume_fraction.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
volume_fraction_profile(sample, z=None, *, max_delta_z=None, merge_equivalent=True)
Erf-smeared volume fraction of every component of sample versus depth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample
|
Sample
|
The sample. It does not need to be bound to a calculator. |
required |
z
|
np.ndarray
|
Depths (Å) at which to evaluate the profile, |
None
|
max_delta_z
|
float
|
Maximum spacing of the default grid; raises the point count above
:data: |
None
|
merge_equivalent
|
bool
|
Merge materials the calculator cannot tell apart (equal name, SLD and
imaginary SLD) into one component, so that the several default solvent
objects of a bilayer come out as one "D2O" trace and its two head
groups as one trace. |
True
|
Returns:
| Type | Description |
|---|---|
VolumeFractionProfile
|
The profile. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The sample has fewer than two layers, both |
Warns:
| Type | Description |
|---|---|
VolumeFractionWarning
|
A fraction dips below |
Source code in src/easyreflectometry/sample/volume_fraction.py
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 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
_composition(material)
Leaf materials of material with their volume fractions, which sum to one.
A MaterialMixture (and so a MaterialSolvated) is split into its two
parts weighted by its fraction; the recursion covers nested mixtures should
they become constructible. Anything else is a leaf.
Source code in src/easyreflectometry/sample/volume_fraction.py
276 277 278 279 280 281 282 283 284 285 286 287 288 | |
_scalar(value)
Float value of a Parameter or a plain number.
Source code in src/easyreflectometry/sample/volume_fraction.py
325 326 327 | |
_layer_entries(sample)
Yield (layer, composition) front to back, with repetitions expanded.
Source code in src/easyreflectometry/sample/volume_fraction.py
330 331 332 333 334 335 336 337 338 339 340 341 342 | |
_gradient_entries(assembly)
Sub-layer i of N is the i/N blend of the two end materials.
That is how GradientLayer builds its sub-layers, but it freezes them at
construction, so the blend is checked against each sub-layer's actual SLD
and a stale gradient is refused rather than silently reinterpreted.
Source code in src/easyreflectometry/sample/volume_fraction.py
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | |
_resolve_slabs(sample, merge_equivalent=True)
Flatten sample into (slabs, labels).
The first and last slabs are the superphase and subphase of the expanded list; their thickness is forced to zero as the calculators do.
Source code in src/easyreflectometry/sample/volume_fraction.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | |
_check_finite(layer, thickness, roughness, composition)
Source code in src/easyreflectometry/sample/volume_fraction.py
403 404 405 406 407 | |
_default_grid(slabs, max_delta_z)
refnx's grid: the film plus four outer roughnesses and 5 Å on each side.
Source code in src/easyreflectometry/sample/volume_fraction.py
413 414 415 416 417 418 419 420 421 422 423 424 | |
_validated_grid(z)
Source code in src/easyreflectometry/sample/volume_fraction.py
427 428 429 430 431 432 433 | |
_smear(z, interfaces, sigmas, values)
Sum of erf steps: values[0] + sum_i (values[i+1] - values[i]) * H_sigma_i(z - interfaces[i]).
This is refnx's sld_profile loop applied to an arbitrary per-slab
quantity. It is O(interfaces x points); plenty for hundreds of interfaces.
Should a many-thousand-repetition stack ever need it, vectorise as
steps @ H(z[None, :], interfaces[:, None], sigmas[:, None]).
Source code in src/easyreflectometry/sample/volume_fraction.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | |
_warn_if_inadmissible(z, fractions, labels)
Source code in src/easyreflectometry/sample/volume_fraction.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |