colliderml 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. {colliderml-0.3.0 → colliderml-0.4.0}/MANIFEST.in +2 -1
  2. colliderml-0.4.0/PKG-INFO +165 -0
  3. colliderml-0.4.0/README.md +108 -0
  4. colliderml-0.4.0/colliderml/__init__.py +106 -0
  5. colliderml-0.4.0/colliderml/_load.py +223 -0
  6. colliderml-0.4.0/colliderml/cli.py +369 -0
  7. colliderml-0.4.0/colliderml/core/hf_download.py +353 -0
  8. colliderml-0.4.0/colliderml/polars/__init__.py +17 -0
  9. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/polars/flatten.py +40 -0
  10. colliderml-0.4.0/colliderml/remote/__init__.py +46 -0
  11. colliderml-0.4.0/colliderml/remote/_auth.py +78 -0
  12. colliderml-0.4.0/colliderml/remote/_client.py +336 -0
  13. colliderml-0.4.0/colliderml/simulate/__init__.py +48 -0
  14. colliderml-0.4.0/colliderml/simulate/api.py +285 -0
  15. colliderml-0.4.0/colliderml/simulate/docker.py +511 -0
  16. colliderml-0.4.0/colliderml/simulate/pipeline.py +265 -0
  17. colliderml-0.4.0/colliderml/simulate/presets.py +134 -0
  18. colliderml-0.4.0/colliderml/simulate/presets.yaml +60 -0
  19. colliderml-0.4.0/colliderml/tasks/__init__.py +234 -0
  20. colliderml-0.4.0/colliderml/tasks/_base.py +120 -0
  21. colliderml-0.4.0/colliderml/tasks/_loading.py +165 -0
  22. colliderml-0.4.0/colliderml/tasks/anomaly/__init__.py +5 -0
  23. colliderml-0.4.0/colliderml/tasks/anomaly/baselines/__init__.py +1 -0
  24. colliderml-0.4.0/colliderml/tasks/anomaly/baselines/isoforest.py +132 -0
  25. colliderml-0.4.0/colliderml/tasks/anomaly/task.py +96 -0
  26. colliderml-0.4.0/colliderml/tasks/jets/__init__.py +5 -0
  27. colliderml-0.4.0/colliderml/tasks/jets/baselines/__init__.py +1 -0
  28. colliderml-0.4.0/colliderml/tasks/jets/baselines/bdt.py +138 -0
  29. colliderml-0.4.0/colliderml/tasks/jets/metrics.py +81 -0
  30. colliderml-0.4.0/colliderml/tasks/jets/task.py +82 -0
  31. colliderml-0.4.0/colliderml/tasks/systems/__init__.py +15 -0
  32. colliderml-0.4.0/colliderml/tasks/systems/dataloading.py +57 -0
  33. colliderml-0.4.0/colliderml/tasks/systems/latency.py +55 -0
  34. colliderml-0.4.0/colliderml/tasks/systems/smallmodel.py +83 -0
  35. colliderml-0.4.0/colliderml/tasks/tracking/__init__.py +5 -0
  36. colliderml-0.4.0/colliderml/tasks/tracking/baselines/__init__.py +15 -0
  37. colliderml-0.4.0/colliderml/tasks/tracking/baselines/ckf.py +111 -0
  38. colliderml-0.4.0/colliderml/tasks/tracking/baselines/oracle.py +184 -0
  39. colliderml-0.4.0/colliderml/tasks/tracking/metrics.py +186 -0
  40. colliderml-0.4.0/colliderml/tasks/tracking/task.py +146 -0
  41. colliderml-0.4.0/colliderml.egg-info/PKG-INFO +165 -0
  42. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml.egg-info/SOURCES.txt +65 -1
  43. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml.egg-info/requires.txt +13 -0
  44. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/components/DataConfig.vue +17 -21
  45. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/config.ts +42 -6
  46. colliderml-0.4.0/docs/changelog.md +76 -0
  47. {colliderml-0.3.0 → colliderml-0.4.0}/docs/guide/installation.md +36 -6
  48. {colliderml-0.3.0 → colliderml-0.4.0}/docs/guide/quickstart.md +53 -2
  49. colliderml-0.4.0/docs/guide/remote-simulation.md +206 -0
  50. colliderml-0.4.0/docs/guide/simulation.md +178 -0
  51. colliderml-0.4.0/docs/guide/tasks.md +150 -0
  52. colliderml-0.4.0/docs/guide/tutorial.md +542 -0
  53. colliderml-0.4.0/docs/index.md +77 -0
  54. colliderml-0.4.0/docs/internal/admin.md +85 -0
  55. colliderml-0.4.0/docs/internal/backend.md +182 -0
  56. colliderml-0.4.0/docs/internal/container-image.md +109 -0
  57. colliderml-0.4.0/docs/internal/deployment.md +103 -0
  58. colliderml-0.4.0/docs/internal/overview.md +29 -0
  59. colliderml-0.4.0/docs/internal/sfapi.md +121 -0
  60. colliderml-0.4.0/docs/library/cli.md +125 -0
  61. colliderml-0.4.0/docs/library/overview.md +63 -0
  62. colliderml-0.4.0/docs/library/remote.md +190 -0
  63. colliderml-0.4.0/docs/library/simulate.md +226 -0
  64. colliderml-0.4.0/docs/library/tasks.md +250 -0
  65. colliderml-0.4.0/docs/spaces/event-display.md +68 -0
  66. colliderml-0.4.0/docs/spaces/leaderboard.md +83 -0
  67. colliderml-0.4.0/docs/spaces/model-zoo.md +68 -0
  68. colliderml-0.4.0/docs/spaces/overview.md +103 -0
  69. colliderml-0.4.0/docs/spaces/simulation-form.md +93 -0
  70. {colliderml-0.3.0 → colliderml-0.4.0}/setup.py +28 -2
  71. colliderml-0.4.0/tests/test_cli_simulate.py +198 -0
  72. colliderml-0.4.0/tests/test_download_event_range.py +358 -0
  73. colliderml-0.4.0/tests/test_load_unified.py +126 -0
  74. colliderml-0.4.0/tests/test_remote_client.py +351 -0
  75. colliderml-0.4.0/tests/test_simulate_api.py +181 -0
  76. colliderml-0.4.0/tests/test_simulate_docker.py +78 -0
  77. colliderml-0.4.0/tests/test_simulate_presets.py +96 -0
  78. colliderml-0.4.0/tests/test_tasks_jets_metrics.py +59 -0
  79. colliderml-0.4.0/tests/test_tasks_loading.py +122 -0
  80. colliderml-0.4.0/tests/test_tasks_registry.py +128 -0
  81. colliderml-0.4.0/tests/test_tasks_tracking_baselines.py +99 -0
  82. colliderml-0.4.0/tests/test_tasks_tracking_env_override.py +132 -0
  83. colliderml-0.4.0/tests/test_tasks_tracking_explode.py +157 -0
  84. colliderml-0.4.0/tests/test_tasks_tracking_metrics.py +184 -0
  85. colliderml-0.3.0/PKG-INFO +0 -147
  86. colliderml-0.3.0/README.md +0 -101
  87. colliderml-0.3.0/colliderml/__init__.py +0 -10
  88. colliderml-0.3.0/colliderml/cli.py +0 -171
  89. colliderml-0.3.0/colliderml/core/hf_download.py +0 -223
  90. colliderml-0.3.0/colliderml/polars/__init__.py +0 -7
  91. colliderml-0.3.0/colliderml.egg-info/PKG-INFO +0 -147
  92. colliderml-0.3.0/docs/changelog.md +0 -35
  93. colliderml-0.3.0/docs/index.md +0 -52
  94. colliderml-0.3.0/docs/library/cli.md +0 -39
  95. colliderml-0.3.0/docs/library/overview.md +0 -47
  96. {colliderml-0.3.0 → colliderml-0.4.0}/LICENSE +0 -0
  97. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/core/__init__.py +0 -0
  98. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/core/data/__init__.py +0 -0
  99. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/core/data/config.py +0 -0
  100. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/core/data/loader_config.py +0 -0
  101. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/core/data/manifest.py +0 -0
  102. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/core/loader.py +0 -0
  103. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/core/tables.py +0 -0
  104. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/physics/__init__.py +0 -0
  105. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/physics/calibration.py +0 -0
  106. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/physics/constants.py +0 -0
  107. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/physics/decay.py +0 -0
  108. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/physics/detector_enums.py +0 -0
  109. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/physics/pileup.py +0 -0
  110. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/utils/__init__.py +0 -0
  111. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/viz/__init__.py +0 -0
  112. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml/viz/plotting_utils.py +0 -0
  113. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml.egg-info/dependency_links.txt +0 -0
  114. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml.egg-info/entry_points.txt +0 -0
  115. {colliderml-0.3.0 → colliderml-0.4.0}/colliderml.egg-info/top_level.txt +0 -0
  116. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/_metadata.json +0 -0
  117. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/chunk-VJWGEPT5.js +0 -0
  118. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/chunk-VJWGEPT5.js.map +0 -0
  119. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/package.json +0 -0
  120. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +0 -0
  121. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +0 -0
  122. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +0 -0
  123. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +0 -0
  124. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/vue.js +0 -0
  125. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/cache/deps/vue.js.map +0 -0
  126. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/components/AboutData.vue +0 -0
  127. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/shims-vue.d.ts +0 -0
  128. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/theme/custom.css +0 -0
  129. {colliderml-0.3.0 → colliderml-0.4.0}/docs/.vitepress/theme/index.ts +0 -0
  130. {colliderml-0.3.0 → colliderml-0.4.0}/docs/acat.md +0 -0
  131. {colliderml-0.3.0 → colliderml-0.4.0}/docs/ais25.md +0 -0
  132. {colliderml-0.3.0 → colliderml-0.4.0}/docs/appendices.md +0 -0
  133. {colliderml-0.3.0 → colliderml-0.4.0}/docs/ctd25.md +0 -0
  134. {colliderml-0.3.0 → colliderml-0.4.0}/docs/guide/introduction.md +0 -0
  135. {colliderml-0.3.0 → colliderml-0.4.0}/docs/library/benchmarks.md +0 -0
  136. {colliderml-0.3.0 → colliderml-0.4.0}/docs/library/exploding.md +0 -0
  137. {colliderml-0.3.0 → colliderml-0.4.0}/docs/library/loading.md +0 -0
  138. {colliderml-0.3.0 → colliderml-0.4.0}/docs/library/physics.md +0 -0
  139. {colliderml-0.3.0 → colliderml-0.4.0}/docs/package-lock.json +0 -0
  140. {colliderml-0.3.0 → colliderml-0.4.0}/docs/package.json +0 -0
  141. {colliderml-0.3.0 → colliderml-0.4.0}/docs/public/.nojekyll +0 -0
  142. {colliderml-0.3.0 → colliderml-0.4.0}/docs/public/logo.png +0 -0
  143. {colliderml-0.3.0 → colliderml-0.4.0}/docs/public/size-estimates.json +0 -0
  144. {colliderml-0.3.0 → colliderml-0.4.0}/docs/tsconfig.json +0 -0
  145. {colliderml-0.3.0 → colliderml-0.4.0}/setup.cfg +0 -0
  146. {colliderml-0.3.0 → colliderml-0.4.0}/tests/__init__.py +0 -0
  147. {colliderml-0.3.0 → colliderml-0.4.0}/tests/test_calo_calibration.py +0 -0
  148. {colliderml-0.3.0 → colliderml-0.4.0}/tests/test_cli_download.py +0 -0
  149. {colliderml-0.3.0 → colliderml-0.4.0}/tests/test_decay_traversal.py +0 -0
  150. {colliderml-0.3.0 → colliderml-0.4.0}/tests/test_download_benchmark.py +0 -0
  151. {colliderml-0.3.0 → colliderml-0.4.0}/tests/test_huggingface_loader.py +0 -0
  152. {colliderml-0.3.0 → colliderml-0.4.0}/tests/test_pileup_subsample.py +0 -0
  153. {colliderml-0.3.0 → colliderml-0.4.0}/tests/test_polars_flatten.py +0 -0
  154. {colliderml-0.3.0 → colliderml-0.4.0}/tests/test_polars_loader.py +0 -0
@@ -3,6 +3,7 @@ include README.md
3
3
  include setup.cfg
4
4
  recursive-include tests *
5
5
  recursive-include docs *
6
+ recursive-include colliderml/simulate *.yaml
6
7
  global-exclude *.py[cod]
7
8
  global-exclude __pycache__
8
- global-exclude *.so
9
+ global-exclude *.so
@@ -0,0 +1,165 @@
1
+ Metadata-Version: 2.4
2
+ Name: colliderml
3
+ Version: 0.4.0
4
+ Summary: A modern machine learning library for high-energy physics data analysis
5
+ Home-page: https://github.com/OpenDataDetector/ColliderML
6
+ Author: Daniel Murnane
7
+ Author-email: dtmurnane@lbl.gov
8
+ Project-URL: Documentation, https://opendatadetector.github.io/ColliderML
9
+ Project-URL: Source, https://github.com/OpenDataDetector/ColliderML
10
+ Project-URL: Issues, https://github.com/OpenDataDetector/ColliderML/issues
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering :: Physics
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: datasets>=2.14.0
23
+ Requires-Dist: huggingface_hub>=0.20.0
24
+ Requires-Dist: numpy>=1.24.0
25
+ Requires-Dist: pandas>=1.5.0
26
+ Requires-Dist: h5py>=3.10.0
27
+ Requires-Dist: polars>=0.20.0
28
+ Requires-Dist: pyyaml>=6.0.0
29
+ Requires-Dist: pyarrow>=14.0.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
32
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
33
+ Requires-Dist: black>=23.11.0; extra == "dev"
34
+ Requires-Dist: ruff>=0.1.6; extra == "dev"
35
+ Requires-Dist: mypy>=1.7.0; extra == "dev"
36
+ Requires-Dist: matplotlib>=3.5.0; extra == "dev"
37
+ Provides-Extra: sim
38
+ Requires-Dist: pyyaml>=6.0.0; extra == "sim"
39
+ Provides-Extra: remote
40
+ Requires-Dist: requests>=2.28.0; extra == "remote"
41
+ Provides-Extra: tasks
42
+ Requires-Dist: scikit-learn>=1.3.0; extra == "tasks"
43
+ Provides-Extra: all
44
+ Requires-Dist: colliderml[dev,remote,sim,tasks]; extra == "all"
45
+ Dynamic: author
46
+ Dynamic: author-email
47
+ Dynamic: classifier
48
+ Dynamic: description
49
+ Dynamic: description-content-type
50
+ Dynamic: home-page
51
+ Dynamic: license-file
52
+ Dynamic: project-url
53
+ Dynamic: provides-extra
54
+ Dynamic: requires-dist
55
+ Dynamic: requires-python
56
+ Dynamic: summary
57
+
58
+ # ColliderML
59
+
60
+ [![Tests](https://github.com/OpenDataDetector/ColliderML/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/OpenDataDetector/ColliderML/actions/workflows/tests.yml)
61
+ ![Coverage](./coverage.svg)
62
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
63
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
64
+
65
+ A modern machine learning library for high-energy physics data analysis.
66
+
67
+ ## Installation
68
+
69
+ ```bash
70
+ pip install colliderml # core + Polars loader + unified load()
71
+ pip install 'colliderml[sim]' # local simulation (needs Docker/Podman)
72
+ pip install 'colliderml[remote]' # SaaS backend client
73
+ pip install 'colliderml[tasks]' # benchmark task reference baselines
74
+ pip install 'colliderml[all]' # everything above + dev tools
75
+ ```
76
+
77
+ For development: `pip install -e ".[dev]"`
78
+
79
+ ## Getting the data
80
+
81
+ **Option 1 — Python one-liner (downloads on first call, then caches):**
82
+
83
+ ```python
84
+ import colliderml
85
+
86
+ frames = colliderml.load("ttbar_pu0", max_events=200)
87
+ print(frames["particles"]) # Polars DataFrame
88
+ ```
89
+
90
+ **Option 2 — CLI (explicit download, then load with the library):**
91
+
92
+ ```bash
93
+ colliderml download --channels ttbar --pileup pu0 --objects particles,tracker_hits,calo_hits,tracks --max-events 200
94
+ ```
95
+
96
+ Cache location: default `~/.cache/colliderml`, or set `COLLIDERML_DATA_DIR`. List downloaded configs: `colliderml list-configs`.
97
+
98
+ **Option 3 — HuggingFace only:**
99
+
100
+ ```python
101
+ from datasets import load_dataset
102
+ dataset = load_dataset("CERN/ColliderML-Release-1", "ttbar_pu0_particles", split="train")
103
+ ```
104
+
105
+ ## Running simulations
106
+
107
+ New in v0.4.0: generate events yourself with the full ODD pipeline, either locally in a container or via the SaaS backend.
108
+
109
+ ```python
110
+ import colliderml
111
+
112
+ # Local: runs inside the OpenDataDetector software container.
113
+ # Needs Docker or Podman; the `[sim]` extra provides the driver.
114
+ result = colliderml.simulate(preset="ttbar-quick")
115
+ print(result.run_dir) # parquet outputs land here
116
+
117
+ # Remote: submit to the SaaS backend (requires an HF token).
118
+ # The `[remote]` extra pulls in requests; no container runtime needed.
119
+ result = colliderml.simulate(preset="higgs-portal-quick", remote=True)
120
+ print(result.remote_request_id)
121
+ ```
122
+
123
+ CLI equivalents:
124
+
125
+ ```bash
126
+ colliderml list-presets
127
+ colliderml simulate --preset ttbar-quick --local
128
+ colliderml simulate --preset higgs-portal-quick --remote
129
+ colliderml status <request-id>
130
+ colliderml balance
131
+ ```
132
+
133
+ See the [Local Simulation](https://opendatadetector.github.io/ColliderML/guide/simulation) and [Remote Simulation](https://opendatadetector.github.io/ColliderML/guide/remote-simulation) guides for details.
134
+
135
+ ## Benchmark tasks
136
+
137
+ New in v0.4.0: six built-in benchmark tasks — `tracking`, `jets`, `anomaly`, `tracking_latency`, `tracking_small`, and `data_loading` — with a unified registry and a leaderboard backed by the SaaS backend.
138
+
139
+ ```python
140
+ import colliderml.tasks
141
+
142
+ print(colliderml.tasks.list_tasks())
143
+ scores = colliderml.tasks.evaluate("tracking", "my_preds.parquet")
144
+ colliderml.tasks.submit("tracking", "my_preds.parquet") # earn credits on new bests
145
+ ```
146
+
147
+ Reference baselines (scikit-learn for BDT/IsoForest) ship with the `[tasks]` extra. See the [Benchmark Tasks guide](https://opendatadetector.github.io/ColliderML/guide/tasks) for details.
148
+
149
+ ## Using the library
150
+
151
+ The notebook [notebooks/colliderml_loader_exploration.ipynb](notebooks/colliderml_loader_exploration.ipynb) shows the data-loading and analysis helpers: `load_tables`, exploding event tables, pileup subsampling, calibration, and plotting.
152
+
153
+ Full docs: <https://opendatadetector.github.io/ColliderML>
154
+
155
+ ## Development
156
+
157
+ ```bash
158
+ pytest -v -m "not integration"
159
+ ```
160
+
161
+ Docs are built with VitePress: `npm ci --prefix docs && npm run --prefix docs docs:build`.
162
+
163
+ ## License
164
+
165
+ [MIT License](LICENSE)
@@ -0,0 +1,108 @@
1
+ # ColliderML
2
+
3
+ [![Tests](https://github.com/OpenDataDetector/ColliderML/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/OpenDataDetector/ColliderML/actions/workflows/tests.yml)
4
+ ![Coverage](./coverage.svg)
5
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ A modern machine learning library for high-energy physics data analysis.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install colliderml # core + Polars loader + unified load()
14
+ pip install 'colliderml[sim]' # local simulation (needs Docker/Podman)
15
+ pip install 'colliderml[remote]' # SaaS backend client
16
+ pip install 'colliderml[tasks]' # benchmark task reference baselines
17
+ pip install 'colliderml[all]' # everything above + dev tools
18
+ ```
19
+
20
+ For development: `pip install -e ".[dev]"`
21
+
22
+ ## Getting the data
23
+
24
+ **Option 1 — Python one-liner (downloads on first call, then caches):**
25
+
26
+ ```python
27
+ import colliderml
28
+
29
+ frames = colliderml.load("ttbar_pu0", max_events=200)
30
+ print(frames["particles"]) # Polars DataFrame
31
+ ```
32
+
33
+ **Option 2 — CLI (explicit download, then load with the library):**
34
+
35
+ ```bash
36
+ colliderml download --channels ttbar --pileup pu0 --objects particles,tracker_hits,calo_hits,tracks --max-events 200
37
+ ```
38
+
39
+ Cache location: default `~/.cache/colliderml`, or set `COLLIDERML_DATA_DIR`. List downloaded configs: `colliderml list-configs`.
40
+
41
+ **Option 3 — HuggingFace only:**
42
+
43
+ ```python
44
+ from datasets import load_dataset
45
+ dataset = load_dataset("CERN/ColliderML-Release-1", "ttbar_pu0_particles", split="train")
46
+ ```
47
+
48
+ ## Running simulations
49
+
50
+ New in v0.4.0: generate events yourself with the full ODD pipeline, either locally in a container or via the SaaS backend.
51
+
52
+ ```python
53
+ import colliderml
54
+
55
+ # Local: runs inside the OpenDataDetector software container.
56
+ # Needs Docker or Podman; the `[sim]` extra provides the driver.
57
+ result = colliderml.simulate(preset="ttbar-quick")
58
+ print(result.run_dir) # parquet outputs land here
59
+
60
+ # Remote: submit to the SaaS backend (requires an HF token).
61
+ # The `[remote]` extra pulls in requests; no container runtime needed.
62
+ result = colliderml.simulate(preset="higgs-portal-quick", remote=True)
63
+ print(result.remote_request_id)
64
+ ```
65
+
66
+ CLI equivalents:
67
+
68
+ ```bash
69
+ colliderml list-presets
70
+ colliderml simulate --preset ttbar-quick --local
71
+ colliderml simulate --preset higgs-portal-quick --remote
72
+ colliderml status <request-id>
73
+ colliderml balance
74
+ ```
75
+
76
+ See the [Local Simulation](https://opendatadetector.github.io/ColliderML/guide/simulation) and [Remote Simulation](https://opendatadetector.github.io/ColliderML/guide/remote-simulation) guides for details.
77
+
78
+ ## Benchmark tasks
79
+
80
+ New in v0.4.0: six built-in benchmark tasks — `tracking`, `jets`, `anomaly`, `tracking_latency`, `tracking_small`, and `data_loading` — with a unified registry and a leaderboard backed by the SaaS backend.
81
+
82
+ ```python
83
+ import colliderml.tasks
84
+
85
+ print(colliderml.tasks.list_tasks())
86
+ scores = colliderml.tasks.evaluate("tracking", "my_preds.parquet")
87
+ colliderml.tasks.submit("tracking", "my_preds.parquet") # earn credits on new bests
88
+ ```
89
+
90
+ Reference baselines (scikit-learn for BDT/IsoForest) ship with the `[tasks]` extra. See the [Benchmark Tasks guide](https://opendatadetector.github.io/ColliderML/guide/tasks) for details.
91
+
92
+ ## Using the library
93
+
94
+ The notebook [notebooks/colliderml_loader_exploration.ipynb](notebooks/colliderml_loader_exploration.ipynb) shows the data-loading and analysis helpers: `load_tables`, exploding event tables, pileup subsampling, calibration, and plotting.
95
+
96
+ Full docs: <https://opendatadetector.github.io/ColliderML>
97
+
98
+ ## Development
99
+
100
+ ```bash
101
+ pytest -v -m "not integration"
102
+ ```
103
+
104
+ Docs are built with VitePress: `npm ci --prefix docs && npm run --prefix docs docs:build`.
105
+
106
+ ## License
107
+
108
+ [MIT License](LICENSE)
@@ -0,0 +1,106 @@
1
+ """ColliderML: a modern machine-learning library for HEP data.
2
+
3
+ This is the top-level package. It re-exports the four existing
4
+ subpackages (``core``, ``physics``, ``polars``, ``utils`` — all v0.3.1
5
+ API is preserved) plus the v0.4.0 additions:
6
+
7
+ * :func:`load` — one-liner for downloading and loading a dataset
8
+ * :mod:`colliderml.simulate` — run the pipeline locally (via Docker)
9
+ or remotely (via the SaaS backend)
10
+ * :mod:`colliderml.remote` — direct client for the SaaS backend
11
+ * :mod:`colliderml.tasks` — benchmark task registry + reference
12
+ baselines
13
+
14
+ Heavyweight features are gated behind optional extras so the base
15
+ install stays lean:
16
+
17
+ .. code-block:: bash
18
+
19
+ pip install colliderml # core + load + viz
20
+ pip install 'colliderml[sim]' # + local Docker/Podman pipeline
21
+ pip install 'colliderml[remote]' # + SaaS client (requests)
22
+ pip install 'colliderml[tasks]' # + reference baselines (scikit-learn)
23
+ pip install 'colliderml[all]' # everything above + dev tools
24
+
25
+ The ``simulate``, ``remote``, and ``tasks`` subpackages are imported
26
+ lazily on first access so that ``import colliderml`` stays cheap even
27
+ when the extras are not installed.
28
+ """
29
+
30
+ from __future__ import annotations
31
+
32
+ from typing import TYPE_CHECKING, Any
33
+
34
+ from importlib.metadata import PackageNotFoundError, version as _version
35
+
36
+ try:
37
+ __version__ = _version("colliderml")
38
+ except PackageNotFoundError: # pragma: no cover — running from a source tree without metadata
39
+ __version__ = "0.0.0+unknown"
40
+
41
+ # Subpackages that were in v0.3.1 and are always available.
42
+ from . import core
43
+ from . import physics
44
+ from . import polars
45
+ from . import utils
46
+
47
+ # Top-level convenience function — canonical one-liner for dataset access.
48
+ from colliderml._load import DEFAULT_OBJECT_TABLES, load
49
+
50
+ #: Names the top-level package exposes. ``simulate``, ``balance``,
51
+ #: ``tasks`` and ``remote`` are resolved lazily via ``__getattr__`` below
52
+ #: so that ``import colliderml`` stays cheap for users of the base install.
53
+ __all__ = [
54
+ "__version__",
55
+ "core",
56
+ "physics",
57
+ "polars",
58
+ "utils",
59
+ "load",
60
+ "DEFAULT_OBJECT_TABLES",
61
+ "simulate",
62
+ "balance",
63
+ "tasks",
64
+ "remote",
65
+ ]
66
+
67
+
68
+ if TYPE_CHECKING: # pragma: no cover - hints for IDEs and type checkers
69
+ from colliderml import remote as remote # noqa: F401
70
+ from colliderml import simulate as simulate_module # noqa: F401
71
+ from colliderml import tasks as tasks # noqa: F401
72
+ from colliderml.remote import balance as balance # noqa: F401
73
+ from colliderml.simulate import simulate as simulate # noqa: F401
74
+
75
+
76
+ def __getattr__(name: str) -> Any:
77
+ """Lazy-import the optional v0.4.0 subpackages and their convenience callables.
78
+
79
+ Importing ``colliderml.simulate`` pulls in ``pyyaml`` and the
80
+ Docker orchestration code; ``colliderml.remote`` wants
81
+ ``requests``; ``colliderml.tasks`` pulls in the whole registry
82
+ and numpy/scipy metrics. Users who only need ``colliderml.load``
83
+ shouldn't pay for any of that at import time, so we defer each
84
+ one until it's first accessed.
85
+
86
+ Raises:
87
+ AttributeError: For attributes that aren't part of the public
88
+ surface listed in ``__all__``.
89
+ """
90
+ if name == "simulate":
91
+ from colliderml.simulate.api import simulate as _simulate
92
+
93
+ return _simulate
94
+ if name == "balance":
95
+ from colliderml.remote import balance as _balance
96
+
97
+ return _balance
98
+ if name == "tasks":
99
+ import colliderml.tasks as _tasks
100
+
101
+ return _tasks
102
+ if name == "remote":
103
+ import colliderml.remote as _remote
104
+
105
+ return _remote
106
+ raise AttributeError(f"module 'colliderml' has no attribute {name!r}")
@@ -0,0 +1,223 @@
1
+ """Top-level ``colliderml.load()`` convenience wrapper.
2
+
3
+ This is the single function most users should reach for. It bundles
4
+ the download → load → filter steps into a one-liner while still
5
+ honouring the Polars-native contract of the rest of the library.
6
+
7
+ The canonical, lower-level entry points are still available for
8
+ callers that need them:
9
+
10
+ * :func:`colliderml.core.hf_download.download_config` —
11
+ explicit download with a :class:`DownloadSpec`.
12
+ * :func:`colliderml.core.loader.load_tables` —
13
+ loader driven by a :class:`LoaderConfig`.
14
+ * :func:`colliderml.core.tables.select_events` — low-level event
15
+ filter.
16
+
17
+ :func:`load` is just those three composed behind a simple string API,
18
+ auto-downloading missing parquets before handing back Polars frames.
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ from typing import Dict, List, Optional, Tuple, Union
24
+
25
+ import polars as pl
26
+
27
+ from colliderml.core.data.loader_config import LoaderConfig
28
+ from colliderml.core.hf_download import (
29
+ DEFAULT_DATASET_ID,
30
+ DownloadSpec,
31
+ download_config,
32
+ )
33
+ from colliderml.core.loader import load_tables as _core_load_tables
34
+ from colliderml.core.tables import select_events
35
+
36
+ #: The set of object tables every release ships for a given channel
37
+ #: and pileup. Used as the default when the caller doesn't say which
38
+ #: tables they want.
39
+ DEFAULT_OBJECT_TABLES: List[str] = [
40
+ "particles",
41
+ "tracker_hits",
42
+ "calo_hits",
43
+ "tracks",
44
+ ]
45
+
46
+
47
+ _PolarsFrame = Union[pl.DataFrame, pl.LazyFrame]
48
+
49
+
50
+ def _parse_dataset_name(dataset: str) -> Tuple[str, str]:
51
+ """Split ``<channel>_<pileup>`` into ``(channel, pileup)``.
52
+
53
+ Mirrors :func:`colliderml.tasks._loading.parse_dataset_name` — a thin
54
+ convenience so ``colliderml.load`` can offer the same shorthand as
55
+ the benchmark task runner without a cross-package import.
56
+ """
57
+ import re
58
+
59
+ match = re.match(r"^(?P<channel>.+?)_(?P<pileup>pu\d+)$", dataset)
60
+ if not match:
61
+ raise ValueError(
62
+ f"Cannot parse dataset name '{dataset}'. Expected "
63
+ f"'<channel>_pu<N>', e.g. 'ttbar_pu0' or 'higgs_portal_pu200'."
64
+ )
65
+ return match.group("channel"), match.group("pileup")
66
+
67
+
68
+ def _ensure_local(
69
+ channel: str,
70
+ pileup: str,
71
+ tables: List[str],
72
+ *,
73
+ dataset_id: str,
74
+ revision: Optional[str] = None,
75
+ max_events: Optional[int] = None,
76
+ event_range: Optional[Tuple[int, int]] = None,
77
+ ) -> None:
78
+ """Download any missing shards for each per-object config.
79
+
80
+ ``max_events`` and ``event_range`` are forwarded to
81
+ :class:`DownloadSpec` so the download layer fetches only the shards
82
+ actually needed — not the entire config (which is up to ~700 GB for
83
+ the high-pileup tracker tables). We always call
84
+ :func:`download_config`; per-shard dedup against the local cache
85
+ happens inside it via :func:`hf_hub_download`.
86
+ """
87
+ for obj in tables:
88
+ cfg_name = f"{channel}_{pileup}_{obj}"
89
+ download_config(
90
+ DownloadSpec(
91
+ dataset_id=dataset_id,
92
+ config=cfg_name,
93
+ revision=revision,
94
+ max_events=max_events,
95
+ event_range=event_range,
96
+ )
97
+ )
98
+
99
+
100
+ def _apply_event_range(
101
+ frames: Dict[str, _PolarsFrame], event_range: Tuple[int, int]
102
+ ) -> Dict[str, _PolarsFrame]:
103
+ start, end = event_range
104
+ if end < start:
105
+ raise ValueError(f"event_range end ({end}) must be >= start ({start}).")
106
+ event_ids = list(range(int(start), int(end)))
107
+ return select_events(frames, event_ids)
108
+
109
+
110
+ def _apply_max_events(
111
+ frames: Dict[str, _PolarsFrame], max_events: int
112
+ ) -> Dict[str, _PolarsFrame]:
113
+ n = int(max_events)
114
+ out: Dict[str, _PolarsFrame] = {}
115
+ for key, frame in frames.items():
116
+ out[key] = frame.head(n) if isinstance(frame, pl.DataFrame) else frame.limit(n)
117
+ return out
118
+
119
+
120
+ def load(
121
+ dataset: str,
122
+ *,
123
+ tables: Optional[List[str]] = None,
124
+ max_events: Optional[int] = None,
125
+ event_range: Optional[Tuple[int, int]] = None,
126
+ dataset_id: Optional[str] = None,
127
+ revision: Optional[str] = None,
128
+ lazy: bool = False,
129
+ auto_download: bool = True,
130
+ ) -> Dict[str, _PolarsFrame]:
131
+ """Download (if needed) and load a ColliderML dataset.
132
+
133
+ ``load`` is a thin convenience over
134
+ :func:`colliderml.core.loader.load_tables` with the following
135
+ differences:
136
+
137
+ * The ``dataset`` argument uses the same ``<channel>_<pileup>``
138
+ shorthand as the rest of the library and the benchmark tasks
139
+ (``"ttbar_pu0"``, ``"higgs_portal_pu200"``). ``load`` parses it
140
+ into the ``channels`` and ``pileup`` fields of a
141
+ :class:`LoaderConfig` internally.
142
+ * Missing objects are auto-downloaded on demand when
143
+ ``auto_download=True`` (the default) so notebooks can call
144
+ ``colliderml.load("ttbar_pu0")`` on a fresh machine and have the
145
+ right thing happen.
146
+ * ``event_range=(start, end)`` selects a half-open range of event
147
+ IDs after loading — useful for grabbing a held-out eval split
148
+ without manually composing :func:`colliderml.core.select_events`.
149
+
150
+ Args:
151
+ dataset: Dataset key of the form ``"<channel>_<pileup>"``.
152
+ tables: Object tables to load. Defaults to
153
+ :data:`DEFAULT_OBJECT_TABLES`.
154
+ max_events: Cap the result at the first ``max_events`` events
155
+ per table. Applied after ``event_range``.
156
+ event_range: Half-open range ``(start, end)`` of event IDs to
157
+ keep.
158
+ dataset_id: Override the HuggingFace dataset repo. Defaults to
159
+ :data:`colliderml.core.hf_download.DEFAULT_DATASET_ID`
160
+ (currently ``"CERN/ColliderML-Release-1"``).
161
+ revision: Optional HF revision/tag/commit for reproducibility.
162
+ lazy: If ``True``, return :class:`polars.LazyFrame` instead of
163
+ :class:`polars.DataFrame`.
164
+ auto_download: If ``False``, don't attempt to pull missing
165
+ parquets — raise :class:`FileNotFoundError` instead.
166
+
167
+ Returns:
168
+ Dict keyed by object name (e.g. ``"tracker_hits"``) whose
169
+ values are Polars frames.
170
+
171
+ Raises:
172
+ ValueError: If ``dataset`` does not match ``<channel>_pu<N>``.
173
+ FileNotFoundError: If ``auto_download=False`` and a required
174
+ config isn't cached yet.
175
+
176
+ Example::
177
+
178
+ import colliderml
179
+
180
+ # Default tables, auto-download on first call.
181
+ frames = colliderml.load("ttbar_pu0", max_events=100)
182
+ print(frames["particles"])
183
+
184
+ # Held-out eval slice for a benchmark task.
185
+ frames = colliderml.load(
186
+ "ttbar_pu200",
187
+ tables=["tracker_hits"],
188
+ event_range=(90_000, 100_000),
189
+ )
190
+ """
191
+ channel, pileup = _parse_dataset_name(dataset)
192
+ repo = dataset_id or DEFAULT_DATASET_ID
193
+ object_tables = list(tables) if tables is not None else list(DEFAULT_OBJECT_TABLES)
194
+
195
+ if auto_download:
196
+ _ensure_local(
197
+ channel,
198
+ pileup,
199
+ object_tables,
200
+ dataset_id=repo,
201
+ revision=revision,
202
+ max_events=max_events,
203
+ event_range=event_range,
204
+ )
205
+
206
+ config = LoaderConfig(
207
+ dataset_id=repo,
208
+ channels=channel,
209
+ pileup=pileup,
210
+ objects=object_tables,
211
+ split="train",
212
+ lazy=lazy,
213
+ )
214
+ frames: Dict[str, _PolarsFrame] = _core_load_tables(config)
215
+
216
+ if event_range is not None:
217
+ frames = _apply_event_range(frames, event_range)
218
+ if max_events is not None:
219
+ frames = _apply_max_events(frames, max_events)
220
+ return frames
221
+
222
+
223
+ __all__ = ["load", "DEFAULT_OBJECT_TABLES"]