File tree 13 files changed +110
-58
lines changed
13 files changed +110
-58
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ requires-python = ">=3.10"
33
33
dependencies = [
34
34
" sciline>=24.06.2" ,
35
35
" scipp>=25.01.0" ,
36
- " scippneutron>=24.11 .0" ,
36
+ " scippneutron>=25.02 .0" ,
37
37
" scippnexus>=24.11.0" ,
38
38
]
39
39
Original file line number Diff line number Diff line change 4
4
# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY!
5
5
sciline>=24.06.2
6
6
scipp>=25.01.0
7
- scippneutron>=24.11 .0
7
+ scippneutron>=25.02 .0
8
8
scippnexus>=24.11.0
Original file line number Diff line number Diff line change 1
- # SHA1:d18487328be0c30ec0a6929501d1c4a58c71bd48
1
+ # SHA1:0aac37186f254abb39dbd8f3c3c6ad52bafc0553
2
2
#
3
3
# This file is autogenerated by pip-compile-multi
4
4
# To update, run:
5
5
#
6
6
# pip-compile-multi
7
7
#
8
+ annotated-types==0.7.0
9
+ # via pydantic
8
10
contourpy==1.3.1
9
11
# via matplotlib
10
12
cyclebane==24.10.0
11
13
# via sciline
12
14
cycler==0.12.1
13
15
# via matplotlib
16
+ dnspython==2.7.0
17
+ # via email-validator
18
+ email-validator==2.2.0
19
+ # via scippneutron
14
20
fonttools==4.56.0
15
21
# via matplotlib
16
22
h5py==3.12.1
17
23
# via
18
24
# scippneutron
19
25
# scippnexus
26
+ idna==3.10
27
+ # via email-validator
20
28
kiwisolver==1.4.8
21
29
# via matplotlib
30
+ lazy-loader==0.4
31
+ # via scippneutron
22
32
matplotlib==3.10.0
23
33
# via
24
34
# mpltoolbox
@@ -27,7 +37,7 @@ mpltoolbox==24.5.1
27
37
# via scippneutron
28
38
networkx==3.4.2
29
39
# via cyclebane
30
- numpy==2.2.2
40
+ numpy==2.2.3
31
41
# via
32
42
# contourpy
33
43
# h5py
@@ -37,16 +47,23 @@ numpy==2.2.2
37
47
# scippneutron
38
48
# scipy
39
49
packaging==24.2
40
- # via matplotlib
50
+ # via
51
+ # lazy-loader
52
+ # matplotlib
41
53
pillow==11.1.0
42
54
# via matplotlib
43
55
plopp==24.10.0
44
56
# via scippneutron
57
+ pydantic==2.10.6
58
+ # via scippneutron
59
+ pydantic-core==2.27.2
60
+ # via pydantic
45
61
pyparsing==3.2.1
46
62
# via matplotlib
47
63
python-dateutil==2.9.0.post0
48
64
# via
49
65
# matplotlib
66
+ # scippneutron
50
67
# scippnexus
51
68
sciline==24.10.0
52
69
# via -r base.in
@@ -55,15 +72,19 @@ scipp==25.2.0
55
72
# -r base.in
56
73
# scippneutron
57
74
# scippnexus
58
- scippneutron==25.1 .0
75
+ scippneutron==25.2 .0
59
76
# via -r base.in
60
77
scippnexus==24.11.1
61
78
# via
62
79
# -r base.in
63
80
# scippneutron
64
- scipy==1.15.1
81
+ scipy==1.15.2
65
82
# via
66
83
# scippneutron
67
84
# scippnexus
68
85
six==1.17.0
69
86
# via python-dateutil
87
+ typing-extensions==4.12.2
88
+ # via
89
+ # pydantic
90
+ # pydantic-core
Original file line number Diff line number Diff line change @@ -19,10 +19,6 @@ cycler==0.12.1
19
19
# via matplotlib
20
20
decorator==5.1.1
21
21
# via ipython
22
- exceptiongroup==1.2.2
23
- # via
24
- # ipython
25
- # pytest
26
22
executing==2.2.0
27
23
# via stack-data
28
24
fonttools==4.56.0
@@ -47,7 +43,7 @@ matplotlib==3.10.0
47
43
# via plopp
48
44
matplotlib-inline==0.1.7
49
45
# via ipython
50
- numpy==2.2.2
46
+ numpy==2.2.3
51
47
# via
52
48
# contourpy
53
49
# matplotlib
@@ -90,7 +86,7 @@ requests==2.32.3
90
86
# via pooch
91
87
scipp==25.2.0
92
88
# via tof
93
- scipy==1.15.1
89
+ scipy==1.15.2
94
90
# via
95
91
# -r basetest.in
96
92
# tof
@@ -100,16 +96,12 @@ stack-data==0.6.3
100
96
# via ipython
101
97
tof==25.2.0
102
98
# via -r basetest.in
103
- tomli==2.2.1
104
- # via pytest
105
99
traitlets==5.14.3
106
100
# via
107
101
# comm
108
102
# ipython
109
103
# ipywidgets
110
104
# matplotlib-inline
111
- typing-extensions==4.12.2
112
- # via ipython
113
105
urllib3==2.3.0
114
106
# via requests
115
107
wcwidth==0.2.13
Original file line number Diff line number Diff line change @@ -44,14 +44,8 @@ requests==2.32.3
44
44
# via -r ci.in
45
45
smmap==5.0.2
46
46
# via gitdb
47
- tomli==2.2.1
48
- # via
49
- # pyproject-api
50
- # tox
51
47
tox==4.24.1
52
48
# via -r ci.in
53
- typing-extensions==4.12.2
54
- # via tox
55
49
urllib3==2.3.0
56
50
# via requests
57
51
virtualenv==20.29.2
Original file line number Diff line number Diff line change 12
12
-r static.txt
13
13
-r test.txt
14
14
-r wheels.txt
15
- annotated-types==0.7.0
16
- # via pydantic
17
15
anyio==4.8.0
18
16
# via
19
17
# httpx
@@ -32,7 +30,7 @@ click==8.1.8
32
30
# via
33
31
# pip-compile-multi
34
32
# pip-tools
35
- copier==9.4.1
33
+ copier==9.5.0
36
34
# via -r dev.in
37
35
dunamai==1.23.0
38
36
# via copier
@@ -91,10 +89,6 @@ prometheus-client==0.21.1
91
89
# via jupyter-server
92
90
pycparser==2.22
93
91
# via cffi
94
- pydantic==2.10.6
95
- # via copier
96
- pydantic-core==2.27.2
97
- # via pydantic
98
92
python-json-logger==3.2.1
99
93
# via jupyter-events
100
94
questionary==2.1.0
Original file line number Diff line number Diff line change @@ -10,8 +10,6 @@ accessible-pygments==0.0.5
10
10
# via pydata-sphinx-theme
11
11
alabaster==1.0.0
12
12
# via sphinx
13
- appnope==0.1.4
14
- # via ipykernel
15
13
asttokens==3.0.0
16
14
# via stack-data
17
15
attrs==25.1.0
@@ -48,16 +46,12 @@ docutils==0.21.2
48
46
# nbsphinx
49
47
# pydata-sphinx-theme
50
48
# sphinx
51
- exceptiongroup==1.2.2
52
- # via ipython
53
49
executing==2.2.0
54
50
# via stack-data
55
51
fastjsonschema==2.21.1
56
52
# via nbformat
57
53
graphviz==0.20.3
58
54
# via -r docs.in
59
- idna==3.10
60
- # via requests
61
55
imagesize==1.4.1
62
56
# via sphinx
63
57
importlib-resources==6.5.2
@@ -141,7 +135,7 @@ platformdirs==4.3.6
141
135
# via jupyter-core
142
136
prompt-toolkit==3.0.50
143
137
# via ipython
144
- psutil==6.1.1
138
+ psutil==7.0.0
145
139
# via ipykernel
146
140
ptyprocess==0.7.0
147
141
# via pexpect
@@ -209,8 +203,6 @@ tinycss2==1.4.0
209
203
# via bleach
210
204
tof==25.2.0
211
205
# via -r docs.in
212
- tomli==2.2.1
213
- # via sphinx
214
206
tornado==6.4.2
215
207
# via
216
208
# ipykernel
@@ -228,13 +220,6 @@ traitlets==5.14.3
228
220
# nbconvert
229
221
# nbformat
230
222
# nbsphinx
231
- typing-extensions==4.12.2
232
- # via
233
- # beautifulsoup4
234
- # ipython
235
- # mistune
236
- # pydata-sphinx-theme
237
- # referencing
238
223
urllib3==2.3.0
239
224
# via requests
240
225
wcwidth==0.2.13
Original file line number Diff line number Diff line change @@ -32,10 +32,6 @@ dnspython==2.7.0
32
32
# via email-validator
33
33
email-validator==2.2.0
34
34
# via scippneutron
35
- exceptiongroup==1.2.2
36
- # via
37
- # ipython
38
- # pytest
39
35
executing==2.2.0
40
36
# via stack-data
41
37
fonttools==4.56.0
@@ -74,7 +70,7 @@ mpltoolbox==24.5.1
74
70
# via scippneutron
75
71
networkx==3.4.2
76
72
# via cyclebane
77
- numpy==2.2.2
73
+ numpy==2.2.3
78
74
# via
79
75
# contourpy
80
76
# h5py
@@ -142,7 +138,7 @@ scippnexus @ git+https://github.com/scipp/scippnexus@main
142
138
# via
143
139
# -r nightly.in
144
140
# scippneutron
145
- scipy==1.15.1
141
+ scipy==1.15.2
146
142
# via
147
143
# -r nightly.in
148
144
# scippneutron
@@ -154,8 +150,6 @@ stack-data==0.6.3
154
150
# via ipython
155
151
tof @ git+https://github.com/scipp/tof@main
156
152
# via -r nightly.in
157
- tomli==2.2.1
158
- # via pytest
159
153
traitlets==5.14.3
160
154
# via
161
155
# comm
@@ -164,7 +158,6 @@ traitlets==5.14.3
164
158
# matplotlib-inline
165
159
typing-extensions==4.12.2
166
160
# via
167
- # ipython
168
161
# pydantic
169
162
# pydantic-core
170
163
urllib3==2.3.0
Original file line number Diff line number Diff line change @@ -11,5 +11,3 @@ packaging==24.2
11
11
# via build
12
12
pyproject-hooks==1.2.0
13
13
# via build
14
- tomli==2.2.1
15
- # via build
Original file line number Diff line number Diff line change 8
8
from contextlib import AbstractContextManager , contextmanager , nullcontext
9
9
from dataclasses import dataclass
10
10
from math import prod
11
- from typing import cast
11
+ from typing import TypeVar , cast
12
12
13
13
import scipp as sc
14
14
import scippnexus as snx
15
15
16
16
from ..logging import get_logger
17
17
from .types import (
18
+ Beamline ,
18
19
FilePath ,
20
+ Measurement ,
19
21
NeXusAllLocationSpec ,
20
22
NeXusEntryName ,
21
23
NeXusFile ,
27
29
class NoNewDefinitionsType : ...
28
30
29
31
32
+ _Model = TypeVar ('_Model' , Beamline , Measurement )
33
+
30
34
NoNewDefinitions = NoNewDefinitionsType ()
31
35
32
36
@@ -74,6 +78,18 @@ def load_all_components(
74
78
return components
75
79
76
80
81
+ def load_metadata (
82
+ file_path : FilePath | NeXusFile | NeXusGroup ,
83
+ model : type [_Model ],
84
+ * ,
85
+ entry_name : NeXusEntryName | None = None ,
86
+ definitions : Mapping | NoNewDefinitionsType = NoNewDefinitions ,
87
+ ) -> _Model :
88
+ with _open_nexus_file (file_path , definitions = definitions ) as f :
89
+ entry = _unique_child_group (f , snx .NXentry , entry_name )
90
+ return model .from_nexus_entry (entry )
91
+
92
+
77
93
def compute_component_position (dg : sc .DataGroup ) -> sc .DataGroup :
78
94
# In some downstream packages we use some of the Nexus components which attempt
79
95
# to compute positions without having actual Nexus data defining depends_on chains.
Original file line number Diff line number Diff line change 7
7
import sciline
8
8
import scipp as sc
9
9
import scippnexus as snx
10
+ from scippneutron import metadata as scn_meta
10
11
11
12
FilePath = NewType ('FilePath' , Path )
12
13
"""Full path to a NeXus file on disk."""
@@ -177,6 +178,13 @@ class TransmissionRun(Generic[ScatteringRunType]):
177
178
UniqueComponent = TypeVar ('UniqueComponent' , snx .NXsample , snx .NXsource )
178
179
"""Components that can be identified by their type as there will only be one."""
179
180
181
+ Beamline = scn_meta .Beamline
182
+ """Beamline metadata."""
183
+ Measurement = scn_meta .Measurement
184
+ """measurement metadata."""
185
+ Source = scn_meta .Source
186
+ """Neutron source metadata."""
187
+
180
188
181
189
class NeXusName (sciline .Scope [Component , str ], str ):
182
190
"""Name of a component in a NeXus file."""
You can’t perform that action at this time.
0 commit comments