示例#1
0
    def initUI(self):

        # positioning and deco
        self.setWindowTitle("Settings")
        self.show()
        
        FormLayout = QtWidgets.QFormLayout(self)
        FormLayout.setVerticalSpacing(10)
        FormLayout.setLabelAlignment(QtCore.Qt.AlignRight)
        self.setLayout(FormLayout)

        # animal selector
        self.Animals = utils.get_Animals(self.config['paths']['animals_folder'])
        last_id = self.config['last']['animal']
        self.Animal, = [Animal for Animal in self.Animals if Animal.ID == last_id]
        display_names = [animal.display() for animal in self.Animals]
        self.AnimalChoiceWidget = StringChoiceWidget(self, choices=display_names)
        self.AnimalChoiceWidget.currentIndexChanged.connect(self.animal_changed)
        try:
            self.AnimalChoiceWidget.set_value(self.Animal.display())
        except:
            # if animal is not in list
            self.AnimalChoiceWidget.set_value(self.Animals[0].display())
        FormLayout.addRow('Animal', self.AnimalChoiceWidget)

        # task selector
        tasks = utils.get_tasks(self.config['paths']['tasks_folder'])
        self.task = self.config['last']['task']
        self.TaskChoiceWidget = StringChoiceWidget(self, choices=tasks)
        self.TaskChoiceWidget.currentIndexChanged.connect(self.task_changed)
        try:
            self.TaskChoiceWidget.set_value(self.task)
        except:
            # if task is not in list
            self.TaskChoiceWidget.set_value(tasks[0])
        FormLayout.addRow('Task', self.TaskChoiceWidget)

        # sep
        line = QtWidgets.QFrame(self)
        line.setFrameShape(QtWidgets.QFrame.HLine)
        line.setFrameShadow(QtWidgets.QFrame.Sunken)
        FormLayout.addRow(line)

        # run button
        self.RunBtn = QtWidgets.QPushButton(self)
        self.RunBtn.setText('Run task')
        FormLayout.addRow(self.RunBtn)
        self.RunBtn.clicked.connect(self.Run)

        # done button
        self.DoneBtn = QtWidgets.QPushButton(self)
        self.DoneBtn.setText('finish session')
        FormLayout.addRow(self.DoneBtn)
        self.DoneBtn.clicked.connect(self.Done)
        self.DoneBtn.setEnabled(False)

        # plot buttons
        self.online_vis_btn = QtWidgets.QPushButton(self)
        self.online_vis_btn.clicked.connect(self.start_online_vis)
        self.online_vis_btn.setText('online visualization')
        FormLayout.addRow(self.online_vis_btn)
        self.online_vis_btn.setEnabled(False)
       
        # calling animal changed again to trigger correct positioning
        # self.AnimalChoiceWidget.currentIndexChanged.connect(self.animal_changed)
        # self.AnimalChoiceWidget.set_value(self.Animal.display())
                
        # enforce function calls if first animal
        self.animal_changed()
        # if animals.index(self.animal) == 0: # to call animal_changed even if the animal is the first in the list
        #     self.animal_changed()
        if tasks.index(self.task) == 0: # enforce function call if first task
            self.task_changed()
示例#2
0
 ##    ## ##       ##    ## ##    ##  ##  ##     ## ###   ##    ##       ##       ##     ## ##       ##       
 ##       ##       ##       ##        ##  ##     ## ####  ##    ##       ##       ##     ## ##       ##       
  ######  ######    ######   ######   ##  ##     ## ## ## ##    ##       ######   ##     ## ######   ##       
       ## ##             ##       ##  ##  ##     ## ##  ####    ##       ##        ##   ##  ##       ##       
 ##    ## ##       ##    ## ##    ##  ##  ##     ## ##   ###    ##       ##         ## ##   ##       ##       
  ######  ########  ######   ######  ####  #######  ##    ##    ######## ########    ###    ######## ######## 
 
"""

Nicknames = ['Lifeguard', 'Lumberjack', 'Teacher', 'Plumber', 'Poolboy', 'Policeman', 'Therapist']
# Nicknames = ['Therapist']
task_name = 'learn_to_choose_v2'

# get animals by Nickname
Animals_folder = Path("/media/georg/htcondor/shared-paton/georg/Animals_reaching")
Animals = utils.get_Animals(Animals_folder)

Animals = [a for a in Animals if a.Nickname in Nicknames]

overwrite = False

for i, Animal in enumerate(Animals):
    utils.printer("processing animal %s" % Animal, 'msg')
    SessionsDf = utils.get_sessions(Animal.folder).groupby('task').get_group(task_name)
    SessionsDf = SessionsDf.reset_index()

    for i, row in SessionsDf.iterrows():
        session_folder = Path(row['path'])
        Session = utils.Session(session_folder)
        
        # session overview
示例#3
0
from Utils import behavior_analysis_utils as bhv
import pandas as pd

# this should be changed ... 
from pathlib import Path
import scipy as sp
import numpy as np
import seaborn as sns
from tqdm import tqdm
import os
from Utils import utils

# %%
folder = Path("/home/georg/data/grasping_animals/")
folder = Path("/media/georg/htcondor/shared-paton/georg/Animals_reaching")
Animals = utils.get_Animals(folder)

# %%

folders = dict(
        Lifeguard="/media/georg/htcondor/shared-paton/georg/Animals_reaching/JJP-02909",
        Lumberjack="/media/georg/htcondor/shared-paton/georg/Animals_reaching/JJP-02911",
        Teacher="/media/georg/htcondor/shared-paton/georg/Animals_reaching/JJP-02912",
        Plumber="/media/georg/htcondor/shared-paton/georg/Animals_reaching/JJP-02994",
        Poolboy="/media/georg/htcondor/shared-paton/georg/Animals_reaching/JJP-02995",
        Policeman="/media/georg/htcondor/shared-paton/georg/Animals_reaching/JJP-02996",
        Therapist="/media/georg/htcondor/shared-paton/georg/Animals_reaching/JJP-02997")

# %%

for animal, folder in folders.items():