experiments
categories
background
base
BackgroundBase
Bases: CategoryCollection
Abstract base for background subcategories in experiments.
Concrete implementations provide parameterized background models and compute background intensities on the experiment grid.
Source code in src/easydiffraction/experiments/categories/background/base.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
calculate(x_data)
abstractmethod
Compute background values for the provided x grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_data
|
Any
|
X positions (e.g. 2θ, TOF) at which to evaluate. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
Background intensity array aligned with |
Source code in src/easydiffraction/experiments/categories/background/base.py
19 20 21 22 23 24 25 26 27 28 29 | |
show()
abstractmethod
Print a human-readable view of background components.
Source code in src/easydiffraction/experiments/categories/background/base.py
32 33 34 35 | |
chebyshev
Chebyshev polynomial background model.
Provides a collection of polynomial terms and evaluation helpers.
ChebyshevPolynomialBackground
Bases: BackgroundBase
Source code in src/easydiffraction/experiments/categories/background/chebyshev.py
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 | |
calculate(x_data)
Evaluate polynomial background over x_data.
Source code in src/easydiffraction/experiments/categories/background/chebyshev.py
91 92 93 94 95 96 97 98 99 100 | |
show()
Print a table of polynomial orders and coefficients.
Source code in src/easydiffraction/experiments/categories/background/chebyshev.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
PolynomialTerm
Bases: CategoryItem
Chebyshev polynomial term.
New public attribute names: order and coef replacing the
longer chebyshev_order / chebyshev_coef. Backward-compatible
aliases are kept so existing serialized data / external code does
not break immediately. Tests should migrate to the short names.
Source code in src/easydiffraction/experiments/categories/background/chebyshev.py
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 | |
enums
Enumerations for background model types.
BackgroundTypeEnum
Bases: str, Enum
Supported background model types.
Source code in src/easydiffraction/experiments/categories/background/enums.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
default()
classmethod
Return a default background type.
Source code in src/easydiffraction/experiments/categories/background/enums.py
17 18 19 20 | |
description()
Human-friendly description for the enum value.
Source code in src/easydiffraction/experiments/categories/background/enums.py
22 23 24 25 26 27 | |
factory
Background collection entry point (public facade).
End users should import Background classes from this module. Internals
live under the package
easydiffraction.experiments.category_collections.background_types
and are re-exported here for a stable and readable API.
BackgroundFactory
Create background collections by type.
Source code in src/easydiffraction/experiments/categories/background/factory.py
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 | |
create(background_type=None)
classmethod
Instantiate a background collection of requested type.
If type is None, the default enum value is used.
Source code in src/easydiffraction/experiments/categories/background/factory.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
line_segment
Line-segment background model.
Interpolate user-specified points to form a background curve.
LineSegment
Bases: CategoryItem
Single background control point for interpolation.
Source code in src/easydiffraction/experiments/categories/background/line_segment.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 80 | |
LineSegmentBackground
Bases: BackgroundBase
Source code in src/easydiffraction/experiments/categories/background/line_segment.py
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 | |
calculate(x_data)
Interpolate background points over x_data.
Source code in src/easydiffraction/experiments/categories/background/line_segment.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
show()
Print a table of control points (x, intensity).
Source code in src/easydiffraction/experiments/categories/background/line_segment.py
107 108 109 110 111 112 113 114 115 116 117 118 | |
excluded_regions
Exclude ranges of x from fitting/plotting (masked regions).
ExcludedRegion
Bases: CategoryItem
Closed interval [start, end] to be excluded.
Source code in src/easydiffraction/experiments/categories/excluded_regions.py
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 | |
ExcludedRegions
Bases: CategoryCollection
Collection of ExcludedRegion instances.
Source code in src/easydiffraction/experiments/categories/excluded_regions.py
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 | |
add(item)
Mark excluded points in the pattern when a region is added.
Source code in src/easydiffraction/experiments/categories/excluded_regions.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
show()
Print a table of excluded [start, end] intervals.
Source code in src/easydiffraction/experiments/categories/excluded_regions.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
experiment_type
Experiment type descriptor (form, beam, probe, scattering).
This lightweight container stores the categorical attributes defining
an experiment configuration and handles CIF serialization via
CifHandler.
ExperimentType
Bases: CategoryItem
Container of categorical attributes defining experiment flavor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample_form
|
str
|
Powder or Single crystal. |
required |
beam_mode
|
str
|
Constant wavelength (CW) or time-of-flight (TOF). |
required |
radiation_probe
|
str
|
Neutrons or X-rays. |
required |
scattering_type
|
str
|
Bragg or Total. |
required |
Source code in src/easydiffraction/experiments/categories/experiment_type.py
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 | |
beam_mode
property
writable
Beam mode descriptor (CW/TOF).
radiation_probe
property
writable
Radiation probe descriptor (neutrons/X-rays).
sample_form
property
writable
Sample form descriptor (powder/single crystal).
scattering_type
property
writable
Scattering type descriptor (Bragg/Total).
instrument
base
Instrument category base definitions for CWL/TOF instruments.
This module provides the shared parent used by concrete instrument implementations under the instrument category.
InstrumentBase
Bases: CategoryItem
Base class for instrument category items.
This class sets the common category_code and is used as a base
for concrete CWL/TOF instrument definitions.
Source code in src/easydiffraction/experiments/categories/instrument/base.py
14 15 16 17 18 19 20 21 22 23 24 | |
__init__()
Initialize instrument base and set category code.
Source code in src/easydiffraction/experiments/categories/instrument/base.py
21 22 23 24 | |
cwl
CwlInstrument
Bases: InstrumentBase
Source code in src/easydiffraction/experiments/categories/instrument/cwl.py
12 13 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
calib_twotheta_offset
property
writable
Instrument misalignment two-theta offset (deg).
setup_wavelength
property
writable
Incident wavelength parameter (Å).
factory
Factory for instrument category items.
Provides a stable entry point for creating instrument objects from the experiment's scattering type and beam mode.
InstrumentFactory
Create instrument instances for supported modes.
The factory hides implementation details and lazy-loads concrete instrument classes to avoid circular imports.
Source code in src/easydiffraction/experiments/categories/instrument/factory.py
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 | |
tof
TofInstrument
Bases: InstrumentBase
Source code in src/easydiffraction/experiments/categories/instrument/tof.py
12 13 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 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 | |
calib_d_to_tof_linear
property
writable
Linear d to TOF conversion coefficient (µs/Å).
calib_d_to_tof_offset
property
writable
TOF offset calibration parameter (µs).
calib_d_to_tof_quad
property
writable
Quadratic d to TOF correction coefficient (µs/Ų).
calib_d_to_tof_recip
property
writable
Reciprocal-velocity d to TOF correction (µs·Å).
setup_twotheta_bank
property
writable
Detector bank two-theta position (deg).
linked_phases
Linked phases allow combining phases with scale factors.
LinkedPhase
Bases: CategoryItem
Link to a phase by id with a scale factor.
Source code in src/easydiffraction/experiments/categories/linked_phases.py
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 | |
id
property
writable
Identifier of the linked phase.
scale
property
writable
Scale factor parameter.
LinkedPhases
Bases: CategoryCollection
Collection of LinkedPhase instances.
Source code in src/easydiffraction/experiments/categories/linked_phases.py
81 82 83 84 85 86 | |
__init__()
Create an empty collection of linked phases.
Source code in src/easydiffraction/experiments/categories/linked_phases.py
84 85 86 | |
peak
base
Base class for peak profile categories.
PeakBase
Bases: CategoryItem
Base class for peak profile categories.
Source code in src/easydiffraction/experiments/categories/peak/base.py
8 9 10 11 12 13 | |
cwl
Constant-wavelength peak profile classes.
CwlPseudoVoigt
Bases: PeakBase, CwlBroadeningMixin
Constant-wavelength pseudo-Voigt peak shape.
Source code in src/easydiffraction/experiments/categories/peak/cwl.py
11 12 13 14 15 16 17 18 19 | |
CwlSplitPseudoVoigt
Bases: PeakBase, CwlBroadeningMixin, EmpiricalAsymmetryMixin
Split pseudo-Voigt (empirical asymmetry) for CWL mode.
Source code in src/easydiffraction/experiments/categories/peak/cwl.py
22 23 24 25 26 27 28 29 30 31 32 | |
CwlThompsonCoxHastings
Bases: PeakBase, CwlBroadeningMixin, FcjAsymmetryMixin
Thompson–Cox–Hastings with FCJ asymmetry for CWL mode.
Source code in src/easydiffraction/experiments/categories/peak/cwl.py
35 36 37 38 39 40 41 42 43 44 45 | |
cwl_mixins
Constant-wavelength (CWL) peak-profile mixins.
This module provides mixins that add broadening and asymmetry parameters for constant-wavelength powder diffraction peak profiles. They are composed into concrete peak classes elsewhere.
CwlBroadeningMixin
Mixin that adds CWL Gaussian and Lorentz broadening parameters.
Source code in src/easydiffraction/experiments/categories/peak/cwl_mixins.py
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 | |
broad_gauss_u
property
writable
Get Gaussian U broadening parameter.
broad_gauss_v
property
writable
Get Gaussian V broadening parameter.
broad_gauss_w
property
writable
Get Gaussian W broadening parameter.
broad_lorentz_x
property
writable
Get Lorentz X broadening parameter.
broad_lorentz_y
property
writable
Get Lorentz Y broadening parameter.
EmpiricalAsymmetryMixin
Mixin that adds empirical CWL peak asymmetry parameters.
Source code in src/easydiffraction/experiments/categories/peak/cwl_mixins.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 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 | |
asym_empir_1
property
writable
Get empirical asymmetry coefficient p1.
asym_empir_2
property
writable
Get empirical asymmetry coefficient p2.
asym_empir_3
property
writable
Get empirical asymmetry coefficient p3.
asym_empir_4
property
writable
Get empirical asymmetry coefficient p4.
FcjAsymmetryMixin
Mixin that adds Finger–Cox–Jephcoat (FCJ) asymmetry params.
Source code in src/easydiffraction/experiments/categories/peak/cwl_mixins.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 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 323 324 325 326 327 328 329 330 331 | |
asym_fcj_1
property
writable
Get FCJ asymmetry parameter 1.
asym_fcj_2
property
writable
Get FCJ asymmetry parameter 2.
factory
PeakFactory
Factory for creating peak profile objects.
Lazily imports implementations to avoid circular dependencies and selects the appropriate class based on scattering type, beam mode and requested profile type.
Source code in src/easydiffraction/experiments/categories/peak/factory.py
12 13 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 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 | |
create(scattering_type=None, beam_mode=None, profile_type=None)
classmethod
Instantiate a peak profile for the given configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scattering_type
|
Optional[ScatteringTypeEnum]
|
Bragg or Total. Defaults to library default. |
None
|
beam_mode
|
Optional[BeamModeEnum]
|
CW or TOF. Defaults to library default. |
None
|
profile_type
|
Optional[PeakProfileTypeEnum]
|
Concrete profile within the mode. If omitted, a sensible default is chosen based on the other args. |
None
|
Returns:
| Type | Description |
|---|---|
|
A newly created peak profile object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a requested option is not supported. |
Source code in src/easydiffraction/experiments/categories/peak/factory.py
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 | |
tof
Time-of-flight peak profile classes.
TofPseudoVoigt
Bases: PeakBase, TofBroadeningMixin
Time-of-flight pseudo-Voigt peak shape.
Source code in src/easydiffraction/experiments/categories/peak/tof.py
10 11 12 13 14 15 16 17 18 | |
TofPseudoVoigtBackToBack
Bases: PeakBase, TofBroadeningMixin, IkedaCarpenterAsymmetryMixin
TOF back-to-back pseudo-Voigt with asymmetry.
Source code in src/easydiffraction/experiments/categories/peak/tof.py
34 35 36 37 38 39 40 41 42 43 44 | |
TofPseudoVoigtIkedaCarpenter
Bases: PeakBase, TofBroadeningMixin, IkedaCarpenterAsymmetryMixin
TOF pseudo-Voigt with Ikeda–Carpenter asymmetry.
Source code in src/easydiffraction/experiments/categories/peak/tof.py
21 22 23 24 25 26 27 28 29 30 31 | |
tof_mixins
Time-of-flight (TOF) peak-profile mixins.
Defines mixins that add Gaussian/Lorentz broadening, mixing, and Ikeda–Carpenter asymmetry parameters used by TOF peak shapes.
IkedaCarpenterAsymmetryMixin
Mixin that adds Ikeda–Carpenter asymmetry parameters.
Source code in src/easydiffraction/experiments/categories/peak/tof_mixins.py
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 286 287 288 289 290 291 292 293 | |
asym_alpha_0
property
writable
Get Ikeda–Carpenter asymmetry alpha_0.
asym_alpha_1
property
writable
Get Ikeda–Carpenter asymmetry alpha_1.
TofBroadeningMixin
Mixin that adds TOF Gaussian/Lorentz broadening and mixing terms.
Source code in src/easydiffraction/experiments/categories/peak/tof_mixins.py
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 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 | |
broad_gauss_sigma_0
property
writable
Get Gaussian sigma_0 parameter.
broad_gauss_sigma_1
property
writable
Get Gaussian sigma_1 parameter.
broad_gauss_sigma_2
property
writable
Get Gaussian sigma_2 parameter.
broad_lorentz_gamma_0
property
writable
Get Lorentz gamma_0 parameter.
broad_lorentz_gamma_1
property
writable
Get Lorentz gamma_1 parameter.
broad_lorentz_gamma_2
property
writable
Get Lorentz gamma_2 parameter.
broad_mix_beta_0
property
writable
Get mixing parameter beta_0.
broad_mix_beta_1
property
writable
Get mixing parameter beta_1.
total
Total-scattering (PDF) peak profile classes.
TotalGaussianDampedSinc
Bases: PeakBase, TotalBroadeningMixin
Gaussian-damped sinc peak for total scattering (PDF).
Source code in src/easydiffraction/experiments/categories/peak/total.py
9 10 11 12 13 14 15 16 17 | |
total_mixins
Total scattering/PDF peak-profile mixins.
Adds damping, broadening, sharpening and envelope parameters used in pair distribution function (PDF) modeling.
TotalBroadeningMixin
Mixin adding PDF broadening/damping/sharpening parameters.
Source code in src/easydiffraction/experiments/categories/peak/total_mixins.py
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 171 172 173 174 175 176 177 178 179 180 181 | |
broad_q
property
writable
Get quadratic PDF broadening coefficient.
cutoff_q
property
writable
Get Q cutoff used for Fourier transform.
damp_particle_diameter
property
writable
Get particle diameter for spherical envelope damping.
damp_q
property
writable
Get Q-resolution damping factor.
sharp_delta_1
property
writable
Get sharpening coefficient with 1/r dependence.
sharp_delta_2
property
writable
Get sharpening coefficient with 1/r^2 dependence.
datastore
base
DatastoreBase
Base class for all data stores.
Attributes:
| Name | Type | Description |
|---|---|---|
meas |
Optional[ndarray]
|
Measured intensities. |
meas_su |
Optional[ndarray]
|
Standard uncertainties of measured intensities. |
excluded |
Optional[ndarray]
|
Flags for excluded points. |
_calc |
Optional[ndarray]
|
Stored calculated intensities. |
Source code in src/easydiffraction/experiments/datastore/base.py
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 | |
as_cif
property
Generate a CIF-formatted string representing the datastore data.
as_truncated_cif
property
Generate a CIF-formatted string representing the datastore data.
calc
property
writable
Access calculated intensities. Should be updated via external calculation.
Returns:
| Type | Description |
|---|---|
Optional[ndarray]
|
Optional[np.ndarray]: Calculated intensities array or None if not set. |
factory
Factory for experiment datastores based on sample form and beam mode.
DatastoreFactory
Create PD or SC datastores depending on sample form.
Source code in src/easydiffraction/experiments/datastore/factory.py
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 | |
create(sample_form=SampleFormEnum.default(), beam_mode=BeamModeEnum.default())
classmethod
Create and return a datastore object for the given sample form.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample_form
|
str
|
Sample form type, e.g. 'powder' or 'single crystal'. |
default()
|
beam_mode
|
str
|
Beam mode for powder sample form. |
default()
|
Returns:
| Name | Type | Description |
|---|---|---|
DatastoreBase |
DatastoreBase
|
Instance of a datastore class corresponding to sample form. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the sample_form or beam_mode is not supported. |
Source code in src/easydiffraction/experiments/datastore/factory.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 | |
pd
PdDatastore
Bases: DatastoreBase
Class for powder diffraction data.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
Optional[ndarray]
|
Scan variable (e.g. 2θ or time-of-flight values). |
d |
Optional[ndarray]
|
d-spacing values. |
bkg |
Optional[ndarray]
|
Background values. |
Source code in src/easydiffraction/experiments/datastore/pd.py
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 | |
__init__(beam_mode=None)
Initialize PowderDatastore.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
beam_mode
|
str
|
Beam mode, e.g. 'time-of-flight' or 'constant wavelength'. |
None
|
Source code in src/easydiffraction/experiments/datastore/pd.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | |
sc
ScDatastore
Bases: DatastoreBase
Class for single crystal diffraction data.
Attributes:
| Name | Type | Description |
|---|---|---|
sin_theta_over_lambda |
Optional[ndarray]
|
sin(θ)/λ values. |
index_h |
Optional[ndarray]
|
Miller index h. |
index_k |
Optional[ndarray]
|
Miller index k. |
index_l |
Optional[ndarray]
|
Miller index l. |
Source code in src/easydiffraction/experiments/datastore/sc.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 | |
__init__()
Initialize SingleCrystalDatastore.
Source code in src/easydiffraction/experiments/datastore/sc.py
25 26 27 28 29 30 31 | |
experiment
BraggPdExperiment
Bases: InstrumentMixin, PdExperimentBase
Powder diffraction experiment.
Wraps background model, peak profile and linked phases for Bragg PD.
Source code in src/easydiffraction/experiments/experiment/bragg_pd.py
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 | |
background_type
property
writable
Current background type enum value.
show_current_background_type()
Print the currently used background type.
Source code in src/easydiffraction/experiments/experiment/bragg_pd.py
134 135 136 137 | |
show_supported_background_types()
Print a table of supported background types.
Source code in src/easydiffraction/experiments/experiment/bragg_pd.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
BraggScExperiment
Bases: ExperimentBase
Single crystal experiment class with specific attributes.
Source code in src/easydiffraction/experiments/experiment/bragg_sc.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
ExperimentBase
Bases: DatablockItem
Base class for all experiments with only core attributes.
Wraps experiment type, instrument and datastore.
Source code in src/easydiffraction/experiments/experiment/base.py
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 | |
as_cif
property
Serialize this experiment to a CIF fragment.
datastore
property
Data container with x, y, error, calc and background arrays.
name
property
writable
Human-readable name of the experiment.
show_as_cif()
Pretty-print the experiment and datastore as CIF text.
Source code in src/easydiffraction/experiments/experiment/base.py
79 80 81 82 83 84 85 86 | |
type
property
Experiment type descriptor (sample form, probe, beam mode).
PdExperimentBase
Bases: ExperimentBase
Base class for all powder experiments.
Source code in src/easydiffraction/experiments/experiment/base.py
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 | |
excluded_regions
property
Collection of excluded regions for the x-grid.
linked_phases
property
Collection of phases linked to this experiment.
peak
property
writable
Peak category object with profile parameters and mixins.
peak_profile_type
property
writable
Currently selected peak profile type enum.
show_current_peak_profile_type()
Print the currently selected peak profile type.
Source code in src/easydiffraction/experiments/experiment/base.py
217 218 219 220 | |
show_supported_peak_profile_types()
Print available peak profile types for this experiment.
Source code in src/easydiffraction/experiments/experiment/base.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
TotalPdExperiment
Bases: PdExperimentBase
PDF experiment class with specific attributes.
Source code in src/easydiffraction/experiments/experiment/total_pd.py
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 | |
base
ExperimentBase
Bases: DatablockItem
Base class for all experiments with only core attributes.
Wraps experiment type, instrument and datastore.
Source code in src/easydiffraction/experiments/experiment/base.py
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 | |
as_cif
property
Serialize this experiment to a CIF fragment.
datastore
property
Data container with x, y, error, calc and background arrays.
name
property
writable
Human-readable name of the experiment.
show_as_cif()
Pretty-print the experiment and datastore as CIF text.
Source code in src/easydiffraction/experiments/experiment/base.py
79 80 81 82 83 84 85 86 | |
type
property
Experiment type descriptor (sample form, probe, beam mode).
PdExperimentBase
Bases: ExperimentBase
Base class for all powder experiments.
Source code in src/easydiffraction/experiments/experiment/base.py
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 | |
excluded_regions
property
Collection of excluded regions for the x-grid.
linked_phases
property
Collection of phases linked to this experiment.
peak
property
writable
Peak category object with profile parameters and mixins.
peak_profile_type
property
writable
Currently selected peak profile type enum.
show_current_peak_profile_type()
Print the currently selected peak profile type.
Source code in src/easydiffraction/experiments/experiment/base.py
217 218 219 220 | |
show_supported_peak_profile_types()
Print available peak profile types for this experiment.
Source code in src/easydiffraction/experiments/experiment/base.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
bragg_pd
BraggPdExperiment
Bases: InstrumentMixin, PdExperimentBase
Powder diffraction experiment.
Wraps background model, peak profile and linked phases for Bragg PD.
Source code in src/easydiffraction/experiments/experiment/bragg_pd.py
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 | |
background_type
property
writable
Current background type enum value.
show_current_background_type()
Print the currently used background type.
Source code in src/easydiffraction/experiments/experiment/bragg_pd.py
134 135 136 137 | |
show_supported_background_types()
Print a table of supported background types.
Source code in src/easydiffraction/experiments/experiment/bragg_pd.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
bragg_sc
Single crystal experiment types and helpers.
BraggScExperiment
Bases: ExperimentBase
Single crystal experiment class with specific attributes.
Source code in src/easydiffraction/experiments/experiment/bragg_sc.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
enums
Enumerations for experiment configuration (forms, modes, types).
BeamModeEnum
Bases: str, Enum
Beam delivery mode for the instrument.
Source code in src/easydiffraction/experiments/experiment/enums.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
PeakProfileTypeEnum
Bases: str, Enum
Available peak profile types per scattering and beam mode.
Source code in src/easydiffraction/experiments/experiment/enums.py
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 | |
RadiationProbeEnum
Bases: str, Enum
Incident radiation probe used in the experiment.
Source code in src/easydiffraction/experiments/experiment/enums.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
SampleFormEnum
Bases: str, Enum
Physical sample form supported by experiments.
Source code in src/easydiffraction/experiments/experiment/enums.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
ScatteringTypeEnum
Bases: str, Enum
Type of scattering modeled in an experiment.
Source code in src/easydiffraction/experiments/experiment/enums.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
factory
ExperimentFactory
Bases: FactoryBase
Creates Experiment instances with only relevant attributes.
Source code in src/easydiffraction/experiments/experiment/factory.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 | |
create(**kwargs)
classmethod
Create an ExperimentBase using a validated argument
combination.
Source code in src/easydiffraction/experiments/experiment/factory.py
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 | |
instrument_mixin
InstrumentMixin
Mixin that wires an experiment to an instrument category.
Creates a default instrument via InstrumentFactory using the
experiment type (scattering type and beam mode) at initialization.
Source code in src/easydiffraction/experiments/experiment/instrument_mixin.py
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 | |
instrument
property
writable
Instrument category object associated with the experiment.
total_pd
TotalPdExperiment
Bases: PdExperimentBase
PDF experiment class with specific attributes.
Source code in src/easydiffraction/experiments/experiment/total_pd.py
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 | |
experiments
Experiments
Bases: DatablockCollection
Collection of Experiment data blocks.
Provides convenience constructors for common creation patterns and helper methods for simple presentation of collection contents.
Source code in src/easydiffraction/experiments/experiments.py
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 | |
add_from_cif_path(cif_path)
Add an experiment from a CIF file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cif_path
|
str
|
Path to a CIF document. |
required |
Source code in src/easydiffraction/experiments/experiments.py
30 31 32 33 34 35 36 37 38 | |
add_from_cif_str(cif_str)
Add an experiment from a CIF string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cif_str
|
str
|
Full CIF document as a string. |
required |
Source code in src/easydiffraction/experiments/experiments.py
40 41 42 43 44 45 46 47 48 | |
add_from_data_path(name, data_path, sample_form=SampleFormEnum.default().value, beam_mode=BeamModeEnum.default().value, radiation_probe=RadiationProbeEnum.default().value, scattering_type=ScatteringTypeEnum.default().value)
Add an experiment from a data file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Experiment identifier. |
required |
data_path
|
str
|
Path to the measured data file. |
required |
sample_form
|
str
|
Sample form (powder or single crystal). |
value
|
beam_mode
|
str
|
Beam mode (constant wavelength or TOF). |
value
|
radiation_probe
|
str
|
Radiation probe (neutron or xray). |
value
|
scattering_type
|
str
|
Scattering type (bragg or total). |
value
|
Source code in src/easydiffraction/experiments/experiments.py
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 | |
add_without_data(name, sample_form=SampleFormEnum.default().value, beam_mode=BeamModeEnum.default().value, radiation_probe=RadiationProbeEnum.default().value, scattering_type=ScatteringTypeEnum.default().value)
Add an experiment without associating a data file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Experiment identifier. |
required |
sample_form
|
str
|
Sample form (powder or single crystal). |
value
|
beam_mode
|
str
|
Beam mode (constant wavelength or TOF). |
value
|
radiation_probe
|
str
|
Radiation probe (neutron or xray). |
value
|
scattering_type
|
str
|
Scattering type (bragg or total). |
value
|
Source code in src/easydiffraction/experiments/experiments.py
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 | |
remove(name)
Remove an experiment by name if it exists.
Source code in src/easydiffraction/experiments/experiments.py
107 108 109 110 111 | |
show_names()
Print the list of experiment names.
Source code in src/easydiffraction/experiments/experiments.py
117 118 119 120 | |
show_params()
Print parameters for each experiment in the collection.
Source code in src/easydiffraction/experiments/experiments.py
122 123 124 125 | |