essreduce 25.7.1__py3-none-any.whl → 25.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ess/reduce/data/__init__.py +17 -0
- ess/reduce/data/_registry.py +355 -0
- essreduce-25.10.0.dist-info/METADATA +51 -0
- {essreduce-25.7.1.dist-info → essreduce-25.10.0.dist-info}/RECORD +8 -7
- ess/reduce/data.py +0 -113
- essreduce-25.7.1.dist-info/METADATA +0 -82
- {essreduce-25.7.1.dist-info → essreduce-25.10.0.dist-info}/WHEEL +0 -0
- {essreduce-25.7.1.dist-info → essreduce-25.10.0.dist-info}/entry_points.txt +0 -0
- {essreduce-25.7.1.dist-info → essreduce-25.10.0.dist-info}/licenses/LICENSE +0 -0
- {essreduce-25.7.1.dist-info → essreduce-25.10.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
# Copyright (c) 2025 Scipp contributors (https://github.com/scipp)
|
|
3
|
+
"""Data files bundled with ESSreduce.
|
|
4
|
+
|
|
5
|
+
This module requires the Pooch package which is not a hard dependency of ESSreduce.
|
|
6
|
+
It has to be installed separately with either pip or conda.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from ._registry import Entry, LocalRegistry, PoochRegistry, Registry, make_registry
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
'Entry',
|
|
13
|
+
'LocalRegistry',
|
|
14
|
+
'PoochRegistry',
|
|
15
|
+
'Registry',
|
|
16
|
+
'make_registry',
|
|
17
|
+
]
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
# SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
+
# Copyright (c) 2025 Scipp contributors (https://github.com/scipp)
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import hashlib
|
|
7
|
+
import os
|
|
8
|
+
from abc import ABC, abstractmethod
|
|
9
|
+
from collections.abc import Mapping
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from functools import cache
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
_LOCAL_CACHE_ENV_VAR = "SCIPP_DATA_DIR"
|
|
16
|
+
_LOCAL_REGISTRY_ENV_VAR = "SCIPP_OVERRIDE_DATA_DIR"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def make_registry(
|
|
20
|
+
prefix: str,
|
|
21
|
+
files: Mapping[str, str | Entry],
|
|
22
|
+
*,
|
|
23
|
+
version: str,
|
|
24
|
+
base_url: str = "https://public.esss.dk/groups/scipp",
|
|
25
|
+
retry_if_failed: int = 3,
|
|
26
|
+
) -> Registry:
|
|
27
|
+
"""Create a file registry object.
|
|
28
|
+
|
|
29
|
+
By default, this function creates a :class:`PoochRegistry` to download files
|
|
30
|
+
via HTTP from an online file store.
|
|
31
|
+
This can be overridden by setting the environment variable `SCIPP_DATA_DIR` to a
|
|
32
|
+
path on the local file system.
|
|
33
|
+
In this case, a :class:`LocalRegistry` is returned.
|
|
34
|
+
|
|
35
|
+
Files are specified as a dict using either the Pooch string format explicitly
|
|
36
|
+
constructed :class:`Entry` objects:
|
|
37
|
+
|
|
38
|
+
>>> from ess.reduce.data import Entry
|
|
39
|
+
>>> files = {
|
|
40
|
+
... "file1.dat": "md5:1234567890abcdef",
|
|
41
|
+
... "file2.csv": Entry(alg="md5", chk="abcdef123456789"),
|
|
42
|
+
... "folder/nested.dat": "blake2b:1234567890abcdef",
|
|
43
|
+
... "zipped.zip": Entry(alg="blake2b", chk="abcdef123456789", unzip=True),
|
|
44
|
+
... }
|
|
45
|
+
|
|
46
|
+
In the example above, the specifications for ``file1.dat`` and ``file2.csv`` are
|
|
47
|
+
essentially equivalent.
|
|
48
|
+
``folder/nested.dat`` is a file in a subfolder.
|
|
49
|
+
Paths like this must always use forward slashes (/) even on Windows.
|
|
50
|
+
|
|
51
|
+
As shown above, it is possible to automatically unzip
|
|
52
|
+
files by specifying ``unzip=True``.
|
|
53
|
+
When calling ``registry.get_path("zipped.zip")`` the file will be unzipped and
|
|
54
|
+
a path to the content is returned.
|
|
55
|
+
This expects that there is only a single file in the zip archive.
|
|
56
|
+
|
|
57
|
+
The complete path to the source file is constructed as follows:
|
|
58
|
+
|
|
59
|
+
- Pooch: ``{base_url}/{prefix}/{version}/{name}``
|
|
60
|
+
- Local: ``{SCIPP_OVERRIDE_DATA_DIR}/{prefix}/{version}/{name}``
|
|
61
|
+
|
|
62
|
+
When using Pooch, files are downloaded to the user's cache directory.
|
|
63
|
+
This can be controlled with the environment variable ``SCIPP_CACHE_DIR``.
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
prefix:
|
|
68
|
+
Prefix to add to all file names.
|
|
69
|
+
files:
|
|
70
|
+
Mapping of file names to checksums or :class:`Entry` objects.
|
|
71
|
+
version:
|
|
72
|
+
A version string for the files.
|
|
73
|
+
base_url:
|
|
74
|
+
URL for the online file store.
|
|
75
|
+
Ignored if the override environment variable is set.
|
|
76
|
+
retry_if_failed:
|
|
77
|
+
Number of retries when downloading a file.
|
|
78
|
+
Ignored if the override environment variable is set.
|
|
79
|
+
|
|
80
|
+
Returns
|
|
81
|
+
-------
|
|
82
|
+
:
|
|
83
|
+
Either a :class:`PoochRegistry` or :class:`LocalRegistry`.
|
|
84
|
+
"""
|
|
85
|
+
if (override := os.environ.get(_LOCAL_REGISTRY_ENV_VAR)) is not None:
|
|
86
|
+
return LocalRegistry(
|
|
87
|
+
_check_local_override_path(override),
|
|
88
|
+
prefix,
|
|
89
|
+
files,
|
|
90
|
+
version=version,
|
|
91
|
+
base_url=base_url,
|
|
92
|
+
retry_if_failed=retry_if_failed,
|
|
93
|
+
)
|
|
94
|
+
return PoochRegistry(
|
|
95
|
+
prefix,
|
|
96
|
+
files,
|
|
97
|
+
version=version,
|
|
98
|
+
base_url=base_url,
|
|
99
|
+
retry_if_failed=retry_if_failed,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _check_local_override_path(override: str) -> Path:
|
|
104
|
+
path = Path(override)
|
|
105
|
+
if not path.is_dir():
|
|
106
|
+
raise ValueError(
|
|
107
|
+
f"The data override path '{override}' is not a directory. If you want to "
|
|
108
|
+
"download files instead, unset the environment variable "
|
|
109
|
+
f"{_LOCAL_REGISTRY_ENV_VAR}."
|
|
110
|
+
)
|
|
111
|
+
return path
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@dataclass(frozen=True, slots=True)
|
|
115
|
+
class Entry:
|
|
116
|
+
"""An entry in a registry."""
|
|
117
|
+
|
|
118
|
+
chk: str
|
|
119
|
+
"""Checksum."""
|
|
120
|
+
alg: str
|
|
121
|
+
"""Checksum algorithm."""
|
|
122
|
+
unzip: bool = False
|
|
123
|
+
"""Whether to unzip the file."""
|
|
124
|
+
|
|
125
|
+
@classmethod
|
|
126
|
+
def from_pooch_string(cls, pooch_string: str) -> Entry:
|
|
127
|
+
alg, chk = pooch_string.split(":")
|
|
128
|
+
return cls(chk=chk, alg=alg)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class Registry(ABC):
|
|
132
|
+
def __init__(self, files: Mapping[str, str | Entry]) -> None:
|
|
133
|
+
self._files = _to_file_entries(files)
|
|
134
|
+
|
|
135
|
+
@abstractmethod
|
|
136
|
+
def get_path(self, name: str) -> Path:
|
|
137
|
+
"""Get the path to a file in the registry.
|
|
138
|
+
|
|
139
|
+
Depending on the implementation, the file is downloaded if necessary.
|
|
140
|
+
|
|
141
|
+
Note that implementations are allowed to cache return values of this method
|
|
142
|
+
to avoid recomputing potentially expensive checksums.
|
|
143
|
+
This usually means that the ``Registry`` object itself gets stored until the
|
|
144
|
+
Python interpreter shuts down.
|
|
145
|
+
However, registries are small and do not own resources.
|
|
146
|
+
|
|
147
|
+
Parameters
|
|
148
|
+
----------
|
|
149
|
+
name:
|
|
150
|
+
Name of the file to get the path for.
|
|
151
|
+
|
|
152
|
+
Returns
|
|
153
|
+
-------
|
|
154
|
+
:
|
|
155
|
+
The Path to the file.
|
|
156
|
+
"""
|
|
157
|
+
|
|
158
|
+
def _needs_unzip(self, name: str) -> bool:
|
|
159
|
+
return self._files[name].unzip
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class PoochRegistry(Registry):
|
|
163
|
+
def __init__(
|
|
164
|
+
self,
|
|
165
|
+
prefix: str,
|
|
166
|
+
files: Mapping[str, str | Entry],
|
|
167
|
+
*,
|
|
168
|
+
version: str,
|
|
169
|
+
base_url: str,
|
|
170
|
+
retry_if_failed: int = 3,
|
|
171
|
+
) -> None:
|
|
172
|
+
self._registry = _create_pooch(
|
|
173
|
+
prefix,
|
|
174
|
+
files,
|
|
175
|
+
version=version,
|
|
176
|
+
base_url=base_url,
|
|
177
|
+
retry_if_failed=retry_if_failed,
|
|
178
|
+
)
|
|
179
|
+
self._unzip_processor = _import_pooch().Unzip()
|
|
180
|
+
super().__init__(files)
|
|
181
|
+
|
|
182
|
+
@cache # noqa: B019
|
|
183
|
+
def get_path(self, name: str) -> Path:
|
|
184
|
+
"""Get the path to a file in the registry.
|
|
185
|
+
|
|
186
|
+
Downloads the file if necessary.
|
|
187
|
+
"""
|
|
188
|
+
if self._needs_unzip(name):
|
|
189
|
+
paths: list[str] = self._registry.fetch( # type: ignore[assignment]
|
|
190
|
+
name, processor=self._unzip_processor
|
|
191
|
+
)
|
|
192
|
+
return Path(_expect_single_unzipped(paths, name))
|
|
193
|
+
return Path(self._registry.fetch(name))
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class LocalRegistry(Registry):
|
|
197
|
+
def __init__(
|
|
198
|
+
self,
|
|
199
|
+
source_path: Path,
|
|
200
|
+
prefix: str,
|
|
201
|
+
files: Mapping[str, str | Entry],
|
|
202
|
+
*,
|
|
203
|
+
version: str,
|
|
204
|
+
base_url: str,
|
|
205
|
+
retry_if_failed: int = 3,
|
|
206
|
+
) -> None:
|
|
207
|
+
# Piggyback off of Pooch to determine the cache directory.
|
|
208
|
+
pooch_registry = _create_pooch(
|
|
209
|
+
prefix,
|
|
210
|
+
files,
|
|
211
|
+
version=version,
|
|
212
|
+
base_url=base_url,
|
|
213
|
+
retry_if_failed=retry_if_failed,
|
|
214
|
+
)
|
|
215
|
+
pooch = _import_pooch()
|
|
216
|
+
self._unzip_processor = pooch.processors.Unzip(extract_dir=pooch_registry.path)
|
|
217
|
+
self._source_path = source_path.resolve().joinpath(*prefix.split("/"), version)
|
|
218
|
+
super().__init__(files)
|
|
219
|
+
|
|
220
|
+
@cache # noqa: B019
|
|
221
|
+
def get_path(self, name: str) -> Path:
|
|
222
|
+
"""Get the path to a file in the registry."""
|
|
223
|
+
try:
|
|
224
|
+
entry = self._files[name]
|
|
225
|
+
except KeyError:
|
|
226
|
+
raise ValueError(f"File '{name}' is not in the registry.") from None
|
|
227
|
+
|
|
228
|
+
path = self._local_path(name)
|
|
229
|
+
if not path.exists():
|
|
230
|
+
raise FileNotFoundError(
|
|
231
|
+
f"File '{name}' is registered but does not exist on the file system. "
|
|
232
|
+
f"Expected it at '{path}'."
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
_check_hash(name, path, entry)
|
|
236
|
+
|
|
237
|
+
if self._needs_unzip(name):
|
|
238
|
+
return Path(
|
|
239
|
+
_expect_single_unzipped(
|
|
240
|
+
self._unzip_processor(os.fspath(path), "download", None), path
|
|
241
|
+
)
|
|
242
|
+
)
|
|
243
|
+
return path
|
|
244
|
+
|
|
245
|
+
def _local_path(self, name: str) -> Path:
|
|
246
|
+
# Split on "/" because `name` is always a POSIX-style path, but the return
|
|
247
|
+
# value is a system path, i.e., it can be a Windows-style path.
|
|
248
|
+
return self._source_path.joinpath(*name.split("/"))
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def _import_pooch() -> Any:
|
|
252
|
+
try:
|
|
253
|
+
import pooch
|
|
254
|
+
except ImportError:
|
|
255
|
+
raise ImportError(
|
|
256
|
+
"You need to install Pooch to access test and tutorial files. "
|
|
257
|
+
"See https://www.fatiando.org/pooch/latest/index.html"
|
|
258
|
+
) from None
|
|
259
|
+
|
|
260
|
+
return pooch
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def _create_pooch(
|
|
264
|
+
prefix: str,
|
|
265
|
+
files: Mapping[str, str | Entry],
|
|
266
|
+
*,
|
|
267
|
+
version: str,
|
|
268
|
+
base_url: str,
|
|
269
|
+
retry_if_failed: int = 3,
|
|
270
|
+
) -> Any:
|
|
271
|
+
pooch = _import_pooch()
|
|
272
|
+
return pooch.create(
|
|
273
|
+
path=pooch.os_cache(prefix),
|
|
274
|
+
env=_LOCAL_CACHE_ENV_VAR,
|
|
275
|
+
base_url=f'{base_url}/{prefix}/{version}/',
|
|
276
|
+
registry=_to_pooch_registry(files),
|
|
277
|
+
retry_if_failed=retry_if_failed,
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def _pooch_unzip_processor(extract_dir: Path) -> Any:
|
|
282
|
+
try:
|
|
283
|
+
import pooch
|
|
284
|
+
except ImportError:
|
|
285
|
+
raise ImportError("You need to install Pooch to unzip files.") from None
|
|
286
|
+
|
|
287
|
+
return pooch.processors.Unzip(extract_dir=os.fspath(extract_dir))
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def _expect_single_unzipped(paths: list[str], archive: str | os.PathLike) -> str:
|
|
291
|
+
if len(paths) != 1:
|
|
292
|
+
raise ValueError(
|
|
293
|
+
f"Expected exactly one file to unzip, got {len(paths)} in "
|
|
294
|
+
f"'{os.fspath(archive)}'."
|
|
295
|
+
)
|
|
296
|
+
return paths[0]
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def _check_hash(name: str, path: Path, entry: Entry) -> None:
|
|
300
|
+
new_chk = _checksum_of_file(path, algorithm=entry.alg)
|
|
301
|
+
if new_chk.lower() != entry.chk.lower():
|
|
302
|
+
raise ValueError(
|
|
303
|
+
f"{entry.alg} hash of file '{name}' does not match the known hash: "
|
|
304
|
+
f"expected {entry.chk}, got {new_chk}."
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def _to_file_entries(files: Mapping[str, str | Entry]) -> dict[str, Entry]:
|
|
309
|
+
return {
|
|
310
|
+
name: entry if isinstance(entry, Entry) else Entry.from_pooch_string(entry)
|
|
311
|
+
for name, entry in files.items()
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def _to_pooch_registry(files: Mapping[str, str | Entry]) -> dict[str, str]:
|
|
316
|
+
return {
|
|
317
|
+
name: f"{entry.alg}:{entry.chk}" if isinstance(entry, Entry) else entry
|
|
318
|
+
for name, entry in files.items()
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
# Code taken from Scitacean and Pooch.
|
|
323
|
+
def _checksum_of_file(path: Path, *, algorithm: str) -> str:
|
|
324
|
+
"""Compute the checksum of a local file.
|
|
325
|
+
|
|
326
|
+
Parameters
|
|
327
|
+
----------
|
|
328
|
+
path:
|
|
329
|
+
Path of the file.
|
|
330
|
+
algorithm:
|
|
331
|
+
Hash algorithm to use.
|
|
332
|
+
Can be any algorithm supported by :func:`hashlib.new`.
|
|
333
|
+
|
|
334
|
+
Returns
|
|
335
|
+
-------
|
|
336
|
+
:
|
|
337
|
+
The hex digest of the hash.
|
|
338
|
+
"""
|
|
339
|
+
chk = _new_hash(algorithm)
|
|
340
|
+
# size based on http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/ioblksize.h;h=ed2f4a9c4d77462f357353eb73ee4306c28b37f1;hb=HEAD#l23 # noqa: E501
|
|
341
|
+
buffer = memoryview(bytearray(128 * 1024))
|
|
342
|
+
with open(path, "rb", buffering=0) as file:
|
|
343
|
+
for n in iter(lambda: file.readinto(buffer), 0):
|
|
344
|
+
chk.update(buffer[:n])
|
|
345
|
+
return chk.hexdigest() # type: ignore[no-any-return]
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def _new_hash(algorithm: str) -> Any:
|
|
349
|
+
# Try to use a named constructor instead of hashlib.new where possible
|
|
350
|
+
# because that is supposed to be faster, according to
|
|
351
|
+
# https://docs.python.org/3/library/hashlib.html#hashlib.new
|
|
352
|
+
try:
|
|
353
|
+
return getattr(hashlib, algorithm)()
|
|
354
|
+
except AttributeError:
|
|
355
|
+
return hashlib.new(algorithm, usedforsecurity=False)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: essreduce
|
|
3
|
+
Version: 25.10.0
|
|
4
|
+
Summary: Common data reduction tools for the ESS facility
|
|
5
|
+
Author: Scipp contributors
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/scipp/essreduce/issues
|
|
8
|
+
Project-URL: Documentation, https://scipp.github.io/essreduce
|
|
9
|
+
Project-URL: Source, https://github.com/scipp/essreduce
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: sciline>=25.05.1
|
|
24
|
+
Requires-Dist: scipp>=25.04.0
|
|
25
|
+
Requires-Dist: scippneutron>=25.02.0
|
|
26
|
+
Requires-Dist: scippnexus>=24.11.0
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: ipywidgets>=8.1; extra == "test"
|
|
29
|
+
Requires-Dist: numba>=0.59; extra == "test"
|
|
30
|
+
Requires-Dist: pooch>=1.5; extra == "test"
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
32
|
+
Requires-Dist: scipy>=1.14; extra == "test"
|
|
33
|
+
Requires-Dist: tof>=25.05.0; extra == "test"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
[](CODE_OF_CONDUCT.md)
|
|
37
|
+
[](https://pypi.python.org/pypi/essreduce)
|
|
38
|
+
[](https://anaconda.org/conda-forge/essreduce)
|
|
39
|
+
[](LICENSE)
|
|
40
|
+
|
|
41
|
+
# ESSreduce
|
|
42
|
+
|
|
43
|
+
## About
|
|
44
|
+
|
|
45
|
+
Common data reduction tools for the ESS facility
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
python -m pip install essreduce
|
|
51
|
+
```
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
ess/reduce/__init__.py,sha256=o1pWRP9YGwTukM_k-qlG6KcoXOpMb0PDVH59vod12lw,419
|
|
2
|
-
ess/reduce/data.py,sha256=0N7iq1363tO16ntMztTNjxkQDFst-Gnp9awpgUOBVdY,4133
|
|
3
2
|
ess/reduce/logging.py,sha256=6n8Czq4LZ3OK9ENlKsWSI1M3KvKv6_HSoUiV4__IUlU,357
|
|
4
3
|
ess/reduce/parameter.py,sha256=4sCfoKOI2HuO_Q7JLH_jAXnEOFANSn5P3NdaOBzhJxc,4635
|
|
5
4
|
ess/reduce/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -7,6 +6,8 @@ ess/reduce/streaming.py,sha256=zbqxQz5dASDq4ZVyx-TdbapBXMyBttImCYz_6WOj4pg,17978
|
|
|
7
6
|
ess/reduce/ui.py,sha256=zmorAbDwX1cU3ygDT--OP58o0qU7OBcmJz03jPeYSLA,10884
|
|
8
7
|
ess/reduce/uncertainty.py,sha256=LR4O6ApB6Z-W9gC_XW0ajupl8yFG-du0eee1AX_R-gk,6990
|
|
9
8
|
ess/reduce/workflow.py,sha256=738-lcdgsORYfQ4A0UTk2IgnbVxC3jBdpscpaOFIpdc,3114
|
|
9
|
+
ess/reduce/data/__init__.py,sha256=uDtqkmKA_Zwtj6II25zntz9T812XhdCn3tktYev4uyY,486
|
|
10
|
+
ess/reduce/data/_registry.py,sha256=TeEiy2HDKeLXXzSMwvusJqozPA_vPJSz7R8YttgvhxE,11126
|
|
10
11
|
ess/reduce/live/__init__.py,sha256=jPQVhihRVNtEDrE20PoKkclKV2aBF1lS7cCHootgFgI,204
|
|
11
12
|
ess/reduce/live/raw.py,sha256=66qV0G2rP8gK5tXuk-syTlDLE2jT3ehfmSnET7Xzfd0,24392
|
|
12
13
|
ess/reduce/live/roi.py,sha256=Hs-pW98k41WU6Kl3UQ41kQawk80c2QNOQ_WNctLzDPE,3795
|
|
@@ -39,9 +40,9 @@ ess/reduce/widgets/_spinner.py,sha256=2VY4Fhfa7HMXox2O7UbofcdKsYG-AJGrsgGJB85nDX
|
|
|
39
40
|
ess/reduce/widgets/_string_widget.py,sha256=iPAdfANyXHf-nkfhgkyH6gQDklia0LebLTmwi3m-iYQ,1482
|
|
40
41
|
ess/reduce/widgets/_switchable_widget.py,sha256=fjKz99SKLhIF1BLgGVBSKKn3Lu_jYBwDYGeAjbJY3Q8,2390
|
|
41
42
|
ess/reduce/widgets/_vector_widget.py,sha256=aTaBqCFHZQhrIoX6-sSqFWCPePEW8HQt5kUio8jP1t8,1203
|
|
42
|
-
essreduce-25.
|
|
43
|
-
essreduce-25.
|
|
44
|
-
essreduce-25.
|
|
45
|
-
essreduce-25.
|
|
46
|
-
essreduce-25.
|
|
47
|
-
essreduce-25.
|
|
43
|
+
essreduce-25.10.0.dist-info/licenses/LICENSE,sha256=nVEiume4Qj6jMYfSRjHTM2jtJ4FGu0g-5Sdh7osfEYw,1553
|
|
44
|
+
essreduce-25.10.0.dist-info/METADATA,sha256=wn62SjFqeWbNwZMN-K_mBxRJmQy9_rjJx79L6d_UHyk,1937
|
|
45
|
+
essreduce-25.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
46
|
+
essreduce-25.10.0.dist-info/entry_points.txt,sha256=PMZOIYzCifHMTe4pK3HbhxUwxjFaZizYlLD0td4Isb0,66
|
|
47
|
+
essreduce-25.10.0.dist-info/top_level.txt,sha256=0JxTCgMKPLKtp14wb1-RKisQPQWX7i96innZNvHBr-s,4
|
|
48
|
+
essreduce-25.10.0.dist-info/RECORD,,
|
ess/reduce/data.py
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# SPDX-License-Identifier: BSD-3-Clause
|
|
2
|
-
# Copyright (c) 2024 Scipp contributors (https://github.com/scipp)
|
|
3
|
-
import pooch
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Registry:
|
|
7
|
-
def __init__(self, instrument: str, files: dict[str, str], version: str):
|
|
8
|
-
self._registry = pooch.create(
|
|
9
|
-
path=pooch.os_cache(f'ess/{instrument}'),
|
|
10
|
-
env=f'ESS_{instrument.upper()}_DATA_DIR',
|
|
11
|
-
base_url=f'https://public.esss.dk/groups/scipp/ess/{instrument}/'
|
|
12
|
-
+ '{version}/',
|
|
13
|
-
version=version,
|
|
14
|
-
registry=files,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
def __contains__(self, key):
|
|
18
|
-
return key in self._registry.registry
|
|
19
|
-
|
|
20
|
-
def get_path(self, name: str, unzip: bool = False) -> str:
|
|
21
|
-
"""
|
|
22
|
-
Get the path to a file in the registry.
|
|
23
|
-
|
|
24
|
-
Parameters
|
|
25
|
-
----------
|
|
26
|
-
name:
|
|
27
|
-
Name of the file to get the path for.
|
|
28
|
-
unzip:
|
|
29
|
-
If `True`, unzip the file before returning the path.
|
|
30
|
-
"""
|
|
31
|
-
return self._registry.fetch(name, processor=pooch.Unzip() if unzip else None)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_bifrost_registry = Registry(
|
|
35
|
-
instrument='bifrost',
|
|
36
|
-
files={
|
|
37
|
-
"BIFROST_20240914T053723.h5": "md5:0f2fa5c9a851f8e3a4fa61defaa3752e",
|
|
38
|
-
},
|
|
39
|
-
version='1',
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_dream_registry = Registry(
|
|
44
|
-
instrument='dream',
|
|
45
|
-
files={
|
|
46
|
-
"TEST_977695_00068064.hdf": "md5:9e6ee9ec70d7c5e8c0c93b9e07e8949f",
|
|
47
|
-
},
|
|
48
|
-
version='2',
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_loki_registry = Registry(
|
|
53
|
-
instrument='loki',
|
|
54
|
-
files={
|
|
55
|
-
# Files from LoKI@Larmor detector test experiment
|
|
56
|
-
#
|
|
57
|
-
# Background run 1 (no sample, sample holder/can only, no transmission monitor)
|
|
58
|
-
'60248-2022-02-28_2215.nxs': 'md5:d9f17b95274a0fc6468df7e39df5bf03',
|
|
59
|
-
# Sample run 1 (sample + sample holder/can, no transmission monitor in beam)
|
|
60
|
-
'60250-2022-02-28_2215.nxs': 'md5:6a519ceaacbae702a6d08241e86799b1',
|
|
61
|
-
# Sample run 2 (sample + sample holder/can, no transmission monitor in beam)
|
|
62
|
-
'60339-2022-02-28_2215.nxs': 'md5:03c86f6389566326bb0cbbd80b8f8c4f',
|
|
63
|
-
# Background transmission run (sample holder/can + transmission monitor)
|
|
64
|
-
'60392-2022-02-28_2215.nxs': 'md5:9ecc1a9a2c05a880144afb299fc11042',
|
|
65
|
-
# Background run 2 (no sample, sample holder/can only, no transmission monitor)
|
|
66
|
-
'60393-2022-02-28_2215.nxs': 'md5:bf550d0ba29931f11b7450144f658652',
|
|
67
|
-
# Sample transmission run (sample + sample holder/can + transmission monitor)
|
|
68
|
-
'60394-2022-02-28_2215.nxs': 'md5:c40f38a62337d86957af925296c4c615',
|
|
69
|
-
# Analytical model for the I(Q) of the Poly-Gauss sample
|
|
70
|
-
'PolyGauss_I0-50_Rg-60.h5': 'md5:f5d60d9c2286cb197b8cd4dc82db3d7e',
|
|
71
|
-
# XML file for the pixel mask
|
|
72
|
-
'mask_new_July2022.xml': 'md5:421b6dc9db74126ffbc5d88164d017b0',
|
|
73
|
-
},
|
|
74
|
-
version='2',
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def bifrost_simulated_elastic() -> str:
|
|
79
|
-
"""McStas simulation with elastic incoherent scattering + phonon."""
|
|
80
|
-
return _bifrost_registry.get_path('BIFROST_20240914T053723.h5')
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def loki_tutorial_sample_run_60250() -> str:
|
|
84
|
-
"""Sample run with sample and sample holder/can, no transmission monitor in beam."""
|
|
85
|
-
return _loki_registry.get_path('60250-2022-02-28_2215.nxs')
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def loki_tutorial_sample_run_60339() -> str:
|
|
89
|
-
"""Sample run with sample and sample holder/can, no transmission monitor in beam."""
|
|
90
|
-
return _loki_registry.get_path('60339-2022-02-28_2215.nxs')
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
def loki_tutorial_background_run_60248() -> str:
|
|
94
|
-
"""Background run with sample holder/can only, no transmission monitor."""
|
|
95
|
-
return _loki_registry.get_path('60248-2022-02-28_2215.nxs')
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def loki_tutorial_background_run_60393() -> str:
|
|
99
|
-
"""Background run with sample holder/can only, no transmission monitor."""
|
|
100
|
-
return _loki_registry.get_path('60393-2022-02-28_2215.nxs')
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def loki_tutorial_sample_transmission_run() -> str:
|
|
104
|
-
"""Sample transmission run (sample + sample holder/can + transmission monitor)."""
|
|
105
|
-
return _loki_registry.get_path('60394-2022-02-28_2215.nxs')
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def dream_coda_test_file() -> str:
|
|
109
|
-
"""CODA file for DREAM where most pulses have been removed.
|
|
110
|
-
|
|
111
|
-
See ``tools/shrink_nexus.py``.
|
|
112
|
-
"""
|
|
113
|
-
return _dream_registry.get_path('TEST_977695_00068064.hdf')
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: essreduce
|
|
3
|
-
Version: 25.7.1
|
|
4
|
-
Summary: Common data reduction tools for the ESS facility
|
|
5
|
-
Author: Scipp contributors
|
|
6
|
-
License: BSD 3-Clause License
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2024, Scipp contributors (https://github.com/scipp)
|
|
9
|
-
All rights reserved.
|
|
10
|
-
|
|
11
|
-
Redistribution and use in source and binary forms, with or without
|
|
12
|
-
modification, are permitted provided that the following conditions are met:
|
|
13
|
-
|
|
14
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
15
|
-
list of conditions and the following disclaimer.
|
|
16
|
-
|
|
17
|
-
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
18
|
-
this list of conditions and the following disclaimer in the documentation
|
|
19
|
-
and/or other materials provided with the distribution.
|
|
20
|
-
|
|
21
|
-
3. Neither the name of the copyright holder nor the names of its
|
|
22
|
-
contributors may be used to endorse or promote products derived from
|
|
23
|
-
this software without specific prior written permission.
|
|
24
|
-
|
|
25
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
26
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
27
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
28
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
29
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
30
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
31
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
32
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
33
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
34
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
35
|
-
|
|
36
|
-
Project-URL: Bug Tracker, https://github.com/scipp/essreduce/issues
|
|
37
|
-
Project-URL: Documentation, https://scipp.github.io/essreduce
|
|
38
|
-
Project-URL: Source, https://github.com/scipp/essreduce
|
|
39
|
-
Classifier: Intended Audience :: Science/Research
|
|
40
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
41
|
-
Classifier: Natural Language :: English
|
|
42
|
-
Classifier: Operating System :: OS Independent
|
|
43
|
-
Classifier: Programming Language :: Python :: 3
|
|
44
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
|
45
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
46
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
47
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
48
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
49
|
-
Classifier: Topic :: Scientific/Engineering
|
|
50
|
-
Classifier: Typing :: Typed
|
|
51
|
-
Requires-Python: >=3.10
|
|
52
|
-
Description-Content-Type: text/markdown
|
|
53
|
-
License-File: LICENSE
|
|
54
|
-
Requires-Dist: sciline>=25.05.1
|
|
55
|
-
Requires-Dist: scipp>=25.01.0
|
|
56
|
-
Requires-Dist: scippneutron>=25.02.0
|
|
57
|
-
Requires-Dist: scippnexus>=24.11.0
|
|
58
|
-
Provides-Extra: test
|
|
59
|
-
Requires-Dist: ipywidgets; extra == "test"
|
|
60
|
-
Requires-Dist: numba; extra == "test"
|
|
61
|
-
Requires-Dist: pooch; extra == "test"
|
|
62
|
-
Requires-Dist: pytest; extra == "test"
|
|
63
|
-
Requires-Dist: scipy>=1.7.0; extra == "test"
|
|
64
|
-
Requires-Dist: tof>=25.05.0; extra == "test"
|
|
65
|
-
Dynamic: license-file
|
|
66
|
-
|
|
67
|
-
[](CODE_OF_CONDUCT.md)
|
|
68
|
-
[](https://pypi.python.org/pypi/essreduce)
|
|
69
|
-
[](https://anaconda.org/scipp/essreduce)
|
|
70
|
-
[](LICENSE)
|
|
71
|
-
|
|
72
|
-
# ESSreduce
|
|
73
|
-
|
|
74
|
-
## About
|
|
75
|
-
|
|
76
|
-
Common data reduction tools for the ESS facility
|
|
77
|
-
|
|
78
|
-
## Installation
|
|
79
|
-
|
|
80
|
-
```sh
|
|
81
|
-
python -m pip install essreduce
|
|
82
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|