import os import json import sys import datetime import dateutil.parser as dp import logging import utils if __name__ == "__main__": logging.basicConfig(filename=utils.get_logfile(), level=utils.log_level) utils.log_intro(__file__) event_loc = utils.jsondump_dir current_time = datetime.datetime.now() list_of_events = os.listdir(event_loc) old_event_ids = set() old_event_locs = [] for event in list_of_events: event_path = os.path.join(event_loc, event) with open(event_path) as event_file: ev_json = json.load(event_file) ev_id = ev_json["id"] if "end_time" in ev_json: ev_time = ev_json["end_time"] else: ev_time = ev_json["start_time"] result = dp.parse(ev_time) if (result.replace(tzinfo=None) < current_time): old_event_locs.append(event_path) old_event_ids.add(ev_id)
# Open the device file for the joystick. joy_input = os.open(sys.argv[1], os.O_RDWR | os.O_NONBLOCK) # # Input subject id # print "Enter the ID: " subject_id = raw_input() mode_sequence = False mode_ctrl = False if float(sys.argv[2]) == 1: logfilename = get_logfile(subject_id,'msl') mode_sequence = True elif float(sys.argv[2]) == 2: logfilename = get_logfile(subject_id,'rnd') else: logfilename = get_logfile(subject_id,'ctrl') mode_ctrl = True # # RT FROM TRAINING # min_median_ref = get_min_rt_from_rtfile(subject_id) # # get joystick range #
############################## # TODO MODIFICATION OF THE INPUT # Open the device file for the joystick. joy_input = os.open(sys.argv[1], os.O_RDWR | os.O_NONBLOCK) # # Input subject id # print "Enter the ID: " subject_id = raw_input() mode_sequence = False mode_ctrl = False if float(sys.argv[2]) == 1: logfilename = get_logfile(subject_id, 'msl') mode_sequence = True elif float(sys.argv[2]) == 2: logfilename = get_logfile(subject_id, 'rnd') else: logfilename = get_logfile(subject_id, 'ctrl') mode_ctrl = True # # RT FROM TRAINING # min_median_ref = get_min_rt_from_rtfile(subject_id) # # get joystick range #
param = param_training ############################# # Import target creation function from utils import create_targets_list, get_logfile, log, log_header, load_calibration, extract_min_rt ############################## # TODO MODIFICATION OF THE INPUT # Open the device file for the joystick. joy_input = os.open(sys.argv[1], os.O_RDWR | os.O_NONBLOCK) # # Input subject id # print "Enter the ID: " subject_id = raw_input() logfilename = get_logfile(subject_id, 'training') # # get joystick range # joy_range = load_calibration() # # Start THREAD # poll_thread = THREAD(joy_range, logfilename, joy_input) poll_thread.daemon = True poll_thread.start() # # Start DISPLAY
from parameters import * from display import DISPLAY from poll import THREAD from utils import update_range, update_center, get_logfile, log_header, save_calibration # Open the device file for the joystick. joy_input = os.open(sys.argv[1], os.O_RDWR | os.O_NONBLOCK) # # Input subject id # print "Enter the ID: " subject_id = raw_input() logfilename = get_logfile(subject_id,'calibration') # # start THREAD # poll_thread = THREAD(joy_range, logfilename, joy_input) poll_thread.daemon = True poll_thread.start() # # start DISPLAY # mode = DISPLAY('USB connection', poll_thread, task_info, FPS, fullscreen_on) # # write header
param = param_training ############################# # Import target creation function from utils import create_targets_list, get_logfile, log, log_header, load_calibration, extract_min_rt ############################## # TODO MODIFICATION OF THE INPUT # Open the device file for the joystick. joy_input = os.open(sys.argv[1], os.O_RDWR | os.O_NONBLOCK) # # Input subject id # print "Enter the ID: " subject_id = raw_input() logfilename = get_logfile(subject_id,'training') # # get joystick range # joy_range = load_calibration() # # Start THREAD # poll_thread = THREAD(joy_range, logfilename, joy_input) poll_thread.daemon = True poll_thread.start() # # Start DISPLAY