Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ requires-python = ">=3.10"
dependencies = [
"dask",
"graphviz",
"essreduce>=24.11.3",
"essreduce>=25.02.4",
"numpy",
"pandas",
"plopp",
"pythreejs",
"sciline>=24.06.2",
"scipp>=24.09.1", # Fixed new hist/bin API
"scippneutron>=24.06.0",
"scippneutron>=25.02.1",
"scippnexus>=23.12.1", # 23.12.0 and below deadlock in threaded use
]

Expand Down
4 changes: 2 additions & 2 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY!
dask
graphviz
essreduce>=24.11.3
essreduce>=25.02.4
numpy
pandas
plopp
pythreejs
sciline>=24.06.2
scipp>=24.09.1
scippneutron>=24.06.0
scippneutron>=25.02.1
scippnexus>=23.12.1
35 changes: 27 additions & 8 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# SHA1:71fbc763453db59fbe23acb0df92531c0434f7ef
# SHA1:4505a5e875bef5ea2f9d5ce0d28ffeafee367336
#
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# pip-compile-multi
#
annotated-types==0.7.0
# via pydantic
asttokens==3.0.0
# via stack-data
click==8.1.8
Expand All @@ -19,11 +21,15 @@ cyclebane==24.10.0
# via sciline
cycler==0.12.1
# via matplotlib
dask==2025.1.0
dask==2025.2.0
# via -r base.in
decorator==5.1.1
# via ipython
essreduce==25.2.0
dnspython==2.7.0
# via email-validator
email-validator==2.2.0
# via scippneutron
essreduce==25.2.4
# via -r base.in
exceptiongroup==1.2.2
# via ipython
Expand All @@ -35,10 +41,12 @@ fsspec==2025.2.0
# via dask
graphviz==0.20.3
# via -r base.in
h5py==3.12.1
h5py==3.13.0
# via
# scippneutron
# scippnexus
idna==3.10
# via email-validator
importlib-metadata==8.6.1
# via dask
ipydatawidgets==4.3.5
Expand All @@ -55,6 +63,8 @@ jupyterlab-widgets==3.0.13
# via ipywidgets
kiwisolver==1.4.8
# via matplotlib
lazy-loader==0.4
# via scippneutron
locket==1.0.0
# via partd
matplotlib==3.10.0
Expand All @@ -67,7 +77,7 @@ mpltoolbox==24.5.1
# via scippneutron
networkx==3.4.2
# via cyclebane
numpy==2.2.2
numpy==2.2.3
# via
# -r base.in
# contourpy
Expand All @@ -83,6 +93,7 @@ numpy==2.2.2
packaging==24.2
# via
# dask
# lazy-loader
# matplotlib
pandas==2.2.3
# via -r base.in
Expand All @@ -104,6 +115,10 @@ ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.3
# via stack-data
pydantic==2.10.6
# via scippneutron
pydantic-core==2.27.2
# via pydantic
pygments==2.19.1
# via ipython
pyparsing==3.2.1
Expand All @@ -112,6 +127,7 @@ python-dateutil==2.9.0.post0
# via
# matplotlib
# pandas
# scippneutron
# scippnexus
pythreejs==2.4.2
# via -r base.in
Expand All @@ -129,7 +145,7 @@ scipp==25.2.0
# essreduce
# scippneutron
# scippnexus
scippneutron==25.1.0
scippneutron==25.2.1
# via
# -r base.in
# essreduce
Expand All @@ -138,7 +154,7 @@ scippnexus==24.11.1
# -r base.in
# essreduce
# scippneutron
scipy==1.15.1
scipy==1.15.2
# via
# scippneutron
# scippnexus
Expand All @@ -161,7 +177,10 @@ traitlets==5.14.3
traittypes==0.2.1
# via ipydatawidgets
typing-extensions==4.12.2
# via ipython
# via
# ipython
# pydantic
# pydantic-core
tzdata==2025.1
# via pandas
wcwidth==0.2.13
Expand Down
4 changes: 2 additions & 2 deletions requirements/basetest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ idna==3.10
# via requests
iniconfig==2.0.0
# via pytest
numpy==2.2.2
numpy==2.2.3
# via scipy
packaging==24.2
# via
Expand All @@ -31,7 +31,7 @@ pytest==8.3.4
# via -r basetest.in
requests==2.32.3
# via pooch
scipy==1.15.1
scipy==1.15.2
# via -r basetest.in
tomli==2.2.1
# via pytest
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# pip-compile-multi
#
cachetools==5.5.1
cachetools==5.5.2
# via tox
certifi==2025.1.31
# via requests
Expand Down
8 changes: 1 addition & 7 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
-r static.txt
-r test.txt
-r wheels.txt
annotated-types==0.7.0
# via pydantic
anyio==4.8.0
# via
# httpx
Expand All @@ -28,7 +26,7 @@ async-lru==2.0.4
# via jupyterlab
cffi==1.17.1
# via argon2-cffi-bindings
copier==9.4.1
copier==9.5.0
# via -r dev.in
dunamai==1.23.0
# via copier
Expand Down Expand Up @@ -87,10 +85,6 @@ prometheus-client==0.21.1
# via jupyter-server
pycparser==2.22
# via cffi
pydantic==2.10.6
# via copier
pydantic-core==2.27.2
# via pydantic
python-json-logger==3.2.1
# via jupyter-events
questionary==2.1.0
Expand Down
10 changes: 3 additions & 7 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ accessible-pygments==0.0.5
# via pydata-sphinx-theme
alabaster==1.0.0
# via sphinx
appnope==0.1.4
# via ipykernel
attrs==25.1.0
# via
# jsonschema
Expand Down Expand Up @@ -42,8 +40,6 @@ docutils==0.21.2
# sphinx
fastjsonschema==2.21.1
# via nbformat
idna==3.10
# via requests
imagesize==1.4.1
# via sphinx
ipykernel==6.29.5
Expand Down Expand Up @@ -83,7 +79,7 @@ mdit-py-plugins==0.4.2
# via myst-parser
mdurl==0.1.2
# via markdown-it-py
mistune==3.1.1
mistune==3.1.2
# via nbconvert
myst-parser==4.0.1
# via -r docs.in
Expand All @@ -108,7 +104,7 @@ platformdirs==4.3.6
# pooch
pooch==1.8.2
# via -r docs.in
psutil==6.1.1
psutil==7.0.0
# via ipykernel
pydata-sphinx-theme==0.16.1
# via -r docs.in
Expand All @@ -124,7 +120,7 @@ requests==2.32.3
# via
# pooch
# sphinx
rpds-py==0.22.3
rpds-py==0.23.0
# via
# jsonschema
# referencing
Expand Down
8 changes: 4 additions & 4 deletions requirements/nightly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cyclebane==24.10.0
# via sciline
cycler==0.12.1
# via matplotlib
dask==2025.1.0
dask==2025.2.0
# via -r nightly.in
decorator==5.1.1
# via ipython
Expand All @@ -50,7 +50,7 @@ fsspec==2025.2.0
# via dask
graphviz==0.20.3
# via -r nightly.in
h5py==3.12.1
h5py==3.13.0
# via
# scippneutron
# scippnexus
Expand Down Expand Up @@ -92,7 +92,7 @@ mpltoolbox==24.5.1
# via scippneutron
networkx==3.4.2
# via cyclebane
numpy==2.2.2
numpy==2.2.3
# via
# -r nightly.in
# contourpy
Expand Down Expand Up @@ -181,7 +181,7 @@ scippnexus @ git+https://github.com/scipp/scippnexus@main
# -r nightly.in
# essreduce
# scippneutron
scipy==1.15.1
scipy==1.15.2
# via
# -r nightly.in
# scippneutron
Expand Down
20 changes: 8 additions & 12 deletions src/ess/isissans/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
DetectorPixelShape,
DetectorPositionOffset,
Incident,
Measurement,
MonitorData,
MonitorPositionOffset,
MonitorType,
NeXusComponent,
NeXusMonitorName,
NonBackgroundWavelengthRange,
RunNumber,
RunTitle,
RunType,
SampleRun,
ScatteringRunType,
Expand Down Expand Up @@ -174,14 +173,12 @@ def monitor_to_tof(
return TofMonitor[RunType, MonitorType](da)


def run_number(dg: LoadedFileContents[SampleRun]) -> RunNumber:
"""Get the run number from the raw sample data."""
return RunNumber(int(dg['run_number']))


def run_title(dg: LoadedFileContents[SampleRun]) -> RunTitle:
"""Get the run title from the raw sample data."""
return RunTitle(dg['run_title'].value)
def experiment_metadata(dg: LoadedFileContents[SampleRun]) -> Measurement:
"""Get experiment metadata from the raw sample data."""
return Measurement(
title=dg['run_title'].value,
run_number=dg['run_number'],
)


def helium3_tube_detector_pixel_shape() -> DetectorPixelShape[ScatteringRunType]:
Expand Down Expand Up @@ -235,6 +232,7 @@ def get_detector_ids_from_sample_run(data: TofData[SampleRun]) -> DetectorIDs:
providers = (
dummy_assemble_detector_data,
dummy_assemble_monitor_data,
experiment_metadata,
to_detector_position_offset,
to_monitor_position_offset,
get_source_position,
Expand All @@ -245,8 +243,6 @@ def get_detector_ids_from_sample_run(data: TofData[SampleRun]) -> DetectorIDs:
get_monitor_data,
data_to_tof,
monitor_to_tof,
run_number,
run_title,
lab_frame_transform,
helium3_tube_detector_pixel_shape,
)
10 changes: 5 additions & 5 deletions src/ess/sans/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
from .types import (
BackgroundSubtractedIofQ,
MaskedDetectorIDs,
Measurement,
OutFilename,
PixelMaskFilename,
RunNumber,
RunTitle,
)


def save_background_subtracted_iofq(
*,
iofq: BackgroundSubtractedIofQ,
out_filename: OutFilename,
run_number: RunNumber,
run_title: RunTitle,
measurement: Measurement,
) -> None:
"""Save background-subtracted I(Q) histogram as an NXcanSAS file."""
if iofq.bins is None:
Expand All @@ -30,7 +28,9 @@ def save_background_subtracted_iofq(
if da.coords.is_edges('Q'):
da.coords['Q'] = sc.midpoints(da.coords['Q'])
with snx.File(out_filename, 'w') as f:
f['sasentry'] = nxcansas.SASentry(title=run_title, run=run_number)
f['sasentry'] = nxcansas.SASentry(
title=measurement.title, run=measurement.run_number_maybe_int
)
f['sasentry']['sasdata'] = nxcansas.SASdata(da, Q_variances='resolutions')


Expand Down
7 changes: 2 additions & 5 deletions src/ess/sans/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,5 @@ class CleanMonitor(

# 4 Metadata

RunTitle = NewType('RunTitle', str)
"""Title of the run."""

RunNumber = NewType('RunNumber', int)
"""Run number."""
Beamline = reduce_t.Beamline
Measurement = reduce_t.Measurement
Loading