def get_spectral_w(w_pars,energy):
    """
    Return spectral weight of an event

    Parameters
    ----------
    w_pars: parameters obtained with get_spectral_w_pars() function
    energy: energy of the event in GeV

    Returns
    -------
    float w
    """

    E0 = w_pars[0]
    index = w_pars[1]
    index_w = w_pars[2]
    R = w_pars[3]
    N_ = w_pars[4]

    w = ((energy/E0)**(index_w-index))*R/N_

    return w