calculate_event_weights
- pyirf.spectral.calculate_event_weights(true_energy, target_spectrum, simulated_spectrum)[source]
Calculate event weights
Events with a certain
simulated_spectrum
are reweighted totarget_spectrum
.\[w_i = \frac{\Phi_\text{Target}(E_i)}{\Phi_\text{Simulation}(E_i)}\]- Parameters:
- true_energy: astropy.units.Quantity[energy]
True energy of the event
- target_spectrum: callable
The target spectrum. Must be a allable with signature (energy) -> flux
- simulated_spectrum: callable
The simulated spectrum. Must be a callable with signature (energy) -> flux
- Returns:
- weights: numpy.ndarray
Weights for each event