ctaplot/plots/plots.py
def plot_multiplicity_per_energy(multiplicity, energies, ax=None, outfile=None):
    """
    Plot the telescope multiplicity as a function of the true_energy
    The plot might be saved automatically if `outfile` is provided.

    Parameters
    ----------
    multiplicity: `numpy.ndarray`
        telescope multiplcity
    energies: `numpy.ndarray`
        event energies
    ax: `matplotlib.pyplot.axes`
    outfile: string
        path to the output file to save the figure
    """

    assert len(multiplicity) == len(energies), "arrays should have same length"
    assert len(multiplicity) > 0, "arrays are empty"

    E, m_mean, m_min, m_max, m_per = ana.multiplicity_stat_per_energy(multiplicity, energies)

    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('Multiplicity')

    ax.fill_between(E, m_min, m_max, alpha=0.5)
    ax.plot(E, m_min, '--')
    ax.plot(E, m_max, '--')
    ax.plot(E, m_mean, color='red')

    ax.set_xscale('log')
    ax.set_title("Multiplicity")

    if type(outfile) is str:
        plt.savefig(outfile, bbox_inches="tight", format='png', dpi=200)

    return ax

    Plot the telescope multiplicity as a function of the true_energy
    The plot might be saved automatically if `outfile` is provided.

    Parameters
    ----------
    multiplicity: `numpy.ndarray`
        telescope multiplcity
    energies: `numpy.ndarray`
        event energies
    ax: `matplotlib.pyplot.axes`
    outfile: string
        path to the output file to save the figure
    
Plot the telescope multiplicity as a function of the true_energy
The plot might be saved automatically if `outfile` is provided.

Parameters


Plot the telescope multiplicity as a function of the true_energy The plot might be saved automatically if ` outfile ` is provided . Parameters
def plot_multiplicity_per_energy(multiplicity, energies, ax=None, outfile=None):
    assert len(multiplicity) == len(energies), "arrays should have same length"
    assert len(multiplicity) > 0, "arrays are empty"
    E, m_mean, m_min, m_max, m_per = ana.multiplicity_stat_per_energy(multiplicity, energies)
    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('Multiplicity')
    ax.fill_between(E, m_min, m_max, alpha=0.5)
    ax.plot(E, m_min, '--')
    ax.plot(E, m_max, '--')
    ax.plot(E, m_mean, color='red')
    ax.set_xscale('log')
    ax.set_title("Multiplicity")
    if type(outfile) is str:
        plt.savefig(outfile, bbox_inches="tight", format='png', dpi=200)
    return ax
def plot_multiplicity_per_energy ( multiplicity , energies , ax = None , outfile = None ) : assert len ( multiplicity ) == len ( energies ) , "arrays should have same length" assert len ( multiplicity ) > 0 , "arrays are empty" E , m_mean , m_min , m_max , m_per = ana . multiplicity_stat_per_energy ( multiplicity , energies ) 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 ( 'Multiplicity' ) ax . fill_between ( E , m_min , m_max , alpha = 0.5 ) ax . plot ( E , m_min , '--' ) ax . plot ( E , m_max , '--' ) ax . plot ( E , m_mean , color = 'red' ) ax . set_xscale ( 'log' ) ax . set_title ( "Multiplicity" ) if type ( outfile ) is str : plt . savefig ( outfile , bbox_inches = "tight" , format = 'png' , dpi = 200 ) return ax
Plot the telescope multiplicity as a function of the true_energy
The plot might be saved automatically if `outfile` is provided.
Plot the telescope multiplicity as a function of the true_energy The plot might be saved automatically if ` outfile ` is provided .
"""
    Plot the telescope multiplicity as a function of the true_energy
    The plot might be saved automatically if `outfile` is provided.

    Parameters
    ----------
    multiplicity: `numpy.ndarray`
        telescope multiplcity
    energies: `numpy.ndarray`
        event energies
    ax: `matplotlib.pyplot.axes`
    outfile: string
        path to the output file to save the figure
    """
multiplicity
energies
ax
outfile