Esempio n. 1
0
def analyseHill(ekindicts):
    """make hist of n coefficents for hill fits"""

    import pylab
    pylab.rc('text', usetex=True)
    f=pylab.figure()
    f.suptitle('n distributions- No linear (case 3)')
    i=1
    for e in ekindicts:
        ekindata = ekindicts[e]
        proteins = ekindata.keys()
        nvals = []
        for prot in proteins:
            edata = ekindata[prot]
            E = EkinProject(data=edata)
            for d in E.datasets:
                fdata = E.getMetaData(d)
                if fdata != None and fdata.has_key('model'):
                    if fdata['model'] == 'Modified Hill':
                        n=fdata['n']
                        if n<5 and n>-5:
                            nvals.append(n)
                            print 'n=', n

        ax = f.add_subplot(2,2,i)
        n, b, patches = pylab.hist(nvals, 30, histtype='bar', alpha=0.8)
        std = round(numpy.std(nvals), 2)
        ave = round(numpy.mean(nvals), 2)
        ax.set_title(e +' mean= '+str(ave)+r' $\sigma$= '+str(std))
        i+=1
    f.subplots_adjust(hspace=0.4)
    f.savefig('n_hist.png')
    return
Esempio n. 2
0
def analyseHill(ekindicts):
    """make hist of n coefficents for hill fits"""

    import pylab
    pylab.rc('text', usetex=True)
    f = pylab.figure()
    f.suptitle('n distributions- No linear (case 3)')
    i = 1
    for e in ekindicts:
        ekindata = ekindicts[e]
        proteins = ekindata.keys()
        nvals = []
        for prot in proteins:
            edata = ekindata[prot]
            E = EkinProject(data=edata)
            for d in E.datasets:
                fdata = E.getMetaData(d)
                if fdata != None and fdata.has_key('model'):
                    if fdata['model'] == 'Modified Hill':
                        n = fdata['n']
                        if n < 5 and n > -5:
                            nvals.append(n)
                            print 'n=', n

        ax = f.add_subplot(2, 2, i)
        n, b, patches = pylab.hist(nvals, 30, histtype='bar', alpha=0.8)
        std = round(numpy.std(nvals), 2)
        ave = round(numpy.mean(nvals), 2)
        ax.set_title(e + ' mean= ' + str(ave) + r' $\sigma$= ' + str(std))
        i += 1
    f.subplots_adjust(hspace=0.4)
    f.savefig('n_hist.png')
    return
Esempio n. 3
0
    def showMetaData(self,
                     ekinproj=None,
                     ekindata=None,
                     dataset=None,
                     fdata=None,
                     silent=False):
        """Print html of fit and metadata for the given dataset"""

        if fdata == None:
            if ekinproj == None and ekindata != None:
                E = EkinProject(data=ekindata)
            else:
                E = ekinproj

            fdata = E.getMetaData(dataset)
        fsock = None
        if silent == True:
            saveout = sys.stdout
            sys.stdout = fsock = StringIO.StringIO()

        print '<table id="mytable">'
        print '<tr>'
        print '<td class="alt" style="bold" colspan=2>%s</td><tr>' % dataset
        kys = fdata.keys()
        ignore = ['error']
        for k in sorted(fdata):
            if k in ignore:
                continue
            if fdata[k] == None:
                continue
            elif type(fdata[k]) is types.DictType:
                print '<td>%s</td>' % k
                print '<td> <table id="mytable">'
                for n in fdata[k]:
                    val = fdata[k][n][1]
                    print '<td class="alt">%s</td><td>%.2f</td><tr>' % (n, val)
                print '</table></td><tr>'
            elif type(fdata[k]) is types.StringType:
                print '<td class="alt">%s</td><td>%s</td><tr>' % (k, fdata[k])

            else:
                print '<td class="alt">%s</td><td>%.2f</td><tr>' % (k,
                                                                    fdata[k])
        print '</table>'
        if silent == True:
            sys.stdout = saveout

        if fsock == None:
            return ''
        else:
            return fsock.getvalue()
        return
Esempio n. 4
0
    def showMetaData(self, ekinproj=None, ekindata=None, dataset=None, fdata=None, silent=False):
        """Print html of fit and metadata for the given dataset"""

        if fdata == None:
            if ekinproj == None and ekindata!=None:
                E = EkinProject(data=ekindata)
            else:
                E = ekinproj

            fdata = E.getMetaData(dataset)
        fsock = None
        if silent == True:
            saveout = sys.stdout
            sys.stdout = fsock = StringIO.StringIO()

        print '<table id="mytable">'
        print '<tr>'
        print '<td class="alt" style="bold" colspan=2>%s</td><tr>' % dataset
        kys = fdata.keys()
        ignore = ['error']
        for k in sorted(fdata):
            if k in ignore:
                continue
            if fdata[k] == None:
                continue
            elif type(fdata[k]) is types.DictType:
                print '<td>%s</td>' %k
                print '<td> <table id="mytable">'
                for n in fdata[k]:
                    val = fdata[k][n][1]
                    print '<td class="alt">%s</td><td>%.2f</td><tr>' %(n, val)
                print '</table></td><tr>'
            elif type(fdata[k]) is types.StringType:
                print '<td class="alt">%s</td><td>%s</td><tr>' %(k, fdata[k])

            else:
                print '<td class="alt">%s</td><td>%.2f</td><tr>' %(k, fdata[k])
        print '</table>'
        if silent == True:
            sys.stdout = saveout

        if fsock == None:
            return ''
        else:
            return fsock.getvalue()
        return