ctaplot/plots/plots.py
def plot_energy_distribution(mc_energy, reco_energy, ax=None, outfile=None, mask_mc_detected=True):
    """
    Plot the true_energy distribution of the simulated particles, detected particles and reconstructed particles
    The plot might be saved automatically if `outfile` is provided.

    Parameters
    ----------
    mc_energy: `numpy.ndarray`
        simulated energies
    reco_energy: `numpy.ndarray`
        reconstructed energies
    ax: `matplotlib.pyplot.axes`
    outfile: string
        output file path
    mask_mc_detected: `numpy.ndarray`
        mask of detected particles for the SimuE array
    """

    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_xlabel('Energy [TeV]')
    ax.set_ylabel('Count')

    ax.set_xscale('log')
    count_S, bin_S, o = ax.hist(mc_energy, log=True, bins=np.logspace(-3, 3, 30), label="Simulated")
    count_D, bin_D, o = ax.hist(mc_energy[mask_mc_detected], log=True, bins=np.logspace(-3, 3, 30), label="Detected")
    count_R, bin_R, o = ax.hist(reco_energy, log=True, bins=np.logspace(-3, 3, 30), label="Reconstructed")
    if outfile is not None:
        plt.savefig(outfile, bbox_inches="tight", format='png', dpi=200)
        plt.close()

    return ax

    Plot the true_energy distribution of the simulated particles, detected particles and reconstructed particles
    The plot might be saved automatically if `outfile` is provided.

    Parameters
    ----------
    mc_energy: `numpy.ndarray`
        simulated energies
    reco_energy: `numpy.ndarray`
        reconstructed energies
    ax: `matplotlib.pyplot.axes`
    outfile: string
        output file path
    mask_mc_detected: `numpy.ndarray`
        mask of detected particles for the SimuE array
    
Plot the true_energy distribution of the simulated particles, detected particles and reconstructed particles
The plot might be saved automatically if `outfile` is provided.

Parameters


Plot the true_energy distribution of the simulated particles detected particles and reconstructed particles The plot might be saved automatically if ` outfile ` is provided . Parameters
def plot_energy_distribution(mc_energy, reco_energy, ax=None, outfile=None, mask_mc_detected=True):
    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_xlabel('Energy [TeV]')
    ax.set_ylabel('Count')
    ax.set_xscale('log')
    count_S, bin_S, o = ax.hist(mc_energy, log=True, bins=np.logspace(-3, 3, 30), label="Simulated")
    count_D, bin_D, o = ax.hist(mc_energy[mask_mc_detected], log=True, bins=np.logspace(-3, 3, 30), label="Detected")
    count_R, bin_R, o = ax.hist(reco_energy, log=True, bins=np.logspace(-3, 3, 30), label="Reconstructed")
    if outfile is not None:
        plt.savefig(outfile, bbox_inches="tight", format='png', dpi=200)
        plt.close()
    return ax
def plot_energy_distribution ( mc_energy , reco_energy , ax = None , outfile = None , mask_mc_detected = True ) : 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_xlabel ( 'Energy [TeV]' ) ax . set_ylabel ( 'Count' ) ax . set_xscale ( 'log' ) count_S , bin_S , o = ax . hist ( mc_energy , log = True , bins = np . logspace ( - 3 , 3 , 30 ) , label = "Simulated" ) count_D , bin_D , o = ax . hist ( mc_energy [ mask_mc_detected ] , log = True , bins = np . logspace ( - 3 , 3 , 30 ) , label = "Detected" ) count_R , bin_R , o = ax . hist ( reco_energy , log = True , bins = np . logspace ( - 3 , 3 , 30 ) , label = "Reconstructed" ) if outfile is not None : plt . savefig ( outfile , bbox_inches = "tight" , format = 'png' , dpi = 200 ) plt . close ( ) return ax
Plot the true_energy distribution of the simulated particles, detected particles and reconstructed particles
The plot might be saved automatically if `outfile` is provided.
Plot the true_energy distribution of the simulated particles detected particles and reconstructed particles The plot might be saved automatically if ` outfile ` is provided .
"""
    Plot the true_energy distribution of the simulated particles, detected particles and reconstructed particles
    The plot might be saved automatically if `outfile` is provided.

    Parameters
    ----------
    mc_energy: `numpy.ndarray`
        simulated energies
    reco_energy: `numpy.ndarray`
        reconstructed energies
    ax: `matplotlib.pyplot.axes`
    outfile: string
        output file path
    mask_mc_detected: `numpy.ndarray`
        mask of detected particles for the SimuE array
    """
mc_energy
reco_energy
ax
outfile
mask_mc_detected