Skip to content

Commit

Permalink
Merge pull request #119 from scipp/det-banks
Browse files Browse the repository at this point in the history
Process multiple detector banks via param series
  • Loading branch information
SimonHeybrock authored Apr 5, 2024
2 parents 8ddea00 + f2eae7a commit 8051614
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 61 deletions.
2 changes: 1 addition & 1 deletion conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requirements:
- python-graphviz
- plopp
- pythreejs
- sciline>=23.9.1
- sciline>=24.4.1
- scipp>=23.8.0
- scippneutron>=23.9.0
- scippnexus>=23.12.1
Expand Down
22 changes: 15 additions & 7 deletions docs/user-guide/loki/loki-direct-beam.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
" 'wavelength', wavelength_min, wavelength_max, n_wavelength_bands + 1\n",
")\n",
"\n",
"# Masking\n",
"masks = ['mask_new_July2022.xml']\n",
"banks = ['larmor_detector']\n",
"\n",
"params[CorrectForGravity] = True\n",
"params[UncertaintyBroadcastMode] = UncertaintyBroadcastMode.upper_bound\n",
Expand Down Expand Up @@ -121,7 +121,9 @@
"providers = sans.providers + loki.providers + (isis.io.read_xml_detector_masking,)\n",
"\n",
"pipeline = sciline.Pipeline(providers, params=params)\n",
"pipeline.insert(sans.merge_banks)\n",
"pipeline.set_param_series(PixelMaskFilename, masks)\n",
"pipeline.set_param_series(NeXusDetectorName, banks)\n",
"\n",
"# Add providers that fetch data from online resource\n",
"for provider in loki.data.providers:\n",
Expand Down Expand Up @@ -163,7 +165,10 @@
"\n",
"There are more details on how this is done in the [beam center finder notebook](../common/beam-center-finder.ipynb),\n",
"but for now we simply reuse the pipeline (by making a copy),\n",
"and inserting the provider that will compute the beam center:"
"and inserting the provider that will compute the beam center.\n",
"\n",
"For now, we compute the beam center only for the rear detector (named 'larmor_detector') but apply it to all banks (currently there is only one bank).\n",
"The beam center may need to be computed or applied differently to each bank, see [scipp/esssans#28](https://github.com/scipp/esssans/issues/28)."
]
},
{
Expand All @@ -174,6 +179,8 @@
"outputs": [],
"source": [
"bc_pipeline = pipeline.copy()\n",
"bc_pipeline.del_param_table(NeXusDetectorName)\n",
"bc_pipeline[NeXusDetectorName] = 'larmor_detector'\n",
"bc_pipeline.insert(sans.beam_center_from_center_of_mass)"
]
},
Expand Down Expand Up @@ -523,14 +530,16 @@
"pipeline = sciline.Pipeline(providers, params=params)\n",
"for provider in loki.data.providers:\n",
" pipeline.insert(provider)\n",
"pipeline.insert(sans.merge_banks)\n",
"pipeline.set_param_series(PixelMaskFilename, masks)\n",
"pipeline.set_param_series(NeXusDetectorName, banks)\n",
"\n",
"# Set parameter series for file names\n",
"pipeline.set_param_series(Filename[SampleRun], sample_runs)\n",
"pipeline.set_param_series(Filename[BackgroundRun], background_runs)\n",
"\n",
"# Add event merging provider\n",
"pipeline.insert(sans.i_of_q.merge_multiple_runs)\n",
"pipeline.insert(sans.merge_runs)\n",
"\n",
"# Add dummy sample provider\n",
"pipeline.insert(loki.io.dummy_load_sample)"
Expand All @@ -554,9 +563,7 @@
"metadata": {},
"outputs": [],
"source": [
"pipeline.visualize(\n",
" BackgroundSubtractedIofQ, compact=True, graph_attr={'rankdir': 'LR'}\n",
")"
"pipeline.visualize(BackgroundSubtractedIofQ, compact=True, graph_attr={'rankdir': 'LR'})"
]
},
{
Expand Down Expand Up @@ -621,7 +628,8 @@
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3"
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"essreduce",
"plopp",
"pythreejs",
"sciline>=24.2.0",
"sciline>=24.4.1",
"scipp>=23.8.0",
"scippneutron>=23.9.0",
"scippnexus>=23.12.1", # 23.12.0 and below deadlock in threaded use
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ graphviz
essreduce
plopp
pythreejs
sciline>=24.2.0
sciline>=24.4.1
scipp>=23.8.0
scippneutron>=23.9.0
scippnexus>=23.12.1
22 changes: 11 additions & 11 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SHA1:94fbb7094df46d96dca3c53cfe92446234039825
# SHA1:a7107dcab866c4c7fe8573b3c5cbaf22e7b1f587
#
# This file is autogenerated by pip-compile-multi
# To update, run:
Expand All @@ -19,11 +19,11 @@ cloudpickle==3.0.0
# via dask
comm==0.2.2
# via ipywidgets
contourpy==1.2.0
contourpy==1.2.1
# via matplotlib
cycler==0.12.1
# via matplotlib
dask==2024.3.1
dask==2024.4.1
# via -r base.in
decorator==5.1.1
# via ipython
Expand All @@ -33,17 +33,17 @@ executing==2.0.1
# via stack-data
fonttools==4.50.0
# via matplotlib
fsspec==2024.3.0
fsspec==2024.3.1
# via dask
graphviz==0.20.2
graphviz==0.20.3
# via -r base.in
h5py==3.10.0
# via
# scippneutron
# scippnexus
idna==3.6
# via requests
importlib-metadata==7.0.2
importlib-metadata==7.1.0
# via dask
ipydatawidgets==4.3.5
# via pythreejs
Expand All @@ -63,7 +63,7 @@ kiwisolver==1.4.5
# via matplotlib
locket==1.0.0
# via partd
matplotlib==3.8.3
matplotlib==3.8.4
# via plopp
matplotlib-inline==0.1.6
# via ipython
Expand All @@ -90,7 +90,7 @@ pexpect==4.9.0
# via ipython
pickleshare==0.7.5
# via ipython
pillow==10.2.0
pillow==10.3.0
# via matplotlib
platformdirs==4.2.0
# via pooch
Expand Down Expand Up @@ -120,22 +120,22 @@ pyyaml==6.0.1
# via dask
requests==2.31.0
# via pooch
sciline==24.2.1
sciline==24.4.1
# via -r base.in
scipp==24.2.0
# via
# -r base.in
# essreduce
# scippneutron
# scippnexus
scippneutron==24.1.0
scippneutron==24.3.0
# via -r base.in
scippnexus==24.3.1
# via
# -r base.in
# essreduce
# scippneutron
scipy==1.12.0
scipy==1.13.0
# via
# scippneutron
# scippnexus
Expand Down
6 changes: 3 additions & 3 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ colorama==0.4.6
# via tox
distlib==0.3.8
# via virtualenv
filelock==3.13.1
filelock==3.13.3
# via
# tox
# virtualenv
gitdb==4.0.11
# via gitpython
gitpython==3.1.42
gitpython==3.1.43
# via -r ci.in
idna==3.6
# via requests
Expand All @@ -48,7 +48,7 @@ tomli==2.0.1
# via
# pyproject-api
# tox
tox==4.14.1
tox==4.14.2
# via -r ci.in
urllib3==2.2.1
# via requests
Expand Down
10 changes: 4 additions & 6 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async-lru==2.0.4
# via jupyterlab
cffi==1.16.0
# via argon2-cffi-bindings
copier==9.1.1
copier==9.2.0
# via -r dev.in
dunamai==1.19.2
# via copier
Expand All @@ -38,7 +38,7 @@ funcy==2.0
# via copier
h11==0.14.0
# via httpcore
httpcore==1.0.4
httpcore==1.0.5
# via httpx
httpx==0.27.0
# via jupyterlab
Expand All @@ -55,7 +55,7 @@ jsonschema[format-nongpl]==4.21.1
# jupyter-events
# jupyterlab-server
# nbformat
jupyter-events==0.9.1
jupyter-events==0.10.0
# via jupyter-server
jupyter-lsp==2.2.4
# via jupyterlab
Expand Down Expand Up @@ -85,16 +85,14 @@ plumbum==1.8.2
# via copier
prometheus-client==0.20.0
# via jupyter-server
pycparser==2.21
pycparser==2.22
# via cffi
pydantic==2.6.4
# via copier
pydantic-core==2.16.3
# via pydantic
python-json-logger==2.0.7
# via jupyter-events
pyyaml-include==1.3.2
# via copier
questionary==2.0.1
# via copier
rfc3339-validator==0.1.4
Expand Down
6 changes: 3 additions & 3 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fastjsonschema==2.19.1
# via nbformat
imagesize==1.4.1
# via sphinx
ipykernel==6.29.3
ipykernel==6.29.4
# via -r docs.in
jinja2==3.1.3
# via
Expand Down Expand Up @@ -81,9 +81,9 @@ myst-parser==2.0.0
# via -r docs.in
nbclient==0.10.0
# via nbconvert
nbconvert==7.16.2
nbconvert==7.16.3
# via nbsphinx
nbformat==5.10.3
nbformat==5.10.4
# via
# nbclient
# nbconvert
Expand Down
20 changes: 11 additions & 9 deletions requirements/nightly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ cloudpickle==3.0.0
# via dask
comm==0.2.2
# via ipywidgets
contourpy==1.2.0
contourpy==1.2.1
# via matplotlib
cycler==0.12.1
# via matplotlib
dask==2024.3.1
dask==2024.4.1
# via -r nightly.in
decorator==5.1.1
# via ipython
Expand All @@ -32,21 +32,21 @@ executing==2.0.1
# via stack-data
fonttools==4.50.0
# via matplotlib
fsspec==2024.3.0
fsspec==2024.3.1
# via dask
graphviz==0.20.2
graphviz==0.20.3
# via -r nightly.in
h5py==3.10.0
# via
# scippneutron
# scippnexus
idna==3.6
# via requests
importlib-metadata==7.0.2
importlib-metadata==7.1.0
# via dask
ipydatawidgets==4.3.5
# via pythreejs
ipython==8.22.2
ipython==8.23.0
# via ipywidgets
ipywidgets==8.1.2
# via
Expand All @@ -60,7 +60,7 @@ kiwisolver==1.4.5
# via matplotlib
locket==1.0.0
# via partd
matplotlib==3.8.3
matplotlib==3.8.4
# via plopp
matplotlib-inline==0.1.6
# via ipython
Expand All @@ -80,7 +80,7 @@ partd==1.4.1
# via dask
pexpect==4.9.0
# via ipython
pillow==10.2.0
pillow==10.3.0
# via matplotlib
platformdirs==4.2.0
# via pooch
Expand Down Expand Up @@ -123,7 +123,7 @@ scippnexus @ git+https://github.com/scipp/scippnexus@main
# -r nightly.in
# essreduce
# scippneutron
scipy==1.12.0
scipy==1.13.0
# via
# scippneutron
# scippnexus
Expand All @@ -147,6 +147,8 @@ traitlets==5.14.2
# traittypes
traittypes==0.2.1
# via ipydatawidgets
typing-extensions==4.10.0
# via ipython
urllib3==2.2.1
# via requests
wcwidth==0.2.13
Expand Down
4 changes: 2 additions & 2 deletions requirements/static.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ cfgv==3.4.0
# via pre-commit
distlib==0.3.8
# via virtualenv
filelock==3.13.1
filelock==3.13.3
# via virtualenv
identify==2.5.35
# via pre-commit
nodeenv==1.8.0
# via pre-commit
platformdirs==4.2.0
# via virtualenv
pre-commit==3.6.2
pre-commit==3.7.0
# via -r static.in
pyyaml==6.0.1
# via pre-commit
Expand Down
2 changes: 1 addition & 1 deletion requirements/wheels.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# pip-compile-multi
#
build==1.1.1
build==1.2.1
# via -r wheels.in
packaging==24.0
# via build
Expand Down
Loading

0 comments on commit 8051614

Please sign in to comment.