Skip to content

Feature: EventWeighter#2927

Open
kosack wants to merge 16 commits into
mainfrom
feature/event_weighter
Open

Feature: EventWeighter#2927
kosack wants to merge 16 commits into
mainfrom
feature/event_weighter

Conversation

@kosack
Copy link
Copy Markdown
Member

@kosack kosack commented Jan 27, 2026

This is part of the DL2 code refactoring (see #2919). It introduces a new Component hierachy ctapipe.irf.EventWeighter that has different implementations of spectral event weighting:

  • SimpleEventWeigher: spectral weigting for the full FOV
  • RadialEventWeighter: spectral weighing in radial bins in the FOV

They operate on a pre-processed table of DL2 information, where you specify the energy and FOV coordinate columns to use. The interface is as follows, :

from astropy.table import QTable

from ctapipe.irf import (
    RadialEventWeighter,
    spectrum_from_name,
    spectrum_from_simulation_config,
)

table = QTable(
    dict(
        true_energy=[1.0, 2.0, 0.5, 0.2] * u.TeV,
        true_fov_offset=[0.1, 1.2, 2.2, 3.2] * u.deg,
    )
)
weighter = RadialEventWeighter(
    source_spectrum=spectrum_from_name("IRFDOC_ELECTRON_SPECTRUM"),
    target_spectrum_name="CRAB_HEGRA",
    fov_offset_max=5.0*u.deg,
    fov_offset_n_bins=5,
  )

print(weighter.fov_offset_bins)
table_with_weights = weighter(table)
image image

Comment thread src/ctapipe/irf/event_weighter.py Outdated
Comment thread src/ctapipe/irf/event_weighter.py Outdated
@kosack kosack force-pushed the feature/event_weighter branch from b069799 to 8b67c78 Compare January 28, 2026 16:26
Comment thread docs/changes/2927.feature.rst
@kosack kosack force-pushed the feature/event_weighter branch from 2b2a5ac to e0e6931 Compare January 30, 2026 09:53
@ctao-sonarqube
Copy link
Copy Markdown

Comment thread src/ctapipe/irf/event_weighter.py
Comment thread src/ctapipe/irf/event_weighter.py
Comment thread src/ctapipe/irf/spectra.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants