MNeuEventLib 0.3.0__tar.gz → 0.4.0__tar.gz
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.
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/.github/workflows/release.yml +0 -15
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/Cargo.lock +27 -27
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/Cargo.toml +1 -1
- {mneueventlib-0.3.0/tools → mneueventlib-0.4.0/MNeuEventLib}/make_default.py +23 -16
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/PKG-INFO +1 -1
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/index.rst +2 -2
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/install.rst +8 -1
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/tutorials/batch_processing.ipynb +148 -9
- mneueventlib-0.4.0/src/batch/functions.rs +292 -0
- mneueventlib-0.3.0/src/batch_interface.rs → mneueventlib-0.4.0/src/batch/interface.rs +666 -38
- mneueventlib-0.4.0/src/batch/mod.rs +7 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/consts.rs +11 -1
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/frame_data.rs +2 -2
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/nexus_data.rs +5 -2
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/sample_logs.rs +27 -37
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/sample_logs.rs +8 -6
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/sanitise/nexus_data.rs +69 -1
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/wimda.rs +14 -10
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/filters/api.rs +605 -277
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/filters/filtering.rs +11 -11
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/interface.rs +46 -13
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/lib.rs +9 -2
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/stats.rs +157 -43
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/utils.rs +5 -2
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/.github/workflows/label_merge_conflicts.yml +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/.github/workflows/push.yml +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/.gitignore +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/.readthedocs.yaml +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/LICENSE +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/MNeuEventLib/__init__.py +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/MNeuEventLib/plotting.py +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/MNeuEventLib/test_helpers.py +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/README.md +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/bench.py +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/Makefile +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/make.bat +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/_static/HIFI00195790.nxs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/_static/api/README.md +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/api.rst +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/conf.py +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/how-to/create_plots.ipynb +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/how-to/filtering.ipynb +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/how-to/index.rst +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/tutorials/getting_started.ipynb +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/docs/source/tutorials/index.rst +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/files/README.md +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/files/muon_ref.nxs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/pyproject.toml +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/mod.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/instrument.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/mod.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/periods.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/sanitise/mod.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/sanitise/utils.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/data/save/utils.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/filters/mod.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/filters/weights.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/src/test_utils.rs +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/tests/integration/test_mantid.py +0 -0
- {mneueventlib-0.3.0 → mneueventlib-0.4.0}/tests/test_data/HIFI00195790.nxs +0 -0
|
@@ -22,16 +22,8 @@ jobs:
|
|
|
22
22
|
platform:
|
|
23
23
|
- runner: ubuntu-latest
|
|
24
24
|
target: x86_64
|
|
25
|
-
- runner: ubuntu-latest
|
|
26
|
-
target: x86
|
|
27
25
|
- runner: ubuntu-latest
|
|
28
26
|
target: aarch64
|
|
29
|
-
- runner: ubuntu-latest
|
|
30
|
-
target: armv7
|
|
31
|
-
- runner: ubuntu-latest
|
|
32
|
-
target: s390x
|
|
33
|
-
- runner: ubuntu-latest
|
|
34
|
-
target: ppc64le
|
|
35
27
|
steps:
|
|
36
28
|
- uses: actions/checkout@v6
|
|
37
29
|
- uses: actions/setup-python@v6
|
|
@@ -59,12 +51,8 @@ jobs:
|
|
|
59
51
|
platform:
|
|
60
52
|
- runner: ubuntu-latest
|
|
61
53
|
target: x86_64
|
|
62
|
-
- runner: ubuntu-latest
|
|
63
|
-
target: x86
|
|
64
54
|
- runner: ubuntu-latest
|
|
65
55
|
target: aarch64
|
|
66
|
-
- runner: ubuntu-latest
|
|
67
|
-
target: armv7
|
|
68
56
|
steps:
|
|
69
57
|
- uses: actions/checkout@v6
|
|
70
58
|
- uses: actions/setup-python@v6
|
|
@@ -93,9 +81,6 @@ jobs:
|
|
|
93
81
|
- runner: windows-latest
|
|
94
82
|
target: x64
|
|
95
83
|
python_arch: x64
|
|
96
|
-
- runner: windows-latest
|
|
97
|
-
target: x86
|
|
98
|
-
python_arch: x86
|
|
99
84
|
- runner: windows-11-arm
|
|
100
85
|
target: aarch64
|
|
101
86
|
python_arch: arm64
|
|
@@ -4,7 +4,7 @@ version = 4
|
|
|
4
4
|
|
|
5
5
|
[[package]]
|
|
6
6
|
name = "MNeuEventLib"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.0"
|
|
8
8
|
dependencies = [
|
|
9
9
|
"anyhow",
|
|
10
10
|
"chrono",
|
|
@@ -77,9 +77,9 @@ checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e"
|
|
|
77
77
|
|
|
78
78
|
[[package]]
|
|
79
79
|
name = "cc"
|
|
80
|
-
version = "1.
|
|
80
|
+
version = "1.6.0"
|
|
81
81
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
82
|
-
checksum = "
|
|
82
|
+
checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630"
|
|
83
83
|
dependencies = [
|
|
84
84
|
"find-msvc-tools",
|
|
85
85
|
"shlex",
|
|
@@ -146,9 +146,9 @@ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
|
|
|
146
146
|
|
|
147
147
|
[[package]]
|
|
148
148
|
name = "either"
|
|
149
|
-
version = "1.
|
|
149
|
+
version = "1.19.0"
|
|
150
150
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
151
|
-
checksum = "
|
|
151
|
+
checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
|
152
152
|
|
|
153
153
|
[[package]]
|
|
154
154
|
name = "equivalent"
|
|
@@ -174,9 +174,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
|
|
174
174
|
|
|
175
175
|
[[package]]
|
|
176
176
|
name = "find-msvc-tools"
|
|
177
|
-
version = "0.1.
|
|
177
|
+
version = "0.1.14"
|
|
178
178
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
179
|
-
checksum = "
|
|
179
|
+
checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
|
|
180
180
|
|
|
181
181
|
[[package]]
|
|
182
182
|
name = "fnv"
|
|
@@ -339,9 +339,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|
|
339
339
|
|
|
340
340
|
[[package]]
|
|
341
341
|
name = "js-sys"
|
|
342
|
-
version = "0.3.
|
|
342
|
+
version = "0.3.106"
|
|
343
343
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
344
|
-
checksum = "
|
|
344
|
+
checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5"
|
|
345
345
|
dependencies = [
|
|
346
346
|
"cfg-if",
|
|
347
347
|
"futures-util",
|
|
@@ -350,9 +350,9 @@ dependencies = [
|
|
|
350
350
|
|
|
351
351
|
[[package]]
|
|
352
352
|
name = "libc"
|
|
353
|
-
version = "0.2.
|
|
353
|
+
version = "0.2.190"
|
|
354
354
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
355
|
-
checksum = "
|
|
355
|
+
checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
|
|
356
356
|
|
|
357
357
|
[[package]]
|
|
358
358
|
name = "libloading"
|
|
@@ -804,9 +804,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
|
|
804
804
|
|
|
805
805
|
[[package]]
|
|
806
806
|
name = "smallvec"
|
|
807
|
-
version = "1.16.
|
|
807
|
+
version = "1.16.2"
|
|
808
808
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
809
|
-
checksum = "
|
|
809
|
+
checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e"
|
|
810
810
|
|
|
811
811
|
[[package]]
|
|
812
812
|
name = "syn"
|
|
@@ -884,18 +884,18 @@ dependencies = [
|
|
|
884
884
|
|
|
885
885
|
[[package]]
|
|
886
886
|
name = "toml_datetime"
|
|
887
|
-
version = "1.1.
|
|
887
|
+
version = "1.1.2+spec-1.1.0"
|
|
888
888
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
889
|
-
checksum = "
|
|
889
|
+
checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
|
|
890
890
|
dependencies = [
|
|
891
891
|
"serde_core",
|
|
892
892
|
]
|
|
893
893
|
|
|
894
894
|
[[package]]
|
|
895
895
|
name = "toml_edit"
|
|
896
|
-
version = "0.25.
|
|
896
|
+
version = "0.25.16+spec-1.1.0"
|
|
897
897
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
898
|
-
checksum = "
|
|
898
|
+
checksum = "88f38f3af8bf71841c67a990f4e2b52143b2d0a1a994c72513ff4c14977fc722"
|
|
899
899
|
dependencies = [
|
|
900
900
|
"indexmap",
|
|
901
901
|
"toml_datetime",
|
|
@@ -905,9 +905,9 @@ dependencies = [
|
|
|
905
905
|
|
|
906
906
|
[[package]]
|
|
907
907
|
name = "toml_parser"
|
|
908
|
-
version = "1.1.
|
|
908
|
+
version = "1.1.4+spec-1.1.0"
|
|
909
909
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
910
|
-
checksum = "
|
|
910
|
+
checksum = "bed810ee007d8e7f9cf20b4774e7198142fa27186e0f805871da7f3c39eaf333"
|
|
911
911
|
dependencies = [
|
|
912
912
|
"winnow",
|
|
913
913
|
]
|
|
@@ -926,9 +926,9 @@ checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
|
|
|
926
926
|
|
|
927
927
|
[[package]]
|
|
928
928
|
name = "wasm-bindgen"
|
|
929
|
-
version = "0.2.
|
|
929
|
+
version = "0.2.129"
|
|
930
930
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
931
|
-
checksum = "
|
|
931
|
+
checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"
|
|
932
932
|
dependencies = [
|
|
933
933
|
"cfg-if",
|
|
934
934
|
"once_cell",
|
|
@@ -939,9 +939,9 @@ dependencies = [
|
|
|
939
939
|
|
|
940
940
|
[[package]]
|
|
941
941
|
name = "wasm-bindgen-macro"
|
|
942
|
-
version = "0.2.
|
|
942
|
+
version = "0.2.129"
|
|
943
943
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
944
|
-
checksum = "
|
|
944
|
+
checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"
|
|
945
945
|
dependencies = [
|
|
946
946
|
"quote",
|
|
947
947
|
"wasm-bindgen-macro-support",
|
|
@@ -949,9 +949,9 @@ dependencies = [
|
|
|
949
949
|
|
|
950
950
|
[[package]]
|
|
951
951
|
name = "wasm-bindgen-macro-support"
|
|
952
|
-
version = "0.2.
|
|
952
|
+
version = "0.2.129"
|
|
953
953
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
954
|
-
checksum = "
|
|
954
|
+
checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"
|
|
955
955
|
dependencies = [
|
|
956
956
|
"bumpalo",
|
|
957
957
|
"proc-macro2",
|
|
@@ -962,9 +962,9 @@ dependencies = [
|
|
|
962
962
|
|
|
963
963
|
[[package]]
|
|
964
964
|
name = "wasm-bindgen-shared"
|
|
965
|
-
version = "0.2.
|
|
965
|
+
version = "0.2.129"
|
|
966
966
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
967
|
-
checksum = "
|
|
967
|
+
checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"
|
|
968
968
|
dependencies = [
|
|
969
969
|
"unicode-ident",
|
|
970
970
|
]
|
|
@@ -17,6 +17,7 @@ object which would have been loaded from a
|
|
|
17
17
|
events data file.
|
|
18
18
|
"""
|
|
19
19
|
|
|
20
|
+
import sys
|
|
20
21
|
import h5py
|
|
21
22
|
|
|
22
23
|
"""
|
|
@@ -138,19 +139,25 @@ def read(obj, new_obj, key):
|
|
|
138
139
|
set_attributes(obj, tmp)
|
|
139
140
|
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
142
|
+
def make_default(example_filename='HIFI00207745.nxs', ref_filename='REF_file.nxs'):
|
|
143
|
+
"""Generate a reference NeXus file from an example histogram NeXus file."""
|
|
144
|
+
with h5py.File(example_filename, 'r') as file:
|
|
145
|
+
with h5py.File(ref_filename, 'w') as new_file:
|
|
146
|
+
# do top level manually
|
|
147
|
+
for key in file.keys():
|
|
148
|
+
new_obj = new_file.require_group(key)
|
|
149
|
+
set_attributes(file[key], new_obj)
|
|
150
|
+
for tmp in file[key].keys():
|
|
151
|
+
if tmp in ['selog']:
|
|
152
|
+
print('skip')
|
|
153
|
+
else:
|
|
154
|
+
read(file[key][tmp], new_obj, tmp)
|
|
155
|
+
if tmp == 'detector_1':
|
|
156
|
+
new_obj[tmp].attrs['NX_class'] = 'NXdata'
|
|
157
|
+
print('done')
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
if __name__ == '__main__':
|
|
161
|
+
example = sys.argv[1] if len(sys.argv) > 1 else 'HIFI00207745.nxs'
|
|
162
|
+
ref = sys.argv[2] if len(sys.argv) > 2 else 'REF_file.nxs'
|
|
163
|
+
make_default(example, ref)
|
|
@@ -13,8 +13,8 @@ version 2 histogram file. This processing may include filtering the events based
|
|
|
13
13
|
- on the values of auxiliary logs such as sample logs, warnings, or vetos;
|
|
14
14
|
- or on a high-pass filter of event amplitudes per detector.
|
|
15
15
|
|
|
16
|
-
It is primarily for muon event data
|
|
17
|
-
|
|
16
|
+
It is primarily for muon event data. The histogram files are
|
|
17
|
+
compatible with `WiMDA <https://shadow.nd.rl.ac.uk/wimda/>`_ and `Mantid <https://www.mantidproject.org/>`_.
|
|
18
18
|
|
|
19
19
|
Get started with MNeuEventLib
|
|
20
20
|
-----------------------------
|
|
@@ -6,7 +6,14 @@ Installation
|
|
|
6
6
|
Install using ``pip``
|
|
7
7
|
---------------------
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
MNeuEventLib can be installed like most other python packages using the ``pip`` package manager.
|
|
10
|
+
|
|
11
|
+
On a machine with ``pip`` installed, simply run
|
|
12
|
+
|
|
13
|
+
.. code-block::
|
|
14
|
+
|
|
15
|
+
pip install MNeuEventLib
|
|
16
|
+
|
|
10
17
|
|
|
11
18
|
Install from source
|
|
12
19
|
-------------------
|
|
@@ -166,36 +166,175 @@
|
|
|
166
166
|
"id": "352d0fdd-4b76-4cd1-9ec0-c5b6f714b99a",
|
|
167
167
|
"metadata": {},
|
|
168
168
|
"source": [
|
|
169
|
-
"If you are using multiple filters as 'slices' along the same lines, we recommend giving them the same name so they can all be removed easily like this
|
|
169
|
+
"If you are using multiple filters as 'slices' along the same lines, we recommend giving them the same name so they can all be removed easily like this."
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"cell_type": "markdown",
|
|
174
|
+
"id": "090d9a0b-b74f-4e58-8c90-25ea8e4c53f1",
|
|
175
|
+
"metadata": {},
|
|
176
|
+
"source": [
|
|
177
|
+
"## Convenience functions\n",
|
|
170
178
|
"\n",
|
|
171
|
-
"
|
|
179
|
+
"For certain common workflows, the BatchData interface also has some convenience functions. For example, if we want to cut our data into evenly-spaced time slices, rather than doing it by hand as above we can create a batch data object with the given space with `time_linspace`."
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"cell_type": "code",
|
|
184
|
+
"execution_count": null,
|
|
185
|
+
"id": "8bafc9fd-8fd5-4b43-9bf2-8a8231acb31a",
|
|
186
|
+
"metadata": {},
|
|
187
|
+
"outputs": [],
|
|
188
|
+
"source": [
|
|
189
|
+
"from MNeuEventLib import time_linspace\n",
|
|
190
|
+
"\n",
|
|
191
|
+
"time_sweep = time_linspace(\"time filter\", 0.5, 2.75, 4)\n",
|
|
192
|
+
"\n",
|
|
193
|
+
"print(time_sweep)"
|
|
172
194
|
]
|
|
173
195
|
},
|
|
174
196
|
{
|
|
175
197
|
"cell_type": "markdown",
|
|
176
|
-
"id": "
|
|
198
|
+
"id": "2b4b5c5d-19e9-4799-aaa4-8e4bcaf519fb",
|
|
177
199
|
"metadata": {},
|
|
178
200
|
"source": [
|
|
179
|
-
"
|
|
201
|
+
"There is also `slog_linspace` to do the same for a sample log filter - all of the convenience functions have both time and sample log variants (for example, for logarithmic (geometric) spacing, there is `time_geomspace` and `slog_geomspace`).\n",
|
|
202
|
+
"\n",
|
|
203
|
+
"To add filters at a fixed step, there is `time_range` and `slog_range`. For example, if we want to add evenly-spaced steps of 0.8C to our temperature log starting at 38C, we can do the following, giving four arguments:\n",
|
|
204
|
+
"- `name`: the filter name;\n",
|
|
205
|
+
"- `log`: the sample log to apply the filter to;\n",
|
|
206
|
+
"- `start`: the lower bound of the range;\n",
|
|
207
|
+
"- `end`: the upper bound of the range;\n",
|
|
208
|
+
"- `step`: the size of each step."
|
|
180
209
|
]
|
|
181
210
|
},
|
|
182
211
|
{
|
|
183
212
|
"cell_type": "code",
|
|
184
213
|
"execution_count": null,
|
|
185
|
-
"id": "
|
|
214
|
+
"id": "e922fdb1-2120-4839-86e7-7408f2ef2b60",
|
|
186
215
|
"metadata": {},
|
|
187
216
|
"outputs": [],
|
|
188
217
|
"source": [
|
|
189
|
-
"
|
|
218
|
+
"from MNeuEventLib import slog_range\n",
|
|
219
|
+
"\n",
|
|
220
|
+
"temp_sweep = slog_range(\"temperature filter\", \"Temp\", 38, 42, 0.8)\n",
|
|
221
|
+
"\n",
|
|
222
|
+
"print(temp_sweep)"
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"cell_type": "markdown",
|
|
227
|
+
"id": "5a0b6d5b-b6b3-416f-a6c4-29936c69c243",
|
|
228
|
+
"metadata": {},
|
|
229
|
+
"source": [
|
|
230
|
+
"and see that the steps have been added.\n",
|
|
231
|
+
"\n",
|
|
232
|
+
"**Note** that data objects created using the linspace, geomspace or range functionality do not have a dataset set for them by default (to save you from having to input the filename in every single call!). To add a dataset, use `set_data`:"
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"cell_type": "code",
|
|
237
|
+
"execution_count": null,
|
|
238
|
+
"id": "b6b58210-32d9-49c8-b9c2-a58e8be445d4",
|
|
239
|
+
"metadata": {},
|
|
240
|
+
"outputs": [],
|
|
241
|
+
"source": [
|
|
242
|
+
"temp_sweep.set_data(\"../_static/HIFI00195790.nxs\", n_spec=64)\n",
|
|
243
|
+
"\n",
|
|
244
|
+
"print(temp_sweep)"
|
|
245
|
+
]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"cell_type": "markdown",
|
|
249
|
+
"id": "91c01a30-8bfb-4392-a7d1-7e6d7ed9669f",
|
|
250
|
+
"metadata": {},
|
|
251
|
+
"source": [
|
|
252
|
+
"When you combine `BatchData` objects (see below), datasets are combined such that:\n",
|
|
253
|
+
"- If both objects have no data set, the combination has no data set;\n",
|
|
254
|
+
"- If just one object has data set, other objects will inherit it;\n",
|
|
255
|
+
"- If both objects have data set, there will be an error if they don't have the same data."
|
|
256
|
+
]
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"cell_type": "markdown",
|
|
260
|
+
"id": "1c6c1d72-05b1-451b-82a6-b0b88ed0d36b",
|
|
261
|
+
"metadata": {},
|
|
262
|
+
"source": [
|
|
263
|
+
"## Combining filters\n",
|
|
264
|
+
"Batch filter sets can be combined. Firstly, you can combine two filter sets of the same size componentwise with `+`."
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"cell_type": "code",
|
|
269
|
+
"execution_count": null,
|
|
270
|
+
"id": "e85cdf7c-5643-4422-8ae3-315a2b5ecb55",
|
|
271
|
+
"metadata": {},
|
|
272
|
+
"outputs": [],
|
|
273
|
+
"source": [
|
|
274
|
+
"data = time_sweep + temp_sweep\n",
|
|
275
|
+
"\n",
|
|
276
|
+
"print(data)"
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"cell_type": "markdown",
|
|
281
|
+
"id": "5ee43c2e-8995-4e6f-a175-63a18ad28e1f",
|
|
282
|
+
"metadata": {},
|
|
283
|
+
"source": [
|
|
284
|
+
"Secondly, say we want to concatenate two sets of filters. For example, we want to take five time slices between 0 seconds and 1 second, and then three between 1 second and 2 seconds. Filters can be concatenated with `&`:"
|
|
190
285
|
]
|
|
191
286
|
},
|
|
192
287
|
{
|
|
193
288
|
"cell_type": "code",
|
|
194
289
|
"execution_count": null,
|
|
195
|
-
"id": "
|
|
290
|
+
"id": "99d94490-bf33-43db-a2e6-c07d23862bac",
|
|
196
291
|
"metadata": {},
|
|
197
292
|
"outputs": [],
|
|
198
|
-
"source": [
|
|
293
|
+
"source": [
|
|
294
|
+
"data = time_linspace(\"sweep 1\", 0, 1, 5) & time_linspace(\"sweep 2\", 1, 2, 3)\n",
|
|
295
|
+
"\n",
|
|
296
|
+
"print(data)"
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"cell_type": "markdown",
|
|
301
|
+
"id": "06a31592-9402-465b-b035-599496d26cae",
|
|
302
|
+
"metadata": {},
|
|
303
|
+
"source": [
|
|
304
|
+
"Finally, if you have two sweeps and want to filter over all combinations of the two, you can get all combinations of filters with `*`."
|
|
305
|
+
]
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"cell_type": "code",
|
|
309
|
+
"execution_count": null,
|
|
310
|
+
"id": "87618138-50cd-464f-b31f-1899b45e761e",
|
|
311
|
+
"metadata": {},
|
|
312
|
+
"outputs": [],
|
|
313
|
+
"source": [
|
|
314
|
+
"data = time_sweep * temp_sweep\n",
|
|
315
|
+
"\n",
|
|
316
|
+
"print(data)"
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"cell_type": "markdown",
|
|
321
|
+
"id": "3ac444db-d7ff-4c53-b488-80cae5711aa1",
|
|
322
|
+
"metadata": {},
|
|
323
|
+
"source": [
|
|
324
|
+
"## More help\n",
|
|
325
|
+
"\n",
|
|
326
|
+
"As always, you can view the full API of the `BatchData` object using `help(BatchData)`:"
|
|
327
|
+
]
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"cell_type": "code",
|
|
331
|
+
"execution_count": null,
|
|
332
|
+
"id": "acd750d3-41ac-4b17-81a6-c47e359aa2d8",
|
|
333
|
+
"metadata": {},
|
|
334
|
+
"outputs": [],
|
|
335
|
+
"source": [
|
|
336
|
+
"help(BatchData)"
|
|
337
|
+
]
|
|
199
338
|
}
|
|
200
339
|
],
|
|
201
340
|
"metadata": {
|
|
@@ -214,7 +353,7 @@
|
|
|
214
353
|
"name": "python",
|
|
215
354
|
"nbconvert_exporter": "python",
|
|
216
355
|
"pygments_lexer": "ipython3",
|
|
217
|
-
"version": "3.
|
|
356
|
+
"version": "3.13.5"
|
|
218
357
|
}
|
|
219
358
|
},
|
|
220
359
|
"nbformat": 4,
|