コード例 #1
0
				ppgplot.pgsci(5)
				ppgplot.pgeras()
				for p in range(xyPositionPlot['numXYPanels']):
					ppgplot.pgenv(startFrame, startFrame + frameRange, -yLimit, yLimit, 0, 0)
					ppgplot.pgbox('A', 1.0, 10, 'BCG', 0.0, 0)
					ppgplot.pglab("", "%d"%p, "")
					ppgplot.pgsch(currentSize)
					
				for p, a in enumerate(referenceApertures.getSources()):
					xValues = [log['frameNumber'] for log in a.positionLog]
					yValues = [log['position'][0] - a.position[0] for log in a.positionLog]
					yErrors = [log['positionError'][0] for log in a.positionLog] 
					ppgplot.pgsci(2)
					ppgplot.pgpanl(1, p + 1)
					ppgplot.pgpt(xValues, yValues, 1)
					ppgplot.pgerry(xValues, yValues + yErrors, yValues + yErrors, 0)
					yValues = [log['position'][1] - a.position[1] for log in a.positionLog]
					ppgplot.pgsci(3)
					ppgplot.pgpanl(1, p + 1)
					ppgplot.pgpt(xValues, yValues, 1)
				
					
			shortXArray = [trueFrameNumber]
			shortYArray = [xPosition]
			ppgplot.pgsci(2)
			ppgplot.pgpanl(1, panel + 1)
			ppgplot.pgpt(shortXArray, shortYArray, 1)
			ppgplot.pgsci(3)
			shortYArray = [yPosition]
			ppgplot.pgpt(shortXArray, shortYArray, 1)
			
コード例 #2
0
ファイル: Pgplot.py プロジェクト: bretonr/presto
def plotbinned(y, x=None, title=None, labx='Bins', laby='Counts', \
               rangex=None, rangey=None, labx2='', laby2='', \
               rangex2=None, rangey2=None, \
               line=ppgplot_linestyle_, width=ppgplot_linewidth_, \
               color=ppgplot_color_, font=ppgplot_font_, logx=0, logy=0, \
               logx2=0, logy2=0, erry=None, id=0, noscale=0, \
               aspect=0.7727, fontsize=ppgplot_font_size_, \
               ticks='in', panels=[1,1], device=ppgplot_device_, setup=1):
    """
    plotbinned(y, ...):
        Plot x-y data that is binned.  This routine differs from
            plotxy() in that instead of each point being connected
            by diagonal lines, each point is actually a flat-line
            with the width of a bin.
            'y' is the numerical sequence of binned data to plot.
        The optional entries are:
            x:        x-centers of each bin.    (default = auto)
            title:    graph title               (default = None)   
            labx:     label for the x-axis      (default = 'Bins')
            laby:     label for the y-axis      (default = 'Counts')
            rangex:   ranges for the x-axis     (default = automatic)
            rangey:   ranges for the y-axis     (default = automatic)
            labx2:    label for the 2nd x-axis  (default = None)   
            laby2:    label for the 2nd y-axis  (default = None)   
            rangex2:  ranges for 2nd x-axis     (default = None)   
            rangey2:  ranges for 2nd y-axis     (default = None)   
            logx:     make the 1st x-axis log   (default = 0 (no))
            logy:     make the 1st y-axis log   (default = 0 (no))
            logx2:    make the 2nd x-axis log   (default = 0 (no))
            logy2:    make the 2nd y-axis log   (default = 0 (no))
            erry:     symmetric y errors        (default = None)   
            line:     line style                (default = 1 (solid))
            width:    line width                (default = 1 (thin))
            color:    line and/or symbol color  (default = 'white')
            font:     PGPLOT font to use        (default = 1 (normal))
            fontsize: PGPLOT font size to use   (default = 1.0 (normal))
            id:       show ID line on plot      (default = 0 (no)) 
            aspect:   aspect ratio              (default = 0.7727 (rect))
            ticks:    Ticks point in or out     (default = 'in')   
            panels:   Number of subpanels [r,c] (default = [1,1])
            device:   PGPLOT device to use      (default = '/XWIN')
            setup:    Auto-setup the plot       (default = 1)
        Note:  Many default values are defined in global variables
            with names like ppgplot_font_ or ppgplot_device_.
    """
    # Make sure our entry sequences are Num arrays
    Num.asarray(y)
    Num.asarray(x)
    if x is None:  x = Num.arange(len(y)) + 0.5
    dx = x[1] - x[0]
    # Correct for the fact that 'x' are the bin centers
    x = x - 0.5 * dx
    # Make the repeat array
    r = Num.zeros(len(x), dtype=Num.int32)+2
    ny = Num.repeat(y, r)
    r[0] = 1
    nx = Num.repeat(x, r)
    # Add the right side of the right-most bin
    nx = Num.concatenate((nx, Num.zeros(1)+nx[-1]+dx))
    plotxy(ny, nx, title, labx=labx, laby=laby, line=line, \
           labx2=labx2, laby2=laby2, \
           rangex2=rangex2, rangey2=rangey2, logx=logx, logy=logy, \
           logx2=logx2, logy2=logy2, noscale=noscale, \
           width=width, color=color, font=font, fontsize=fontsize, \
           id=id, aspect=aspect, rangex=rangex, rangey=rangey, \
           ticks=ticks, panels=panels, device=device, setup=setup)
    if erry is not None:
        ppgplot.pgerry(Num.arange(len(y))+0.5, y+erry, y-erry, 1.0)
コード例 #3
0
ファイル: Pgplot.py プロジェクト: lao19881213/presto_on_gpu
def plotxy(y, x=None, title=None, rangex=None, rangey=None, \
           labx='', laby='', rangex2=None, rangey2=None, \
           labx2='', laby2='', symbol=ppgplot_symbol_, \
           line=ppgplot_linestyle_, width=ppgplot_linewidth_, \
           color=ppgplot_color_, font=ppgplot_font_, logx=0, logy=0, \
           logx2=0, logy2=0, errx=None, erry=None, id=0, noscale=0, \
           aspect=0.7727, fontsize=ppgplot_font_size_, ticks='in', \
           panels=[1,1], device=ppgplot_device_, setup=1):
    """
    plotxy(y, ...)
        An interface to make various XY style plots using PGPLOT.
            'y' is the 1D sequence object to plot.
        The optional entries are:
            x:        x values                  (default = 0, 1, ...)
            title:    graph title               (default = None)   
            rangex:   ranges for the x-axis     (default = automatic)
            rangey:   ranges for the y-axis     (default = automatic)
            labx:     label for the x-axis      (default = None)   
            laby:     label for the y-axis      (default = None)   
            rangex2:  ranges for 2nd x-axis     (default = None)   
            rangey2:  ranges for 2nd y-axis     (default = None)   
            labx2:    label for the 2nd x-axis  (default = None)   
            laby2:    label for the 2nd y-axis  (default = None)   
            logx:     make the 1st x-axis log   (default = 0 (no))
            logy:     make the 1st y-axis log   (default = 0 (no))
            logx2:    make the 2nd x-axis log   (default = 0 (no))
            logy2:    make the 2nd y-axis log   (default = 0 (no))
            errx:     symmetric x errors        (default = None)   
            erry:     symmetric y errors        (default = None)   
            symbol:   symbol for points         (default = None)   
            line:     line style                (default = 1 (solid))
            width:    line width                (default = 1 (thin))
            color:    line and/or symbol color  (default = 'white')
            font:     PGPLOT font to use        (default = 1 (normal))
            fontsize: PGPLOT font size to use   (default = 1.0 (normal))
            id:       show ID line on plot      (default = 0 (no)) 
            noscale:  turn off auto scaling     (default = 0 (no)) 
            aspect:   aspect ratio              (default = 0.7727 (rect))
            ticks:    Ticks point in or out     (default = 'in')   
            panels:   Number of subpanels [r,c] (default = [1,1])
            device:   PGPLOT device to use      (default = '/XWIN')
            setup:    Auto-setup the plot       (default = 1)
        Note:  Many default values are defined in global variables
            with names like ppgplot_font_ or ppgplot_device_.
    """
    # Make sure the input data is an array
    y = Num.asarray(y)
    # Announce the global variables we will be using
    global ppgplot_dev_open_, ppgplot_dev_prep_, ppgplot_colors_
    # Define the X axis limits if needed
    if x is None: x = Num.arange(len(y), dtype='f')
    else: x = Num.asarray(x)
    # Determine the scaling to use for the first axis
    if rangex is None: rangex = [x.min(), x.max()]
    if rangey is None:
        if noscale: rangey = [y.min(), y.max()]
        else: rangey = scalerange(y)
    # Prep the plotting device...
    if (not ppgplot_dev_prep_ and setup):
        prepplot(rangex, rangey, title, labx, laby, \
                 rangex2, rangey2, labx2, laby2, \
                 logx, logy, logx2, logy2, font, fontsize, \
                 id, aspect, ticks, panels, device=device)
    # Choose the line color
    if type(color) == types.StringType:
        ppgplot.pgsci(ppgplot_colors_[color])
    else:
        ppgplot.pgsci(color)
    # Plot symbols (and errors) if requested
    if not symbol is None:
        ppgplot.pgpt(x, y, symbol)
    # Error bars
    if errx is not None:
        if not logx:
            errx = Num.asarray(errx)
            ppgplot.pgerrx(x + errx, x - errx, y, 1.0)
        else:
            errx = 10.0**Num.asarray(errx)
            ppgplot.pgerrx(Num.log10(10.0**x + errx),
                           Num.log10(10.0**x - errx), y, 1.0)
    if erry is not None:
        if not logy:
            erry = Num.asarray(erry)
            ppgplot.pgerry(x, y + erry, y - erry, 1.0)
        else:
            erry = 10.0**Num.asarray(erry)
            ppgplot.pgerry(x, Num.log10(10.0**y + erry),
                           Num.log10(10.0**y - erry), 1.0)
    # Plot connecting lines if requested
    if not line is None:
        # Choose the line style
        ppgplot.pgsls(line)
        # Choose the line width
        ppgplot.pgslw(width)
        ppgplot.pgline(x, y)
コード例 #4
0
ファイル: Pgplot.py プロジェクト: lao19881213/presto_on_gpu
def plotbinned(y, x=None, title=None, labx='Bins', laby='Counts', \
               rangex=None, rangey=None, labx2='', laby2='', \
               rangex2=None, rangey2=None, \
               line=ppgplot_linestyle_, width=ppgplot_linewidth_, \
               color=ppgplot_color_, font=ppgplot_font_, logx=0, logy=0, \
               logx2=0, logy2=0, erry=None, id=0, noscale=0, \
               aspect=0.7727, fontsize=ppgplot_font_size_, \
               ticks='out', panels=[1,1], device=ppgplot_device_, setup=1):
    """
    plotbinned(y, ...):
        Plot x-y data that is binned.  This routine differs from
            plotxy() in that instead of each point being connected
            by diagonal lines, each point is actually a flat-line
            with the width of a bin.
            'y' is the numerical sequence of binned data to plot.
        The optional entries are:
            x:        x-centers of each bin.    (default = auto)
            title:    graph title               (default = None)   
            labx:     label for the x-axis      (default = 'Bins')
            laby:     label for the y-axis      (default = 'Counts')
            rangex:   ranges for the x-axis     (default = automatic)
            rangey:   ranges for the y-axis     (default = automatic)
            labx2:    label for the 2nd x-axis  (default = None)   
            laby2:    label for the 2nd y-axis  (default = None)   
            rangex2:  ranges for 2nd x-axis     (default = None)   
            rangey2:  ranges for 2nd y-axis     (default = None)   
            logx:     make the 1st x-axis log   (default = 0 (no))
            logy:     make the 1st y-axis log   (default = 0 (no))
            logx2:    make the 2nd x-axis log   (default = 0 (no))
            logy2:    make the 2nd y-axis log   (default = 0 (no))
            erry:     symmetric y errors        (default = None)   
            line:     line style                (default = 1 (solid))
            width:    line width                (default = 1 (thin))
            color:    line and/or symbol color  (default = 'white')
            font:     PGPLOT font to use        (default = 1 (normal))
            fontsize: PGPLOT font size to use   (default = 1.0 (normal))
            id:       show ID line on plot      (default = 0 (no)) 
            aspect:   aspect ratio              (default = 0.7727 (rect))
            ticks:    Ticks point in or out     (default = 'in')   
            panels:   Number of subpanels [r,c] (default = [1,1])
            device:   PGPLOT device to use      (default = '/XWIN')
            setup:    Auto-setup the plot       (default = 1)
        Note:  Many default values are defined in global variables
            with names like ppgplot_font_ or ppgplot_device_.
    """
    # Make sure our entry sequences are Num arrays
    Num.asarray(y)
    Num.asarray(x)
    if x is None: x = Num.arange(len(y)) + 0.5
    dx = x[1] - x[0]
    # Correct for the fact that 'x' are the bin centers
    x = x - 0.5 * dx
    # Make the repeat array
    r = Num.zeros(len(x), dtype=Num.int32) + 2
    ny = Num.repeat(y, r)
    r[0] = 1
    nx = Num.repeat(x, r)
    # Add the right side of the right-most bin
    nx = Num.concatenate((nx, Num.zeros(1) + nx[-1] + dx))
    plotxy(ny, nx, title, labx=labx, laby=laby, line=line, \
           labx2=labx2, laby2=laby2, \
           rangex2=rangex2, rangey2=rangey2, logx=logx, logy=logy, \
           logx2=logx2, logy2=logy2, noscale=noscale, \
           width=width, color=color, font=font, fontsize=fontsize, \
           id=id, aspect=aspect, rangex=rangex, rangey=rangey, \
           ticks=ticks, panels=panels, device=device, setup=setup)
    if erry is not None:
        ppgplot.pgerry(Num.arange(len(y)) + 0.5, y + erry, y - erry, 1.0)
コード例 #5
0
ファイル: Pgplot.py プロジェクト: ChrisLaidler/presto
def plotxy(y, x=None, title=None, rangex=None, rangey=None, \
           labx='', laby='', rangex2=None, rangey2=None, \
           labx2='', laby2='', symbol=ppgplot_symbol_, \
           line=ppgplot_linestyle_, width=ppgplot_linewidth_, \
           color=ppgplot_color_, font=ppgplot_font_, logx=0, logy=0, \
           logx2=0, logy2=0, errx=None, erry=None, id=0, noscale=0, \
           aspect=0.7727, fontsize=ppgplot_font_size_, ticks='in', \
           panels=[1,1], device=ppgplot_device_, setup=1):
    """
    plotxy(y, ...)
        An interface to make various XY style plots using PGPLOT.
            'y' is the 1D sequence object to plot.
        The optional entries are:
            x:        x values                  (default = 0, 1, ...)
            title:    graph title               (default = None)   
            rangex:   ranges for the x-axis     (default = automatic)
            rangey:   ranges for the y-axis     (default = automatic)
            labx:     label for the x-axis      (default = None)   
            laby:     label for the y-axis      (default = None)   
            rangex2:  ranges for 2nd x-axis     (default = None)   
            rangey2:  ranges for 2nd y-axis     (default = None)   
            labx2:    label for the 2nd x-axis  (default = None)   
            laby2:    label for the 2nd y-axis  (default = None)   
            logx:     make the 1st x-axis log   (default = 0 (no))
            logy:     make the 1st y-axis log   (default = 0 (no))
            logx2:    make the 2nd x-axis log   (default = 0 (no))
            logy2:    make the 2nd y-axis log   (default = 0 (no))
            errx:     symmetric x errors        (default = None)   
            erry:     symmetric y errors        (default = None)   
            symbol:   symbol for points         (default = None)   
            line:     line style                (default = 1 (solid))
            width:    line width                (default = 1 (thin))
            color:    line and/or symbol color  (default = 'white')
            font:     PGPLOT font to use        (default = 1 (normal))
            fontsize: PGPLOT font size to use   (default = 1.0 (normal))
            id:       show ID line on plot      (default = 0 (no)) 
            noscale:  turn off auto scaling     (default = 0 (no)) 
            aspect:   aspect ratio              (default = 0.7727 (rect))
            ticks:    Ticks point in or out     (default = 'in')   
            panels:   Number of subpanels [r,c] (default = [1,1])
            device:   PGPLOT device to use      (default = '/XWIN')
            setup:    Auto-setup the plot       (default = 1)
        Note:  Many default values are defined in global variables
            with names like ppgplot_font_ or ppgplot_device_.
    """
    # Make sure the input data is an array
    y = Num.asarray(y);
    # Announce the global variables we will be using
    global ppgplot_dev_open_, ppgplot_dev_prep_, ppgplot_colors_
    # Define the X axis limits if needed
    if x is None: x=Num.arange(len(y), dtype='f')
    else: x = Num.asarray(x)
    # Determine the scaling to use for the first axis
    if rangex is None: rangex=[x.min(), x.max()]
    if rangey is None:
        if noscale: rangey=[y.min(), y.max()]
        else: rangey=scalerange(y)
    # Prep the plotting device...
    if (not ppgplot_dev_prep_ and setup):
        prepplot(rangex, rangey, title, labx, laby, \
                 rangex2, rangey2, labx2, laby2, \
                 logx, logy, logx2, logy2, font, fontsize, \
                 id, aspect, ticks, panels, device=device)
    # Choose the line color
    if type(color) == types.StringType:
        ppgplot.pgsci(ppgplot_colors_[color])
    else:
        ppgplot.pgsci(color)
    # Plot symbols (and errors) if requested
    if not symbol is None:
        ppgplot.pgpt(x, y, symbol)
    # Error bars
    if errx is not None:
        if not logx:
            errx = Num.asarray(errx)
            ppgplot.pgerrx(x+errx, x-errx, y, 1.0)
        else:
            errx = 10.0**Num.asarray(errx)
            ppgplot.pgerrx(Num.log10(10.0**x + errx),
                           Num.log10(10.0**x - errx), y, 1.0)
    if erry is not None:
        if not logy:
            erry = Num.asarray(erry)
            ppgplot.pgerry(x, y+erry, y-erry, 1.0)
        else:
            erry = 10.0**Num.asarray(erry)
            ppgplot.pgerry(x, Num.log10(10.0**y + erry),
                           Num.log10(10.0**y - erry), 1.0)
    # Plot connecting lines if requested
    if not line is None:
        # Choose the line style
        ppgplot.pgsls(line)
        # Choose the line width
        ppgplot.pgslw(width)
        ppgplot.pgline(x, y)