ctaplot/plots/plots.py
def plot_impact_parameter_error_per_multiplicity(reco_x, reco_y, simu_x, simu_y, multiplicity,
                                                 max_mult=None, ax=None, **kwargs):
    """
    Plot the impact parameter error as a function of multiplicity
    TODO: refactor and clean code

    Parameters
    ----------
    reco_x: `numpy.ndarray`
    reco_y: `numpy.ndarray`
    simu_x: `numpy.ndarray`
    simu_y: `numpy.ndarray`
    multiplicity: `numpy.ndarray`
    max_mult: optional, max multiplicity - float
    ax: `matplotlib.pyplot.axes`

    Returns
    -------

    """
    max_mult = multiplicity.max() + 1 if max_mult is None else max_mult

    M = np.arange(multiplicity.min(), max_mult)
    e_mean = []
    e_min = []
    e_max = []
    e_std = []
    for m in M:
        mask = (multiplicity == m)
        if True in mask:
            d = ana.impact_parameter_error(reco_x[mask], reco_y[mask], simu_x[mask], simu_y[mask])
            e_mean.append(d.mean())
            e_min.append(d.min())
            e_max.append(d.max())
            e_std.append(np.std(d))
        else:
            e_mean.append(0)
            e_min.append(0)
            e_max.append(0)
            e_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('Multiplicity')

    ax.fill_between(M, e_min, e_max)
    ax.errorbar(M, e_mean, e_std, color="red", label="mean+std")

    return M, np.array(e_mean)

    Plot the impact parameter error as a function of multiplicity
    TODO: refactor and clean code

    Parameters
    ----------
    reco_x: `numpy.ndarray`
    reco_y: `numpy.ndarray`
    simu_x: `numpy.ndarray`
    simu_y: `numpy.ndarray`
    multiplicity: `numpy.ndarray`
    max_mult: optional, max multiplicity - float
    ax: `matplotlib.pyplot.axes`

    Returns
    -------

    
Plot the impact parameter error as a function of multiplicity
TODO: refactor and clean code

Parameters



Returns
Plot the impact parameter error as a function of multiplicity TODO : refactor and clean code Parameters Returns
def plot_impact_parameter_error_per_multiplicity(reco_x, reco_y, simu_x, simu_y, multiplicity,
                                                 max_mult=None, ax=None, **kwargs):
    max_mult = multiplicity.max() + 1 if max_mult is None else max_mult
    M = np.arange(multiplicity.min(), max_mult)
    e_mean = []
    e_min = []
    e_max = []
    e_std = []
    for m in M:
        mask = (multiplicity == m)
        if True in mask:
            d = ana.impact_parameter_error(reco_x[mask], reco_y[mask], simu_x[mask], simu_y[mask])
            e_mean.append(d.mean())
            e_min.append(d.min())
            e_max.append(d.max())
            e_std.append(np.std(d))
        else:
            e_mean.append(0)
            e_min.append(0)
            e_max.append(0)
            e_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('Multiplicity')
    ax.fill_between(M, e_min, e_max)
    ax.errorbar(M, e_mean, e_std, color="red", label="mean+std")
    return M, np.array(e_mean)
def plot_impact_parameter_error_per_multiplicity ( reco_x , reco_y , simu_x , simu_y , multiplicity , max_mult = None , ax = None , ** kwargs ) : max_mult = multiplicity . max ( ) + 1 if max_mult is None else max_mult M = np . arange ( multiplicity . min ( ) , max_mult ) e_mean = [ ] e_min = [ ] e_max = [ ] e_std = [ ] for m in M : mask = ( multiplicity == m ) if True in mask : d = ana . impact_parameter_error ( reco_x [ mask ] , reco_y [ mask ] , simu_x [ mask ] , simu_y [ mask ] ) e_mean . append ( d . mean ( ) ) e_min . append ( d . min ( ) ) e_max . append ( d . max ( ) ) e_std . append ( np . std ( d ) ) else : e_mean . append ( 0 ) e_min . append ( 0 ) e_max . append ( 0 ) e_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 ( 'Multiplicity' ) ax . fill_between ( M , e_min , e_max ) ax . errorbar ( M , e_mean , e_std , color = "red" , label = "mean+std" ) return M , np . array ( e_mean )
Plot the impact parameter error as a function of multiplicity
TODO: refactor and clean code
Plot the impact parameter error as a function of multiplicity TODO : refactor and clean code
"""
    Plot the impact parameter error as a function of multiplicity
    TODO: refactor and clean code

    Parameters
    ----------
    reco_x: `numpy.ndarray`
    reco_y: `numpy.ndarray`
    simu_x: `numpy.ndarray`
    simu_y: `numpy.ndarray`
    multiplicity: `numpy.ndarray`
    max_mult: optional, max multiplicity - float
    ax: `matplotlib.pyplot.axes`

    Returns
    -------

    """
reco_x
reco_y
simu_x
simu_y
multiplicity
max_mult
ax