MNeuEventLib 0.4.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 (63) hide show
  1. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/.github/workflows/push.yml +11 -3
  2. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/.github/workflows/release.yml +3 -3
  3. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/Cargo.lock +50 -51
  4. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/Cargo.toml +1 -1
  5. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/MNeuEventLib/plotting.py +25 -7
  6. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/PKG-INFO +1 -1
  7. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/how-to/create_plots.ipynb +36 -0
  8. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/how-to/filtering.ipynb +37 -7
  9. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/tutorials/getting_started.ipynb +3 -1
  10. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/batch/functions.rs +5 -1
  11. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/batch/interface.rs +762 -104
  12. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/consts.rs +11 -0
  13. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/nexus_data.rs +165 -11
  14. mneueventlib-0.5.2/src/data/sample_logs.rs +785 -0
  15. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/instrument.rs +2 -2
  16. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/sample_logs.rs +33 -20
  17. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/wimda.rs +5 -4
  18. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/filters/api.rs +850 -88
  19. mneueventlib-0.5.2/src/filters/filtering.rs +611 -0
  20. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/filters/mod.rs +2 -2
  21. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/interface.rs +112 -1
  22. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/lib.rs +2 -0
  23. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/stats.rs +79 -25
  24. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/test_utils.rs +22 -0
  25. mneueventlib-0.5.2/src/utils.rs +558 -0
  26. mneueventlib-0.4.0/src/data/sample_logs.rs +0 -395
  27. mneueventlib-0.4.0/src/filters/filtering.rs +0 -266
  28. mneueventlib-0.4.0/src/utils.rs +0 -87
  29. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/.github/workflows/label_merge_conflicts.yml +0 -0
  30. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/.gitignore +0 -0
  31. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/.readthedocs.yaml +0 -0
  32. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/LICENSE +0 -0
  33. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/MNeuEventLib/__init__.py +0 -0
  34. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/MNeuEventLib/make_default.py +0 -0
  35. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/MNeuEventLib/test_helpers.py +0 -0
  36. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/README.md +0 -0
  37. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/bench.py +0 -0
  38. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/Makefile +0 -0
  39. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/make.bat +0 -0
  40. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/_static/HIFI00195790.nxs +0 -0
  41. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/_static/api/README.md +0 -0
  42. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/api.rst +0 -0
  43. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/conf.py +0 -0
  44. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/how-to/index.rst +0 -0
  45. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/index.rst +0 -0
  46. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/install.rst +0 -0
  47. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/tutorials/batch_processing.ipynb +0 -0
  48. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/docs/source/tutorials/index.rst +0 -0
  49. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/files/README.md +0 -0
  50. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/files/muon_ref.nxs +0 -0
  51. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/pyproject.toml +0 -0
  52. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/batch/mod.rs +0 -0
  53. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/frame_data.rs +0 -0
  54. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/mod.rs +0 -0
  55. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/mod.rs +0 -0
  56. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/periods.rs +0 -0
  57. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/sanitise/mod.rs +0 -0
  58. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/sanitise/nexus_data.rs +0 -0
  59. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/sanitise/utils.rs +0 -0
  60. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/data/save/utils.rs +0 -0
  61. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/src/filters/weights.rs +0 -0
  62. {mneueventlib-0.4.0 → mneueventlib-0.5.2}/tests/integration/test_mantid.py +0 -0
  63. {mneueventlib-0.4.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
 
@@ -28,7 +28,7 @@ jobs:
28
28
  - uses: actions/checkout@v6
29
29
  - uses: actions/setup-python@v6
30
30
  with:
31
- python-version: "3.8"
31
+ python-version: "3.13"
32
32
  - name: Build wheels
33
33
  uses: PyO3/maturin-action@v1
34
34
  with:
@@ -57,7 +57,7 @@ jobs:
57
57
  - uses: actions/checkout@v6
58
58
  - uses: actions/setup-python@v6
59
59
  with:
60
- python-version: "3.8"
60
+ python-version: "3.13"
61
61
  - name: Build wheels
62
62
  uses: PyO3/maturin-action@v1
63
63
  with:
@@ -115,7 +115,7 @@ jobs:
115
115
  - uses: actions/checkout@v6
116
116
  - uses: actions/setup-python@v6
117
117
  with:
118
- python-version: "3.8"
118
+ python-version: "3.13"
119
119
  - name: Build wheels
120
120
  uses: PyO3/maturin-action@v1
121
121
  with:
@@ -4,7 +4,7 @@ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "MNeuEventLib"
7
- version = "0.4.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.6.0"
80
+ version = "1.11.1"
81
81
  source = "registry+https://github.com/rust-lang/crates.io-index"
82
- checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630"
82
+ checksum = "4ff2a8126fff0f8c839080d619675a585e61720bb12d2baceae45769fd66f155"
83
83
  dependencies = [
84
84
  "find-msvc-tools",
85
85
  "shlex",
@@ -152,15 +152,15 @@ 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.14"
177
+ version = "0.1.15"
178
178
  source = "registry+https://github.com/rust-lang/crates.io-index"
179
- checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
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.106"
342
+ version = "0.3.107"
343
343
  source = "registry+https://github.com/rust-lang/crates.io-index"
344
- checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5"
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.190"
353
+ version = "0.2.191"
354
354
  source = "registry+https://github.com/rust-lang/crates.io-index"
355
- checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
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.2"
807
+ version = "1.16.5"
808
808
  source = "registry+https://github.com/rust-lang/crates.io-index"
809
- checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e"
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.2+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 = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053"
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.16+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 = "88f38f3af8bf71841c67a990f4e2b52143b2d0a1a994c72513ff4c14977fc722"
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.4+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 = "bed810ee007d8e7f9cf20b4774e7198142fa27186e0f805871da7f3c39eaf333"
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.129"
929
+ version = "0.2.130"
930
930
  source = "registry+https://github.com/rust-lang/crates.io-index"
931
- checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"
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.129"
941
+ version = "0.2.130"
943
942
  source = "registry+https://github.com/rust-lang/crates.io-index"
944
- checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"
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.129"
951
+ version = "0.2.130"
953
952
  source = "registry+https://github.com/rust-lang/crates.io-index"
954
- checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"
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.129"
964
+ version = "0.2.130"
966
965
  source = "registry+https://github.com/rust-lang/crates.io-index"
967
- checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"
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.4.0"
3
+ version = "0.5.2"
4
4
  edition = "2021"
5
5
  license = "BSD-3-Clause"
6
6
  readme = "README.md"
@@ -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.4.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
+ }
@@ -55,7 +55,9 @@
55
55
  "id": "d15e0dbe-f268-4751-859c-e3a32af17369",
56
56
  "metadata": {},
57
57
  "source": [
58
- "Then, we can save the data using the `save` method. This creates a histogram NeXus file containing the metadata from the event file as well as the calculated histogram."
58
+ "Then, we can save the data using the `save` method. This creates a histogram NeXus file containing the metadata from the event file as well as the calculated histogram.\n",
59
+ "\n",
60
+ "If you change any filters or histogram settings after calculating, `save` will recalculate the histogram before writing it out, and warn you that it has done so. This means the saved file always matches the filters you currently have set."
59
61
  ]
60
62
  },
61
63
  {
@@ -151,6 +151,7 @@ pub fn slog_range(name: String, log: String, start: f64, end: f64, step: f64) ->
151
151
  mod tests {
152
152
  use super::*;
153
153
  use crate::consts::ToNanoseconds;
154
+ use crate::filters::LogPredicate;
154
155
 
155
156
  /// The bounds of every filter set's single time filter, in order of
156
157
  /// filter set.
@@ -173,7 +174,10 @@ mod tests {
173
174
  .map(|filters| {
174
175
  assert_eq!(filters.sample_log_filters.len(), 1);
175
176
  let filter = &filters.sample_log_filters[name];
176
- (filter.lower.unwrap(), filter.upper.unwrap())
177
+ match &filter.predicate {
178
+ LogPredicate::Range { lower, upper } => (lower.unwrap(), upper.unwrap()),
179
+ other => panic!("expected a range predicate, got {other:?}"),
180
+ }
177
181
  })
178
182
  .collect()
179
183
  }