Esempio n. 1
0
def plotdeltaframe(fname, k):
    d = genplotlib.gendict_phase(fname, 'deltaframe')
    md = genplotlib.genlist(d)

    n = []
    for i, v in d.iteritems():
        n.append(max(v))
    print(n)

    plt.figure()
    genplotlib.plotdata(d,
                        md,
                        k,
                        's',
                        'Delay (frames)',
                        'Frame delay',
                        ymin=0,
                        ylim=max(n) + 5)
    plt.savefig('deltaframe_summ')

    plt.figure()
    genplotlib.plotdata(d,
                        md,
                        k,
                        'b',
                        'Delay (frames)',
                        'Frame delay',
                        ymin=0,
                        ylim=max(n) + 5)
    plt.savefig('deltaframe_summ_bar')
Esempio n. 2
0
def plotnlpersec(capfile):
    n = pcapm.gendictnps(capfile)
    mn = pcapm.genlist(n)
    l = n.keys()
    genplotlib.plotdata(n, mn, l, 's', 'nL/sec', 'Amount consumed \n nL/sec', ylim=10, 
            titlesize='x-large', xlabelsize='medium', xstart=0.25)
    plt.savefig('pooled_cap_nlpersec')
Esempio n. 3
0
def plotdeltatime(fname, k):
    d = genplotlib.gendict_phase(fname, 'deltatime')
    md = genplotlib.genlist(d)

    n = []
    for i, v in d.iteritems():
        n.append(max(v))
    print(n)

    plt.figure()
    genplotlib.plotdata(d,
                        md,
                        k,
                        's',
                        'Delay (seconds)',
                        'Time delay',
                        ymin=0.05,
                        ylim=(max(n) + 0.1 * max(n)))
    plt.savefig('deltatime_summ')

    plt.figure()
    genplotlib.plotdata(d,
                        md,
                        k,
                        'b',
                        'Delay (seconds)',
                        'Time delay',
                        ymin=0.05,
                        ylim=(max(n) + 0.1 * max(n)))
    plt.savefig('deltatime_summ_bar')
Esempio n. 4
0
def plotpixpersec(capfile):
    
    p = pcapm.gendictpps(capfile)
    mp = pcapm.genlist(p)
    k = p.keys()
    genplotlib.plotdata(p, mp, k, 's', 'pix/sec', 'Amount consumed \n pixels/sec', ylim=10, 
            titlesize='x-large', xlabelsize='medium', xstart=0.25)
    plt.savefig('pooled_cap_pixpersec')
    plt.close()
Esempio n. 5
0
def plotandsavepooledscatterplot(p_peakf_file, roi):
    """Plots scatter plot from data in 'peakf.txt' and saves it in the summary directory. Run from a 
    data/ or summary/ folder."""
    
    dictdata = genplotlib.gendict(p_peakf_file)
    dictmeans = genplotlib.genlist(dictdata)
    keylist = genplotlib.genkeylist(dictdata)
    genplotlib.plotdata(dictdata, dictmeans, keylist, 's', ylabel='Hz', ftitle='Mean pumping ' + 
    'frequency '+roi)
    plt.savefig('pooled_freq_scatter_'+roi)
Esempio n. 6
0
def plotandsavescatterplot_poolrois(fname, keylist, fdir='.', ylim=10):
    """Plots bar graph from data in 'peakf_pooled.txt' and saves it in the summary directory. Run from a 
    data/ or summary/ folder."""
    
    dictdata = genplotlib.gendict(fname)
    dictmeans = genplotlib.genlist(dictdata)
    #~ keylist = genplotlib.genkeylist(dictdata)
    genplotlib.plotdata(dictdata, dictmeans, keylist, 's', ylabel='Hz', ftitle='Mean frequency', 
    ylim=ylim)
    plt.savefig('dftf_freq_scatter_pooled')
Esempio n. 7
0
def plotandsavescatterplot(roiname, keylist, fdir='.', ylim=10):
    """Plots scatter plot from data in 'peakf.txt' and saves it in the summary directory. Run from a 
    data/ or summary/ folder."""
    
    dictdata = genplotlib.gendict(genpeakffname_roi(roiname, fdir))
    dictmeans = genplotlib.genlist(dictdata)
    #~ keylist = genplotlib.genkeylist(dictdata)
    genplotlib.plotdata(dictdata, dictmeans, keylist, 's', ylabel='Hz', ftitle='Mean pumping ' + 
    'frequency '+roiname, ylim=ylim)
    savegraph('dftf_freq_scatter_'+roiname, roiname)
Esempio n. 8
0
def plotdur(k, fname, type='s', ymax=30):
    plt.figure()
    d = genplotlib.gendictgc(fname)[2]
    md = genplotlib.genlist(d)
    print('Duration')
    for tastant, values in d.iteritems():
        print(tastant, np.max(values))
    
    if type == 'b':
        genplotlib.plotdata(d, md, k, 'b', 'seconds', 'Duration', 0, ymax, xlabelsize='medium')
    if type == 's':
        genplotlib.plotdata(d, md, k, 's', 'seconds', 'Duration', -5, ymax+10, xlabelsize='medium')
Esempio n. 9
0
def plotpeak(k, fname, type = 's', ymax=1.0):
    plt.figure()
    d = genplotlib.gendictgc(fname)[0]
    md = genplotlib.genlist(d)
    print('Peak')
    for tastant, values in d.iteritems():
        print(tastant, np.max(values))
    if type == 'b':
        genplotlib.plotdata(d, md, k, 'b', '%', 'Peak deltaF/F', 0, ymax, xlabelsize='medium')
    if type == 's':
        genplotlib.plotdata(d, md, k, 's', 'Peak deltaF/F', 'Peak deltaF/F', -0.4, ymax+0.6, 
        xlabelsize='medium')
Esempio n. 10
0
def bg_key(p_peakf_file, keyfile, roi):
    dictdata = genplotlib.gendict(p_peakf_file)
    dictmeans = genplotlib.genlist(dictdata)
    keylist = cmn.load_keys(keyfile)
    
    dictdata2 = {}
    for k in keylist:
        dictdata2[k] = dictdata[k]
    
    genplotlib.plotdata(dictdata2, dictmeans, keylist, 'b', ylabel='Hz', 
            ftitle='Mean pumping frequency', xlabelsize = 'medium')
    plt.savefig('pooled_dftf_freq_bar_'+roi)
Esempio n. 11
0
def pool_per_results():
    
    homefol = os.path.abspath('.')
    
    pooled_perfile = 'pooled_perfile.txt'
    if os.path.exists(pooled_perfile) == True:
        os.remove(pooled_perfile)
    
    
    
    for expt in EXPTS:
        exptpath = os.path.join(os.path.abspath('../../'), expt)
        print(exptpath)
        os.chdir(exptpath)
        perfiles = glob.glob('*percheck.txt')
        #print(perfiles)
        try:
            perfile = os.path.join(exptpath, perfiles[0])
        except IndexError:
            print('No perfile')
            os.chdir(homefol)
            continue
        
        
        os.chdir(homefol)
        with open(pooled_perfile, 'a') as g:
            with open(perfile, 'r') as f:
                f.next()
                for l in f:
                    name, cond, per = l.strip('\n').split(',')[0:3]
                    print(cond)
                    try:
                        condi = condcurr.index(cond)
                        cond = condnew[condi]
                    except:
                        pass
                    print(cond)
                    
                    g.write(name+','+cond+','+per+'\n')
                    
        
        
    os.chdir(homefol)
    d = genplotlib.gendictper2(pooled_perfile)
    md = gfplot.genpercent_noci(d)
    k = genplotlib.genkeylist(md)
    
    print(md)
    genplotlib.plotdata(d, md, k, 'b', ylabel='Probability of PER', ftitle='PER', ylim=120, xlabelsize='large')
    plt.savefig('pooled_per_bar')
    plt.close()
    genplotlib.plotdata(d, md, k, 's', ylabel='Probability of PER', ftitle='PER', ylim=120, xlabelsize='large')
    plt.savefig('pooled_per_scatter')
Esempio n. 12
0
def plotfreqs(file, type):
    """Plots the frequencies taken from the summary text files ('fname') with the title 'ftitle'; 
    can plot either per bin or per fly depending on the summary file."""
    
    ftitle = 'Frequencies ({0})'.format(type)
    
    d = genplotlib.gendict_freq(file)
    md = genplotlib.genlist(d)
    keylist = genplotlib.genkeylist(d)
    genplotlib.plotdata(d, md, keylist, 's', ftitle=ftitle, err='stdev', ylim=8, ylabel='Hz')
    name = 'pooled_freqs_{0}'.format(type)
    plt.savefig(name)
Esempio n. 13
0
def plotbar(dictdata, keylist, plotname, fdir='.', ylim=10):
    """Plots bar graph from data in 'peakf.txt' and saves it in the summary directory. Run from a 
    data/ or summary/ folder."""
    
    dictmeans = genplotlib.genlist(dictdata)
    n = []
    for i, v in dictdata.iteritems():
        n.append(max(v))
    
    plt.figure()
    genplotlib.plotdata(d, md, k, 'b', 'Delay (seconds)', 'Time delay', ymin=0.05, ylim=(max(n)))
    plt.savefig(plotname)
Esempio n. 14
0
def plotbar(dd, md, k):
    
    k = load_keys(keyfile)

    n = []
    for i, v in dd.iteritems():
        n.append(max(v))
    plt.figure()
    #gpl.plotdata(dd, md, K, 'b', 'nL', 'Volume per pump', ymin=0, ylim=max(n)+0.1*max(n))
    gpl.plotdata(dd, md, k, 'b', 'nL', 'Volume per pump', ymin=0, ylim=4)

    plt.savefig(plotname)
Esempio n. 15
0
def plotdyearea_3d2(fname, k):
    plt.figure()
    d = genplotlib.gendictgc2(fname)[3]
    #~ print(d)
    md = genplotlib.genlist(d)
    print(md)
    #~ print('Dye Area Max Values')
    #~ for tastant, values in d.iteritems():
        #~ print(tastant, np.max(values))
    genplotlib.plotdata(d, md, k, 'b', 'Normalized Area', 'Dye Area', -0.001, 0.05, xlabelsize='medium')
    plt.savefig('dyearea_b')
    genplotlib.plotdata(d, md, k, 's', 'Normalized Area', 'Dye Area', -.01, 0.12, xlabelsize='medium')
    plt.savefig('dyearea_s')
Esempio n. 16
0
def plotcibareacirc(cibresultsfile):
    d = genplotlib.gendict_cibarea_circ(cibresultsfile)
    md = genplotlib.genlist(d)
    k = d.keys()
    genplotlib.plotdata(d,
                        md,
                        k,
                        'b',
                        'Normalized cib area',
                        'Cib area',
                        ymin=0,
                        ylim=100)
    plt.savefig('pooled_cibareacirc')
Esempio n. 17
0
def plotarea(k, fname, type='s', ymax=10):
    plt.figure()
    d = genplotlib.gendictgc(fname)[1]
    md = genplotlib.genlist(d)
    print('Area')
    for tastant, values in d.iteritems():
        print(tastant, np.max(values))
    if type == 'b':
        genplotlib.plotdata(d, md, k, 'b', 'intensity-seconds', 'Area under curve', 0, ymax,
                xlabelsize='medium')
    if type == 's':
        genplotlib.plotdata(d, md, k, 's', 'Area under curve', 'Area under curve', 0, ymax+15,i
                xlabelsize='medium')
Esempio n. 18
0
def plotandsavepooledscatterplot(p_peakf_file, roi):
    """Plots scatter plot from data in 'peakf.txt' and saves it in the summary directory. Run from a 
    data/ or summary/ folder."""

    dictdata = genplotlib.gendict(p_peakf_file)
    dictmeans = genplotlib.genlist(dictdata)
    keylist = genplotlib.genkeylist(dictdata)
    genplotlib.plotdata(dictdata,
                        dictmeans,
                        keylist,
                        's',
                        ylabel='Hz',
                        ftitle='Mean pumping ' + 'frequency ' + roi)
    plt.savefig('pooled_freq_scatter_' + roi)
Esempio n. 19
0
def plotnlpersec(capfile):
    n = pcapm.gendictnps(capfile)
    mn = pcapm.genlist(n)
    l = n.keys()
    genplotlib.plotdata(n,
                        mn,
                        l,
                        's',
                        'nL/sec',
                        'Amount consumed \n nL/sec',
                        ylim=10,
                        titlesize='x-large',
                        xlabelsize='medium',
                        xstart=0.25)
    plt.savefig('pooled_cap_nlpersec')
Esempio n. 20
0
def plotdeltaframe(fname, k):
    d = genplotlib.gendict_phase(fname, 'deltaframe')
    md = genplotlib.genlist(d)
    
    n = []
    for i, v in d.iteritems():
        n.append(max(v))
    print(n)
    
    plt.figure()
    genplotlib.plotdata(d, md, k, 's', 'Delay (frames)', 'Frame delay', ymin=0, ylim=max(n)+5)
    plt.savefig('deltaframe_summ')
    
    plt.figure()
    genplotlib.plotdata(d, md, k, 'b', 'Delay (frames)', 'Frame delay', ymin=0, ylim=max(n)+5)
    plt.savefig('deltaframe_summ_bar')
Esempio n. 21
0
def bg_key(p_peakf_file, keyfile, roi):
    dictdata = genplotlib.gendict(p_peakf_file)
    dictmeans = genplotlib.genlist(dictdata)
    keylist = cmn.load_keys(keyfile)

    dictdata2 = {}
    for k in keylist:
        dictdata2[k] = dictdata[k]

    genplotlib.plotdata(dictdata2,
                        dictmeans,
                        keylist,
                        'b',
                        ylabel='Hz',
                        ftitle='Mean pumping frequency',
                        xlabelsize='medium')
    plt.savefig('pooled_dftf_freq_bar_' + roi)
Esempio n. 22
0
def plotpixpersec(capfile):

    p = pcapm.gendictpps(capfile)
    mp = pcapm.genlist(p)
    k = p.keys()
    genplotlib.plotdata(p,
                        mp,
                        k,
                        's',
                        'pix/sec',
                        'Amount consumed \n pixels/sec',
                        ylim=10,
                        titlesize='x-large',
                        xlabelsize='medium',
                        xstart=0.25)
    plt.savefig('pooled_cap_pixpersec')
    plt.close()
Esempio n. 23
0
def plotpixpersec(capfile, k):
    """capfile is the summary file, k is the keylist"""

    p = gendictpps(capfile)
    mp = genlist(p)
    gp.plotdata(p,
                mp,
                k,
                's',
                'pix/sec',
                'Amount consumed \n pixels/sec',
                ylim=10,
                titlesize='x-large',
                xlabelsize='medium',
                xstart=0.25)
    plt.savefig('cap_pixpersec')
    plt.close()
Esempio n. 24
0
def plotdeltatime(fname, k):
    d = genplotlib.gendict_phase(fname, 'deltatime')
    md = genplotlib.genlist(d)
    
    n = []
    for i, v in d.iteritems():
        n.append(max(v))
    print(n)
    
    plt.figure()
    genplotlib.plotdata(d, md, k, 's', 'Delay (seconds)', 'Time delay', ymin=0.05, 
            ylim=(max(n)+0.1*max(n)))
    plt.savefig('deltatime_summ')
    
    plt.figure()
    genplotlib.plotdata(d, md, k, 'b', 'Delay (seconds)', 'Time delay', ymin=0.05, 
            ylim=(max(n)+0.1*max(n)))
    plt.savefig('deltatime_summ_bar')
Esempio n. 25
0
def plotpumpdata(keyfile='keylist', fname='cib_pumps.txt', type='b', ylim=40):
    
    cib, pumps = gendictgf(fname)
    mpumps = genplotlib.genlist(pumps)
    #keylist = sorted(mpumps.keys())
    keylist = cmn.load_keys(keyfile)
    
    fig1 = genplotlib.plotdata(pumps, mpumps, keylist, type, ylabel='# of pumps',
            ftitle = 'Number of ' + 'pumps over 30 seconds', ylim=ylim, ymin=-2)
    fig1.subplots_adjust(bottom=0.45)
Esempio n. 26
0
def plotbar(dictdata, keylist, plotname, fdir='.', ylim=10):
    """Plots bar graph from data in 'peakf.txt' and saves it in the summary directory. Run from a 
    data/ or summary/ folder."""

    dictmeans = genplotlib.genlist(dictdata)
    n = []
    for i, v in dictdata.iteritems():
        n.append(max(v))

    plt.figure()
    genplotlib.plotdata(d,
                        md,
                        k,
                        'b',
                        'Delay (seconds)',
                        'Time delay',
                        ymin=0.05,
                        ylim=(max(n)))
    plt.savefig(plotname)
Esempio n. 27
0
def plotfreqs(file, type):
    """Plots the frequencies taken from the summary text files ('fname') with the title 'ftitle'; 
    can plot either per bin or per fly depending on the summary file."""

    ftitle = 'Frequencies ({0})'.format(type)

    d = genplotlib.gendict_freq(file)
    md = genplotlib.genlist(d)
    keylist = genplotlib.genkeylist(d)
    genplotlib.plotdata(d,
                        md,
                        keylist,
                        's',
                        ftitle=ftitle,
                        err='stdev',
                        ylim=8,
                        ylabel='Hz')
    name = 'pooled_freqs_{0}'.format(type)
    plt.savefig(name)
Esempio n. 28
0
def plotcibdata_noci(keyfile='keylist', fname='cib_pumps.txt', type='b'):
    """Fname is the file with the original cibarium and pump count data."""
    
    cib, npumps = gendictgf(fname)
    cibdict = genpercent_noci(cib)
    #keylist = sorted(pcib.keys())
    keylist = cmn.load_keys(keyfile)

    fig1 = genplotlib.plotdata(cib, cibdict, keylist, type, ylabel='%',
            ftitle='Percentage of flies with open' + ' cibariums', ylim=100, ymin=-2)
    fig1.subplots_adjust(bottom=0.45)
Esempio n. 29
0
def plotnlpersec(capfile, l):
    """capfile is the summary file, l is the keylist"""

    n = gendictnps(capfile)
    mn = genlist(n)

    o = []
    for i, v in n.iteritems():
        o.append(max(v))

    print(max(o))

    gp.plotdata(n,
                mn,
                l,
                's',
                'nL/sec',
                'Amount consumed',
                ylim=max(o) + 0.3 * max(o),
                titlesize='x-large',
                xlabelsize='medium',
                xstart=0.25)
    plt.savefig('cap_nlpersec')

    plt.figure()
    gp.plotdata(n,
                mn,
                l,
                'b',
                'nL/sec',
                'Amount consumed',
                ylim=max(o) + 0.3 * max(o),
                titlesize='x-large',
                xlabelsize='medium',
                xstart=0.25)
    plt.savefig('cap_nlpersec_bar')
Esempio n. 30
0
def plotpumpdata(keyfile='keylist', fname='cib_pumps.txt', type='b', ylim=40):

    cib, pumps = gendictgf(fname)
    mpumps = genplotlib.genlist(pumps)
    #keylist = sorted(mpumps.keys())
    keylist = cmn.load_keys(keyfile)

    fig1 = genplotlib.plotdata(pumps,
                               mpumps,
                               keylist,
                               type,
                               ylabel='# of pumps',
                               ftitle='Number of ' + 'pumps over 30 seconds',
                               ylim=ylim,
                               ymin=-2)
    fig1.subplots_adjust(bottom=0.45)
Esempio n. 31
0
def plotcibdata_noci(keyfile='keylist', fname='cib_pumps.txt', type='b'):
    """Fname is the file with the original cibarium and pump count data."""

    cib, npumps = gendictgf(fname)
    cibdict = genpercent_noci(cib)
    #keylist = sorted(pcib.keys())
    keylist = cmn.load_keys(keyfile)

    fig1 = genplotlib.plotdata(cib,
                               cibdict,
                               keylist,
                               type,
                               ylabel='%',
                               ftitle='Percentage of flies with open' +
                               ' cibariums',
                               ylim=100,
                               ymin=-2)
    fig1.subplots_adjust(bottom=0.45)
Esempio n. 32
0
def plotcibarea(fname, k1, k2):

    dicts = gpl.gendict_cibgf(fname)
    dmean, ddiffa = dicts
    mdicts = map(gpl.genlist, dicts)
    mdmean, mddiffa = mdicts
    zd = zip(dicts, mdicts)

    #k1 = sorted(dmean.keys())
    #k2 = sorted(ddiffa.keys())

    for type in ['b', 's']:
        gpl.plotdata(dmean,
                     mdmean,
                     k1,
                     type,
                     r'$\mu$m$^2$',
                     'Mean areas',
                     ylim=10000,
                     ymin=0)
        plt.savefig('areameans_' + type)

        if type == 'b':
            gpl.plotdata(ddiffa,
                         mddiffa,
                         k2,
                         type,
                         r'$\mu$m$^2$',
                         'Difference in area',
                         ylim=6000,
                         ymin=-1000)
            plt.savefig('areadiffs_' + type)
        if type == 's':
            gpl.plotdata(ddiffa,
                         mddiffa,
                         k2,
                         type,
                         r'$\mu$m$^2$',
                         'Difference in area',
                         ylim=6000,
                         ymin=-2000)
            plt.savefig('areadiffs_' + type)
Esempio n. 33
0
def plotcibarea(fname, k1, k2):
    
    dicts = gpl.gendict_cibgf(fname)
    dmean, ddiffa = dicts
    mdicts = map(gpl.genlist, dicts)
    mdmean, mddiffa = mdicts
    zd = zip(dicts, mdicts)
    

    #k1 = sorted(dmean.keys())
    #k2 = sorted(ddiffa.keys())
    
    for type in ['b', 's']:
        gpl.plotdata(dmean, mdmean, k1, type, r'$\mu$m$^2$', 'Mean areas', ylim=10000, ymin=0)
        plt.savefig('areameans_' + type)
        
        if type == 'b':
            gpl.plotdata(ddiffa, mddiffa, k2, type, r'$\mu$m$^2$', 'Difference in area', 
            ylim=6000, ymin=-1000)
            plt.savefig('areadiffs_' + type)
        if type == 's':
            gpl.plotdata(ddiffa, mddiffa, k2, type, r'$\mu$m$^2$', 'Difference in area', 
            ylim=6000, ymin=-2000)
            plt.savefig('areadiffs_' + type)
Esempio n. 34
0
if os.path.exists(x) == True:
    os.remove(x)

names = batchfiles('.')
for name in names:
    print os.path.basename(name)
    os.chdir(name)
    params = CibData(PARAMS_FILE, RESULTS_FILE)
    cibdict = params.Gendata()
    writeresults(cibdict)

os.chdir('../../summary')
d = genplotlib.gendict_cibarea_circ('cibresults.txt')
md = genplotlib.genlist(d)
k = d.keys()
genplotlib.plotdata(d, md, k, 'b', 'NormCibArea', 'Fraction of cibarium open', ymin=0, ylim=100)
plt.savefig('cibareacirc')

#plt.figure()
#e = genplotlib.gendict_cibarea_dur('cibresults.txt')
#me = genplotlib.genlist(e)
#genplotlib.plotdata(e, me, k, 'b', 'Duration', 'Duration of Drinking', ymin=0, ylim=200)
#plt.savefig('duration')


    #try:
        #a = 
        #f = findfraction()
        #list.append(f)
    #except IOError as e:
        #if e.errno == 2:
Esempio n. 35
0
            h.write(key + ',{0},{1},{2},{3}\n'.format(value['cap'], value['freq'], volperpump, value['cond']))

        except KeyError:
            continue
        except ZeroDivisionError:
            continue
            

keyfile = os.path.join(makepardir_subexpt(), KEYLIST)
K = load_keys(keyfile)

dd = gpl.gendict_volperpump(CAP_PEAKFFILE)
md = gpl.genlist(dd)

n = []
for i, v in dd.iteritems():
    n.append(max(v))

print(max(n))

plt.figure()
gpl.plotdata(dd, md, K, 's', 'nL', 'Volume per pump', ymin=0, ylim=max(n)+0.1*max(n))
plt.savefig('volperpump_sc')

plt.figure()
#gpl.plotdata(dd, md, K, 'b', 'nL', 'Volume per pump', ymin=0, ylim=max(n)+0.1*max(n))
gpl.plotdata(dd, md, K, 'b', 'nL', 'Volume per pump', ymin=0, ylim=4)

plt.savefig('volperpump_bar')

Esempio n. 36
0
            continue

keyfile = os.path.join(makepardir_subexpt(), KEYLIST)
K = load_keys(keyfile)

dd = gpl.gendict_volperpump(CAP_PEAKFFILE)
md = gpl.genlist(dd)

n = []
for i, v in dd.iteritems():
    n.append(max(v))

print(max(n))

plt.figure()
gpl.plotdata(dd,
             md,
             K,
             's',
             'nL',
             'Volume per pump',
             ymin=0,
             ylim=max(n) + 0.1 * max(n))
plt.savefig('volperpump_sc')

plt.figure()
#gpl.plotdata(dd, md, K, 'b', 'nL', 'Volume per pump', ymin=0, ylim=max(n)+0.1*max(n))
gpl.plotdata(dd, md, K, 'b', 'nL', 'Volume per pump', ymin=0, ylim=4)

plt.savefig('volperpump_bar')
Esempio n. 37
0
names = batchfiles('.')
for name in names:
    print os.path.basename(name)
    os.chdir(name)
    params = CibData(PARAMS_FILE, RESULTS_FILE)
    cibdict = params.Gendata()
    writeresults(cibdict)

os.chdir('../../summary')
d = genplotlib.gendict_cibarea_circ('cibresults.txt')
md = genplotlib.genlist(d)
k = d.keys()
genplotlib.plotdata(d,
                    md,
                    k,
                    'b',
                    'NormCibArea',
                    'Fraction of cibarium open',
                    ymin=0,
                    ylim=100)
plt.savefig('cibareacirc')

#plt.figure()
#e = genplotlib.gendict_cibarea_dur('cibresults.txt')
#me = genplotlib.genlist(e)
#genplotlib.plotdata(e, me, k, 'b', 'Duration', 'Duration of Drinking', ymin=0, ylim=200)
#plt.savefig('duration')

#try:
#a =
#f = findfraction()
#list.append(f)
Esempio n. 38
0
def plotcibareacirc(cibresultsfile):
    d = genplotlib.gendict_cibarea_circ(cibresultsfile)
    md = genplotlib.genlist(d)
    k = d.keys()
    genplotlib.plotdata(d, md, k, 'b', 'Normalized cib area', 'Cib area', ymin=0, ylim=100)
    plt.savefig('pooled_cibareacirc')
Esempio n. 39
0
def pool_per_results():

    homefol = os.path.abspath('.')

    pooled_perfile = 'pooled_perfile.txt'
    if os.path.exists(pooled_perfile) == True:
        os.remove(pooled_perfile)

    for expt in EXPTS:
        exptpath = os.path.join(os.path.abspath('../../'), expt)
        print(exptpath)
        os.chdir(exptpath)
        perfiles = glob.glob('*percheck.txt')
        #print(perfiles)
        try:
            perfile = os.path.join(exptpath, perfiles[0])
        except IndexError:
            print('No perfile')
            os.chdir(homefol)
            continue

        os.chdir(homefol)
        with open(pooled_perfile, 'a') as g:
            with open(perfile, 'r') as f:
                f.next()
                for l in f:
                    name, cond, per = l.strip('\n').split(',')[0:3]
                    print(cond)
                    try:
                        condi = condcurr.index(cond)
                        cond = condnew[condi]
                    except:
                        pass
                    print(cond)

                    g.write(name + ',' + cond + ',' + per + '\n')

    os.chdir(homefol)
    d = genplotlib.gendictper2(pooled_perfile)
    md = gfplot.genpercent_noci(d)
    k = genplotlib.genkeylist(md)

    print(md)
    genplotlib.plotdata(d,
                        md,
                        k,
                        'b',
                        ylabel='Probability of PER',
                        ftitle='PER',
                        ylim=120,
                        xlabelsize='large')
    plt.savefig('pooled_per_bar')
    plt.close()
    genplotlib.plotdata(d,
                        md,
                        k,
                        's',
                        ylabel='Probability of PER',
                        ftitle='PER',
                        ylim=120,
                        xlabelsize='large')
    plt.savefig('pooled_per_scatter')