Skip to content

Commit 522f00f

Browse files
authored
Merge pull request #106 from scipp/back-to-tof
Convert reduced data back to tof
2 parents 5a5ca40 + 5b5da74 commit 522f00f

20 files changed

+265
-110
lines changed

docs/user-guide/dream/dream-data-reduction.ipynb

+18-18
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
"outputs": [],
2121
"source": [
2222
"import scipp as sc\n",
23-
"import scippneutron as scn\n",
24-
"import scippneutron.io\n",
2523
"\n",
2624
"from ess import dream, powder\n",
2725
"import ess.dream.data # noqa: F401\n",
@@ -90,7 +88,7 @@
9088
"source": [
9189
"## Use the workflow\n",
9290
"\n",
93-
"We can visualize the graph for computing the final normalized result for intensity as a function of d-spacing:"
91+
"We can visualize the graph for computing the final normalized result for intensity as a function of time-of-flight:"
9492
]
9593
},
9694
{
@@ -100,15 +98,16 @@
10098
"metadata": {},
10199
"outputs": [],
102100
"source": [
103-
"workflow.visualize(IofDspacing, graph_attr={\"rankdir\": \"LR\"})"
101+
"workflow.visualize([IofTof, ReducedTofCIF], graph_attr={\"rankdir\": \"LR\"})"
104102
]
105103
},
106104
{
107105
"cell_type": "markdown",
108106
"id": "8",
109107
"metadata": {},
110108
"source": [
111-
"We then call `compute()` to compute the result:"
109+
"We then call `compute()` to compute the result:\n",
110+
"(The `cif` object will later be used to write the result to disk.)"
112111
]
113112
},
114113
{
@@ -118,8 +117,9 @@
118117
"metadata": {},
119118
"outputs": [],
120119
"source": [
121-
"result = workflow.compute(IofDspacing)\n",
122-
"result"
120+
"results = workflow.compute([IofTof, ReducedTofCIF])\n",
121+
"result = results[IofTof]\n",
122+
"cif_data = results[ReducedTofCIF]"
123123
]
124124
},
125125
{
@@ -129,8 +129,8 @@
129129
"metadata": {},
130130
"outputs": [],
131131
"source": [
132-
"dspacing_histogram = result.hist()\n",
133-
"dspacing_histogram.plot()"
132+
"histogram = result.hist()\n",
133+
"histogram.plot()"
134134
]
135135
},
136136
{
@@ -148,11 +148,11 @@
148148
"metadata": {},
149149
"outputs": [],
150150
"source": [
151-
"to_save = dspacing_histogram.assign_coords(\n",
152-
" dspacing=sc.midpoints(\n",
153-
" dspacing_histogram.coords[\"dspacing\"]\n",
154-
" ))\n",
155-
"scn.io.save_xye(\"dspacing.xye\", to_save)"
151+
"cif_data.comment = \"\"\"This file was generated with the DREAM data reduction user guide\n",
152+
"in the documentation of ESSdiffraction.\n",
153+
"See https://scipp.github.io/essdiffraction/\n",
154+
"\"\"\"\n",
155+
"cif_data.save('reduced.cif')"
156156
]
157157
},
158158
{
@@ -333,7 +333,7 @@
333333
"metadata": {},
334334
"outputs": [],
335335
"source": [
336-
"workflow.visualize(IofDspacing, graph_attr={\"rankdir\": \"LR\"})"
336+
"workflow.visualize(IofTof, graph_attr={\"rankdir\": \"LR\"})"
337337
]
338338
},
339339
{
@@ -343,8 +343,8 @@
343343
"metadata": {},
344344
"outputs": [],
345345
"source": [
346-
"results = workflow.compute((IofDspacing, WavelengthMonitor[SampleRun, CaveMonitor]))\n",
347-
"normalized_by_monitor = results[IofDspacing]\n",
346+
"results = workflow.compute((IofTof, WavelengthMonitor[SampleRun, CaveMonitor]))\n",
347+
"normalized_by_monitor = results[IofTof]\n",
348348
"monitor = results[WavelengthMonitor[SampleRun, CaveMonitor]]\n",
349349
"monitor"
350350
]
@@ -375,7 +375,7 @@
375375
"outputs": [],
376376
"source": [
377377
"sc.plot({\n",
378-
" 'By proton charge': dspacing_histogram,\n",
378+
" 'By proton charge': histogram,\n",
379379
" 'By monitor': normalized_by_monitor.hist()\n",
380380
"})"
381381
]

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dependencies = [
3838
"pythreejs",
3939
"sciline>=24.06.0",
4040
"scipp>=24.09.1",
41-
"scippneutron>=24.9.0",
41+
"scippneutron>=24.11.0",
4242
"scippnexus>=23.12.0",
4343
]
4444

requirements/base.txt

+17-17
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ asttokens==2.4.1
99
# via stack-data
1010
click==8.1.7
1111
# via dask
12-
cloudpickle==3.0.0
12+
cloudpickle==3.1.0
1313
# via dask
1414
comm==0.2.2
1515
# via ipywidgets
16-
contourpy==1.3.0
16+
contourpy==1.3.1
1717
# via matplotlib
1818
cyclebane==24.10.0
1919
# via sciline
2020
cycler==0.12.1
2121
# via matplotlib
22-
dask==2024.9.1
22+
dask==2024.11.2
2323
# via -r base.in
2424
decorator==5.1.1
2525
# via ipython
26-
essreduce==24.10.2
26+
essreduce==24.11.1
2727
# via -r base.in
2828
exceptiongroup==1.2.2
2929
# via ipython
3030
executing==2.1.0
3131
# via stack-data
3232
fonttools==4.54.1
3333
# via matplotlib
34-
fsspec==2024.9.0
34+
fsspec==2024.10.0
3535
# via dask
3636
graphviz==0.20.3
3737
# via -r base.in
@@ -43,13 +43,13 @@ importlib-metadata==8.5.0
4343
# via dask
4444
ipydatawidgets==4.3.5
4545
# via pythreejs
46-
ipython==8.28.0
46+
ipython==8.29.0
4747
# via ipywidgets
4848
ipywidgets==8.1.5
4949
# via
5050
# ipydatawidgets
5151
# pythreejs
52-
jedi==0.19.1
52+
jedi==0.19.2
5353
# via ipython
5454
jupyterlab-widgets==3.0.13
5555
# via ipywidgets
@@ -65,9 +65,9 @@ matplotlib-inline==0.1.7
6565
# via ipython
6666
mpltoolbox==24.5.1
6767
# via scippneutron
68-
networkx==3.4
68+
networkx==3.4.2
6969
# via cyclebane
70-
numpy==2.1.2
70+
numpy==2.1.3
7171
# via
7272
# -r base.in
7373
# contourpy
@@ -79,7 +79,7 @@ numpy==2.1.2
7979
# scipp
8080
# scippneutron
8181
# scipy
82-
packaging==24.1
82+
packaging==24.2
8383
# via
8484
# dask
8585
# matplotlib
@@ -89,9 +89,9 @@ partd==1.4.2
8989
# via dask
9090
pexpect==4.9.0
9191
# via ipython
92-
pillow==10.4.0
92+
pillow==11.0.0
9393
# via matplotlib
94-
plopp==24.9.3
94+
plopp==24.10.0
9595
# via
9696
# -r base.in
9797
# scippneutron
@@ -103,7 +103,7 @@ pure-eval==0.2.3
103103
# via stack-data
104104
pygments==2.18.0
105105
# via ipython
106-
pyparsing==3.1.4
106+
pyparsing==3.2.0
107107
# via matplotlib
108108
python-dateutil==2.9.0.post0
109109
# via
@@ -113,7 +113,7 @@ pythreejs==2.4.2
113113
# via -r base.in
114114
pyyaml==6.0.2
115115
# via dask
116-
sciline==24.6.3
116+
sciline==24.10.0
117117
# via
118118
# -r base.in
119119
# essreduce
@@ -123,9 +123,9 @@ scipp==24.11.1
123123
# essreduce
124124
# scippneutron
125125
# scippnexus
126-
scippneutron==24.9.0
126+
scippneutron==24.11.0
127127
# via -r base.in
128-
scippnexus==24.10.0
128+
scippnexus==24.11.0
129129
# via
130130
# -r base.in
131131
# essreduce
@@ -160,5 +160,5 @@ wcwidth==0.2.13
160160
# via prompt-toolkit
161161
widgetsnbextension==4.0.13
162162
# via ipywidgets
163-
zipp==3.20.2
163+
zipp==3.21.0
164164
# via importlib-metadata

requirements/basetest.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ idna==3.10
1515
# via requests
1616
iniconfig==2.0.0
1717
# via pytest
18-
numpy==2.1.2
18+
numpy==2.1.3
1919
# via pandas
20-
packaging==24.1
20+
packaging==24.2
2121
# via
2222
# pooch
2323
# pytest
@@ -39,7 +39,7 @@ requests==2.32.3
3939
# via pooch
4040
six==1.16.0
4141
# via python-dateutil
42-
tomli==2.0.2
42+
tomli==2.1.0
4343
# via pytest
4444
tzdata==2024.2
4545
# via pandas

requirements/ci.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ gitpython==3.1.43
2727
# via -r ci.in
2828
idna==3.10
2929
# via requests
30-
packaging==24.1
30+
packaging==24.2
3131
# via
3232
# -r ci.in
3333
# pyproject-api
@@ -44,15 +44,15 @@ requests==2.32.3
4444
# via -r ci.in
4545
smmap==5.0.1
4646
# via gitdb
47-
tomli==2.0.2
47+
tomli==2.1.0
4848
# via
4949
# pyproject-api
5050
# tox
51-
tox==4.21.2
51+
tox==4.23.2
5252
# via -r ci.in
5353
typing-extensions==4.12.2
5454
# via tox
5555
urllib3==2.2.3
5656
# via requests
57-
virtualenv==20.26.6
57+
virtualenv==20.27.1
5858
# via tox

requirements/dev.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
-r wheels.txt
1515
annotated-types==0.7.0
1616
# via pydantic
17-
anyio==4.6.0
17+
anyio==4.6.2.post1
1818
# via
1919
# httpx
2020
# jupyter-server
@@ -28,7 +28,7 @@ async-lru==2.0.4
2828
# via jupyterlab
2929
cffi==1.17.1
3030
# via argon2-cffi-bindings
31-
copier==9.3.1
31+
copier==9.4.1
3232
# via -r dev.in
3333
dunamai==1.22.0
3434
# via copier
@@ -46,7 +46,7 @@ isoduration==20.11.0
4646
# via jsonschema
4747
jinja2-ansible-filters==1.3.2
4848
# via copier
49-
json5==0.9.25
49+
json5==0.9.28
5050
# via jupyterlab-server
5151
jsonpointer==3.0.0
5252
# via jsonschema
@@ -67,7 +67,7 @@ jupyter-server==2.14.2
6767
# notebook-shim
6868
jupyter-server-terminals==0.5.3
6969
# via jupyter-server
70-
jupyterlab==4.2.5
70+
jupyterlab==4.3.0
7171
# via -r dev.in
7272
jupyterlab-server==2.27.3
7373
# via jupyterlab
@@ -119,11 +119,11 @@ types-python-dateutil==2.9.0.20241003
119119
# via arrow
120120
uri-template==1.3.0
121121
# via jsonschema
122-
webcolors==24.8.0
122+
webcolors==24.11.1
123123
# via jsonschema
124124
websocket-client==1.8.0
125125
# via jupyter-server
126-
wheel==0.44.0
126+
wheel==0.45.0
127127
# via pip-tools
128128

129129
# The following packages are considered to be unsafe in a requirements file:

0 commit comments

Comments
 (0)