Skip to content

Commit 57e496b

Browse files
Fix peak profile function and parameter names (#150)
* Apply latest templates * Correcting peak profiles * Make load_numeric_block skip non-numeric lines anywhere in file * Add double-jorgensen-von-dreele peak profile (CrysPy type0m) * Add some temporary documents and tests [ci skip] * Clean up * Exclude tmp/ directory and update roadmap * Clean up
1 parent 007004a commit 57e496b

113 files changed

Lines changed: 29002 additions & 88927 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WARNING: Do not edit this file manually.
22
# Any changes will be overwritten by Copier.
3-
_commit: v0.10.1-40-g29e2ccf
3+
_commit: v0.10.1-41-g508666e
44
_src_path: gh:easyscience/templates
55
app_docs_url: https://easyscience.github.io/diffraction-app
66
app_doi: 10.5281/zenodo.18163581

.github/workflows/pypi-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
run: pixi init easydiffraction
5050

5151
- name: Set the minimum system requirements
52+
working-directory: easydiffraction
5253
run: pixi project system-requirements add macos 14.0
5354

5455
- name: Add Python 3.14 from Conda

.github/workflows/test.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,27 @@ jobs:
9999
echo
100100
echo "🔹🔸🔹🔸🔹 Python: $py_ver 🔹🔸🔹🔸🔹"
101101
102-
env="py-$(echo $py_ver | tr -d .)-env" # Converts 3.11 -> py-311-env
102+
env="py-$(echo $py_ver | tr -d .)-env" # Converts 3.XX -> py-3XX-env
103103
104104
echo "Running tests in environment: $env"
105105
pixi run --environment $env unit-tests
106106
done
107107
108+
- name: Run functional tests
109+
shell: bash
110+
run: |
111+
set -euo pipefail
112+
113+
for py_ver in $PY_VERSIONS; do
114+
echo
115+
echo "🔹🔸🔹🔸🔹 Python: $py_ver 🔹🔸🔹🔸🔹"
116+
117+
env="py-$(echo $py_ver | tr -d .)-env" # Converts 3.XX -> py-3XX-env
118+
119+
echo "Running tests in environment: $env"
120+
pixi run --environment $env functional-tests
121+
done
122+
108123
- name: Run integration tests ${{ needs.env-prepare.outputs.pytest-marks }}
109124
shell: bash
110125
run: |
@@ -114,7 +129,7 @@ jobs:
114129
echo
115130
echo "🔹🔸🔹🔸🔹 Python: $py_ver 🔹🔸🔹🔸🔹"
116131
117-
env="py-$(echo $py_ver | tr -d .)-env" # Converts 3.11 -> py-311-env
132+
env="py-$(echo $py_ver | tr -d .)-env" # Converts 3.XX -> py-3XX-env
118133
119134
echo "Running tests in environment: $env"
120135
pixi run --environment $env integration-tests ${{ needs.env-prepare.outputs.pytest-marks }}
@@ -263,6 +278,25 @@ jobs:
263278
cd ..
264279
done
265280
281+
- name: Run functional tests
282+
shell: bash
283+
run: |
284+
set -euo pipefail
285+
286+
for py_ver in $PY_VERSIONS; do
287+
echo
288+
echo "🔹🔸🔹🔸🔹 Python: $py_ver 🔹🔸🔹🔸🔹"
289+
290+
echo "Entering pixi project directory easydiffraction_py$py_ver"
291+
cd easydiffraction_py$py_ver
292+
293+
echo "Running tests"
294+
pixi run python -m pytest ../tests/functional/ --color=yes -v
295+
296+
echo "Exiting pixi project directory"
297+
cd ..
298+
done
299+
266300
- name: Run integration tests ${{ needs.env-prepare.outputs.pytest-marks }}
267301
shell: bash
268302
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ CMakeLists.txt.user*
4949
# Used to fetch tutorials data during their runtime. Need to have '/' at
5050
# the beginning to avoid ignoring 'data' module in the src/.
5151
/data/
52+
/tmp/

docs/architecture/ROADMAP.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ Legend:
5050

5151
### Atomic Displacement Parameters (ADP)
5252

53-
| Feature | LIB | APP |
54-
| ----------------------------------------------- | ----------- | --- |
55-
| Isotropic Biso | | 🗓 |
56-
| Isotropic Uiso | 🗓 ||
57-
| Anisotropic Bani _B11, B22, B33, B12, B13, B23_ | 🗓`highest` | 🗓 |
58-
| Anisotropic Uani _U11, U22, U33, U12, U13, U23_ | 🗓 | 🗓 |
53+
| Feature | LIB | APP |
54+
| ----------------------------------------------- | --- | --- |
55+
| Isotropic Biso || 🗓 |
56+
| Isotropic Uiso | 🚧 ||
57+
| Anisotropic Bani _B11, B22, B33, B12, B13, B23_ | 🚧 | 🗓 |
58+
| Anisotropic Uani _U11, U22, U33, U12, U13, U23_ | 🚧 | 🗓 |
5959

6060
---
6161

@@ -110,9 +110,9 @@ Legend:
110110
| Feature | LIB | APP |
111111
| -------------------------------------------------------- | --- | --- |
112112
| Wavelength |||
113-
| Second wavelength | 🚧 | 🗓 |
113+
| Second wavelength | 🗓 | 🗓 |
114114
| 2θ offset |||
115-
| Sample displacement correction (FullProf _SyCos, SySin_) | 🚧 | 🗓 |
115+
| Sample displacement correction (FullProf _SyCos, SySin_) | 🗓 | 🗓 |
116116

117117
### Instrument — Time-of-Flight
118118

@@ -123,9 +123,6 @@ Legend:
123123

124124
### Peak Profile — Constant Wavelength
125125

126-
CrysPy: Pseudo-Voigt from FullProf. Empirical asymmetry, 4 params (p1,
127-
p2, p3, p4) from FullProf.
128-
129126
| Feature | LIB | APP |
130127
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | --- |
131128
| Pseudo-Voigt + Empirical asymmetry<br>_Gaussian broadening U, V, W. Lorentzian broadening X, Y<br>Empirical asymmetry p1, p2, p3, p4_<br>(CrysPy) |||
@@ -144,14 +141,16 @@ CrysPy peak_shape options:
144141
| Feature | LIB | APP |
145142
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- |
146143
| Jorgensen (back-to-back exponentials ⊗ Gaussian)<br>_Gaussian broadening σ₀, σ₁, σ₂<br>Back-to-back exponential rise α₀, α₁. Back-to-back exponential decay β₀, β₁_<br>(CrysPy) |||
147-
| Jorgensen-Von Dreele (back-to-back exponentials ⊗ pseudo-Voigt)<br>_Gaussian broadening σ₀, σ₁, σ₂. Lorentzian broadening γ₀, γ₁, γ₂<br>Back-to-back exponential rise α₀, α₁. Back-to-back exponential decay β₀, β₁_<br>(CrysPy) | 🗓 ||
148-
| Double back-to-back exponentials ⊗ pseudo-Voigt [Z-Rietveld type0m]<br>_Gaussian broadening σ₀, σ₁, σ₂. Lorentzian broadening γ₀, γ₁, γ₂<br>Rise α₁, α₂. Fast decay β₀₀, β₀₁. Slow decay β₁₀. Switching r₀₁, r₀₂, r₀₃_<br>(CrysPy) | 🗓 | 🗓 |
144+
| Jorgensen-Von Dreele (back-to-back exponentials ⊗ pseudo-Voigt)<br>_Gaussian broadening σ₀, σ₁, σ₂. Lorentzian broadening γ₀, γ₁, γ₂<br>Back-to-back exponential rise α₀, α₁. Back-to-back exponential decay β₀, β₁_<br>(CrysPy) |||
145+
| Double back-to-back exponentials ⊗ pseudo-Voigt [Z-Rietveld type0m]<br>_Gaussian broadening σ₀, σ₁, σ₂. Lorentzian broadening γ₀, γ₁, γ₂<br>Rise α₁, α₂. Fast decay β₀₀, β₀₁. Slow decay β₁₀. Switching r₀₁, r₀₂, r₀₃_<br>(CrysPy) || 🗓 |
146+
| Ikeda-Carpenter ⊗ pseudo-Voigt<br>_Moderator pulse α₀, α₁, β₀, κ<br>Gaussian broadening σ². Lorentzian broadening γ_<br>(CrysFML) | 🗓 | 🗓 |
149147

150148
| TOF profile | TOF source | Performance |
151149
| ------------------------------------------------------------------- | ----------------------------------------------------------------- | ----------- |
152150
| Jorgensen (back-to-back exponentials ⊗ Gaussian) | Simpler TOF profile, including reactor-source TOF implementations | Fast |
153151
| Jorgensen-Von Dreele (back-to-back exponentials ⊗ pseudo-Voigt) | Spallation-source TOF | Slower |
154152
| Double back-to-back exponentials ⊗ pseudo-Voigt (Z-Rietveld type0m) | Spallation-source TOF; more elaborate asymmetric profile | Slowest |
153+
| Ikeda-Carpenter ⊗ pseudo-Voigt | Spallation-source TOF; moderator pulse shape model | Moderate |
155154

156155
---
157156

@@ -169,9 +168,8 @@ CrysPy peak_shape options:
169168

170169
### Extinction
171170

172-
CrysPy's extinction is NOT Shelx-style. It's an analytical
173-
Becker-Coppens spherical model with Gauss or Lorentz mosaicity
174-
distribution
171+
CrysPy's extinction is an analytical Becker-Coppens spherical model with
172+
Gauss or Lorentz mosaicity distribution
175173

176174
| Feature | LIB | APP |
177175
| ----------------------------------------------------- | --- | --- |

docs/architecture/architecture.md

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class PeakFactory(FactoryBase):
337337
frozenset({
338338
('scattering_type', ScatteringTypeEnum.BRAGG),
339339
('beam_mode', BeamModeEnum.TIME_OF_FLIGHT),
340-
}): PeakProfileTypeEnum.PSEUDO_VOIGT_IKEDA_CARPENTER,
340+
}): PeakProfileTypeEnum.JORGENSEN,
341341
frozenset({
342342
('scattering_type', ScatteringTypeEnum.TOTAL),
343343
}): PeakProfileTypeEnum.GAUSSIAN_DAMPED_SINC,
@@ -389,26 +389,26 @@ from .line_segment import LineSegmentBackground
389389

390390
### 5.5 All Factories
391391

392-
| Factory | Domain | Tags resolve to |
393-
| ---------------------------- | ---------------------- | ----------------------------------------------------------- |
394-
| `BackgroundFactory` | Background categories | `LineSegmentBackground`, `ChebyshevPolynomialBackground` |
395-
| `PeakFactory` | Peak profiles | `CwlPseudoVoigt`, `TofPseudoVoigtIkedaCarpenter`, |
396-
| `InstrumentFactory` | Instruments | `CwlPdInstrument`, `TofPdInstrument`, … |
397-
| `DataFactory` | Data collections | `PdCwlData`, `PdTofData`, `ReflnData`, `TotalData` |
398-
| `ExtinctionFactory` | Extinction models | `BeckerCoppensExtinction` |
399-
| `LinkedCrystalFactory` | Linked-crystal refs | `LinkedCrystal` |
400-
| `ExcludedRegionsFactory` | Excluded regions | `ExcludedRegions` |
401-
| `LinkedPhasesFactory` | Linked phases | `LinkedPhases` |
402-
| `ExperimentTypeFactory` | Experiment descriptors | `ExperimentType` |
403-
| `CellFactory` | Unit cells | `Cell` |
404-
| `SpaceGroupFactory` | Space groups | `SpaceGroup` |
405-
| `AtomSitesFactory` | Atom sites | `AtomSites` |
406-
| `AliasesFactory` | Parameter aliases | `Aliases` |
407-
| `ConstraintsFactory` | Parameter constraints | `Constraints` |
408-
| `FitModeFactory` | Fit-mode category | `FitMode` |
409-
| `JointFitExperimentsFactory` | Joint-fit weights | `JointFitExperiments` |
410-
| `CalculatorFactory` | Calculation engines | `CryspyCalculator`, `CrysfmlCalculator`, `PdffitCalculator` |
411-
| `MinimizerFactory` | Minimisers | `LmfitMinimizer`, `DfolsMinimizer`, … |
392+
| Factory | Domain | Tags resolve to |
393+
| ---------------------------- | ---------------------- | ------------------------------------------------------------ |
394+
| `BackgroundFactory` | Background categories | `LineSegmentBackground`, `ChebyshevPolynomialBackground` |
395+
| `PeakFactory` | Peak profiles | `CwlPseudoVoigt`, `TofJorgensen`, `TofJorgensenVonDreele`, … |
396+
| `InstrumentFactory` | Instruments | `CwlPdInstrument`, `TofPdInstrument`, … |
397+
| `DataFactory` | Data collections | `PdCwlData`, `PdTofData`, `ReflnData`, `TotalData` |
398+
| `ExtinctionFactory` | Extinction models | `BeckerCoppensExtinction` |
399+
| `LinkedCrystalFactory` | Linked-crystal refs | `LinkedCrystal` |
400+
| `ExcludedRegionsFactory` | Excluded regions | `ExcludedRegions` |
401+
| `LinkedPhasesFactory` | Linked phases | `LinkedPhases` |
402+
| `ExperimentTypeFactory` | Experiment descriptors | `ExperimentType` |
403+
| `CellFactory` | Unit cells | `Cell` |
404+
| `SpaceGroupFactory` | Space groups | `SpaceGroup` |
405+
| `AtomSitesFactory` | Atom sites | `AtomSites` |
406+
| `AliasesFactory` | Parameter aliases | `Aliases` |
407+
| `ConstraintsFactory` | Parameter constraints | `Constraints` |
408+
| `FitModeFactory` | Fit-mode category | `FitMode` |
409+
| `JointFitExperimentsFactory` | Joint-fit weights | `JointFitExperiments` |
410+
| `CalculatorFactory` | Calculation engines | `CryspyCalculator`, `CrysfmlCalculator`, `PdffitCalculator` |
411+
| `MinimizerFactory` | Minimisers | `LmfitMinimizer`, `DfolsMinimizer`, … |
412412

413413
> **Note:** `ExperimentFactory` and `StructureFactory` are _builder_
414414
> factories with `from_cif_path`, `from_cif_str`, `from_data_path`, and
@@ -450,15 +450,15 @@ Tags are the user-facing identifiers for selecting types. They must be:
450450

451451
**Peak tags**
452452

453-
| Tag | Class |
454-
| ---------------------------------- | ------------------------------ |
455-
| `pseudo-voigt` | `CwlPseudoVoigt` |
456-
| `split-pseudo-voigt` | `CwlSplitPseudoVoigt` |
457-
| `thompson-cox-hastings` | `CwlThompsonCoxHastings` |
458-
| `tof-pseudo-voigt` | `TofPseudoVoigt` |
459-
| `tof-pseudo-voigt-ikeda-carpenter` | `TofPseudoVoigtIkedaCarpenter` |
460-
| `tof-pseudo-voigt-back-to-back` | `TofPseudoVoigtBackToBack` |
461-
| `gaussian-damped-sinc` | `TotalGaussianDampedSinc` |
453+
| Tag | Class |
454+
| ------------------------------------ | ---------------------------------- |
455+
| `pseudo-voigt` | `CwlPseudoVoigt` |
456+
| `pseudo-voigt + empirical asymmetry` | `CwlPseudoVoigtEmpiricalAsymmetry` |
457+
| `thompson-cox-hastings` | `CwlThompsonCoxHastings` |
458+
| `jorgensen` | `TofJorgensen` |
459+
| `jorgensen-von-dreele` | `TofJorgensenVonDreele` |
460+
| `double-jorgensen-von-dreele` | `TofDoubleJorgensenVonDreele` |
461+
| `gaussian-damped-sinc` | `TotalGaussianDampedSinc` |
462462

463463
**Instrument tags**
464464

@@ -542,25 +542,25 @@ line-segment points.
542542

543543
#### Singleton CategoryItems — factory-created (get all three)
544544

545-
| Class | Factory |
546-
| ------------------------------ | ----------------------- |
547-
| `CwlPdInstrument` | `InstrumentFactory` |
548-
| `CwlScInstrument` | `InstrumentFactory` |
549-
| `TofPdInstrument` | `InstrumentFactory` |
550-
| `TofScInstrument` | `InstrumentFactory` |
551-
| `CwlPseudoVoigt` | `PeakFactory` |
552-
| `CwlSplitPseudoVoigt` | `PeakFactory` |
553-
| `CwlThompsonCoxHastings` | `PeakFactory` |
554-
| `TofPseudoVoigt` | `PeakFactory` |
555-
| `TofPseudoVoigtIkedaCarpenter` | `PeakFactory` |
556-
| `TofPseudoVoigtBackToBack` | `PeakFactory` |
557-
| `TotalGaussianDampedSinc` | `PeakFactory` |
558-
| `BeckerCoppensExtinction` | `ExtinctionFactory` |
559-
| `LinkedCrystal` | `LinkedCrystalFactory` |
560-
| `Cell` | `CellFactory` |
561-
| `SpaceGroup` | `SpaceGroupFactory` |
562-
| `ExperimentType` | `ExperimentTypeFactory` |
563-
| `FitMode` | `FitModeFactory` |
545+
| Class | Factory |
546+
| ---------------------------------- | ----------------------- |
547+
| `CwlPdInstrument` | `InstrumentFactory` |
548+
| `CwlScInstrument` | `InstrumentFactory` |
549+
| `TofPdInstrument` | `InstrumentFactory` |
550+
| `TofScInstrument` | `InstrumentFactory` |
551+
| `CwlPseudoVoigt` | `PeakFactory` |
552+
| `CwlPseudoVoigtEmpiricalAsymmetry` | `PeakFactory` |
553+
| `CwlThompsonCoxHastings` | `PeakFactory` |
554+
| `TofJorgensen` | `PeakFactory` |
555+
| `TofJorgensenVonDreele` | `PeakFactory` |
556+
| `TofDoubleJorgensenVonDreele` | `PeakFactory` |
557+
| `TotalGaussianDampedSinc` | `PeakFactory` |
558+
| `BeckerCoppensExtinction` | `ExtinctionFactory` |
559+
| `LinkedCrystal` | `LinkedCrystalFactory` |
560+
| `Cell` | `CellFactory` |
561+
| `SpaceGroup` | `SpaceGroupFactory` |
562+
| `ExperimentType` | `ExperimentTypeFactory` |
563+
| `FitMode` | `FitModeFactory` |
564564

565565
#### CategoryCollections — factory-created (get all three)
566566

@@ -889,7 +889,7 @@ expt = ExperimentFactory.from_data_path(
889889
)
890890
expt.instrument.calib_d_to_tof_offset = 0.0
891891
expt.instrument.calib_d_to_tof_linear = 7476.91
892-
expt.peak_profile_type = 'pseudo-voigt * ikeda-carpenter'
892+
expt.peak_profile_type = 'jorgensen'
893893
expt.peak.broad_gauss_sigma_0 = 3.0
894894
```
895895

0 commit comments

Comments
 (0)