Beispiel #1
0
def get_flux_tables(table, y_method, function, spectral_index):
    table1 = table.copy()
    lafferty_flux = compute_differential_flux_points('lafferty', y_method, table1,
                                                     function, spectral_index)
    table2 = table1.copy()
    log_flux = compute_differential_flux_points('log_center', y_method, table2,
                                                function, spectral_index)
    return lafferty_flux, log_flux
Beispiel #2
0
def get_flux_tables(table, y_method, function, spectral_index):
    table1 = table.copy()
    lafferty_flux = compute_differential_flux_points('lafferty', y_method,
                                                     table1, function,
                                                     spectral_index)
    table2 = table1.copy()
    log_flux = compute_differential_flux_points('log_center', y_method, table2,
                                                function, spectral_index)
    return lafferty_flux, log_flux
Beispiel #3
0
def compute_flux_error(gamma_true, gamma_reco, method):
    # Let's assume a concrete true spectrum and energy bin.
    # Note that the residuals computed below do *not* depend on
    # these parameters.
    energy_min, energy_max = 1, 10
    energy_ref, diff_flux_ref = 1, 1
    # Compute integral flux in the energy band assuming `gamma_true`
    int_flux = power_law_integral_flux(diff_flux_ref, gamma_true, energy_ref,
                                       energy_min, energy_max)
    # Compute flux point
    table = compute_differential_flux_points(method,
                                             'power_law',
                                             spectral_index=gamma_reco,
                                             energy_min=energy_min,
                                             energy_max=energy_max,
                                             int_flux=int_flux)
    # Compute relative error of the flux point
    energy = table['ENERGY'].data
    flux_reco = table['DIFF_FLUX'].data
    flux_true = power_law_evaluate(energy,
                                   diff_flux_ref * np.ones_like(energy),
                                   np.array(gamma_true).reshape(energy.shape),
                                   energy_ref * np.ones_like(energy))
    flux_true = flux_true.reshape(gamma_true.shape)
    flux_reco = flux_reco.reshape(gamma_true.shape)
    flux_error = (flux_reco - flux_true) / flux_true
    return flux_error
Beispiel #4
0
def compute_flux_error(gamma_true, gamma_reco, method):
    # Let's assume a concrete true spectrum and energy bin.
    # Note that the residuals computed below do *not* depend on
    # these parameters.
    energy_min, energy_max = 1, 10
    energy_ref, diff_flux_ref = 1, 1
    # Compute integral flux in the energy band assuming `gamma_true`
    int_flux = power_law_integral_flux(diff_flux_ref, gamma_true,
                                       energy_ref, energy_min, energy_max)
    # Compute flux point
    table = compute_differential_flux_points(method, 'power_law',
                                             spectral_index=gamma_reco,
                                             energy_min=energy_min, energy_max=energy_max,
                                             int_flux=int_flux)
    # Compute relative error of the flux point
    energy = table['ENERGY'].data
    flux_reco = table['DIFF_FLUX'].data
    flux_true = power_law_evaluate(energy, diff_flux_ref * np.ones_like(energy),
                                   np.array(gamma_true).reshape(energy.shape),
                                   energy_ref * np.ones_like(energy))
    flux_true = flux_true.reshape(gamma_true.shape)
    flux_reco = flux_reco.reshape(gamma_true.shape)
    flux_error = (flux_reco - flux_true) / flux_true
    return flux_error