weight

lstchain.mc.mc.weight(shape, emin, emax, sim_sp_idx, rate, nev, w_param)

Calculates the weight of events to transform a power-law distribution with spectral index sim_sp_idx to a power-law distribution with spectral index w_sp_idx

Parameters:
shape: `string` estimated spectrum shape
emin: `float` minimum energy
emax: `float` maximum energy
sim_sp_idx: `float` simulated spectral index of the power-law distribution
rate: `float` rate of simulated events
nev: `int` number of simulated events
w_param: `dict` with weighted spectral parameters
if shape is ‘PowerLaw’:
w_param should include ‘f0’,’e0’,’alpha’
dFdE = f0 * np.power(E / e0, alpha)
if shape is ‘LogParabola’:
w_param should include ‘f0’,’e0’,’alpha’,’beta’
dFdE = f0 * np.power(E / e0, alpha + beta * np.log10(E/e0))
Returns:
weight: float rate of events