GraphNeT and Gamma Rays:

Integrating the MAGIC Telescopes

GraphNeT Workshop

Jarred Green

18 August 2025

Max Planck Institute for Physics

jgreen@mpp.mpg.de

Outline

  1. Current Reconstruction Method
  2. MAGIC Graphs
  3. The Data and GraphNeT
  4. Results
  5. GraphNet Perspectives

Jarred Green - jgreen@mpp.mpg.de

1. Current Reconstruction

Jarred Green - jgreen@mpp.mpg.de

1. Current Reconstruction

Jarred Green - jgreen@mpp.mpg.de

1. Current Reconstruction

1. Raw data

  • charge measured in each pixel
  • 50 time slices recorded in each pixel [waveforms]

Jarred Green - jgreen@mpp.mpg.de

2. Image cleaning

  • isolate main part of image
  • average pixel arrival time

1. Current Reconstruction

Jarred Green - jgreen@mpp.mpg.de

3. Image parameterization

{
	'size': 546.8863769783503,
	'xc': -3.7898364035228065,
	'yc': 7.294274369102854,
	'length': 7.767692666363586,
	'width': 1.7648053936769377,
	'delta': -0.5687518727314761,
	 ...
}

1. Current Reconstruction

"Hillas Parameters" (1977!)

Jarred Green - jgreen@mpp.mpg.de

{
	'size': 546.8863769783503,
	'xc': -3.7898364035228065,
	'yc': 7.294274369102854,
	'length': 7.767692666363586,
	'width': 1.7648053936769377,
	'delta': -0.5687518727314761,
	 ...
}

"Hillas Parameters"

Random Forest

1. Current Reconstruction

4. Algorithms: the ML part

Jarred Green - jgreen@mpp.mpg.de

{
	'size': 546.8863769783503,
	'xc': -3.7898364035228065,
	'yc': 7.294274369102854,
	'length': 7.767692666363586,
	'width': 1.7648053936769377,
	'delta': -0.5687518727314761,
	 ...
}

tl;dr

  • Particle Type
  • Energy
  • Arrival Direction

ML

1. Current Reconstruction

1039 \ \text{pixels} \\ \times 50 \ \text{time slices} \\ \times 2 \ \text{telescopes} \\ = 103900 \ \text{data points}

Jarred Green - jgreen@mpp.mpg.de

A way to include as much information as possible?

1. Current Reconstruction

Jarred Green - jgreen@mpp.mpg.de

Proton

Gamma

Muon

Find a new ways to represent raw data

1. Current Reconstruction

for MAGIC?

Jarred Green - jgreen@mpp.mpg.de

2. Graphs

Jarred Green - jgreen@mpp.mpg.de

time

Sample MC gamma event

2. Graphs

  •  200k+ nodes / graph
  • ❌ Training ~weeks
  • ✅ Keeps full context of 'night sky background'

Jarred Green - jgreen@mpp.mpg.de

time

Can we make these graphs smaller somehow?

cleaning!

  • ✅ Small graphs with 200-2K nodes
  • ✅ Training ~hours
  • ❌ Maybe loosing some background information

2. Graphs

Jarred Green - jgreen@mpp.mpg.de

3. Data and GraphNeT

 

  1. 2D detector instead of 3D
  2. Every pixel always triggers [full graphs]
  3. 2 separate detectors with no absolute shared clock
  4. Noise/background pixels contain useful information
  5. Instrument is pointed - we only care about arrival directions around an ROI

Vovk et al. 2018 [1806.03167]

Cherenkov astronomy vs neutrinos

Jarred Green - jgreen@mpp.mpg.de

Data processing pipeline

.parquet or .lmdb files exported

about ~1GB / min of data

3. Data and GraphNeT

Python package magic-gnn
all the low-level telescope stuff

Data processing pipeline

RAW MAGIC data

GraphNeT

Training with
cleaned graphs

Training with
full graphs

2️⃣

1️⃣

Jarred Green - jgreen@mpp.mpg.de

Available Data:

  • 2M MC gamma events
  • 100k MC proton events
  • way too much data to load into memory
  • SQLite is quite slow for data fetching big graphs (~1s)
  • Rough when you have 1M training samples

3. Data and GraphNeT

Jarred Green - jgreen@mpp.mpg.de

Enter: LMDB

3. Data and GraphNeT

  • Lightning Memory-Mapped Database
  • Key-value store (not relational)
  • Can serialize any data to the value
  • Allows for concurrent reads
  • Reads around ~10x faster on MAGIC graphs

Main con for me at the moment:

  • DB index ↔️ Event ID mapping

Jarred Green - jgreen@mpp.mpg.de

Enter: LMDB

3. Data and GraphNeT

lmdb_dataset.py

 

needs to be:

  • cleaned up
  • match the GraphNeT API
  • documented
  • tests
  • etc

Fun hackathon idea?

Jarred Green - jgreen@mpp.mpg.de

4. Results

✅ Particle ID classification

Direction reconstruction

Energy regression

Particle Classification with

DynEdge

  • Similar performance to standard analysis on MC
  • Only 75k training example per particle type
  • Trained on full graphs and cleaned (both work!)
  • Only added a cross-attention layer so the two telescopes can talk

Jarred Green - jgreen@mpp.mpg.de

4. Results

✅ Particle ID classification

Direction reconstruction

Energy regression

Direction reconstruction with

DeepIce

  • Similar performance to standard analysis on MC
  • 2M gamma training samples
  • Used a Euclidean loss 
  • Angular resolution robust enough to do science ✨
  • Only slight tweaks to the default configuration

Jarred Green - jgreen@mpp.mpg.de

5. GraphNet Perspectives

  • MAGIC Detector Class
  • LMDB Dataset Class
  • Files that aggregate detectors/datasets
  • New losses, tasks, models

What code did I add to get this to work?

So nothing crazy needed to be done at all!

Jarred Green - jgreen@mpp.mpg.de

5. GraphNet Perspectives

  • Documentation
  • New detectors
  • Training and inference
  • Installation
  • Availability of powerful models for testing
  • Custom labels
  • Overall mental model

Where did I run into the most/least trouble?

  • How to format non-neutrino data
  • Graph-level features
  • Fixed graph geometry
  • Still a bit tough to implement new Dataset formats

Jarred Green - jgreen@mpp.mpg.de

🤠 Is GraphNeT the first multimessenger GNN framework?

5. GraphNet Perspectives

Thank you!

Jarred Green - jgreen@mpp.mpg.de

GraphNeT MAGIC Workshop V

By astrojarred

GraphNeT MAGIC Workshop V

  • 35