Exemple #1
0
    FODataFiles = [filepath.split(sep)[-1] for filepath in glob(expDir + "*.txt")]
    FODataFiles = sorted(FODataFiles)

    print("\n Analysing the following log files:\n")
    print(FODataFiles)

    # Run single trial analysis on each file in folder .....................................................
    for fileToAnalyse in FODataFiles:

        flyID = fileToAnalyse.split("_")[0]
        trial = FODataFiles.index(fileToAnalyse) + 1

        # Load single trial data from file
        if rerunbasicanalysis == "y":
            returnVal = singleVRTrialAnalysis(expDir + fileToAnalyse)
            print("Ran analysis, now loading saved *.npy file.")
            FODatLoad = np.load(expDir + fileToAnalyse[:-3] + "npy")[()]
        else:
            print("Loading saved *.npy file.")
            FODatLoad = np.load(expDir + fileToAnalyse[:-3] + "npy")[()]

        # Split into visible object trials and invisible object trials
        if "Invisible" in fileToAnalyse or "invisible" in fileToAnalyse:
            trialtype = "invisible"
            nTrialsIN += 1
        else:
            trialtype = "visible"
            nTrialsVI += 1

        vTrans = np.copy(FODatLoad["transVelo"])
""" Script for analysing a single FlyOver trial (assumes use of FlyOver version 9.2 or higher) """

__author__ = "Hannah Haberkern, [email protected]"


from Tkinter import Tk
from tkFileDialog import askopenfilename

from flyVR_oneTrialBasicAnalysis import singleVRTrialAnalysis


baseDir = "/Volumes/jayaramanlab/Hannah/Projects/FlyVR/1_Experiments/"

root = Tk()
# prevents root window from appearing
root.withdraw()
# choose experiment
fileToAnalyse = askopenfilename(initialdir=baseDir, title="Select file for analysis")

returnVal = singleVRTrialAnalysis(fileToAnalyse)