ctaplot/plots/plots.py
def plot_impact_parameter_error_per_energy(reco_x, reco_y, simu_x, simu_y, energy, ax=None, **kwargs):
    """
    plot the impact parameter error distance as a function of true_energy and save the plot as Outfile
    
    Parameters
    ----------
    reco_x: `numpy.ndarray`
    reco_y: `numpy.ndarray`
    simu_x: `numpy.ndarray`
    simu_y: `numpy.ndarray`
    energy: `numpy.ndarray`
    ax: `matplotlib.pyplot.axes`
    kwargs: args for `matplotlib.pyplot.errorbar`

    Returns
    -------
    true_energy, err_mean : numpy arrays
    """
    irf = ana.irf_cta()
    E_bin = irf.E_bin
    E = []
    err_mean = []
    err_min = []
    err_max = []
    err_std = []
    for i, eb in enumerate(E_bin[:-1]):
        mask = (energy > E_bin[i]) & (energy < E_bin[i + 1])
        E.append(np.mean([E_bin[i], E_bin[i + 1]]))
        if True in mask:
            d = ana.impact_parameter_error(reco_x[mask], reco_y[mask], simu_x[mask], simu_y[mask])
            err_mean.append(d.mean())
            err_min.append(d.min())
            err_max.append(d.max())
            err_std.append(np.std(d))
        else:
            err_mean.append(0)
            err_min.append(0)
            err_max.append(0)
            err_std.append(0)

    ax = plt.gca() if ax is None else ax

    ax.spines["top"].set_visible(False)
    ax.spines["right"].set_visible(False)
    ax.get_xaxis().tick_bottom()
    ax.get_yaxis().tick_left()
    ax.set_ylabel('Error on Impact Parameter [m]')
    ax.set_xlabel('Energy [TeV]')

    ax.set_xscale('log')

    ax.fill_between(E, err_min, err_max)
    ax.errorbar(E, err_mean, err_std, color="red", label="mean+std")

    ax.set_title('Impact parameter resolution')

    return E, np.array(err_mean)

    plot the impact parameter error distance as a function of true_energy and save the plot as Outfile
    
    Parameters
    ----------
    reco_x: `numpy.ndarray`
    reco_y: `numpy.ndarray`
    simu_x: `numpy.ndarray`
    simu_y: `numpy.ndarray`
    energy: `numpy.ndarray`
    ax: `matplotlib.pyplot.axes`
    kwargs: args for `matplotlib.pyplot.errorbar`

    Returns
    -------
    true_energy, err_mean : numpy arrays
    
plot the impact parameter error distance as a function of true_energy and save the plot as Outfile
Parameters



Returns


plot the impact parameter error distance as a function of true_energy and save the plot as Outfile Parameters Returns
def plot_impact_parameter_error_per_energy(reco_x, reco_y, simu_x, simu_y, energy, ax=None, **kwargs):
    irf = ana.irf_cta()
    E_bin = irf.E_bin
    E = []
    err_mean = []
    err_min = []
    err_max = []
    err_std = []
    for i, eb in enumerate(E_bin[:-1]):
        mask = (energy > E_bin[i]) & (energy < E_bin[i + 1])
        E.append(np.mean([E_bin[i], E_bin[i + 1]]))
        if True in mask:
            d = ana.impact_parameter_error(reco_x[mask], reco_y[mask], simu_x[mask], simu_y[mask])
            err_mean.append(d.mean())
            err_min.append(d.min())
            err_max.append(d.max())
            err_std.append(np.std(d))
        else:
            err_mean.append(0)
            err_min.append(0)
            err_max.append(0)
            err_std.append(0)
    ax = plt.gca() if ax is None else ax
    ax.spines["top"].set_visible(False)
    ax.spines["right"].set_visible(False)
    ax.get_xaxis().tick_bottom()
    ax.get_yaxis().tick_left()
    ax.set_ylabel('Error on Impact Parameter [m]')
    ax.set_xlabel('Energy [TeV]')
    ax.set_xscale('log')
    ax.fill_between(E, err_min, err_max)
    ax.errorbar(E, err_mean, err_std, color="red", label="mean+std")
    ax.set_title('Impact parameter resolution')
    return E, np.array(err_mean)
def plot_impact_parameter_error_per_energy ( reco_x , reco_y , simu_x , simu_y , energy , ax = None , ** kwargs ) : irf = ana . irf_cta ( ) E_bin = irf . E_bin E = [ ] err_mean = [ ] err_min = [ ] err_max = [ ] err_std = [ ] for i , eb in enumerate ( E_bin [ : - 1 ] ) : mask = ( energy > E_bin [ i ] ) & ( energy < E_bin [ i + 1 ] ) E . append ( np . mean ( [ E_bin [ i ] , E_bin [ i + 1 ] ] ) ) if True in mask : d = ana . impact_parameter_error ( reco_x [ mask ] , reco_y [ mask ] , simu_x [ mask ] , simu_y [ mask ] ) err_mean . append ( d . mean ( ) ) err_min . append ( d . min ( ) ) err_max . append ( d . max ( ) ) err_std . append ( np . std ( d ) ) else : err_mean . append ( 0 ) err_min . append ( 0 ) err_max . append ( 0 ) err_std . append ( 0 ) ax = plt . gca ( ) if ax is None else ax ax . spines [ "top" ] . set_visible ( False ) ax . spines [ "right" ] . set_visible ( False ) ax . get_xaxis ( ) . tick_bottom ( ) ax . get_yaxis ( ) . tick_left ( ) ax . set_ylabel ( 'Error on Impact Parameter [m]' ) ax . set_xlabel ( 'Energy [TeV]' ) ax . set_xscale ( 'log' ) ax . fill_between ( E , err_min , err_max ) ax . errorbar ( E , err_mean , err_std , color = "red" , label = "mean+std" ) ax . set_title ( 'Impact parameter resolution' ) return E , np . array ( err_mean )
plot the impact parameter error distance as a function of true_energy and save the plot as Outfile
Parameters
plot the impact parameter error distance as a function of true_energy and save the plot as Outfile Parameters
"""
    plot the impact parameter error distance as a function of true_energy and save the plot as Outfile
    
    Parameters
    ----------
    reco_x: `numpy.ndarray`
    reco_y: `numpy.ndarray`
    simu_x: `numpy.ndarray`
    simu_y: `numpy.ndarray`
    energy: `numpy.ndarray`
    ax: `matplotlib.pyplot.axes`
    kwargs: args for `matplotlib.pyplot.errorbar`

    Returns
    -------
    true_energy, err_mean : numpy arrays
    """
reco_x
reco_y
simu_x
simu_y
energy
ax