Beispiel #1
0
def dothatplot(whatphi):
    p = biggles.FramedArray(2, 1)
    x, y = makeplot(phi=whatphi, show="chi")
    x = list(x)
    y = list(y)
    x.append(0.)
    y.append(240.4)
    p[0, 0].add(biggles.Points(x, y, symboltype="filled circle"))
    p[0, 0].add(biggles.LineY(240.4))
    p[0, 0].add(biggles.LineY(240.4 + 1.))
    x, y = makeplot(phi=whatphi, show="area")
    x = list(x)
    y = list(y)
    x.append(0.)
    y.append(324.13)
    p[1, 0].add(biggles.Points(x, y, symboltype="filled circle"))
    #  p[1,0].add(biggles.LineY(324.13))
    #  p[1,0].add(biggles.LineY(324.13*0.99))
    p.xrange = 0., 3.
    p.ylabel = r"Area (MeV nb)               $\chi^2$"
    p.xlabel = r"$y_{ggg} / y_{qq} = sqrt(f B_{ggg} / B_{qq}$)"
    p[0, 0].yrange = 230., 330.
    p[1, 0].yrange = 310., 339.999
    p.title = r"Fit results with $\phi_g$ = " + str(whatphi) + r"$\degree$"
    p.write_eps("interference_nowwithphi_" + str(whatphi) + ".eps")
    p.show()
Beispiel #2
0
    def plotHistogram( self, *name, **arg ):
        """
        @param bins: number of bins (10)
        @type  bins: int
        @param ynormalize: normalize histograms to area 1.0 (False)
        @type  ynormalize: bool
        @param xnormalize: adapt bin range to min and max of all profiles (True)
        @type  xnormalize: bool
        @param xrange: min and max of bin range (None)
        @type  xrange: (float, float)
        @param steps: draw histogram steps (True)
        @type  steps: bool
        """
        if not biggles:
            raise ImportError, 'module biggles could not be imported'

        plot = biggles.FramedArray( len(name),1 )

        if not 'size' in arg:
            arg['size'] = 1
        
        bins = arg.get('bins', 10)
        hist = arg.get('ynormalize', False)
        steps= arg.get('steps', 1)
        histrange= arg.get('xrange', None)
        autorange= arg.get('xnormalize', histrange is None)
        
        xkey = arg.get('xkey', None)
        if xkey:
            plot.xlabel = xkey

        if autorange:
            v = []
            for keys in name:
                if not type(keys) is tuple:
                    keys = ( keys, )
                for key in keys:
                    v += list(self[key])
            histrange = ( min( v ), max( v ) )
            
        for i, keys in enumerate(name):
            
            if not type(keys) is tuple:
                keys = ( keys, )
                
            for j, key in enumerate(keys):

                h = density( self[key], nBins=bins, steps=steps, hist=hist,
                             range=histrange )
                x = h[:,0]
                y = h[:,1]
                
                colors = [0] + T.colorSpectrum( len(keys) , '00FF00', 'FF00FF')

                plot[i,0].add( biggles.Curve( x, y, color=colors[j], **arg ) )
    
                plot[i,0].add( biggles.PlotLabel( 0.7, 0.95-j*0.1, key,
                                                  color=colors[j] ) )

        return plot
Beispiel #3
0
def plot_autocorr(trials, window=100, show=False, **kw):
    import biggles
    import emcee

    arr = biggles.FramedArray(trials.shape[1], 1)
    arr.uniform_limits = True

    func = emcee.autocorr.function(trials)
    tau2 = emcee.autocorr.integrated_time(trials, window=window)

    xvals = numpy.arange(func.shape[0])
    zc = biggles.Curve([0, func.shape[0] - 1], [0, 0])

    for i in xrange(trials.shape[1]):
        pts = biggles.Curve(xvals, func[:, i], color='blue')

        lab = biggles.PlotLabel(0.9,
                                0.9,
                                r'$%s tau\times 2: %s$' % (i, tau2[i]),
                                halign='right')
        arr[i, 0].add(pts, zc, lab)

    if show:
        arr.show(**kw)

    return arr
Beispiel #4
0
    def plotMemberProfiles( self, *name, **arg ):
        """
        Plot profiles of all member trajectories seperately::
          plotMemberProfiles( name1, [name2, .. ],[ arg1=x,..])
            -> biggles.Table

        :param name: profile name(s)
        :type  name: str
        :param arg: pairs for biggles.Curve() and/or xlabel=..,ylabel=..
        :type  arg: key=value

        :return: biggles plot object
        :rtype: biggles.FramedArray()   
        """
        if not biggles:
            raise ImportError('biggles module could not be imported.')
        
        rows = self.n_members // 2 + self.n_members % 2
        page = biggles.FramedArray( rows , 2)

        biggles.configure('fontsize_min', 1)
        colors = T.colorSpectrum( len( name ) , '00FF00', 'FF00FF') 

        ml = self.memberList()

        i = 0
        minV = maxV = None

        for t in ml:

            for j in range( len(name)):

                p = t.profile( name[j] )

                if minV is None or minV > min( p ):
                    minV = min(p)
                if maxV is None or maxV < max( p ):
                    maxV = max(p)

                page[i//2, i%2].add( biggles.Curve( list(range( len(p))), list(p),
                                                   color=colors[j], **arg ) )

                page[i//2, i%2].add( biggles.PlotLabel( 0.8, 0.8-j/8.0, name[j],
                                                       color=colors[j]) )

            page[i//2, i%2].add( biggles.PlotLabel( 0.1, 0.9, 'Traj %i' % i))

            i += 1

        if self.n_members % 2 != 0:
            line = biggles.Line( (0,minV), (len(p),maxV) )
            page[ self.n_members//2, 1 ].add( line )

        page.uniform_limits = 1
        page.xlabel = arg.get('xlabel',None)
        page.ylabel = arg.get('ylabel',None)

        return page
 def get_page(self, page):
     pr, pc = self.page_shape
     filename = self.filename % page
     plot = biggles.Table(1, pc)
     for i in range(pc):
         plot[0, i] = biggles.FramedArray(pr, 1)
     self.canvas = {
         'filename': filename,
         'plot': plot,
     }
Beispiel #6
0
    def test_example10(self):
        from numpy import log10, logspace, random

        # set up some data
        x = logspace(log10(0.1), log10(10.0), 10)

        model = 1.0 / x
        yerr = 0.1 * model
        y = model + yerr * random.normal(size=x.size)

        yratio = y / model
        yratio_err = yerr / model

        # build the FramedArray.  Note the x axis
        # is set to log for all plots
        a = biggles.FramedArray(
            2,
            1,
            xlog=True,
            aspect_ratio=1.2,
            xlabel=r'$R [h^{-1} Mpc]$',
            row_fractions=[0.75, 0.25],
        )

        color = 'blue'
        sym = 'filled circle'

        mcurve = biggles.Curve(x, model)
        pts = biggles.Points(x, y, type=sym, color=color)
        epts = biggles.SymmetricErrorBarsY(x, y, yerr, color=color)

        pts.label = 'data'
        mcurve.label = '1/x'

        key = biggles.PlotKey(0.9, 0.9, [pts, mcurve], halign='right')

        a[0, 0] += pts, epts, mcurve, key
        a[0, 0].ytitle = r'$\Delta\Sigma  [M_{\odot} pc^{-2}]$'
        a[0, 0].yrange = [0.05, 20.0]
        a[0, 0].xrange = [0.05, 20.0]
        a[0, 0].ylog = True  # log y axis only for the top plot

        a[1, 0] += biggles.Points(x, yratio, type=sym, color=color, size=3)
        a[1, 0] += biggles.SymmetricErrorBarsY(x,
                                               yratio,
                                               yratio_err,
                                               color=color)
        a[1, 0] += biggles.Curve(x, x * 0 + 1)
        a[1, 0].ytitle = r'$ratio$'
        a[1, 0].yrange = [0.5, 1.5]

        _write_example(10, a)
Beispiel #7
0
    def plotArray(self, *name, **arg):
        """
        Plot several profiles as a panel of separate plots.
        :param *name: one or more profile names or tuples of profile names
        :type  *name: str or (str, str,...)
        :param xkey: profile to be used as x-axis (default: None)
        :type  xkey: str
        :param arg: key=value pairs for Biggles.Curve() function
        :type  arg: 

        :return: plot, view using plot.show() 
        :rtype: biggles.FramedPlot

        :raise TypeError: if profile contains non-number items
        :raise ImportError: If biggles module could not be imported
        """
        if not biggles:
            raise ImportError('module biggles could not be imported')

        plot = biggles.FramedArray(len(name), 1)

        if not 'size' in arg:
            arg['size'] = 1

        xkey = arg.get('xkey', None)
        if xkey:
            plot.xlabel = xkey

        for i, keys in enumerate(name):

            if not type(keys) is tuple:
                keys = (keys, )

            for j, key in enumerate(keys):

                x = self.get(xkey, list(range(self.profLength())))
                y = self[key]

                colors = [0] + T.colorSpectrum(len(keys), '00FF00', 'FF00FF')

                plot[i, 0].add(biggles.Curve(x, y, color=colors[j], **arg))

                plot[i, 0].add(
                    biggles.PlotLabel(0.7,
                                      0.95 - j * 0.1,
                                      key,
                                      color=colors[j]))

        return plot
Beispiel #8
0
    def plotArray(self, xkey, *ykey, **arg):
        """
        Plot pairs of item values.

        C{ EXAMPLE: plot( xkey, [ykey1, ykey2..],[arg1=x, arg2=y]) }
        C{         -> biggles.FramedPlot                           }

        @param xkey: key for x-values
        @type  xkey: any
        @param ykey: key for y-values
        @type  ykey: any
        @param arg: arguments handed over to biggles.Points()
        @type  arg: any

        @return: Biggles.FramedArray, display with show()
        @rtype: Biggles.FramedArray
        """
        if not biggles:
            raise ImportError, 'biggles module could not be imported.'

        if len(ykey) == 0:
            xkey, ykey = 'index', [xkey]

        plot = biggles.FramedArray(len(ykey), 1)

        plot.xlabel = xkey

        colors = C.colorRange(len(ykey))

        if not 'size' in arg:
            arg['size'] = 1

        for i in range(len(ykey)):

            x = range(len(self))
            if xkey != 'index':
                x = self.valuesOf(xkey)

            y = self.valuesOf(ykey[i])

            x, y = self.__maskNone(x, y)

            plot[i, 0].add(biggles.Points(x, y, color=colors[i], **arg))

            plot[i,
                 0].add(biggles.PlotLabel(0.2, 0.95, ykey[i], color=colors[i]))

        return plot
Beispiel #9
0
def plotthree(h,
              title,
              filename=None,
              ghigh=0.966 * nbha["high"],
              ghoff=nbha["hoff"],
              glow=0.966 * nbha["low"],
              gloff=nbha["loff"]):
    #   hups = h["high"] - h["hoff"]*ptoc_high
    #   lups = h["low"] - h["loff"]*ptoc_low
    #   frac = hups/lups * 1.*ngam["low"]/ngam["high"]

    #   hups = h["high"]/float(ngam["high"]) - h["hoff"]/float(ngam["hoff"])
    #   lups = h["low"]/float(ngam["low"]) - h["loff"]/float(ngam["loff"])
    #   frac = hups/lups

    hups = h["high"] / float(ghigh) - h["hoff"] / float(ghoff)
    lups = h["low"] / float(glow) - h["loff"] / float(gloff)
    frac = hups / lups

    wm = jt.wmean(zip(frac.values, frac.errors))[0]

    sigmas = []
    for i in range(frac.bins):
        if frac.errors[i] > 0.:
            sigmas.append((frac.values[i] - wm) / frac.errors[i])
        else:
            sigmas.append(0.)

    p = biggles.FramedArray(3, 1)
    addtoplot(p[0, 0], hups)
    p[0, 0].yrange = 0., max(hups.values) * 1.1

    addtoplot(p[1, 0], frac)
    p[1, 0].add(biggles.LineY(wm))
    p[1, 0].yrange = 0.701, 1.299

    p[2, 0].add(biggles.Points(frac.bin_centers(), sigmas))
    p[2, 0].add(biggles.LineY(0.))
    p[2, 0].yrange = -4., 4.

    p.xlabel = title
    p.show()
    if filename != None: p.write_eps(filename)
Beispiel #10
0
def test_example5():
    x = numpy.arange(0, 3 * numpy.pi, numpy.pi / 10)
    y = numpy.sin(x)

    a = biggles.FramedArray(2, 2, title='title')
    a.aspect_ratio = 0.75
    a.xlabel = "x label"
    a.ylabel = "y label"
    a.uniform_limits = 1
    a.cellspacing = 1.

    a += biggles.LineY(0, type='dot')
    a += [biggles.LineY(-1, type='dashed'), biggles.LineY(1, type='dashed')]

    a[0, 0].add(biggles.Curve(x, .25 * y))
    a[0, 1].add(biggles.Curve(x, .50 * y))
    a[1, 0].add(biggles.Curve(x, .75 * y))
    a[1, 1].add(biggles.Curve(x, y))

    _write_example(5, a)
 def _create_hpage_stacked(self):
     V, H, S, M, N = self.target_shape
     v, h, m, n = self.pointer
     page = biggles.Table(1, M)
     for i in range(M):
         page[0, i] = biggles.FramedArray(N, 1)
         if self.xlabel is not None:
             page[0, i].xlabel = self.xlabel
         if self.ylabel is not None:
             page[0, i].ylabel = self.ylabel
         r, c1, _, c2 = self.to_rowcol((v, h, i, 0)) + self.to_rowcol(
             (v, h, i, N - 1))
         if self.rowcol_labels:
             page[0, i].title = 'Row %2i  Cols %2i-%2i' % (r, c1, c2)
         if self.col_labels:
             page[0, i].title = 'Cols %2i-%2i' % (c1, c2)
         if self.row_labels:
             page[0, i].title = 'Rows %2i-%2i' % (c1, c2)  # :P
     if self.title is not None:
         page.title = self.title
     return page
Beispiel #12
0
    def plotArray(self, xkey, *ykey, **arg):
        """
        Plot pairs of info values.::
          plot( xkey, [ykey1, ykey2..],[arg1=x, arg2=y]) -> biggles.FramedArray

        @param xkey: key specifying x-values
        @type  xkey: str
        @param ykey: key specifying y-values
        @type  ykey: str OR [str]
        @param arg: additional biggles arguments
        @type  arg: key=value

        @return: biggles plot object
        @rtype: biggles.FramedArray        
        """
        if not biggles:
            raise ImportError('biggles module could not be imported.')

        plot = biggles.FramedArray(len(ykey), 1)

        plot.xlabel = xkey

        colors = t.colorSpectrum(len(ykey))

        if not 'size' in arg:
            arg['size'] = 1

        for i in range(len(ykey)):

            x = self.valuesOf(xkey)
            y = self.valuesOf(ykey[i])

            x, y = self.__maskNone(x, y)

            plot[i, 0].add(biggles.Points(x, y, color=colors[i], **arg))

            plot[i,
                 0].add(biggles.PlotLabel(0.2, 0.95, ykey[i], color=colors[i]))

        return plot
Beispiel #13
0
#!/usr/bin/env python

import sys
sys.path.insert(1, '..')

import biggles
import math, numpy

x = numpy.arange(0, 3 * math.pi, math.pi / 10)
y = numpy.sin(x)

a = biggles.FramedArray(2, 2, title='title')
a.aspect_ratio = 0.75
a.xlabel = "x label"
a.ylabel = "y label"
a.uniform_limits = 1
a.cellspacing = 1.

a.add(biggles.LineY(0, type='dot'))

a[0, 0].add(biggles.Curve(x, .25 * y))
a[0, 1].add(biggles.Curve(x, .50 * y))
a[1, 0].add(biggles.Curve(x, .75 * y))
a[1, 1].add(biggles.Curve(x, y))

#a.write_img( 400, 400, "example5.png" )
#a.write_eps( "example5.eps" )
a.show()
        math.sqrt((float(b3) / float(n3)) * (1. - float(b3) / float(n3)) /
                  float(n3)))
    block4.append(float(b4) / float(n4))
    block4err.append(
        math.sqrt((float(b4) / float(n4)) * (1. - float(b4) / float(n4)) /
                  float(n4)))
    block5.append(float(b5) / float(n5))
    block5err.append(
        math.sqrt((float(b5) / float(n5)) * (1. - float(b5) / float(n5)) /
                  float(n5)))
    block6.append(float(b6) / float(n6))
    block6err.append(
        math.sqrt((float(b6) / float(n6)) * (1. - float(b6) / float(n6)) /
                  float(n6)))

p1 = biggles.FramedArray(2, 1)
p1[0,
   0].add(biggles.Points(rnum, eff, symboltype="filled circle",
                         symbolsize=0.2))
p1[0, 0].add(biggles.SymmetricErrorBarsY(rnum, eff, efferr))
p1[0, 0].add(biggles.LineY(1., linetype="dotted"))
p1[0, 0].yrange = (0.987, 1.005)
p1[0, 0].xrange = (min(rnum) - 100, max(rnum) + 100)
p1[1,
   0].add(biggles.Points(rnum, eff, symboltype="filled circle",
                         symbolsize=0.2))
p1[1, 0].add(biggles.SymmetricErrorBarsY(rnum, eff, efferr))
p1[1, 0].add(biggles.LineY(1., linetype="dotted"))
p1[1, 0].yrange = (0.8, 1.1)
p1[1, 0].xrange = (min(rnum) - 100, max(rnum) + 100)
p1.xlabel = "Run number"
Beispiel #15
0
#######################
## dump plot data
#dump( {'diff_area':diff_area, 'rank_area':rank_area,
#       'rmsd_all_dic':rmsd_all_dic, 'rmsd_surf_dic':rmsd_surf_dic} ,dumpFile )

#################################################
##### profile plots of best solutions
plots = 4

## add aditional plot as specified in options
additional = options.get('additional_profile', None)
if additional:
    aRec, aLig = toIntList(additional)
    plots = 5

b = biggles.FramedArray(plots, 1)
b.title = cName
b.xlabel = 'solution'
b.ylabel = 'fraction of native contacts'

## xray
b[0, 0].add(biggles.Curve(range(512), data[0][0]))
b[0, 0].add(biggles.PlotLabel(.5, .95, 'Xray', size=4))

## best solutions
r, l = best_soln[0], best_soln[1]
b[1, 0].add(biggles.Curve(range(512), data[r - 1][l - 1]))
label = 'the highest number of good scoring solutions (%i/%i)' % (r, l)
b[1, 0].add(biggles.PlotLabel(.5, .95, label, size=4))

## best rank
Beispiel #16
0
# set up some data
x = logspace(log10(0.1), log10(10.0), 10)

model = 1.0 / x
yerr = 0.1 * model
y = model + yerr * random.normal(size=x.size)

yratio = y / model
yratio_err = yerr / model

# build the FramedArray.  Note the x axis
# is set to log for all plots
a = biggles.FramedArray(
    2,
    1,
    xlog=True,
    aspect_ratio=1.2,
    xlabel=r'$R [h^{-1} Mpc]$',
    row_fractions=[0.75, 0.25],
)

color = 'blue'
sym = 'filled circle'

mcurve = biggles.Curve(x, model)
pts = biggles.Points(x, y, type=sym, color=color)
epts = biggles.SymmetricErrorBarsY(x, y, yerr, color=color)

pts.label = 'data'
mcurve.label = '1/x'

key = biggles.PlotKey(0.9, 0.9, [pts, mcurve], halign='right')
Beispiel #17
0
    for key in keys[1:]:
        data += [transpose(c_lst.valuesOf(key))]

    for i in range(len(data)):
        if sum([j == None for j in data[i]]) > 0:
            print '\n################################'
            print 'Info data for %s == None for at least one complex' % keys[i]
            print 'Plotting will fail for this key.'
            print '################################\n'
        else:
            print 'Data for %s is OK' % keys[i]

    if options['if']:
        ## Array plot - rmsd vs. fnc
        ap = biggles.FramedArray(2, 2, title=nameFromPath(options['i']))
        ap.uniform_limits = 1

        ## labels
        ap.ylabel = 'fraction of native contacts'
        ap.xlabel = 'interface rmsd'

        x_key = 'rms_if'

        for plot in subPlot(data, keys, x_key, pkeys[0]):
            ap[0, 0].add(plot)

        for plot in subPlot(data, keys, x_key, pkeys[1]):
            ap[0, 1].add(plot)

        for plot in subPlot(data, keys, x_key, pkeys[2]):
Beispiel #18
0

(RunRecord, run) = cPickle.load(open("daf9/lumis.p"))

x = []
y = []
yerr = []
n = []
for r, ru in run.iteritems():
    x.append(r)
    frac = float(ru.numer_region) / float(ru.denom_region)
    y.append(frac)
    yerr.append(math.sqrt(frac * (1. - frac) / float(ru.denom_region)))
    n.append(float(ru.denom_region))

fracerrs = biggles.FramedArray(2, 1)
fracerrs.uniform_limits = 0
fracerrs[0, 0].add(
    biggles.Points(x, y, symboltype="filled circle", symbolsize=0.5))
fracerrs[0, 0].add(biggles.SymmetricErrorBarsY(x, y, yerr))
fracerrs[0, 0].yrange = (0.99, 1.0)
fracerrs[1, 0].add(
    biggles.Points(x, y, symboltype="filled circle", symbolsize=0.5))
fracerrs[1, 0].add(biggles.SymmetricErrorBarsY(x, y, yerr))
fracerrs[1, 0].yrange = (0.8, 1.02)
fracerrs.xlabel = "Run numbers"
fracerrs.ylabel = "BhabhaBarrel trigger efficiency"
fracerrs.show()
fracerrs.write_eps("plottrig_1.eps")

ylow, nlow = zip(*filter(lambda (yi, ni): yi < 0.99, zip(y, n)))
      den += run[r].denom[i,j]
  tmp = float(num)/float(den)
  b.append(tmp)
  berr.append(math.sqrt(tmp*(1.-tmp)/float(den)))

  num = 0
  den = 0
  for i in range(76, 82):
    for j in range(59, 62):
      num += run[r].numer[i,j]
      den += run[r].denom[i,j]
  tmp = float(num)/float(den)
  c.append(tmp)
  cerr.append(math.sqrt(tmp*(1.-tmp)/float(den)))

p = biggles.FramedArray(3,1)
p[0,0].add(biggles.Points(runnumbers, a, symboltype="filled circle", symbolsize=0.5))
p[0,0].add(biggles.SymmetricErrorBarsY(runnumbers, a, aerr))
p[0,0].yrange = (0., 1.1)
p[1,0].add(biggles.Points(runnumbers, b, symboltype="filled circle", symbolsize=0.5))
p[1,0].add(biggles.SymmetricErrorBarsY(runnumbers, b, berr))
p[1,0].yrange = (0., 1.1)
p[2,0].add(biggles.Points(runnumbers, c, symboltype="filled circle", symbolsize=0.5))
p[2,0].add(biggles.SymmetricErrorBarsY(runnumbers, c, cerr))
p[2,0].yrange = (0., 1.1)
p.xlabel = r"$\epsilon$ of blocks A, B, C versus run"

p[0,0].add(biggles.LineX(122354, linetype="longdashed"))
p[1,0].add(biggles.LineX(122354, linetype="longdashed"))
p[2,0].add(biggles.LineX(122354, linetype="longdashed"))
p[2,0].add(biggles.DataLabel(122354+70, 0.2, "122354 (in 3S db17)", texthalign="left"))
p.aspect_ratio = 0.8
p.show()
p.write_eps("plots/cesrv_correlation.eps")

#############################################################

myarea, myrmsbeam, myback, myjan16, myjan30, myfeb06, myfeb13, myfeb20, myfeb27, mymar06, mymar13, myapr03, myapr08, myapr09, myapr10, myfullgam, myyint, myphi, mybtautau, mytauyint, mytauphi, mytwophofrac = ggfits[1].values

x = Numeric.arange(9460.-30., 9460.+30., 0.1)
y = Numeric.arange(9460.-30., 9460.+30., 0.1)
y = map(lambda en: 8.686*9460.30**2/en**2 + myarea * mygbwkf(9460.30, myfullgam, myrmsbeam, 0.588, 0., en) / 0.9253 * 0.0249 * 0.298667/2.66667, y)
x2 = Numeric.arange(9460.-30., 9460.+30., 0.1)
y2 = Numeric.arange(9460.-30., 9460.+30., 0.1)
y2 = map(lambda en: 8.686*9460.30**2/en**2 + myarea * mygbwkf(9460.30, myfullgam, myrmsbeam, 0., 0., en) / 0.9253 * 0.0249 * 0.298667/2.66667, y2)

p = biggles.FramedArray(2,1)
p[0,0].add(biggles.Curve(x2, y2, linetype="dashed"))
p[0,0].add(biggles.Curve(x, y))
p[1,0].add(biggles.Curve(x, y))
p.xrange = 9460.-30., 9460.+30.
p[0,0].yrange = 8.6, 8.8
p[1,0].yrange = 0., 9.9999
p.xlabel = r"2 $\times$ beam energy (MeV)"
p.ylabel = r"outer $e^+e^-$ effective cross-section (nb)"
p.aspect_ratio = 0.8
p.show()
p.write_eps("plots/bbout_effective_crosssection.eps")


p = biggles.FramedPlot()
p.add(biggles.Curve(x2, y2, linetype="dashed"))
Beispiel #21
0
cleanup(rec_pdbs)

## Plot results
##
import biggles

## get individual energy terms, remove non calculated terms
for t in bind.keys():
    zero_mask = [bind[k] == 0.0 for k in bind.keys()]
    e_val = transpose(compress(logical_not(zero_mask), l_energy))
    e_key = sum(transpose(take(bind.keys(), nonzero(sum(l_energy)))))
    e_key = [string.strip(key) for key in e_key]

## initiale FramedArray
biggles.configure('fontsize_min', .5)
p = biggles.FramedArray(len(e_key), 1)

## labels etc.
p.title = '/'.join(string.split(options['o'], '/')[-4:-1])
p.xlabel = 'fraction of native contacts'
p.ylabel = 'fold_X binding energy'

## Y-data
d0 = biggles.Points(l_fnc, l_tot, type='circle', size=1)

p_energy = []
p_label = []
p_average = []
p_reference = []
p_histogram = []
p_popLines = []
correction_factor_err = []
for r in testsample:
    num = runrec[r].bhabha_cotTnumer.sum(0.1, 1.23)
    den = runrec[r].bhabha_cotTdenom.sum(0.1, 1.23)
    frac = float(num) / float(den)
    correction_factor_err.append(math.sqrt(frac * (1. - frac) / float(den)))

    corhist = (runrec[r].gamgam_cotT /
               runrec[r].bhabha_cotTnumer.divide_by_superset(
                   runrec[r].bhabha_cotTdenom))
    den = corhist.sum(0.1, 1.23)
    num = runrec[r].gamgam_cotT.sum(0.1, 1.23)
    frac = float(num) / float(den)
    correction_factor.append(frac)

p = biggles.FramedArray(1, 2)
p[0, 0].add(biggles.Points(testsample, correction_factor,
                           type="filled circle"))
p[0, 0].add(
    biggles.SymmetricErrorBarsY(testsample, correction_factor,
                                correction_factor_err))
p[0, 0].yrange = 0.98, 1.
p[0, 0].xrange = 121400, 123200
p[0, 0].add(biggles.LineX(122226, type="longdashed"))
p[0, 1].add(biggles.Points(testsample, correction_factor,
                           type="filled circle"))
p[0, 1].add(
    biggles.SymmetricErrorBarsY(testsample, correction_factor,
                                correction_factor_err))
p[0, 1].yrange = 0.98, 1.
p[0, 1].xrange = 128102, 128164