Exemple #1
0
def plot_image(img,\
        figsize=(11,10),\
        axwin=(0.10, 0.08, 0.88, 0.88),\
        cmap='inferno',\
        title='x-y image',\
        xlabel='x',\
        ylabel='y',\
        titwin=None,\
        fnm='img.png',\
        amp_range=None,\
        img_range=None,\
        origin='upper',\
        hwin_x0y0=(10,10),\
        prefix='plot',\
        do_save=False) :
    """draws figure with image
    """
    s = img.shape
    _img_range = (0, s[1], s[0], 0) if img_range is None else img_range
    imgnb = img[1:-2, 1:-2]
    _amp_range = (0, imgnb.mean() +
                  4 * imgnb.std()) if amp_range is None else amp_range
    #_amp_range = (0, 0.2*img.max())
    axim = plotImageLarge(img, img_range=_img_range, amp_range=_amp_range, figsize=figsize,\
                          title=title, origin=origin, window=axwin, cmap=cmap)
    axim.set_xlabel(xlabel, fontsize=18)
    axim.set_ylabel(ylabel, fontsize=18)
    axim.set_title(title, fontsize=12)
    move(hwin_x0y0[0], hwin_x0y0[1])
    save('%s-%s' % (prefix, fnm), do_save)
Exemple #2
0
def h1d(hlst, bins=None, amp_range=None, weights=None, color=None, show_stat=True, log=False,\
        figsize=(6,5), axwin=(0.15, 0.12, 0.78, 0.80), title='Title', xlabel='x', ylabel='y', titwin=None, fnm='hist.png') :
    """Wrapper for hist1d, move, and save methods, using common store parameters
    """
    fig, axhi, hi = hist1d(np.array(hlst), bins, amp_range, weights, color, show_stat,\
                           log, figsize, axwin, title, xlabel, ylabel, titwin)

    move(sp.hwin_x0y0[0], sp.hwin_x0y0[1])
    save('%s-%s' % (sp.prefix, fnm), sp.do_save)
    return fig, axhi, hi
Exemple #3
0
def plot_graph(x, y, figsize=(7,6), pfmt='r-', lw=2, xlimits=None, ylimits=None, \
               title='py vs. px', xlabel='px', ylabel='py', fnm='graph.png') :
    fig, ax = plotGraph(x, y, figsize=figsize, pfmt=pfmt, lw=lw)
    ax.set_xlim(xlimits)
    ax.set_ylim(ylimits)
    ax.set_xlabel(xlabel, fontsize=18)
    ax.set_ylabel(ylabel, fontsize=18)
    ax.set_title(title, fontsize=12)

    move(sp.hwin_x0y0[0], sp.hwin_x0y0[1])
    save('%s-%s' % (sp.prefix, fnm), sp.do_save)
Exemple #4
0
def plot_image(img, figsize=(11,10), axwin=(0.10, 0.08, 0.88, 0.88), cmap='inferno',\
               title='x-y image', xlabel='x', ylabel='y', titwin=None, fnm='img.png', amp_range=None, img_range=None, origin='upper') : #'gray_r'
    """
    """
    s = img.shape
    _img_range = (0, s[1], s[0], 0) if img_range is None else img_range
    imgnb = img[1:-2, 1:-2]
    _amp_range = (0, imgnb.mean() +
                  4 * imgnb.std()) if amp_range is None else amp_range
    #_amp_range = (0, 0.2*img.max())
    axim = plotImageLarge(img, img_range=_img_range, amp_range=_amp_range, figsize=figsize,\
                          title=title, origin=origin, window=axwin, cmap=cmap) # 'Greys') #'gray_r'
    axim.set_xlabel(xlabel, fontsize=18)
    axim.set_ylabel(ylabel, fontsize=18)
    axim.set_title(title, fontsize=12)

    move(sp.hwin_x0y0[0], sp.hwin_x0y0[1])
    save('%s-%s' % (sp.prefix, fnm), sp.do_save)
Exemple #5
0
def plot_graph(x, y,\
        figsize=(7,6),\
        pfmt='r-',\
        lw=2,\
        xlimits=None,\
        ylimits=None,\
        title='py vs. px',\
        xlabel='px',\
        ylabel='py',\
        fnm='graph.png',\
        hwin_x0y0=(10,10),\
        prefix='plot',\
        do_save=False) :
    """draws figure with graph
    """
    fig, ax = plotGraph(x, y, figsize=figsize, pfmt=pfmt, lw=lw)
    ax.set_xlim(xlimits)
    ax.set_ylim(ylimits)
    ax.set_xlabel(xlabel, fontsize=18)
    ax.set_ylabel(ylabel, fontsize=18)
    ax.set_title(title, fontsize=12)
    move(hwin_x0y0[0], hwin_x0y0[1])
    save('%s-%s' % (prefix, fnm), do_save)
Exemple #6
0
def h1d(hlst,\
        bins=None,\
        amp_range=None,\
        weights=None,\
        color=None,\
        show_stat=True,\
        log=False,\
        figsize=(6,5),\
        axwin=(0.15, 0.12, 0.78, 0.80),\
        title='Title',\
        xlabel='x',\
        ylabel='y',\
        titwin=None,\
        fnm='hist.png',\
        hwin_x0y0=(10,10),\
        prefix='plot',\
        do_save=False) :
    """draws figure with 1d- histogram
    """
    fig, axhi, hi = hist1d(np.array(hlst), bins, amp_range, weights, color, show_stat,\
                           log, figsize, axwin, title, xlabel, ylabel, titwin)
    move(hwin_x0y0[0], hwin_x0y0[1])
    save('%s-%s' % (prefix, fnm), do_save)
    return fig, axhi, hi