ctaplot/plots/calib.py
def plot_photoelectron_true_reco(true_pe, reco_pe, bins=200, stat='median', errorbar=True, percentile=68.27,
                                 ax=None, hist_args={}, stat_args={}, xy_args={}):
    """
    Plot the number of reconstructed photo-electrons as a function of the number of true photo-electron

    Parameters
    ----------
    true_pe: `numpy.ndarray`
        shape: (n_pixels, )
    reco_pe: `numpy.ndarray`
        shape: (n_pixels, )
    bins: int or `numpy.ndarray`
    stat: str or None
        'mean', 'median', 'min', 'max'. if None, not plotted.
    errorbar: bool
        plot the errorbar corresponding to the percentile as colored area around the stat line
    percentile: float
        between 0 and 100
        percentile for the errorbars
    ax: `matplotlib.pyplot.axis` or None
    hist_args: args for `pyplot.hist2d`
    stat_args: args for `ctaplot.plots.plot_binned_stat`
    xy_args: args for `pyplot.plot`

    Returns
    -------
    ax: `matplotlib.pyplot.axis`
    """
    ax = plt.gca() if ax is None else ax

    mask = (true_pe > 0) & (reco_pe > 0)
    x = np.log10(true_pe[mask])
    y = np.log10(reco_pe[mask])

    if 'bins' in hist_args:
        hist_args.pop('bins')
    hist_args.setdefault('norm', LogNorm())
    h, xedges, yedges, im = ax.hist2d(x, y, bins=bins, **hist_args)

    if stat is not None:
        stat_args.setdefault('color', 'red')
        stat_args.setdefault('linewidth', 2)
        plot_binned_stat(x, y, errorbar=errorbar, bins=bins, ax=ax, statistic=stat, percentile=percentile, label=stat,
                         line=True, **stat_args)

    xy_args.setdefault('color', 'black')
    xy_args.setdefault('label', 'y=x')
    ax.plot([x.min(), x.max()], [x.min(), x.max()], **xy_args)

    ylim = list(ax.get_ylim())
    ylim[1] *= 1.2
    ax.set_ylim(ylim)

    plt.colorbar(im, ax=ax)
    ax.set_xlabel('log10(true pe)', fontsize=18)
    ax.set_ylabel('log10(reco pe)', fontsize=18)
    ax.grid()
    ax.legend(fontsize=16)
    return ax

    Plot the number of reconstructed photo-electrons as a function of the number of true photo-electron

    Parameters
    ----------
    true_pe: `numpy.ndarray`
        shape: (n_pixels, )
    reco_pe: `numpy.ndarray`
        shape: (n_pixels, )
    bins: int or `numpy.ndarray`
    stat: str or None
        'mean', 'median', 'min', 'max'. if None, not plotted.
    errorbar: bool
        plot the errorbar corresponding to the percentile as colored area around the stat line
    percentile: float
        between 0 and 100
        percentile for the errorbars
    ax: `matplotlib.pyplot.axis` or None
    hist_args: args for `pyplot.hist2d`
    stat_args: args for `ctaplot.plots.plot_binned_stat`
    xy_args: args for `pyplot.plot`

    Returns
    -------
    ax: `matplotlib.pyplot.axis`
    
Plot the number of reconstructed photo-electrons as a function of the number of true photo-electron
Parameters



Returns


Plot the number of reconstructed photo - electrons as a function of the number of true photo - electron Parameters Returns
def plot_photoelectron_true_reco(true_pe, reco_pe, bins=200, stat='median', errorbar=True, percentile=68.27,
                                 ax=None, hist_args={}, stat_args={}, xy_args={}):
    ax = plt.gca() if ax is None else ax
    mask = (true_pe > 0) & (reco_pe > 0)
    x = np.log10(true_pe[mask])
    y = np.log10(reco_pe[mask])
    if 'bins' in hist_args:
        hist_args.pop('bins')
    hist_args.setdefault('norm', LogNorm())
    h, xedges, yedges, im = ax.hist2d(x, y, bins=bins, **hist_args)
    if stat is not None:
        stat_args.setdefault('color', 'red')
        stat_args.setdefault('linewidth', 2)
        plot_binned_stat(x, y, errorbar=errorbar, bins=bins, ax=ax, statistic=stat, percentile=percentile, label=stat,
                         line=True, **stat_args)
    xy_args.setdefault('color', 'black')
    xy_args.setdefault('label', 'y=x')
    ax.plot([x.min(), x.max()], [x.min(), x.max()], **xy_args)
    ylim = list(ax.get_ylim())
    ylim[1] *= 1.2
    ax.set_ylim(ylim)
    plt.colorbar(im, ax=ax)
    ax.set_xlabel('log10(true pe)', fontsize=18)
    ax.set_ylabel('log10(reco pe)', fontsize=18)
    ax.grid()
    ax.legend(fontsize=16)
    return ax
def plot_photoelectron_true_reco ( true_pe , reco_pe , bins = 200 , stat = 'median' , errorbar = True , percentile = 68.27 , ax = None , hist_args = { } , stat_args = { } , xy_args = { } ) : ax = plt . gca ( ) if ax is None else ax mask = ( true_pe > 0 ) & ( reco_pe > 0 ) x = np . log10 ( true_pe [ mask ] ) y = np . log10 ( reco_pe [ mask ] ) if 'bins' in hist_args : hist_args . pop ( 'bins' ) hist_args . setdefault ( 'norm' , LogNorm ( ) ) h , xedges , yedges , im = ax . hist2d ( x , y , bins = bins , ** hist_args ) if stat is not None : stat_args . setdefault ( 'color' , 'red' ) stat_args . setdefault ( 'linewidth' , 2 ) plot_binned_stat ( x , y , errorbar = errorbar , bins = bins , ax = ax , statistic = stat , percentile = percentile , label = stat , line = True , ** stat_args ) xy_args . setdefault ( 'color' , 'black' ) xy_args . setdefault ( 'label' , 'y=x' ) ax . plot ( [ x . min ( ) , x . max ( ) ] , [ x . min ( ) , x . max ( ) ] , ** xy_args ) ylim = list ( ax . get_ylim ( ) ) ylim [ 1 ] *= 1.2 ax . set_ylim ( ylim ) plt . colorbar ( im , ax = ax ) ax . set_xlabel ( 'log10(true pe)' , fontsize = 18 ) ax . set_ylabel ( 'log10(reco pe)' , fontsize = 18 ) ax . grid ( ) ax . legend ( fontsize = 16 ) return ax
Plot the number of reconstructed photo-electrons as a function of the number of true photo-electron
Parameters
Plot the number of reconstructed photo - electrons as a function of the number of true photo - electron Parameters
"""
    Plot the number of reconstructed photo-electrons as a function of the number of true photo-electron

    Parameters
    ----------
    true_pe: `numpy.ndarray`
        shape: (n_pixels, )
    reco_pe: `numpy.ndarray`
        shape: (n_pixels, )
    bins: int or `numpy.ndarray`
    stat: str or None
        'mean', 'median', 'min', 'max'. if None, not plotted.
    errorbar: bool
        plot the errorbar corresponding to the percentile as colored area around the stat line
    percentile: float
        between 0 and 100
        percentile for the errorbars
    ax: `matplotlib.pyplot.axis` or None
    hist_args: args for `pyplot.hist2d`
    stat_args: args for `ctaplot.plots.plot_binned_stat`
    xy_args: args for `pyplot.plot`

    Returns
    -------
    ax: `matplotlib.pyplot.axis`
    """
true_pe
reco_pe
bins
stat
errorbar
percentile
ax
hist_args
stat_args
xy_args