| --- |
| license: apache-2.0 |
| pretty_name: BEvAn — COSI activation simulations (β⁺ / 511 keV) |
| tags: |
| - astrophysics |
| - gamma-ray |
| - compton-telescope |
| - megalib |
| - cosi |
| - simulation |
| size_categories: |
| - 1K<n<10K |
| --- |
| |
| # BEvAn — COSI activation simulations |
|
|
| MEGAlib simulation files backing [`cosi-betadecay/BEvAn`](https://github.com/cosi-betadecay/BEvAn), |
| a physics-based likelihood classifier that tags each simulated COSI event as a |
| β⁺ / positron-annihilation signal (back-to-back 511 keV photons) or background |
| from its Compton kinematics. |
|
|
| All events come from a **cosima activation simulation** (`BeamType Activation`, |
| `DecayMode ActivationBuildup`): cosmic-ray protons irradiate the instrument, the |
| activated isotopes decay, and the β⁺ emitters among them produce the 511 keV |
| annihilation signal the classifier is trained to find. The three-step cosima |
| source files that generate this are in the GitHub repo under |
| [`data/cosima/`](https://github.com/cosi-betadecay/BEvAn/tree/main/data/cosima) |
| and are **not** duplicated here. Produced with MEGAlib 4.00.00. |
|
|
| ## Datasets |
|
|
| One folder per detector geometry. The geometries ship with MEGAlib under |
| `$MEGALIB/resource/examples/geomega/`: |
|
|
| | Folder | Geometry (`.geo.setup`) | Size | |
| |---|---|---| |
| | `SPILike/` | `special/SPILike` | 382 MB | |
| | `NCT/` | `special/Simple_Ge_NCT_try1_040721` | 848 MB | |
| | `Max/` | `special/Max` | 1.2 GB | |
| | `GeACT/` | `special/GeACT` | 3.8 GB | |
| | `COSIBalloon_9det/` | `cosiballoon/COSIBalloon.9Detector` | 1.0 GB | |
| | `COSIBalloon_10det/` | `cosiballoon/COSIBalloon.10Detector` | 980 MB | |
| | `COSIBalloon_12det/` | `cosiballoon/COSIBalloon.12Detector` | 1.1 GB | |
|
|
| ## Files in each folder |
|
|
| For a dataset `{name}`: |
|
|
| | File | What it is | |
| |---|---| |
| | `{name}.sim` | **Concatenation file written by `mcosima` — it holds no events.** It is a short header plus `IN {name}.incN.id1.sim.gz` lines pointing at the chunks below. This is the path you pass to the pipeline; MEGAlib follows the pointers. | |
| | `{name}.incN.id1.sim.gz` | The actual simulated events, one chunk per parallel `mcosima` thread (N = 1…4). Required — `{name}.sim` is useless without them. | |
| | `{name}.tra` | Compton-reconstructed events (`revan` output) for `{name}.sim`. | |
| | `{name}_P1.*`, `{name}_P2.*` | Two **dedicated prior simulations** against the same geometry, each a full `.sim` (+ `.tra`) set of its own. Their ANNI-labeled events, counted per hit-multiplicity bucket, form the classifier's class priors. The training split is never used for the prior, which is why these are separate runs. Passed via `--prior-sim`. `_P1` files are self-contained `.sim` files from an earlier run; `_P2` files use the same `mcosima` concatenation layout as above. | |
|
|
| The `COSIBalloon_*` folders additionally carry a `crossections/` directory — |
| MEGAlib-generated cross-section tables. They are regenerated on demand by |
| MEGAlib and are included only so the folders are a byte-exact mirror. |
|
|
| ## Results |
|
|
| `results/` holds the **outputs** of the ablation study over the datasets above — |
| a mirror of `ablations/results/` in the GitHub repo (which remains the source of |
| truth; these are generated files, published here so the figures and numbers are |
| citable alongside the inputs they came from). 25 MB total. |
|
|
| One folder per run, named by timestamp: |
|
|
| | Run | Contents | |
| |---|---| |
| | `2026-07-14_09-33-32/` | includes a `no_calibration` ablation, since removed | |
| | `2026-07-15_00-45-23/` | | |
| | `2026-07-15_05-06-29/` | most recent; adds `deployment` and `label_window` | |
|
|
| Each run folder has: |
|
|
| - `tables/` — one CSV per ablation (`factor_contributions`, `learned_weights`, |
| `no_ckd_order`, `gt_tolerance` / `label_window`, …) plus a `summary.csv`. |
| `deployment.csv` is the champion deployed per dataset at the dedicated-prior |
| operating point. |
| - `figures/` — one PNG per ablation at the top level, plus a per-dataset |
| subfolder (`SPILike/`, `NCT/`, `Max/`, `GeACT/`, `COSIBalloon_*/`) of the |
| per-run plots for that geometry. |
|
|
| Regenerate with `python ablations/main.py` from the GitHub repo. |
|
|
| ## Download |
|
|
| ```bash |
| hf download aryaraeesi/BEvAn-data --repo-type dataset --local-dir data/ |
| ``` |
|
|
| Note this pulls `results/` into `data/` too. For just the simulation inputs, or |
| a single dataset (remember to take its `.inc*` chunks along with the `.sim`): |
|
|
| ```bash |
| hf download aryaraeesi/BEvAn-data --repo-type dataset \ |
| --include "SPILike/*" --local-dir data/ |
| ``` |
|
|
| Or just the results, without the multi-GB simulations: |
|
|
| ```bash |
| hf download aryaraeesi/BEvAn-data --repo-type dataset \ |
| --include "results/*" --local-dir . |
| ``` |
|
|
| ## Gotcha: the geometry path is absolute |
|
|
| The `Geometry` line inside every `.sim` header is an **absolute path from the |
| machine that ran the simulation** (`/home/arya/Documents/megalib/...`). MEGAlib |
| will not find the geometry on your machine unless you either point that line at |
| your own `$MEGALIB` checkout or pass the geometry explicitly — which is what the |
| BEvAn entry scripts do via `--geo-file`: |
|
|
| ```bash |
| python src/BEvAn/analysis.py \ |
| --geo-file $MEGALIB/resource/examples/geomega/special/SPILike.geo.setup \ |
| --sim-file data/SPILike/SPILike.sim \ |
| --tra-file data/SPILike/SPILike.tra \ |
| --prior-sim data/SPILike/SPILike_P1.sim data/SPILike/SPILike_P2.sim |
| ``` |
|
|
| ## License |
|
|
| Apache-2.0, matching the BEvAn repository. |
|
|