Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
cf994bc
SData refactor: allow Spectrum1DCollection to be produced
ajjackson Feb 14, 2024
bbed803
Implement _atom_type_s using Spectrum1DCollection features
ajjackson Feb 14, 2024
8a3ced1
Extend Euphonic Spectrum types in abins.sdata
ajjackson Feb 14, 2024
e770366
More Abins spectra->workspaces tidy-up
ajjackson Feb 14, 2024
dda362b
Rework abins "masses table" to work with spectrum
ajjackson Feb 14, 2024
b580c91
Change return type of spowdersemiempiricalcalculator
ajjackson Feb 14, 2024
93f561c
Refactor threshold check so it can be done outside SData
ajjackson Feb 14, 2024
1749d1b
Move threshold check, fix 2D systemtest
ajjackson Feb 14, 2024
6637dda
Continue pushing SData further back into nested function heirarchy
ajjackson Feb 14, 2024
2b78c5c
Factor out kinematic constraints from SData
ajjackson Feb 14, 2024
60b0816
More spowdersemiempiricalcalculator refactoring
ajjackson Feb 14, 2024
00d2110
Start saving structure factors directly to Spectrum objects
ajjackson Feb 14, 2024
38381a3
Format mass metadata to string
ajjackson Feb 14, 2024
3882397
Tidy up import
ajjackson Feb 14, 2024
7313cd0
Apply Debye-Waller factor to SpectrumCollection, drop SData method
ajjackson Feb 14, 2024
1cd97c9
Apply autoconvolution, q2 corrections to spectra
ajjackson Feb 14, 2024
b592350
Drop SData autoconvolution method, port test to replacement function
ajjackson Feb 14, 2024
e389534
Minor cleanup
ajjackson Feb 14, 2024
debbaa4
Remove unused SDataByAngle class and tests
ajjackson Feb 14, 2024
6a007a1
calculate_s_isotropic directly into Spectra
ajjackson Feb 14, 2024
4248688
Return suitable isotropic data quickly, drop empty SData builder
ajjackson Feb 14, 2024
28c592f
Tidy up comments and references to SData
ajjackson Feb 14, 2024
c4fc3c8
Remove Abins SData class
ajjackson Feb 14, 2024
3cfb728
Correct axis-order for dummy 2D spectra
ajjackson Feb 14, 2024
ef2217c
Slightly improve performance of spectrum broadening
ajjackson Feb 14, 2024
1a59f84
Try to make Spectrum Collection concatenation more efficient
ajjackson Feb 14, 2024
3bcf152
Extend broadening efficiency tweak to 2D
ajjackson Feb 14, 2024
406dcfd
Handle fundamental-only cases more robustly
ajjackson May 28, 2024
b159e42
Further optimisation of autoconvolution: Dealing with Pint overhead
ajjackson Jun 10, 2024
dc5f175
Implement iter_metadata for spectrum collections, speed up loops
ajjackson Jun 17, 2024
fb57288
Parallelise Abins autoconvolution over atoms
ajjackson Jun 17, 2024
d9e137e
More efficient spectrum slicing
ajjackson Jun 17, 2024
79bc922
Implement parallel broadening over 1D spectra
ajjackson Jun 17, 2024
cfc20ec
Tidy up: for now 2D parallel broadening is not implemented
ajjackson Jun 17, 2024
0537d44
Abins2D optimisation: avoid unnecessary Spectrum iteration
ajjackson Jun 18, 2024
6937f4f
Experiment with parallel 2D broadening
ajjackson Jun 18, 2024
307ad19
Better 2D broadening: remove an outer loop
ajjackson Jun 20, 2024
ec01fc5
Tidy up an import statement
ajjackson Jun 20, 2024
969dadc
Cleaner parallel map with Pool.map and functools.partial
ajjackson Aug 7, 2024
f476e49
TMP: try converting parallel map of broadening to series
ajjackson Aug 7, 2024
fb956f6
Precompute Pychop resolution before parallel map on spectra
ajjackson Aug 8, 2024
0079de3
Create "prepare_resolution()" instrument method
ajjackson Aug 20, 2024
beab351
bump euphonic requirement
ajjackson Jan 22, 2025
633d2ae
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 28, 2025
efbb9b7
Move type-hint definition to before first use
ajjackson Jan 29, 2025
8b236bd
Revert "bump euphonic requirement"
ajjackson Jan 31, 2025
04b6b6a
Pin to pre-refactor Euphonic while checking tests on rebase
ajjackson Feb 21, 2025
d2a4a81
Bump euphonic requirement
ajjackson Mar 10, 2025
4ca7a0b
(mostly) delegate Spectrum Collection implementations to Euphonic
ajjackson Mar 12, 2025
92c1d2b
Add missing get_bin_edges method to Spectrum2DCollection
ajjackson Mar 16, 2025
b611c45
Bump Euphonic, drop patched code
ajjackson Apr 15, 2025
1b047c2
Remove wrappers for Euphonic spectrum classes
ajjackson May 20, 2025
45da66c
Relax Euphonic upper version bound
ajjackson May 20, 2025
6618398
Use existing euphonic method to iterate over metadata
ajjackson Jun 6, 2025
d5af402
Quick fixes from code review
ajjackson Jun 6, 2025
a75c390
Rework autoconvolution to use Spectrum1DCollection
ajjackson Jun 6, 2025
6e3818d
Raise error if max autoconvolution order is too low (i.e. = 1)
ajjackson Jun 6, 2025
ebfb120
Review feedback: stricter cast float to string
ajjackson Jun 6, 2025
ef6e0a0
Expand docstring
ajjackson Jun 6, 2025
2d97fcc
Review feedback: 1D/2D handling in spowdersemiempiricalcalculator
ajjackson Jun 6, 2025
7f6fae6
Use already-defined units
ajjackson Jun 6, 2025
0a63a1e
Move abins.constants imports to top of file
ajjackson Jun 17, 2025
bff4852
Simplify abins.parameters.performance["threads"] check
ajjackson Jun 17, 2025
976fd1e
Move another import to top-level
ajjackson Jun 17, 2025
36b203a
For debugging, tweak package build tests to Abins-only
ajjackson Jul 16, 2025
ecaf5dc
Force 'spawn' method for multiprocessing - THIS HANGS LINUX SYSTEMTESTS
ajjackson Jul 17, 2025
c6ce535
Quick fix to Abins Systemtest cleanup
ajjackson Jul 17, 2025
eb652ea
Remove parallelism from AbINS
ajjackson Jul 17, 2025
0c4b417
Tidy up imports
ajjackson Jul 21, 2025
06dec9f
Revert "For debugging, tweak package build tests to Abins-only"
ajjackson Jul 21, 2025
eb8e10d
Move imports to top level
ajjackson Jul 25, 2025
e388e11
Rework Abins systemtests to use temporary cache directory
ajjackson Jul 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions Framework/PythonInterface/plugins/algorithms/Abins.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def PyExec(self):
cache_directory=self._cache_directory,
)
s_calculator.progress_reporter = prog_reporter
s_data = s_calculator.get_formatted_data()

spectra = s_calculator.get_formatted_data()

# Clean up parameter modified by _get_properties()
abins.parameters.sampling["bin_width"] = self._initial_parameters_bin_width
Expand All @@ -156,11 +157,17 @@ def PyExec(self):

workspaces.extend(
self.create_workspaces(
atoms_symbols=atom_symbols, s_data=s_data, atoms_data=atoms_data, max_quantum_order=self._max_event_order
atoms_symbols=atom_symbols,
spectra=spectra,
max_quantum_order=self._max_event_order,
)
)
workspaces.extend(
self.create_workspaces(atom_numbers=atom_numbers, s_data=s_data, atoms_data=atoms_data, max_quantum_order=self._max_event_order)
self.create_workspaces(
atom_numbers=atom_numbers,
spectra=spectra,
max_quantum_order=self._max_event_order,
)
)
prog_reporter.report("Workspaces with partial dynamical structure factors have been constructed.")

Expand Down
15 changes: 11 additions & 4 deletions Framework/PythonInterface/plugins/algorithms/Abins2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ def PyExec(self):
cache_directory=self._cache_directory,
)
s_calculator.progress_reporter = prog_reporter
s_data = s_calculator.get_formatted_data()
self._q_bins = s_data.get_q_bins()
spectra = s_calculator.get_formatted_data()

self._q_bins = spectra.get_bin_edges(bin_ax="x").to("1/angstrom").magnitude

# Hold reporter at 80% for this message
prog_reporter.resetNumSteps(1, 0.8, 0.80000001)
Expand All @@ -167,11 +168,17 @@ def PyExec(self):
workspaces = []
workspaces.extend(
self.create_workspaces(
atoms_symbols=atom_symbols, s_data=s_data, atoms_data=atoms_data, max_quantum_order=self._max_event_order
atoms_symbols=atom_symbols,
spectra=spectra,
max_quantum_order=self._max_event_order,
)
)
workspaces.extend(
self.create_workspaces(atom_numbers=atom_numbers, s_data=s_data, atoms_data=atoms_data, max_quantum_order=self._max_event_order)
self.create_workspaces(
atom_numbers=atom_numbers,
spectra=spectra,
max_quantum_order=self._max_event_order,
)
)
prog_reporter.report("Workspaces with partial dynamical structure factors have been constructed.")

Expand Down
21 changes: 12 additions & 9 deletions Testing/SystemTests/tests/framework/AbinsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from tempfile import TemporaryDirectory

import systemtesting
from mantid.simpleapi import Abins, Abins2D, mtd, DeleteWorkspace

import abins
from abins.constants import (
ALL_INSTRUMENTS,
ALL_SUPPORTED_AB_INITIO_PROGRAMS,
Expand All @@ -18,7 +19,7 @@
)


class HelperTestingClass(object):
class HelperTestingClass:
def __init__(self):
self._temperature = 10 # K
self._sample_form = "Powder"
Expand All @@ -36,6 +37,8 @@ def __init__(self):
self._quantum_order_event = None
self._system_name = None

self._cache_directory = TemporaryDirectory()

def set_bin_width(self, width):
if not (isinstance(width, float) and 1.0 <= width <= 10.0):
raise ValueError("Invalid bin width: {}. ".format(width) + "Valid range is [1.0, 10.0] cm^-1")
Expand Down Expand Up @@ -94,6 +97,7 @@ def case_from_scratch(self):
Scale=self._scale,
ScaleByCrossSection=self._cross_section_factor,
OutputWorkspace=self._output_name,
CacheDirectory=self._cache_directory.name,
)

def case_restart_diff_t(self):
Expand Down Expand Up @@ -121,6 +125,7 @@ def case_restart_diff_t(self):
QuantumOrderEventsNumber=str(self._quantum_order_event),
ScaleByCrossSection=self._cross_section_factor,
OutputWorkspace=wrk_name + "init",
CacheDirectory=self._cache_directory.name,
)

# T = 20 K
Expand All @@ -137,6 +142,7 @@ def case_restart_diff_t(self):
QuantumOrderEventsNumber=str(self._quantum_order_event),
ScaleByCrossSection=self._cross_section_factor,
OutputWorkspace=wrk_name + "_mod",
CacheDirectory=self._cache_directory.name,
)

# T = 10 K
Expand All @@ -153,6 +159,7 @@ def case_restart_diff_t(self):
QuantumOrderEventsNumber=str(self._quantum_order_event),
ScaleByCrossSection=self._cross_section_factor,
OutputWorkspace=self._output_name,
CacheDirectory=self._cache_directory.name,
)

def case_restart_diff_order(self, order=None):
Expand All @@ -177,20 +184,15 @@ def case_restart_diff_order(self, order=None):
QuantumOrderEventsNumber=str(order),
ScaleByCrossSection=self._cross_section_factor,
OutputWorkspace=self._output_name,
CacheDirectory=self._cache_directory.name,
)

def __del__(self):
"""
Destructor removes output files after tests and workspaces.
:return:
"""

try:
abins.test_helpers.remove_output_files(list_of_names=[self._system_name])
except TypeError:
# nothing to remove but it is OK
pass

self._cache_directory.cleanup()
mtd.clear()


Expand Down Expand Up @@ -571,6 +573,7 @@ def runTest(self):
autoconvolution=True,
ScaleByCrossSection=self._cross_section_factor,
OutputWorkspace=self._output_name,
CacheDirectory=self._cache_directory.name,
**params_2d,
)

Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ libopenblas:
- 0.3.27

euphonic:
- '>=1.2.1,<2.0'
- '>=1.4.3,<2.0'

librdkafka:
- '>=1.6.0'
Expand Down
1 change: 0 additions & 1 deletion scripts/abins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from .atomsdata import AtomsData
from .abinsdata import AbinsData
from .powderdata import PowderData
from .sdata import SData, SDataByAngle

# Calculating modules
from .powdercalculator import PowderCalculator
Expand Down
12 changes: 9 additions & 3 deletions scripts/abins/abins2.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def PyExec(self):
cache_directory=self._cache_directory,
)
s_calculator.progress_reporter = prog_reporter
s_data = s_calculator.get_formatted_data()
spectra = s_calculator.get_formatted_data()

# Hold reporter at 80% for this message
prog_reporter.resetNumSteps(1, 0.8, 0.80000001)
Expand All @@ -149,11 +149,17 @@ def PyExec(self):

workspaces.extend(
self.create_workspaces(
atoms_symbols=atom_symbols, s_data=s_data, atoms_data=atoms_data, max_quantum_order=self._max_event_order
atoms_symbols=atom_symbols,
spectra=spectra,
max_quantum_order=self._max_event_order,
)
)
workspaces.extend(
self.create_workspaces(atom_numbers=atom_numbers, s_data=s_data, atoms_data=atoms_data, max_quantum_order=self._max_event_order)
self.create_workspaces(
atom_numbers=atom_numbers,
spectra=spectra,
max_quantum_order=self._max_event_order,
)
)
prog_reporter.report("Workspaces with partial dynamical structure factors have been constructed.")

Expand Down
Loading