Add the remaining 139 files
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- README.md +45 -0
- labeled/test/noise_tags.npz +3 -0
- labeled/test/pid_labels.npz +3 -0
- labeled/test/spacepoints.npz +3 -0
- labeled/test/track_ids.npz +3 -0
- labeled/train/noise_tags_000.npz +3 -0
- labeled/train/noise_tags_001.npz +3 -0
- labeled/train/noise_tags_002.npz +3 -0
- labeled/train/noise_tags_003.npz +3 -0
- labeled/train/noise_tags_004.npz +3 -0
- labeled/train/noise_tags_005.npz +3 -0
- labeled/train/noise_tags_006.npz +3 -0
- labeled/train/pid_labels_000.npz +3 -0
- labeled/train/pid_labels_001.npz +3 -0
- labeled/train/pid_labels_002.npz +3 -0
- labeled/train/pid_labels_003.npz +3 -0
- labeled/train/pid_labels_004.npz +3 -0
- labeled/train/pid_labels_005.npz +3 -0
- labeled/train/pid_labels_006.npz +3 -0
- labeled/train/spacepoints_000.npz +3 -0
- labeled/train/spacepoints_001.npz +3 -0
- labeled/train/spacepoints_002.npz +3 -0
- labeled/train/spacepoints_003.npz +3 -0
- labeled/train/spacepoints_004.npz +3 -0
- labeled/train/spacepoints_005.npz +3 -0
- labeled/train/spacepoints_006.npz +3 -0
- labeled/train/track_ids_000.npz +3 -0
- labeled/train/track_ids_001.npz +3 -0
- labeled/train/track_ids_002.npz +3 -0
- labeled/train/track_ids_003.npz +3 -0
- labeled/train/track_ids_004.npz +3 -0
- labeled/train/track_ids_005.npz +3 -0
- labeled/train/track_ids_006.npz +3 -0
- labeled/validation/noise_tags.npz +3 -0
- labeled/validation/pid_labels.npz +3 -0
- labeled/validation/spacepoints.npz +3 -0
- labeled/validation/track_ids.npz +3 -0
- scripts/demo.ipynb +477 -0
- scripts/plot.py +188 -0
- unlabeled/spacepoints_000.npz +3 -0
- unlabeled/spacepoints_001.npz +3 -0
- unlabeled/spacepoints_002.npz +3 -0
- unlabeled/spacepoints_003.npz +3 -0
- unlabeled/spacepoints_004.npz +3 -0
- unlabeled/spacepoints_005.npz +3 -0
- unlabeled/spacepoints_006.npz +3 -0
- unlabeled/spacepoints_007.npz +3 -0
- unlabeled/spacepoints_008.npz +3 -0
- unlabeled/spacepoints_009.npz +3 -0
- unlabeled/spacepoints_010.npz +3 -0
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
pretty_name: TPCpp-10M
|
| 4 |
+
tags:
|
| 5 |
+
- particle-physics
|
| 6 |
+
- time-projection-chamber
|
| 7 |
+
- sphenix
|
| 8 |
+
- point-cloud
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# TPCpp-10M
|
| 12 |
+
|
| 13 |
+
This repository mirrors TPCpp-10M, the dataset of simulated proton-proton collisions in an sPHENIX-like Time Projection Chamber that Li et al. released with the FM4NPP foundation model ([Zenodo 10.5281/zenodo.16970029](https://doi.org/10.5281/zenodo.16970029), CC BY 4.0). Zenodo distributes it as one 118.5 GB archive, which is larger than a single file on the Hugging Face Hub may be, so we mirror the archive's files instead: every file of `TPCpp-10M.zip`, unchanged and in the archive's folders. The release's `TPCpp-10M_scripts.zip` and `TPCpp-10M_labeled_test.zip` hold copies of `scripts/` and `labeled/test/` and are not repeated here.
|
| 14 |
+
|
| 15 |
+
Each event is a set of TPC space points from one collision at √s = 200 GeV. `labeled/train/` (sharded `_000` to `_006`), `labeled/validation/` and `labeled/test/` hold 70,000, 13,000 and 7,000 labeled events, and `unlabeled/spacepoints_000.npz` to `_099.npz` hold 100,000 unlabeled events each for pretraining. In every `.npz` file, `data` is a flat array over the points of all its events and `size` (in the `spacepoints` files) gives the points per event. The `spacepoints` columns are the deposited energy and the position x, y, z; `track_ids`, `pid_labels` (0 other, 1 pion, 2 kaon, 3 proton, 4 electron) and `noise_tags` label each point of the labeled events.
|
| 16 |
+
|
| 17 |
+
## Use
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
import panda
|
| 21 |
+
|
| 22 |
+
dataset = panda.v2.TPCpp10MDataset(split="test", transform=panda.v2.transform("sphenix"))
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
The dataset reads these files directly, without a conversion step, and returns each event exactly as the [Panda V2](https://github.com/DeepLearnPhysics/Panda) models were trained and scored on it. As in the Panda V2 paper, `validation` and `test` keep the events with at most 3,200 points by default.
|
| 26 |
+
|
| 27 |
+
## Citation
|
| 28 |
+
|
| 29 |
+
Please cite the dataset and the FM4NPP paper:
|
| 30 |
+
|
| 31 |
+
```bibtex
|
| 32 |
+
@article{tpcpp10m2025,
|
| 33 |
+
title = {TPCpp-10M: Simulated proton-proton collisions in a Time Projection Chamber for AI Foundation Models},
|
| 34 |
+
author = {Li, Shuhang and Huang, Yi and Park, David and Luo, Xihaier and Yu, Haiwang and Go, Yeonju and Pinkenburg, Christopher and Lin, Yuewei and Yoo, Shinjae and Osborn, Joseph and Roland, Christof and Huang, Jin and Ren, Yihui},
|
| 35 |
+
journal = {arXiv preprint arXiv:2509.05792},
|
| 36 |
+
year = {2025}
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
@article{park2025fm4npp,
|
| 40 |
+
title = {FM4NPP: A Scaling Foundation Model for Nuclear and Particle Physics},
|
| 41 |
+
author = {Park, David and Li, Shuhang and Huang, Yi and Luo, Xihaier and Yu, Haiwang and Go, Yeonju and Pinkenburg, Christopher and Lin, Yuewei and Yoo, Shinjae and Osborn, Joseph and others},
|
| 42 |
+
journal = {arXiv preprint arXiv:2508.14087},
|
| 43 |
+
year = {2025}
|
| 44 |
+
}
|
| 45 |
+
```
|
labeled/test/noise_tags.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7c67208c883553bc091fd046ae3e647cd80cc409f5a7a2792c4918792ead388
|
| 3 |
+
size 41200
|
labeled/test/pid_labels.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bc09332dc4a542b07f04722a3a9322b6e4850b5aa5a8ed4ba1d1300352eb8b95
|
| 3 |
+
size 129697
|
labeled/test/spacepoints.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:71094f7658aeb94da6fd15dbafcc95cdfead04e71e1d76853cc29981d2b9fe8d
|
| 3 |
+
size 81356628
|
labeled/test/track_ids.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19c02c6e0f45ffa379200f553634bdee972bd4ce4c86d8277511f679c678f621
|
| 3 |
+
size 242053
|
labeled/train/noise_tags_000.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a02f794144ed49c599ed349410328de4f65fc2b5e79c1a0927251365d5600b81
|
| 3 |
+
size 58854
|
labeled/train/noise_tags_001.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6832209966aa5d33c066fba35dac1b755b6f217f2de886acbde0ad65ce9783c4
|
| 3 |
+
size 58706
|
labeled/train/noise_tags_002.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:391e8aa5401b384d5d1547a85d8ed1a2c60d7ca12bbfb1c9b810b7d43817ffdb
|
| 3 |
+
size 58912
|
labeled/train/noise_tags_003.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:40516929e2e6f585adc2bacc04344b8d092a28e54230dd130981bca146fe7c8e
|
| 3 |
+
size 58449
|
labeled/train/noise_tags_004.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:afa1582471fcb7cd8701a706b7bfbdbd8ffa4617e021f38293532902b5d367eb
|
| 3 |
+
size 58939
|
labeled/train/noise_tags_005.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d1277fc2351e6da167c0538e1a1539278d896751781d96ff800f948fd4e26d89
|
| 3 |
+
size 58670
|
labeled/train/noise_tags_006.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f6c24f40b2c1bc8666cd2df050c1c0c0f87b91c97f708bf986795c46dc6f1e03
|
| 3 |
+
size 58598
|
labeled/train/pid_labels_000.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3e4aa01001bd16c40ec6855f884b484e73e366be58885cee1d03f8f545e22fbf
|
| 3 |
+
size 187741
|
labeled/train/pid_labels_001.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:899c8336b5862e95fbaee4b2ccd645c955dfe857d76b3a98f5a4c89a02da85d9
|
| 3 |
+
size 185595
|
labeled/train/pid_labels_002.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:efe9e976637b077424104d175b504d0e319fa4d826c4c279a73edf314630d9fe
|
| 3 |
+
size 185703
|
labeled/train/pid_labels_003.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bbb642193a450fce351ea456947c2cb67a0113d74fc8f42e1c6537af74fba5c6
|
| 3 |
+
size 185011
|
labeled/train/pid_labels_004.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:51163f326f60c6e4e111e60b9acb0579e7dcce40f9cd9c123d037da72a3aa32a
|
| 3 |
+
size 185860
|
labeled/train/pid_labels_005.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d357ef53498fe9bf5605f2ab19bfbc86af695ecc1a62486604a22dce752c53e8
|
| 3 |
+
size 185938
|
labeled/train/pid_labels_006.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6e88e19b0fe12d4e07387cfbaffb4d3c13c5f94b8997a011977dc6c41a4f62c9
|
| 3 |
+
size 185728
|
labeled/train/spacepoints_000.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8bf6417bcbb491286dffbc145ace6dbec0a6ed2f26bfbebf9034325a73d7d2bf
|
| 3 |
+
size 117601899
|
labeled/train/spacepoints_001.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e4c3fcaf805f4bc9ebb4705e96a0fa4fa678375e3d8200189b61919d8c7e046f
|
| 3 |
+
size 116437544
|
labeled/train/spacepoints_002.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:314f971354ae275518769fc6c60a358c295723e7ff1b578e6ec461c7205f7a36
|
| 3 |
+
size 116504710
|
labeled/train/spacepoints_003.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b48d9e4b2f23d4365ca5fe44af8a69c9ea0d900ffa3f3d42724dc629d2c96a3
|
| 3 |
+
size 115874758
|
labeled/train/spacepoints_004.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:65a9df77703a5ff1c1593880de635aa22c89f85701e0881387e5aef1142eb05a
|
| 3 |
+
size 116946862
|
labeled/train/spacepoints_005.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:17c1fe7b224e4e5359a6d82fb19237fab281ab5984cdfcaf10ff1305b9e92257
|
| 3 |
+
size 116376887
|
labeled/train/spacepoints_006.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:86445720b5d13b678f2460862e67cf64b77ac431c2c31554c63dd23f1ca1c1ad
|
| 3 |
+
size 116225763
|
labeled/train/track_ids_000.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5db12f3d917135ff7a25768c1c0679348e509bfb5c5c5ec5ceb60bf838771fb3
|
| 3 |
+
size 348633
|
labeled/train/track_ids_001.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ba4ce74df8f3ceaa50dc6f9f3c39f88c5d5859a2a745ad420d579bc9e34fa46
|
| 3 |
+
size 346649
|
labeled/train/track_ids_002.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:be5f722ad41fb34f90c06172afa995a0e75a08e223c73eaead8590a65b0782bd
|
| 3 |
+
size 346601
|
labeled/train/track_ids_003.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:057dea0ce7d198da64b4620255b26b631be0c9fe980e458ad78f99319302a776
|
| 3 |
+
size 344934
|
labeled/train/track_ids_004.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:494d78aae3e65bb9a3ac871d3c43c7d758f54b29efe5f84d1e1613b42a7f752f
|
| 3 |
+
size 346891
|
labeled/train/track_ids_005.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:357bf05895b061255c8295fe7ba32707442aba01fa275c570210ce8faf0daa19
|
| 3 |
+
size 345794
|
labeled/train/track_ids_006.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ac1e5abe7e538e4ba5326d6da834686c83de916f4406badc247d490caeeae454
|
| 3 |
+
size 344714
|
labeled/validation/noise_tags.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2717eaa45de9cf88392958578cce6505424af63cc7699ad45adebbba2c9a10cc
|
| 3 |
+
size 76308
|
labeled/validation/pid_labels.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:697745036e4adc9bdafa8eba989d03401edc48ee0dc0b15e8f316ec158a99713
|
| 3 |
+
size 242172
|
labeled/validation/spacepoints.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:309ca42dc067b19f963518db67fc47ac56db2818aee33ff4bb04c6ded24b0126
|
| 3 |
+
size 151305488
|
labeled/validation/track_ids.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3b16adcd63b98aff575ccb169cc299e7f68e7c471bdfd756e5c3f898b7dc7cab
|
| 3 |
+
size 450401
|
scripts/demo.ipynb
ADDED
|
@@ -0,0 +1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ides an example for dataloading and simple visualization of the **TPCpp-10M dataset**, a large-scale particle physics dataset designed for machine learning applications in high-energy physics research. The definitions of the plotting functions are defined in `plot.py`.\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"## Dataset Overview\n",
|
| 13 |
+
"\n",
|
| 14 |
+
"The TPCpp-10M dataset contains simulated particle collision events from a Time Projection Chamber (TPC) detector, commonly used in particle physics experiments. This dataset is specifically designed for:\n",
|
| 15 |
+
"\n",
|
| 16 |
+
"- **Foundation model training** for particle and nuclear physics applications\n",
|
| 17 |
+
"- **Particle track reconstruction**\n",
|
| 18 |
+
"- **Particle identification** \n",
|
| 19 |
+
"- **Signal vs. noise discrimination**\n",
|
| 20 |
+
"\n",
|
| 21 |
+
"## Dataset Characteristics\n",
|
| 22 |
+
"\n",
|
| 23 |
+
"- **Total Events**: over 10 million simulated proton-proton collision events at 200GeV \n",
|
| 24 |
+
"- **Input Data Format**: Structured spacepoint data with 4D coordinates (energy + $x,y,z$-coordiantes)\n",
|
| 25 |
+
"- **Labels**: including track IDs, particle types, and noise classification\n",
|
| 26 |
+
"- **Split**: 10M unlabeled events, 70k/13k/7k labeled events for training/validation/testing\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"## Data Components\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"1. **Spacepoints**: 4D spacepoints with energy and spatial coordinates\n",
|
| 31 |
+
"2. **Track IDs**: Unique identifiers for particle trajectories \n",
|
| 32 |
+
"3. **Particle ID Labels**: Classification labels for different particle types\n",
|
| 33 |
+
"4. **Noise Tags**: Binary labels distinguishing signal from detector noise\n",
|
| 34 |
+
"\n",
|
| 35 |
+
"## Notebook Contents\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"This demonstration notebook includes:\n",
|
| 38 |
+
"- Data loading.\n",
|
| 39 |
+
"- Distribution of numbers of spacepoints, number of tracks, and class ratios.\n",
|
| 40 |
+
"- Interactive 3D scatter plots color-coded by track, particle type, and signal/noise classification."
|
| 41 |
+
]
|
| 42 |
+
},
|
| 43 |
+
{
|
| 44 |
+
"cell_type": "markdown",
|
| 45 |
+
"id": "45bcca32-9eaa-4bdb-a979-eac5dc5178e3",
|
| 46 |
+
"metadata": {},
|
| 47 |
+
"source": [
|
| 48 |
+
"## Install and run `Plotly`\n",
|
| 49 |
+
"The notebook uses the library `Plotly` for plotting. If it is not installed, please use the following command to install it:\n",
|
| 50 |
+
"- **Conda**:\n",
|
| 51 |
+
" ```\n",
|
| 52 |
+
" conda install -c conda-forge plotly\n",
|
| 53 |
+
" ```\n",
|
| 54 |
+
"- **Pip**:\n",
|
| 55 |
+
" ```\n",
|
| 56 |
+
" pip install plotly\n",
|
| 57 |
+
" ```\n",
|
| 58 |
+
"\n",
|
| 59 |
+
"For running `Plotly` in Jupyter Notebook or Jupyter Lab and saving the plots, please check out this webpage: [https://plotly.com/python/getting-started/](https://plotly.com/python/getting-started/)."
|
| 60 |
+
]
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"cell_type": "code",
|
| 64 |
+
"execution_count": null,
|
| 65 |
+
"id": "2244df27-c924-4369-9c05-4a2eba8c6c04",
|
| 66 |
+
"metadata": {},
|
| 67 |
+
"outputs": [],
|
| 68 |
+
"source": [
|
| 69 |
+
"from pathlib import Path\n",
|
| 70 |
+
"import numpy as np\n",
|
| 71 |
+
"\n",
|
| 72 |
+
"# custom plotting functions\n",
|
| 73 |
+
"from plot import (plot_histogram, \n",
|
| 74 |
+
" plot_pie, \n",
|
| 75 |
+
" plot_scatter)"
|
| 76 |
+
]
|
| 77 |
+
},
|
| 78 |
+
{
|
| 79 |
+
"cell_type": "code",
|
| 80 |
+
"execution_count": null,
|
| 81 |
+
"id": "cff4a872-84c1-4a40-acb8-5970c3c24f91",
|
| 82 |
+
"metadata": {},
|
| 83 |
+
"outputs": [],
|
| 84 |
+
"source": [
|
| 85 |
+
"# if you want to save the plots\n",
|
| 86 |
+
"plot_folder = Path('./plots')\n",
|
| 87 |
+
"plot_folder.mkdir(exist_ok=True)"
|
| 88 |
+
]
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"cell_type": "markdown",
|
| 92 |
+
"id": "a90837ff-4828-4853-8c68-3b23bc31f064",
|
| 93 |
+
"metadata": {},
|
| 94 |
+
"source": [
|
| 95 |
+
"## Load all events saved in one `.npz` file \n",
|
| 96 |
+
"together with labels for downstream tasks"
|
| 97 |
+
]
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"cell_type": "code",
|
| 101 |
+
"execution_count": null,
|
| 102 |
+
"id": "da3b9642-de59-4906-ac8c-5a6cde7864e2",
|
| 103 |
+
"metadata": {},
|
| 104 |
+
"outputs": [],
|
| 105 |
+
"source": [
|
| 106 |
+
"folder = Path('labeled/test/')\n",
|
| 107 |
+
"\n",
|
| 108 |
+
"with np.load(folder/'spacepoints.npz') as handle:\n",
|
| 109 |
+
" spacepoints = handle['data']\n",
|
| 110 |
+
" event_sizes = handle['size']\n",
|
| 111 |
+
"\n",
|
| 112 |
+
"# although track_ids, pid_labels, and noise_tags\n",
|
| 113 |
+
"# all have 'size' containing the sizes of each \n",
|
| 114 |
+
"# individual events, they are the same as that\n",
|
| 115 |
+
"# from the spacepoints, so we don't have to\n",
|
| 116 |
+
"# load them.\n",
|
| 117 |
+
"with np.load(folder/'track_ids.npz') as handle:\n",
|
| 118 |
+
" # track_ids are of type np.uint32\n",
|
| 119 |
+
" track_ids = handle['data']\n",
|
| 120 |
+
"\n",
|
| 121 |
+
"with np.load(folder/'pid_labels.npz') as handle:\n",
|
| 122 |
+
" # pid_labels are of type np.uint8\n",
|
| 123 |
+
" pid_labels = handle['data']\n",
|
| 124 |
+
"\n",
|
| 125 |
+
"with np.load(folder/'noise_tags.npz') as handle:\n",
|
| 126 |
+
" # noise_tags are boolean\n",
|
| 127 |
+
" noise_tags = handle['data']\n",
|
| 128 |
+
"\n",
|
| 129 |
+
"num_events = len(event_sizes)\n",
|
| 130 |
+
"print(f'Loaded {num_events} events.')"
|
| 131 |
+
]
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"cell_type": "markdown",
|
| 135 |
+
"id": "9f0cf560-7999-4b37-9608-ebb584ac496a",
|
| 136 |
+
"metadata": {},
|
| 137 |
+
"source": [
|
| 138 |
+
"## Load one event"
|
| 139 |
+
]
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"cell_type": "code",
|
| 143 |
+
"execution_count": null,
|
| 144 |
+
"id": "dd7dffb7-50ee-433a-9824-0a4574d31259",
|
| 145 |
+
"metadata": {},
|
| 146 |
+
"outputs": [],
|
| 147 |
+
"source": [
|
| 148 |
+
"# we can use event sizes to determine the start\n",
|
| 149 |
+
"# and end indices of each event.\n",
|
| 150 |
+
"indices = np.cumsum(event_sizes)"
|
| 151 |
+
]
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"cell_type": "code",
|
| 155 |
+
"execution_count": null,
|
| 156 |
+
"id": "b6084963-43ae-4120-bb52-16bdec74aff6",
|
| 157 |
+
"metadata": {},
|
| 158 |
+
"outputs": [],
|
| 159 |
+
"source": [
|
| 160 |
+
"# specify an event id\n",
|
| 161 |
+
"event_id = 20\n",
|
| 162 |
+
"\n",
|
| 163 |
+
"# get the start and end indices from the event sizes\n",
|
| 164 |
+
"start_id = 0 if event_id == 0 else indices[event_id - 1]\n",
|
| 165 |
+
"end_id = indices[event_id]\n",
|
| 166 |
+
"\n",
|
| 167 |
+
"# get a single event\n",
|
| 168 |
+
"event_spacepoints = spacepoints[start_id: end_id]\n",
|
| 169 |
+
"event_track_ids = track_ids[start_id: end_id]\n",
|
| 170 |
+
"event_pid_labels = pid_labels[start_id: end_id]\n",
|
| 171 |
+
"event_noise_tags = noise_tags[start_id: end_id]\n",
|
| 172 |
+
"\n",
|
| 173 |
+
"print(f'event {event_id}:')\n",
|
| 174 |
+
"print(f'\\tspacepoints shape = {event_spacepoints.shape}')\n",
|
| 175 |
+
"print(f'\\ttrack_ids[:50] = {event_track_ids[:50]}')\n",
|
| 176 |
+
"print(f'\\tpid_labels[:50] = {pid_labels[:50]}')\n",
|
| 177 |
+
"print(f'\\tnoise_tags[:50] = {noise_tags[:50]}')"
|
| 178 |
+
]
|
| 179 |
+
},
|
| 180 |
+
{
|
| 181 |
+
"cell_type": "markdown",
|
| 182 |
+
"id": "03ba25bd-1d06-40ef-a6b5-288c140d9763",
|
| 183 |
+
"metadata": {},
|
| 184 |
+
"source": [
|
| 185 |
+
"## Statistics"
|
| 186 |
+
]
|
| 187 |
+
},
|
| 188 |
+
{
|
| 189 |
+
"cell_type": "markdown",
|
| 190 |
+
"id": "04c53af3-c80d-4804-8c60-20d4e2eb1ce6",
|
| 191 |
+
"metadata": {},
|
| 192 |
+
"source": [
|
| 193 |
+
"### Distribution of number of spacepoints"
|
| 194 |
+
]
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
"cell_type": "code",
|
| 198 |
+
"execution_count": null,
|
| 199 |
+
"id": "e377d98d-3d70-4103-be0b-8156be12db36",
|
| 200 |
+
"metadata": {},
|
| 201 |
+
"outputs": [],
|
| 202 |
+
"source": [
|
| 203 |
+
"start_id = 0\n",
|
| 204 |
+
"num_sp = [] # \n",
|
| 205 |
+
"for end_id in indices:\n",
|
| 206 |
+
" event_spacepoints = spacepoints[start_id: end_id]\n",
|
| 207 |
+
" num_sp.append(len(event_spacepoints))\n",
|
| 208 |
+
" start_id = end_id\n",
|
| 209 |
+
"\n",
|
| 210 |
+
"fig = plot_histogram(num_sp, xaxis_title='Number of Spacepoints')\n",
|
| 211 |
+
"fig.show()\n",
|
| 212 |
+
"fig.write_image(plot_folder/'distribution_spacepoints.png', scale=2)\n",
|
| 213 |
+
"fig.write_html(plot_folder/'distribution_spacepoints.html')"
|
| 214 |
+
]
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"cell_type": "markdown",
|
| 218 |
+
"id": "e922c119-2325-473c-a120-7a6446fa374e",
|
| 219 |
+
"metadata": {},
|
| 220 |
+
"source": [
|
| 221 |
+
"### Distribution of number of tracks"
|
| 222 |
+
]
|
| 223 |
+
},
|
| 224 |
+
{
|
| 225 |
+
"cell_type": "code",
|
| 226 |
+
"execution_count": null,
|
| 227 |
+
"id": "9eb713e2-8432-43b5-bf6e-6ebd0ea2d362",
|
| 228 |
+
"metadata": {},
|
| 229 |
+
"outputs": [],
|
| 230 |
+
"source": [
|
| 231 |
+
"start_id = 0\n",
|
| 232 |
+
"num_tracks = []\n",
|
| 233 |
+
"for end_id in indices:\n",
|
| 234 |
+
" event_track_ids = track_ids[start_id: end_id]\n",
|
| 235 |
+
" event_num_tracks = len(np.unique(event_track_ids))\n",
|
| 236 |
+
" num_tracks.append(event_num_tracks)\n",
|
| 237 |
+
" start_id = end_id\n",
|
| 238 |
+
"\n",
|
| 239 |
+
"fig = plot_histogram(num_tracks, xaxis_title='Number of Tracks')\n",
|
| 240 |
+
"fig.show()\n",
|
| 241 |
+
"fig.write_image(plot_folder/'distribution_tracks.png', scale=2)\n",
|
| 242 |
+
"fig.write_html(plot_folder/'distribution_tracks.html')"
|
| 243 |
+
]
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"cell_type": "markdown",
|
| 247 |
+
"id": "8d08a18c-40c6-47b7-8fec-0bc7218e6341",
|
| 248 |
+
"metadata": {},
|
| 249 |
+
"source": [
|
| 250 |
+
"### Distribution of noise fraction"
|
| 251 |
+
]
|
| 252 |
+
},
|
| 253 |
+
{
|
| 254 |
+
"cell_type": "code",
|
| 255 |
+
"execution_count": null,
|
| 256 |
+
"id": "9bb092f2-0ed4-4034-880f-f948b9144692",
|
| 257 |
+
"metadata": {},
|
| 258 |
+
"outputs": [],
|
| 259 |
+
"source": [
|
| 260 |
+
"start_id = 0\n",
|
| 261 |
+
"noise_fraction = []\n",
|
| 262 |
+
"for end_id in indices:\n",
|
| 263 |
+
" event_noise_tags = noise_tags[start_id: end_id]\n",
|
| 264 |
+
" \n",
|
| 265 |
+
" total = len(event_noise_tags)\n",
|
| 266 |
+
" noise = event_noise_tags.sum()\n",
|
| 267 |
+
" \n",
|
| 268 |
+
" noise_fraction.append(noise / total)\n",
|
| 269 |
+
" start_id = end_id\n",
|
| 270 |
+
"\n",
|
| 271 |
+
"fig = plot_histogram(noise_fraction, xaxis_title='Fraction of Noise')\n",
|
| 272 |
+
"fig.show()\n",
|
| 273 |
+
"fig.write_image(plot_folder/'distribution_noise.png', scale=2)\n",
|
| 274 |
+
"fig.write_html(plot_folder/'distribution_noise.html')"
|
| 275 |
+
]
|
| 276 |
+
},
|
| 277 |
+
{
|
| 278 |
+
"cell_type": "markdown",
|
| 279 |
+
"id": "24436b6a-018f-4478-8472-40ce36863263",
|
| 280 |
+
"metadata": {},
|
| 281 |
+
"source": [
|
| 282 |
+
"### Distribution of particle ids"
|
| 283 |
+
]
|
| 284 |
+
},
|
| 285 |
+
{
|
| 286 |
+
"cell_type": "code",
|
| 287 |
+
"execution_count": null,
|
| 288 |
+
"id": "6b688bab-eb73-4517-a44e-6292edcf6d8d",
|
| 289 |
+
"metadata": {},
|
| 290 |
+
"outputs": [],
|
| 291 |
+
"source": [
|
| 292 |
+
"_, counts = np.unique(pid_labels, return_counts=True)\n",
|
| 293 |
+
"total = sum(counts)\n",
|
| 294 |
+
"fractions = [count / total for count in counts]\n",
|
| 295 |
+
"names = ['others', 'pion', 'kaon', 'proton', 'electron']\n",
|
| 296 |
+
"\n",
|
| 297 |
+
"fig = plot_pie(names, \n",
|
| 298 |
+
" fractions, \n",
|
| 299 |
+
" title=\"Particle IDs\", \n",
|
| 300 |
+
" width=450, \n",
|
| 301 |
+
" height=450)\n",
|
| 302 |
+
"fig.show()\n",
|
| 303 |
+
"fig.write_image(plot_folder/'distribution_particle_ids.png', scale=2)\n",
|
| 304 |
+
"fig.write_html(plot_folder/'distribution_particle_ids.html')"
|
| 305 |
+
]
|
| 306 |
+
},
|
| 307 |
+
{
|
| 308 |
+
"cell_type": "markdown",
|
| 309 |
+
"id": "5642fa73-3202-4904-8a5a-0421a7a2d52e",
|
| 310 |
+
"metadata": {},
|
| 311 |
+
"source": [
|
| 312 |
+
"## Visualization"
|
| 313 |
+
]
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"cell_type": "markdown",
|
| 317 |
+
"id": "124df5df-36e0-41e9-8816-dda272091cfd",
|
| 318 |
+
"metadata": {},
|
| 319 |
+
"source": [
|
| 320 |
+
"### Load one event"
|
| 321 |
+
]
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
"cell_type": "code",
|
| 325 |
+
"execution_count": null,
|
| 326 |
+
"id": "61c58913-2fdc-467e-82f5-67765a9fb16a",
|
| 327 |
+
"metadata": {},
|
| 328 |
+
"outputs": [],
|
| 329 |
+
"source": [
|
| 330 |
+
"# specify an event id\n",
|
| 331 |
+
"event_id = 20\n",
|
| 332 |
+
"\n",
|
| 333 |
+
"# get the start and end indices from the event sizes\n",
|
| 334 |
+
"start_id = 0 if event_id == 0 else indices[event_id - 1]\n",
|
| 335 |
+
"end_id = indices[event_id]\n",
|
| 336 |
+
"\n",
|
| 337 |
+
"# get a single event\n",
|
| 338 |
+
"event_spacepoints = spacepoints[start_id: end_id]\n",
|
| 339 |
+
"event_track_ids = track_ids[start_id: end_id]\n",
|
| 340 |
+
"event_pid_labels = pid_labels[start_id: end_id]\n",
|
| 341 |
+
"event_noise_tags = noise_tags[start_id: end_id]"
|
| 342 |
+
]
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"cell_type": "code",
|
| 346 |
+
"execution_count": null,
|
| 347 |
+
"id": "436a9cfb-86c3-444d-b512-f900c5f21451",
|
| 348 |
+
"metadata": {},
|
| 349 |
+
"outputs": [],
|
| 350 |
+
"source": [
|
| 351 |
+
"# spacepoints contains 4 columns: energy, x, y, z.\n",
|
| 352 |
+
"# x, y, z are the coordinates (cm) in the Euclidean space.\n",
|
| 353 |
+
"energy, x, y, z = event_spacepoints.T"
|
| 354 |
+
]
|
| 355 |
+
},
|
| 356 |
+
{
|
| 357 |
+
"cell_type": "markdown",
|
| 358 |
+
"id": "dec8a4d8-ad87-4a68-b429-b0c1c9caffa1",
|
| 359 |
+
"metadata": {},
|
| 360 |
+
"source": [
|
| 361 |
+
"### Spacepoints"
|
| 362 |
+
]
|
| 363 |
+
},
|
| 364 |
+
{
|
| 365 |
+
"cell_type": "code",
|
| 366 |
+
"execution_count": null,
|
| 367 |
+
"id": "aef788d5-07b3-42aa-9301-08ec4d998726",
|
| 368 |
+
"metadata": {},
|
| 369 |
+
"outputs": [],
|
| 370 |
+
"source": [
|
| 371 |
+
"fig = plot_scatter(x, y, z)\n",
|
| 372 |
+
"fig.show()\n",
|
| 373 |
+
"fig.write_image(plot_folder/'scatter_spacepoints.png', scale=2)\n",
|
| 374 |
+
"fig.write_html(plot_folder/'scatter_spacepoints.html')"
|
| 375 |
+
]
|
| 376 |
+
},
|
| 377 |
+
{
|
| 378 |
+
"cell_type": "markdown",
|
| 379 |
+
"id": "03c33b61-91b1-4e0d-9530-a66e60600e8f",
|
| 380 |
+
"metadata": {},
|
| 381 |
+
"source": [
|
| 382 |
+
"### Tracks"
|
| 383 |
+
]
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"cell_type": "code",
|
| 387 |
+
"execution_count": null,
|
| 388 |
+
"id": "4256ffdf-3dd6-41df-96cd-a50b9d0abaf8",
|
| 389 |
+
"metadata": {},
|
| 390 |
+
"outputs": [],
|
| 391 |
+
"source": [
|
| 392 |
+
"fig = plot_scatter(x, y, z, labels=event_track_ids)\n",
|
| 393 |
+
"fig.show()\n",
|
| 394 |
+
"fig.write_image(plot_folder/'scatter_tracks.png', scale=2)\n",
|
| 395 |
+
"fig.write_html(plot_folder/'scatter_tracks.html')"
|
| 396 |
+
]
|
| 397 |
+
},
|
| 398 |
+
{
|
| 399 |
+
"cell_type": "markdown",
|
| 400 |
+
"id": "ef38d5a9-87d0-4430-9bf5-d3f3377fc209",
|
| 401 |
+
"metadata": {},
|
| 402 |
+
"source": [
|
| 403 |
+
"### Signal vs. Noise"
|
| 404 |
+
]
|
| 405 |
+
},
|
| 406 |
+
{
|
| 407 |
+
"cell_type": "code",
|
| 408 |
+
"execution_count": null,
|
| 409 |
+
"id": "901c521e-9cbe-47c7-beab-f566d8b74322",
|
| 410 |
+
"metadata": {},
|
| 411 |
+
"outputs": [],
|
| 412 |
+
"source": [
|
| 413 |
+
"# Let us give all possible labels since an event may \n",
|
| 414 |
+
"# not contain noise/signal spacepoints.\n",
|
| 415 |
+
"fig = plot_scatter(x, y, z, \n",
|
| 416 |
+
" labels = event_noise_tags, \n",
|
| 417 |
+
" color_cycle = ['skyblue', 'orange'],\n",
|
| 418 |
+
" unique_labels = [0, 1],\n",
|
| 419 |
+
" names = ['signal', 'noise'])\n",
|
| 420 |
+
"fig.show()\n",
|
| 421 |
+
"fig.write_image(plot_folder/'scatter_signal-vs-noise.png', scale=2)\n",
|
| 422 |
+
"fig.write_html(plot_folder/'scatter_signal-vs-noise.html')"
|
| 423 |
+
]
|
| 424 |
+
},
|
| 425 |
+
{
|
| 426 |
+
"cell_type": "markdown",
|
| 427 |
+
"id": "058e79cc-c122-4110-ad74-cc5d8c8d079e",
|
| 428 |
+
"metadata": {},
|
| 429 |
+
"source": [
|
| 430 |
+
"### Particle IDs"
|
| 431 |
+
]
|
| 432 |
+
},
|
| 433 |
+
{
|
| 434 |
+
"cell_type": "code",
|
| 435 |
+
"execution_count": null,
|
| 436 |
+
"id": "e186396a-12da-494f-82e4-2d4f377fcc3a",
|
| 437 |
+
"metadata": {},
|
| 438 |
+
"outputs": [],
|
| 439 |
+
"source": [
|
| 440 |
+
"# Let us give all possible labels since an event may \n",
|
| 441 |
+
"# not contain all types of particles\n",
|
| 442 |
+
"fig = plot_scatter(x, y, z, \n",
|
| 443 |
+
" labels = event_pid_labels, \n",
|
| 444 |
+
" unique_labels = [1, 2, 3, 4, 0],\n",
|
| 445 |
+
" names = ['charged pion', # instead of π±\n",
|
| 446 |
+
" 'charged kaon', # instead of K±\n",
|
| 447 |
+
" 'proton/antiproton',\n",
|
| 448 |
+
" 'electron/positron',\n",
|
| 449 |
+
" 'others'])\n",
|
| 450 |
+
"fig.show()\n",
|
| 451 |
+
"fig.write_image(plot_folder/'scatter_particle-ids.png', scale=2)\n",
|
| 452 |
+
"fig.write_html(plot_folder/'scatter_particle-ids.html')"
|
| 453 |
+
]
|
| 454 |
+
}
|
| 455 |
+
],
|
| 456 |
+
"metadata": {
|
| 457 |
+
"kernelspec": {
|
| 458 |
+
"display_name": "pyg",
|
| 459 |
+
"language": "python",
|
| 460 |
+
"name": "pyg"
|
| 461 |
+
},
|
| 462 |
+
"language_info": {
|
| 463 |
+
"codemirror_mode": {
|
| 464 |
+
"name": "ipython",
|
| 465 |
+
"version": 3
|
| 466 |
+
},
|
| 467 |
+
"file_extension": ".py",
|
| 468 |
+
"mimetype": "text/x-python",
|
| 469 |
+
"name": "python",
|
| 470 |
+
"nbconvert_exporter": "python",
|
| 471 |
+
"pygments_lexer": "ipython3",
|
| 472 |
+
"version": "3.12.6"
|
| 473 |
+
}
|
| 474 |
+
},
|
| 475 |
+
"nbformat": 4,
|
| 476 |
+
"nbformat_minor": 5
|
| 477 |
+
}
|
scripts/plot.py
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import plotly.express as px
|
| 3 |
+
import plotly.graph_objects as go
|
| 4 |
+
|
| 5 |
+
def plot_histogram(data,
|
| 6 |
+
nbins=100,
|
| 7 |
+
mean_color='coral',
|
| 8 |
+
bar_color='skyblue',
|
| 9 |
+
xaxis_title=None,
|
| 10 |
+
log_y=False):
|
| 11 |
+
|
| 12 |
+
# add bar plot
|
| 13 |
+
fig = px.histogram(data,
|
| 14 |
+
nbins=100,
|
| 15 |
+
title=None,
|
| 16 |
+
color_discrete_sequence=[bar_color])
|
| 17 |
+
|
| 18 |
+
# whether to use a log scale for the y-axis
|
| 19 |
+
if log_y:
|
| 20 |
+
fig.update_yaxes(type="log", title="Count")
|
| 21 |
+
fig.update_layout(bargap=0.2) # gaps between bar
|
| 22 |
+
fig.update_traces(showlegend=False) # remove legend for bars
|
| 23 |
+
|
| 24 |
+
# add a line for mean
|
| 25 |
+
mean = np.mean(data)
|
| 26 |
+
fig.add_vline(x=mean,
|
| 27 |
+
line_width=3,
|
| 28 |
+
line_dash="dot",
|
| 29 |
+
line_color=mean_color)
|
| 30 |
+
# add a dummy trace so we can have a legend for the mean value
|
| 31 |
+
fig.add_trace(go.Scatter(x=[mean],
|
| 32 |
+
y=[0],
|
| 33 |
+
mode="lines",
|
| 34 |
+
line=dict(color=mean_color, width=3, dash="dot"),
|
| 35 |
+
name=f"Mean={mean:.2f}",
|
| 36 |
+
showlegend=True))
|
| 37 |
+
|
| 38 |
+
if xaxis_title is None:
|
| 39 |
+
xaxis_title = 'Number'
|
| 40 |
+
fig.update_layout(
|
| 41 |
+
width=450,
|
| 42 |
+
height=350,
|
| 43 |
+
xaxis_title=xaxis_title,
|
| 44 |
+
yaxis_title="Count",
|
| 45 |
+
legend=dict(
|
| 46 |
+
x=0.95, # horizontal position (0 = left, 1 = right)
|
| 47 |
+
y=0.95, # vertical position (0 = bottom, 1 = top)
|
| 48 |
+
xanchor="right",
|
| 49 |
+
yanchor="top",
|
| 50 |
+
bgcolor="rgba(255,255,255,0.3)", # optional: semi-transparent background
|
| 51 |
+
title=None,
|
| 52 |
+
),
|
| 53 |
+
margin=dict(
|
| 54 |
+
l=50, # left margin
|
| 55 |
+
r=50, # right margin
|
| 56 |
+
t=50, # top margin
|
| 57 |
+
b=50 # bottom margin
|
| 58 |
+
)
|
| 59 |
+
)
|
| 60 |
+
return fig
|
| 61 |
+
|
| 62 |
+
def plot_pie(names,
|
| 63 |
+
fractions,
|
| 64 |
+
title = None,
|
| 65 |
+
width = 450,
|
| 66 |
+
height = 450):
|
| 67 |
+
|
| 68 |
+
fig = px.pie(
|
| 69 |
+
names = names,
|
| 70 |
+
values = fractions,
|
| 71 |
+
title = title,
|
| 72 |
+
category_orders={"names": names},
|
| 73 |
+
color_discrete_sequence=px.colors.qualitative.Pastel
|
| 74 |
+
)
|
| 75 |
+
|
| 76 |
+
fig.update_layout(
|
| 77 |
+
width = width,
|
| 78 |
+
height = height,
|
| 79 |
+
margin = dict(l=20, r=10, t=50, b=10))
|
| 80 |
+
|
| 81 |
+
return fig
|
| 82 |
+
|
| 83 |
+
def plot_scatter(x, y, z,
|
| 84 |
+
labels = None,
|
| 85 |
+
color_cycle = None, *,
|
| 86 |
+
marker_size = 2,
|
| 87 |
+
opacity = 1,
|
| 88 |
+
width = 600,
|
| 89 |
+
height = 480,
|
| 90 |
+
shuffle = False,
|
| 91 |
+
names = None,
|
| 92 |
+
axis_title_font_size = 16,
|
| 93 |
+
axis_tick_font_size = 12,
|
| 94 |
+
legend_config = None,
|
| 95 |
+
showticklabels = True,
|
| 96 |
+
unique_labels = None,
|
| 97 |
+
distance = 1):
|
| 98 |
+
|
| 99 |
+
# set up parameters
|
| 100 |
+
if labels is None:
|
| 101 |
+
labels = [1] * len(x)
|
| 102 |
+
|
| 103 |
+
if color_cycle is None:
|
| 104 |
+
color_cycle = color_discrete_sequence=px.colors.qualitative.Set3
|
| 105 |
+
|
| 106 |
+
if unique_labels is None:
|
| 107 |
+
unique_labels = np.unique(labels)
|
| 108 |
+
|
| 109 |
+
if shuffle:
|
| 110 |
+
np.random.shuffle(unique_labels)
|
| 111 |
+
|
| 112 |
+
if names is not None:
|
| 113 |
+
assert len(unique_labels) <= len(names)
|
| 114 |
+
else:
|
| 115 |
+
names = [None] * len(unique_labels)
|
| 116 |
+
|
| 117 |
+
# == create one trace for a unique label value ============
|
| 118 |
+
traces = []
|
| 119 |
+
for i, (label, name) in enumerate(zip(unique_labels, names)):
|
| 120 |
+
color = color_cycle[i % len(color_cycle)]
|
| 121 |
+
trace = go.Scatter3d(
|
| 122 |
+
x=x[labels == label],
|
| 123 |
+
y=y[labels == label],
|
| 124 |
+
z=z[labels == label],
|
| 125 |
+
mode = 'markers',
|
| 126 |
+
marker = dict(size = marker_size,
|
| 127 |
+
color = color,
|
| 128 |
+
opacity = opacity),
|
| 129 |
+
name = name,
|
| 130 |
+
showlegend = False
|
| 131 |
+
)
|
| 132 |
+
traces.append(trace)
|
| 133 |
+
|
| 134 |
+
# Dummy trace for larger legend marker
|
| 135 |
+
if name is not None:
|
| 136 |
+
trace = go.Scatter3d(
|
| 137 |
+
x=[None],
|
| 138 |
+
y=[None],
|
| 139 |
+
z=[None], # Invisible point
|
| 140 |
+
mode = 'markers',
|
| 141 |
+
name = name,
|
| 142 |
+
marker = dict(size = 12,
|
| 143 |
+
color = color), # Larger size for legend
|
| 144 |
+
showlegend = True
|
| 145 |
+
)
|
| 146 |
+
traces.append(trace)
|
| 147 |
+
|
| 148 |
+
# == figure layout ========================================
|
| 149 |
+
def config_axis(title):
|
| 150 |
+
return dict(title = dict(text = title,
|
| 151 |
+
font = dict(size=axis_title_font_size)),
|
| 152 |
+
tickfont = dict(size = axis_tick_font_size),
|
| 153 |
+
showticklabels = showticklabels)#,
|
| 154 |
+
# backgroundcolor='lightgray')
|
| 155 |
+
|
| 156 |
+
layout = go.Layout(
|
| 157 |
+
width=width,
|
| 158 |
+
height=height,
|
| 159 |
+
scene=dict(
|
| 160 |
+
xaxis = config_axis('x (cm)' if showticklabels else ''),
|
| 161 |
+
yaxis = config_axis('y (cm)' if showticklabels else ''),
|
| 162 |
+
zaxis = config_axis('z (cm)' if showticklabels else ''),
|
| 163 |
+
camera = dict(
|
| 164 |
+
# zoom (default is (1.25, 1.25, 1.25))
|
| 165 |
+
eye=dict(x=1.8 * distance, y=1.2 * distance, z=1.6 * distance),
|
| 166 |
+
# y axis is pointing up, so the z axis can lie down
|
| 167 |
+
up=dict(x=0, y=1, z=0)
|
| 168 |
+
)
|
| 169 |
+
),
|
| 170 |
+
# paper_bgcolor='rgba(0,0,0,0)',
|
| 171 |
+
# plot_bgcolor='rgba(0,0,0,0)',
|
| 172 |
+
margin = dict(l=0, r=0, t=0, b=20),
|
| 173 |
+
legend=dict(
|
| 174 |
+
x=0.80, # horizontal position (0 = left, 1 = right)
|
| 175 |
+
y=0.80, # vertical position (0 = bottom, 1 = top)
|
| 176 |
+
xanchor="left",
|
| 177 |
+
yanchor="top",
|
| 178 |
+
bgcolor="rgba(200,200,200,0.3)", # optional: semi-transparent background
|
| 179 |
+
title=None,
|
| 180 |
+
),
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
figure = go.Figure(data=traces, layout=layout)
|
| 184 |
+
|
| 185 |
+
if legend_config is not None:
|
| 186 |
+
figure.update_layout(legend=legend_config)
|
| 187 |
+
|
| 188 |
+
return figure
|
unlabeled/spacepoints_000.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ad72994db44e0143def058e1cd1ef1b01b4b5877e012ebb0866757a5ab63b9ca
|
| 3 |
+
size 1176875238
|
unlabeled/spacepoints_001.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f0287db34cd294e90f90e30a57455f6512a3368a879ccb53d6f7d90fc9fa60c0
|
| 3 |
+
size 1178328291
|
unlabeled/spacepoints_002.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b75f0b4b2eeb14fb058b8a2ba820f44b9cc4cb21a68c2d0078f9fddc1cf5bfcb
|
| 3 |
+
size 1171916499
|
unlabeled/spacepoints_003.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f61f516fd87908f628c0971d11c9d854f0decfb78901acd97fe5cb51281a62a
|
| 3 |
+
size 1175086277
|
unlabeled/spacepoints_004.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:48cbfbf7b8fd57e02605b24fb0e19ea547f6a7487f6d140060f16c4d67587f47
|
| 3 |
+
size 1170835321
|
unlabeled/spacepoints_005.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a6e91181720492fa169a1294ace278e035132109859ed48e0f0573287d2aa1ba
|
| 3 |
+
size 1175301499
|
unlabeled/spacepoints_006.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c6b2dde7d5fcd651e76442a24c7107d9613a76d675403af63665fe8704ee04c7
|
| 3 |
+
size 1177957025
|
unlabeled/spacepoints_007.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a8d640579f038a0638cca3ef7df4330f979db66636edfe85830f2b4acf489851
|
| 3 |
+
size 1177875383
|
unlabeled/spacepoints_008.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:40096a52c34bc69173f9220bd336c125dbf7425f674c29f800e1ff4cd19c30ce
|
| 3 |
+
size 1175363705
|
unlabeled/spacepoints_009.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3289fe24a9f030608256f6f74641dec54f45b8c95ef44017b0fd2c13ea3a73d1
|
| 3 |
+
size 1170801682
|
unlabeled/spacepoints_010.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:51b6f06bf876924e4a8657c62643db725810ba010bdc0eb6d52dc3d9a18aa99d
|
| 3 |
+
size 1173860720
|