コード例 #1
0
def gentoplot_dft(xlimhz):

    toplot = {}

    # Generates a list of movie paths in the data folder.
    files = dftf.batch_s('.')

    # Generates dft traces and plots for each roi in each movie.
    for file in files:
        os.chdir(file)
        print(os.path.basename(file))

        for col in COLS:

            if os.path.exists('params') == True:
                rawtracedata = dftf.TraceData(fname=RESULTS_FILE,
                                              paramsfile=PARAMS_FILE,
                                              corrparamsfile=CORRPARAMS_FILE,
                                              colname=col)
                td = rawtracedata.Processrawtrace(DFTSIZE, HZ_BOUND1,
                                                  HZ_BOUND2)

                condition = td['condition']
                m = td['peakf']

                xpoints = np.linspace(0, td['fps'] / 2, td['dftsize'] / 2)
                prop = xlimhz / (td['fps'] / 2)
                tracelen = np.rint(prop * len(td['dftnormtrunctrace']))

                toplot[td['moviename']] = [
                    xpoints[:tracelen], td['dftnormtrunctrace'][:tracelen],
                    condition
                ]

    return (toplot)
コード例 #2
0
def gentoplot(time):
    """Generates a dictionary where the keys are movie names and the values are the raw trace for
    plotting. Time specifies the length of time in seconds of the plots shown."""
    
    toplot = {}

    # Generates a list of movie paths in the data folder.
    files = dftf.batch_s('.')   

    # Generates dft traces and plots for each roi in each movie.
    for file in files:
        os.chdir(file)
        print(os.path.basename(file))

        for col in COLS:
             
            if os.path.exists('params') == True:
                rawtracedata = dftf.TraceData(fname=RESULTS_FILE, paramsfile=PARAMS_FILE, 
                corrparamsfile=CORRPARAMS_FILE, colname=col)
                td = rawtracedata.Processrawtrace(DFTSIZE, HZ_BOUND1, HZ_BOUND2)
                moviename = os.path.basename(os.path.abspath('.'))
                
                # Selects the area of the raw trace to plot.
                frames = time * td['fps']
                #print(frames)
                plottime = td['seltrace'][:frames]/10
                #print(len(plottime))
                ms = plottime-np.mean(plottime)
                xsec = np.linspace(0, len(plottime)/td['fps'], len(plottime))
                #print(xsec)
                condition = td['condition']
                toplot[moviename] = [xsec, ms, condition]
                print(np.max(ms), np.min(ms))
                
    return(toplot)
コード例 #3
0
def plotspecmovie(nfft, padmultiple):

    rawtracedata = dftf.TraceData(fname=RESULTS_FILE,
                                  paramsfile=PARAMS_FILE,
                                  corrparamsfile=CORRPARAMS_FILE,
                                  colname='Mean1')
    td = rawtracedata.Processrawtrace(DFTSIZE, HZ_BOUND1, HZ_BOUND2)

    plotcustomspec(td,
                   nfft=nfft,
                   time=TIME,
                   xlim=XLIM,
                   ylim=YLIM,
                   padmultiple=padmultiple)
コード例 #4
0
def gentoplot(time):
    """Generates a dictionary where the keys are movie names and the values are the raw trace for
    plotting. Time specifies the length of time in seconds of the plots shown."""
    
    toplot = {}

    # Generates a list of movie paths in the data folder.
    files = dftf.batch_s('.')   

    # Generates dft traces and plots for each roi in each movie.
    for file in files:
        os.chdir(file)
        print(os.path.basename(file))

        for col in COLS:
             
            if os.path.exists('params') == True:
                rawtracedata = dftf.TraceData(fname=RESULTS_FILE, paramsfile=PARAMS_FILE, 
                corrparamsfile=CORRPARAMS_FILE, colname=col)
                td = rawtracedata.Processrawtrace(DFTSIZE, HZ_BOUND1, HZ_BOUND2)

                # Selects the area of the raw trace to plot.
                frames = time * td['fps']
                frameoffset = TIMEOFFSET * td['fps']
                #print(frames)
                if os.path.basename(file) == 'mov_20101130_200533' \ 
                or os.path.basename(file) == 'mov_20110517_181356' \ 
                or os.path.basename(file) == 'mov_20110517_174209':
                    plottime = td['seltrace'][frameoffset:frames]/8
                elif os.path.basename(file) == 'mov_20110518_192012':
                    plottime = td['seltrace'][frameoffset:frames]/1.5
                elif os.path.basename(file) == 'mov_20110518_184849':
                    plottime = td['seltrace'][frameoffset:frames]/3
                #elif os.path.basename(file) == 'mov_20110527_163607_part2':
                    #plottime = td['seltrace'][50:frames+50]
                else:
                    plottime = td['seltrace'][frameoffset:frames]
                #print(len(plottime))
                ms = plottime-np.mean(plottime)
                xsec = np.linspace(0, len(plottime)/td['fps'], len(plottime))
                #print(xsec)
                condition = td['condition']
                toplot[td['moviename']] = [xsec, ms, condition]
                print(np.max(ms), np.min(ms))
    
    return(toplot)
コード例 #5
0
def checkframes():
    """Generates a dictionary with the f1 from the params file and the pdframes file for each movie."""
    
    d = {}
    for movie in MOVIES.iterkeys():
        os.chdir(DATAFOL)
        os.chdir(movie)
        rawtracedata = dftf.TraceData(fname=RESULTS_FILE, paramsfile=PARAMS_FILE, 
        corrparamsfile=CORRPARAMS_FILE, colname='Mean1')
        td = rawtracedata.Processrawtrace(DFTSIZE, HZ_BOUND1, HZ_BOUND2)
        
        os.chdir(IFILEFOL)
        os.chdir(movie)
        pd = {}
        with open('pdframes') as f:
             for l in f:
                pd[l.split(',')[0]] = (l.split(',')[1].strip('\n'))
        
        d[movie] = (td['f1'], float(pd['f1']))
    print(d)    
    return(d)
コード例 #6
0
    figname = os.path.join(plotfolder, td['moviename'] + '_dft_ticks_labels')
    plt.savefig(figname + '.svg', dpi=FIGDPI, format='svg')
    plt.savefig(figname + '.png', dpi=FIGDPI, format='png')


mpl.rc('axes', linewidth=LINEWIDTH)
# Generates a list of movie paths in the data folder.
files = dftf.batch_s('.')

# Generates dft traces and plots for each roi in each movie.
for movie, val in DFT_MOVIES.iteritems():
    os.chdir(movie)
    print(os.path.basename(movie))

    for col in COLS:

        if os.path.exists('params') == True:
            rawtracedata = dftf.TraceData(fname=RESULTS_FILE,
                                          paramsfile=PARAMS_FILE,
                                          corrparamsfile=CORRPARAMS_FILE,
                                          colname=col)
            td = rawtracedata.Processrawtrace(DFTSIZE, HZ_BOUND1, HZ_BOUND2)

            condition, offset, color = val

            plotdft_paper(td, FIGW, FIGH, FIGDPI, FONTSIZE, YLIM, BORDER,
                          YLABEL, XAXISTICKS, YAXISTICKS, XLIMHZ, color,
                          LINEWIDTH)

    os.chdir('../')