MNeuEventLib 0.3.0__tar.gz → 0.5.2__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.
Files changed (66) hide show
  1. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/.github/workflows/push.yml +11 -3
  2. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/.github/workflows/release.yml +3 -18
  3. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/Cargo.lock +52 -53
  4. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/Cargo.toml +1 -1
  5. {mneueventlib-0.3.0/tools → mneueventlib-0.5.2/MNeuEventLib}/make_default.py +23 -16
  6. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/MNeuEventLib/plotting.py +25 -7
  7. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/PKG-INFO +1 -1
  8. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/how-to/create_plots.ipynb +36 -0
  9. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/how-to/filtering.ipynb +37 -7
  10. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/index.rst +2 -2
  11. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/install.rst +8 -1
  12. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/tutorials/batch_processing.ipynb +148 -9
  13. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/tutorials/getting_started.ipynb +3 -1
  14. mneueventlib-0.5.2/src/batch/functions.rs +296 -0
  15. mneueventlib-0.5.2/src/batch/interface.rs +2126 -0
  16. mneueventlib-0.5.2/src/batch/mod.rs +7 -0
  17. mneueventlib-0.5.2/src/consts.rs +36 -0
  18. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/frame_data.rs +2 -2
  19. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/nexus_data.rs +170 -13
  20. mneueventlib-0.5.2/src/data/sample_logs.rs +785 -0
  21. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/instrument.rs +2 -2
  22. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/sample_logs.rs +38 -23
  23. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/sanitise/nexus_data.rs +69 -1
  24. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/wimda.rs +19 -14
  25. mneueventlib-0.5.2/src/filters/api.rs +2058 -0
  26. mneueventlib-0.5.2/src/filters/filtering.rs +611 -0
  27. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/filters/mod.rs +2 -2
  28. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/interface.rs +157 -13
  29. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/lib.rs +11 -2
  30. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/stats.rs +234 -66
  31. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/test_utils.rs +22 -0
  32. mneueventlib-0.5.2/src/utils.rs +558 -0
  33. mneueventlib-0.3.0/src/batch_interface.rs +0 -840
  34. mneueventlib-0.3.0/src/consts.rs +0 -15
  35. mneueventlib-0.3.0/src/data/sample_logs.rs +0 -405
  36. mneueventlib-0.3.0/src/filters/api.rs +0 -968
  37. mneueventlib-0.3.0/src/filters/filtering.rs +0 -266
  38. mneueventlib-0.3.0/src/utils.rs +0 -84
  39. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/.github/workflows/label_merge_conflicts.yml +0 -0
  40. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/.gitignore +0 -0
  41. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/.readthedocs.yaml +0 -0
  42. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/LICENSE +0 -0
  43. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/MNeuEventLib/__init__.py +0 -0
  44. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/MNeuEventLib/test_helpers.py +0 -0
  45. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/README.md +0 -0
  46. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/bench.py +0 -0
  47. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/Makefile +0 -0
  48. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/make.bat +0 -0
  49. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/_static/HIFI00195790.nxs +0 -0
  50. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/_static/api/README.md +0 -0
  51. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/api.rst +0 -0
  52. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/conf.py +0 -0
  53. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/how-to/index.rst +0 -0
  54. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/docs/source/tutorials/index.rst +0 -0
  55. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/files/README.md +0 -0
  56. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/files/muon_ref.nxs +0 -0
  57. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/pyproject.toml +0 -0
  58. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/mod.rs +0 -0
  59. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/mod.rs +0 -0
  60. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/periods.rs +0 -0
  61. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/sanitise/mod.rs +0 -0
  62. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/sanitise/utils.rs +0 -0
  63. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/data/save/utils.rs +0 -0
  64. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/src/filters/weights.rs +0 -0
  65. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/tests/integration/test_mantid.py +0 -0
  66. {mneueventlib-0.3.0 → mneueventlib-0.5.2}/tests/test_data/HIFI00195790.nxs +0 -0
@@ -62,18 +62,26 @@ jobs:
62
62
  uses: conda-incubator/setup-miniconda@v4
63
63
  with:
64
64
  miniconda-version: "latest"
65
- mamba-version: "*"
66
65
  channels: ${{ matrix.mantid_channel }},conda-forge
67
66
  channel-priority: flexible
68
67
  conda-remove-defaults: true
69
68
  activate-environment: mantid-env
70
69
  auto-activate-base: false
71
70
 
71
+ - name: Configure conda network settings
72
+ shell: bash -el {0}
73
+ run: |
74
+ conda config --set remote_connect_timeout_secs 30
75
+ conda config --set remote_read_timeout_secs 120
76
+ conda config --set remote_max_retries 5
77
+ conda config --set remote_backoff_factor 3
78
+
72
79
  - name: Install Mantid and test deps
73
80
  shell: bash -el {0}
74
81
  env:
75
82
  MSYS_NO_PATHCONV: 1
76
- run: mamba install -y -n mantid-env mantid pytest pip
83
+ CONDA_OVERRIDE_OSX: "14"
84
+ run: conda install -y -n mantid-env mantid pytest pip
77
85
 
78
86
  - name: Show resolved python version
79
87
  shell: bash -el {0}
@@ -90,7 +98,7 @@ jobs:
90
98
  - name: Verify test deps installed
91
99
  shell: bash -el {0}
92
100
  run: |
93
- mamba list -n mantid-env pytest
101
+ conda list -n mantid-env pytest
94
102
  conda activate mantid-env
95
103
  python -c "import pytest; print(pytest.__version__)"
96
104
 
@@ -22,21 +22,13 @@ 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
38
30
  with:
39
- python-version: "3.8"
31
+ python-version: "3.13"
40
32
  - name: Build wheels
41
33
  uses: PyO3/maturin-action@v1
42
34
  with:
@@ -59,17 +51,13 @@ 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
71
59
  with:
72
- python-version: "3.8"
60
+ python-version: "3.13"
73
61
  - name: Build wheels
74
62
  uses: PyO3/maturin-action@v1
75
63
  with:
@@ -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
@@ -130,7 +115,7 @@ jobs:
130
115
  - uses: actions/checkout@v6
131
116
  - uses: actions/setup-python@v6
132
117
  with:
133
- python-version: "3.8"
118
+ python-version: "3.13"
134
119
  - name: Build wheels
135
120
  uses: PyO3/maturin-action@v1
136
121
  with:
@@ -4,7 +4,7 @@ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "MNeuEventLib"
7
- version = "0.3.0"
7
+ version = "0.5.2"
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.4.7"
80
+ version = "1.11.1"
81
81
  source = "registry+https://github.com/rust-lang/crates.io-index"
82
- checksum = "54413ede23c2daf518f35156dfde027feb2374004d63bd497f983c8db9c0e313"
82
+ checksum = "4ff2a8126fff0f8c839080d619675a585e61720bb12d2baceae45769fd66f155"
83
83
  dependencies = [
84
84
  "find-msvc-tools",
85
85
  "shlex",
@@ -146,21 +146,21 @@ checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
146
146
 
147
147
  [[package]]
148
148
  name = "either"
149
- version = "1.18.0"
149
+ version = "1.19.0"
150
150
  source = "registry+https://github.com/rust-lang/crates.io-index"
151
- checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
151
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
152
152
 
153
153
  [[package]]
154
154
  name = "equivalent"
155
- version = "1.0.2"
155
+ version = "1.0.3"
156
156
  source = "registry+https://github.com/rust-lang/crates.io-index"
157
- checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
157
+ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
158
158
 
159
159
  [[package]]
160
160
  name = "errno"
161
- version = "0.3.14"
161
+ version = "0.3.15"
162
162
  source = "registry+https://github.com/rust-lang/crates.io-index"
163
- checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
163
+ checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776"
164
164
  dependencies = [
165
165
  "libc",
166
166
  "windows-sys",
@@ -174,9 +174,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
174
174
 
175
175
  [[package]]
176
176
  name = "find-msvc-tools"
177
- version = "0.1.13"
177
+ version = "0.1.15"
178
178
  source = "registry+https://github.com/rust-lang/crates.io-index"
179
- checksum = "ef25905e51abafe4dcea6c15fec58c57b601cdbd0ee53d22ea1d3016c587d39b"
179
+ checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
180
180
 
181
181
  [[package]]
182
182
  name = "fnv"
@@ -250,7 +250,7 @@ dependencies = [
250
250
  "proc-macro-crate",
251
251
  "proc-macro2",
252
252
  "quote",
253
- "syn 3.0.6",
253
+ "syn 3.0.10",
254
254
  ]
255
255
 
256
256
  [[package]]
@@ -264,9 +264,9 @@ dependencies = [
264
264
 
265
265
  [[package]]
266
266
  name = "hdf5-metno-sys"
267
- version = "0.12.4"
267
+ version = "0.12.5"
268
268
  source = "registry+https://github.com/rust-lang/crates.io-index"
269
- checksum = "567a57ee34c38263f551f2cf02b95675def6b91d0e321c5e70f8c6d5ef9cee87"
269
+ checksum = "5c25498a6b2db388939b973be69d09516ab5f198944dbe8487bfaf37def8c371"
270
270
  dependencies = [
271
271
  "hdf5-metno-src",
272
272
  "libc",
@@ -333,15 +333,15 @@ dependencies = [
333
333
 
334
334
  [[package]]
335
335
  name = "itoa"
336
- version = "1.0.18"
336
+ version = "1.0.19"
337
337
  source = "registry+https://github.com/rust-lang/crates.io-index"
338
- checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
338
+ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
339
339
 
340
340
  [[package]]
341
341
  name = "js-sys"
342
- version = "0.3.105"
342
+ version = "0.3.107"
343
343
  source = "registry+https://github.com/rust-lang/crates.io-index"
344
- checksum = "ce57d20d1ea864ce2ac172ab472d409214f4fd359f0b2a2775abdf522e2af99e"
344
+ checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a"
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.189"
353
+ version = "0.2.191"
354
354
  source = "registry+https://github.com/rust-lang/crates.io-index"
355
- checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
355
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
356
356
 
357
357
  [[package]]
358
358
  name = "libloading"
@@ -381,9 +381,9 @@ dependencies = [
381
381
 
382
382
  [[package]]
383
383
  name = "log"
384
- version = "0.4.34"
384
+ version = "0.4.35"
385
385
  source = "registry+https://github.com/rust-lang/crates.io-index"
386
- checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
386
+ checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
387
387
 
388
388
  [[package]]
389
389
  name = "matrixmultiply"
@@ -718,9 +718,9 @@ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
718
718
 
719
719
  [[package]]
720
720
  name = "rustix"
721
- version = "1.1.5"
721
+ version = "1.1.6"
722
722
  source = "registry+https://github.com/rust-lang/crates.io-index"
723
- checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d"
723
+ checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa"
724
724
  dependencies = [
725
725
  "bitflags",
726
726
  "errno",
@@ -774,14 +774,14 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
774
774
  dependencies = [
775
775
  "proc-macro2",
776
776
  "quote",
777
- "syn 3.0.6",
777
+ "syn 3.0.10",
778
778
  ]
779
779
 
780
780
  [[package]]
781
781
  name = "serde_json"
782
- version = "1.0.151"
782
+ version = "1.0.154"
783
783
  source = "registry+https://github.com/rust-lang/crates.io-index"
784
- checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
784
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
785
785
  dependencies = [
786
786
  "itoa",
787
787
  "memchr",
@@ -804,9 +804,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
804
804
 
805
805
  [[package]]
806
806
  name = "smallvec"
807
- version = "1.16.1"
807
+ version = "1.16.5"
808
808
  source = "registry+https://github.com/rust-lang/crates.io-index"
809
- checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891"
809
+ checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46"
810
810
 
811
811
  [[package]]
812
812
  name = "syn"
@@ -821,9 +821,9 @@ dependencies = [
821
821
 
822
822
  [[package]]
823
823
  name = "syn"
824
- version = "3.0.6"
824
+ version = "3.0.10"
825
825
  source = "registry+https://github.com/rust-lang/crates.io-index"
826
- checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee"
826
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
827
827
  dependencies = [
828
828
  "proc-macro2",
829
829
  "quote",
@@ -884,18 +884,18 @@ dependencies = [
884
884
 
885
885
  [[package]]
886
886
  name = "toml_datetime"
887
- version = "1.1.1+spec-1.1.0"
887
+ version = "1.1.3+spec-1.1.0"
888
888
  source = "registry+https://github.com/rust-lang/crates.io-index"
889
- checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7"
889
+ checksum = "173f25c883cd2176a2d8212155638c0a60d484a9d84546d270866f40f56b6e49"
890
890
  dependencies = [
891
891
  "serde_core",
892
892
  ]
893
893
 
894
894
  [[package]]
895
895
  name = "toml_edit"
896
- version = "0.25.15+spec-1.1.0"
896
+ version = "0.25.19+spec-1.1.0"
897
897
  source = "registry+https://github.com/rust-lang/crates.io-index"
898
- checksum = "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614"
898
+ checksum = "dd43688c4858d7264ae1cf9a9f874a67c3feb74a883b1cd7bebd6a4ea8307218"
899
899
  dependencies = [
900
900
  "indexmap",
901
901
  "toml_datetime",
@@ -905,33 +905,32 @@ dependencies = [
905
905
 
906
906
  [[package]]
907
907
  name = "toml_parser"
908
- version = "1.1.3+spec-1.1.0"
908
+ version = "1.1.5+spec-1.1.0"
909
909
  source = "registry+https://github.com/rust-lang/crates.io-index"
910
- checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56"
910
+ checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c"
911
911
  dependencies = [
912
912
  "winnow",
913
913
  ]
914
914
 
915
915
  [[package]]
916
916
  name = "unicode-ident"
917
- version = "1.0.26"
917
+ version = "1.0.27"
918
918
  source = "registry+https://github.com/rust-lang/crates.io-index"
919
- checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
919
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
920
920
 
921
921
  [[package]]
922
922
  name = "unicode-width"
923
- version = "0.2.2"
923
+ version = "0.2.3"
924
924
  source = "registry+https://github.com/rust-lang/crates.io-index"
925
- checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
925
+ checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557"
926
926
 
927
927
  [[package]]
928
928
  name = "wasm-bindgen"
929
- version = "0.2.128"
929
+ version = "0.2.130"
930
930
  source = "registry+https://github.com/rust-lang/crates.io-index"
931
- checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf"
931
+ checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c"
932
932
  dependencies = [
933
933
  "cfg-if",
934
- "once_cell",
935
934
  "rustversion",
936
935
  "wasm-bindgen-macro",
937
936
  "wasm-bindgen-shared",
@@ -939,9 +938,9 @@ dependencies = [
939
938
 
940
939
  [[package]]
941
940
  name = "wasm-bindgen-macro"
942
- version = "0.2.128"
941
+ version = "0.2.130"
943
942
  source = "registry+https://github.com/rust-lang/crates.io-index"
944
- checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed"
943
+ checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9"
945
944
  dependencies = [
946
945
  "quote",
947
946
  "wasm-bindgen-macro-support",
@@ -949,22 +948,22 @@ dependencies = [
949
948
 
950
949
  [[package]]
951
950
  name = "wasm-bindgen-macro-support"
952
- version = "0.2.128"
951
+ version = "0.2.130"
953
952
  source = "registry+https://github.com/rust-lang/crates.io-index"
954
- checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a"
953
+ checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a"
955
954
  dependencies = [
956
955
  "bumpalo",
957
956
  "proc-macro2",
958
957
  "quote",
959
- "syn 3.0.6",
958
+ "syn 3.0.10",
960
959
  "wasm-bindgen-shared",
961
960
  ]
962
961
 
963
962
  [[package]]
964
963
  name = "wasm-bindgen-shared"
965
- version = "0.2.128"
964
+ version = "0.2.130"
966
965
  source = "registry+https://github.com/rust-lang/crates.io-index"
967
- checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e"
966
+ checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e"
968
967
  dependencies = [
969
968
  "unicode-ident",
970
969
  ]
@@ -1039,9 +1038,9 @@ dependencies = [
1039
1038
 
1040
1039
  [[package]]
1041
1040
  name = "winnow"
1042
- version = "1.0.4"
1041
+ version = "1.0.5"
1043
1042
  source = "registry+https://github.com/rust-lang/crates.io-index"
1044
- checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81"
1043
+ checksum = "8c3b93199df0ab874cdf0c6a94f0a0dc3423fe41f1cafb62b8bd7b1deb277aef"
1045
1044
  dependencies = [
1046
1045
  "memchr",
1047
1046
  ]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "MNeuEventLib"
3
- version = "0.3.0"
3
+ version = "0.5.2"
4
4
  edition = "2021"
5
5
  license = "BSD-3-Clause"
6
6
  readme = "README.md"
@@ -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
- with h5py.File('HIFI00207745.nxs', 'r') as file:
142
- with h5py.File('REF_file.nxs', 'w') as new_file:
143
- # do top level manually
144
- for key in file.keys():
145
- new_obj = new_file.require_group(key)
146
- set_attributes(file[key], new_obj)
147
- for tmp in file[key].keys():
148
- if tmp in ['selog']:
149
- print('skip')
150
- else:
151
- read(file[key][tmp], new_obj, tmp)
152
- if tmp == 'detector_1':
153
- new_obj[tmp].attrs['NX_class'] = 'NXdata'
154
- # clean up
155
- print('done')
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)
@@ -21,16 +21,25 @@ def plot_sample_log(data: Data, log_name: str):
21
21
  fig, ax = plt.subplots()
22
22
  ax.set_title(sample_log['name'])
23
23
  ax.set_xlabel("Time (seconds)")
24
- if units := sample_log['unit'] == "":
25
- unit_string = ""
26
- else:
27
- unit_string = f"({units})"
24
+ units = sample_log['unit']
25
+ unit_string = "" if units == "" else f"({units})"
28
26
  ax.set_ylabel(f"Value {unit_string}")
29
- ax.plot(sample_log['time'], sample_log['value'])
27
+
28
+ values = sample_log['value']
29
+ if isinstance(values, list):
30
+ # a string log comes back as a list of str rather than an array, so
31
+ # we need to plot it differently
32
+ categories = list(dict.fromkeys(values))
33
+ ax.plot(sample_log['time'], values, drawstyle="steps-post", marker="o")
34
+ ax.set_yticks(categories)
35
+ ax.set_ylabel("Value")
36
+ else:
37
+ ax.plot(sample_log['time'], values)
30
38
 
31
39
  plt.show()
32
40
 
33
- def plot_amplitudes(data: Data, max_height: Optional[float] = None, n_bins: int = 10):
41
+ def plot_amplitudes(data: Data, max_height: Optional[float] = None, n_bins: int = 10,
42
+ detector: Optional[int] = None):
34
43
  """
35
44
  Plot a histogram of amplitudes.
36
45
 
@@ -44,12 +53,21 @@ def plot_amplitudes(data: Data, max_height: Optional[float] = None, n_bins: int
44
53
  If not provided, calculates the maximum amplitude in the data.
45
54
  n_bins: int, default 10
46
55
  The number of equal-width bins to use.
56
+ detector: int, optional
57
+ The detector to plot amplitudes for.
58
+ If not provided, plots for all detectors.
47
59
  """
48
60
  # get_amp_histogram returns the histogram and the max height used
49
- hist, max_h = data.dataset.get_amp_histogram(max_height, n_bins)
61
+ hist, max_h = data.dataset.get_amp_histogram(max_height, n_bins, detector)
50
62
 
51
63
  steps = np.linspace(0, max_h, len(hist)+1)
52
64
  fig, ax = plt.subplots()
65
+ if detector is None:
66
+ ax.set_title("Amplitude histogram")
67
+ else:
68
+ ax.set_title(f"Amplitude histogram (detector {detector})")
69
+ ax.set_xlabel("Amplitude")
70
+ ax.set_ylabel("Counts")
53
71
  ax.stairs(hist, steps, fill = True)
54
72
 
55
73
  plt.show()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MNeuEventLib
3
- Version: 0.3.0
3
+ Version: 0.5.2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -112,6 +112,42 @@
112
112
  "source": [
113
113
  "plot_amplitudes(data, max_height=3000)"
114
114
  ]
115
+ },
116
+ {
117
+ "cell_type": "markdown",
118
+ "id": "a725ec2b-8707-469d-ae0b-0af4fa75eff6",
119
+ "metadata": {},
120
+ "source": [
121
+ "Finally, you can plot the amplitudes recorded by a single detector with the `detector` argument. Detectors are indexed from zero, so for our 64-detector dataset the valid values are 0 to 63:"
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "execution_count": null,
127
+ "id": "e996ee48-0c6a-4551-9904-09bb4c4c1827",
128
+ "metadata": {},
129
+ "outputs": [],
130
+ "source": [
131
+ "plot_amplitudes(data, n_bins=30, detector=0)"
132
+ ]
133
+ },
134
+ {
135
+ "cell_type": "markdown",
136
+ "id": "2d275497-4701-4b36-83d4-6f9aafbb6174",
137
+ "metadata": {},
138
+ "source": [
139
+ "Note that when `max_height` is not supplied, it is still calculated across *all* detectors rather than just the chosen one. This means histograms for different detectors share an x-axis, so they can be compared directly:"
140
+ ]
141
+ },
142
+ {
143
+ "cell_type": "code",
144
+ "execution_count": null,
145
+ "id": "48cb5237-d3c5-4194-baae-61c31e29211d",
146
+ "metadata": {},
147
+ "outputs": [],
148
+ "source": [
149
+ "plot_amplitudes(data, n_bins=30, detector=21)"
150
+ ]
115
151
  }
116
152
  ],
117
153
  "metadata": {
@@ -124,9 +124,7 @@
124
124
  "cell_type": "markdown",
125
125
  "id": "172a15b2-34f9-4233-bf61-94d0307abde2",
126
126
  "metadata": {},
127
- "source": [
128
- "Finally, we can remove our time filter with the `remove_time_filter` method:"
129
- ]
127
+ "source": "If we want to change a filter we have already added, we can use the `edit_time_filter` method. This takes the name of the filter, and new values for `start` and/or `end`; any bound we don't give is left as it is. For example, `data.edit_time_filter(\"filter 1\", end=2.0)` would move the end of our filter to 2 seconds, leaving it starting at 0.5 seconds.\n\nFinally, we can remove our time filter with the `remove_time_filter` method:"
130
128
  },
131
129
  {
132
130
  "cell_type": "code",
@@ -211,9 +209,7 @@
211
209
  "cell_type": "markdown",
212
210
  "id": "239f9487-e7e1-44ed-8869-f5637ca20f2d",
213
211
  "metadata": {},
214
- "source": [
215
- "As for time filters, we can remove sample log filters with `remove_log_filter`."
216
- ]
212
+ "source": "As for time filters, existing sample log filters can be changed with `edit_log_filter`. This takes the name of the filter, and new values for `log`, `lower` and/or `upper`; anything we don't give is left as it is. For example, `data.edit_log_filter(\"temperature filter\", upper=40.5)` would raise the upper bound of our filter to 40.5 degrees. Note that a bound which is unbounded stays unbounded: to turn a bounded filter into an unbounded one, remove it and add it again with `add_log_filter_above` or `add_log_filter_below`.\n\n Also as for time filters, we can remove sample log filters with `remove_log_filter`."
217
213
  },
218
214
  {
219
215
  "cell_type": "code",
@@ -226,6 +222,40 @@
226
222
  "data.remove_log_filter(\"temperature filter 2\")"
227
223
  ]
228
224
  },
225
+ {
226
+ "cell_type": "markdown",
227
+ "metadata": {},
228
+ "source": [
229
+ "### Filtering text sample logs\n",
230
+ "\n",
231
+ "Not every sample log holds numbers. Some record the state of a piece of equipment as text, for example a cryostat writing `\"IDLE\"`, `\"RUNNING\"` and `\"PAUSED\"` as the run progresses. A range makes no sense for these, so they are filtered on an exact value instead, using `add_string_log_filter`. It takes three arguments:\n",
232
+ "- `name`: A name label for the filter, unique across all sample log filters.\n",
233
+ "- `log`: The sample log that the filter applies to.\n",
234
+ "- `value`: The value the log must hold for data to be kept.\n",
235
+ "\n",
236
+ "```python\n",
237
+ "data.add_string_log_filter(\"running only\", \"status\", \"RUNNING\")\n",
238
+ "```\n",
239
+ "\n",
240
+ "This keeps only the data taken while the `status` log held `\"RUNNING\"`, and discards everything else. Matching ignores case, so `\"running\"` and `\"Running\"` select the same data.\n",
241
+ "\n",
242
+ "So a log reading\n",
243
+ "\n",
244
+ "| time | value |\n",
245
+ "| ---- | ----- |\n",
246
+ "| 0s | IDLE |\n",
247
+ "| 3s | RUNNING |\n",
248
+ "| 10s | PAUSED |\n",
249
+ "\n",
250
+ "filtered on `\"RUNNING\"` keeps the data from 3s to 10s.\n",
251
+ "\n",
252
+ "Text and numeric filters cannot be swapped: `add_log_filter` on a text log, or `add_string_log_filter` on a numeric one, raises an error saying so. Asking for a value the log never takes is also an error, which lists the values that *are* present - otherwise the filter would match nothing and you would silently get the whole dataset back.\n",
253
+ "\n",
254
+ "Text log filters are changed with `edit_string_log_filter`, which takes the name of the filter and new values for `log` and/or `value`; anything we don't give is left as it is. For example, `data.edit_string_log_filter(\"running only\", value=\"PAUSED\")` would make our filter keep the data from 10s onwards instead. `edit_log_filter` can't change the value of a text filter, and `edit_string_log_filter` can't edit a numeric one.\n",
255
+ "\n",
256
+ "Text log filters are removed with `remove_log_filter`, just like numeric ones.\n"
257
+ ]
258
+ },
229
259
  {
230
260
  "cell_type": "markdown",
231
261
  "id": "1383b7e2-cd11-4a83-a86c-6c4f98a889b0",
@@ -300,4 +330,4 @@
300
330
  },
301
331
  "nbformat": 4,
302
332
  "nbformat_minor": 5
303
- }
333
+ }
@@ -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, and the histogram files are
17
- currently only compatible with `WiMDA <https://shadow.nd.rl.ac.uk/wimda/>`_.
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
- TODO: not currently on PyPI...
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
  -------------------