Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c183566
Add ideal instrument and models
Apr 16, 2025
41d3880
Drop Ikeda-Carpenter spec until implementation is written
ajjackson Jan 7, 2026
e757b6e
Add ideal models to MODELS dict, tweak __init__ signatures
ajjackson Jan 7, 2026
a1b3c14
Redefine Boxcar function: width, not sigma
ajjackson Jan 7, 2026
9fdb0ab
add IDEAL instrument to INSTRUMENT_MAP
ajjackson Jan 7, 2026
3c7befd
Update IDEAL models from "omega_q" notation to "points"
ajjackson Jan 7, 2026
6a045e9
Rework boxcar, triangular IDEAL models to quantize points
ajjackson Jan 9, 2026
b7b7e24
Update test filename
ajjackson Jan 9, 2026
ea9d0bf
Remove debug printing
ajjackson Jan 12, 2026
b9703ab
Convolution-free implementation of snapped peaks mixin
ajjackson Jan 12, 2026
7c8e120
Remove "static" broadening mixin, use general implementation
ajjackson Jan 12, 2026
62a52fc
Tidy up ideal triangle model, add unit test
ajjackson Jan 12, 2026
6bcc29f
Add the test functions
ajjackson Jan 12, 2026
4261787
Simplify triangle (no kernel snap); add peaks snap for trapezoid
ajjackson Jan 12, 2026
fd5bf10
Refactor Ideal instrument tests
ajjackson Jan 13, 2026
b11abca
Fix trapezoid parameters, add unit tests for Gaussian and trapezoid
ajjackson Jan 13, 2026
88cd877
Improve appearance of test sanity-check plots
ajjackson Jan 13, 2026
04b7a4b
Add Lorentzian unit tests, refactor with itertools.product()
ajjackson Jan 13, 2026
7dfed21
Drop unused import
ajjackson Jan 13, 2026
bb150b8
Ruff-friendly jaxtyping annotations in ideal.py
ajjackson Jan 13, 2026
af70859
Cleanup ideal.py a bit more using ruff
ajjackson Jan 13, 2026
9027f1c
ruff format ideal.py
ajjackson Jan 13, 2026
1df7e5b
ruff format test_ideal_instrument.py
ajjackson Jan 13, 2026
3a54fbb
Correct default ideal model; add ideal models to docs
ajjackson Jan 13, 2026
7efc647
Review response: Fix boxcar sigma calculation, update docstrings
ajjackson Jan 13, 2026
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
docs/include/auto-instruments
tests/unit_tests/data/*.png

# Test debug images
tests/unit_tests/data/*.png
tests/unit_tests/data/*/*.png

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
7 changes: 7 additions & 0 deletions docs/source/api/models/ideal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resolution\_functions.models.ideal
----------------------------------

.. automodule:: resolution_functions.models.ideal
:members:
:show-inheritance:
:special-members: __call__
8 changes: 8 additions & 0 deletions docs/source/instruments/ideal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
IDEAL
#####

The IDEAL instrument is synthetic and supports a variety of
energy-independent 1-D broadening models. It is mainly intended for
testing and experimentation.

.. include:: ../../include/auto-instruments/ideal-auto.rst
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,18 @@ where = ["src"]

[tool.setuptools.package-data]
resolution_functions = ["instrument_data/*.yaml"]

[tool.ruff]
line-length = 88
target-version = "py311"

[tool.ruff.lint]
# When jaxtyping array with one dimension, include a leading space
# e.g. Float[np.ndarray, " mesh"]
# in order to throw F722 (like a higher-D array) rather than F821
# (which is sometimes a useful error).
# https://docs.kidger.site/jaxtyping/faq/#flake8-or-ruff-are-throwing-an-error

ignore = [
"F722" # Caused by jaxtyping annotations.
]
1 change: 1 addition & 0 deletions src/resolution_functions/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'ARCS': ('arcs.yaml', None),
'CNCS': ('cncs.yaml', None),
'HYSPEC': ('hyspec.yaml', None),
'IDEAL': ('ideal.yaml', None),
'Lagrange': ('lagrange.yaml', None),
'LET': ('let.yaml', None),
'MAPS': ('maps.yaml', None),
Expand Down
47 changes: 47 additions & 0 deletions src/resolution_functions/instrument_data/ideal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "IDEAL"
default_version: "IDEAL"

version:
IDEAL:
default_model: "gaussian"
models:
boxcar: "boxcar_v1"
boxcar_v1:
function: "boxcar"
citation: [""]
parameters:
defaults: {}
restrictions: {}
configurations: {}
triangle: "triangle_v1"
triangle_v1:
function: "triangle"
citation: [ "" ]
parameters:
defaults: {}
restrictions: {}
configurations: { }
trapezoid: "trapezoid_v1"
trapezoid_v1:
function: "trapezoid"
citation: [ "" ]
parameters:
defaults: {}
restrictions: {}
configurations: { }
gaussian: "gaussian_v1"
gaussian_v1:
function: "gaussian"
citation: [ "" ]
parameters:
defaults: {}
restrictions: {}
configurations: { }
lorentzian: "lorentzian_v1"
lorentzian_v1:
function: "lorentzian"
citation: [ "" ]
parameters:
defaults: {}
restrictions: {}
configurations: { }
12 changes: 12 additions & 0 deletions src/resolution_functions/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@

from typing import TYPE_CHECKING

from .ideal import (
GenericBoxcar1DModel,
GenericTriangle1DModel,
GenericTrapezoid1DModel,
GenericGaussian1DModel,
GenericLorentzian1DModel,
)
from .polynomial import PolynomialModel1D, DiscontinuousPolynomialModel1D
from .panther_abins import PantherAbINSModel
from .pychop import PyChopModelFermi, PyChopModelNonFermi, PyChopModelCNCS, PyChopModelLET
Expand All @@ -24,6 +31,11 @@


MODELS: dict[str, type[InstrumentModel]] = {
'boxcar': GenericBoxcar1DModel,
'triangle': GenericTriangle1DModel,
'trapezoid': GenericTrapezoid1DModel,
'gaussian': GenericGaussian1DModel,
'lorentzian': GenericLorentzian1DModel,
'polynomial_1d': PolynomialModel1D,
'discontinuous_polynomial': DiscontinuousPolynomialModel1D,
'tosca_book': ToscaBookModel,
Expand Down
Loading
Loading