Esempio n. 1
0
#
# wait for mri then log
#
if param['mri_trigger']:
    pressFive = False
    while not poll_thread.joy_status['ttl'] and not pressFive:
        for event in pygame.event.get():
            if event.type == KEYDOWN:
                #
                # Quit if something goes wrong
                #
                if event.unicode == u'm':
                    pressFive = True

        mode.display_text('BE READY', colors.RED, 100)

    mode.task_info['time'] = datetime.now().strftime("%H:%M:%S.%f")
    mode.task_info['description'] = 'start mri'
    log(poll_thread.logfile, poll_thread.joy_status, mode.task_info)
    poll_thread.joy_status['ttl'] = False

if param['start_emg']:
    if mode.debug:
        print 'Start EMG'

    lji.run_stimulation(lj_trigger_emg)
    mode.task_info['time'] = datetime.now().strftime("%H:%M:%S.%f")
    mode.task_info['description'] = 'start EMG'
    log(poll_thread.logfile, poll_thread.joy_status, mode.task_info)
Esempio n. 2
0
#
# wait for mri then log
#
if param['mri_trigger']:
    pressFive = False
    while not poll_thread.joy_status['ttl'] and not pressFive:
        for event in pygame.event.get():
            if event.type == KEYDOWN:
                #
                # Quit if something goes wrong
                #
                if event.unicode == u'm':
                    pressFive = True

        mode.display_text('BE READY', colors.RED, 100)

    mode.task_info['time'] = datetime.now().strftime("%H:%M:%S.%f")
    mode.task_info['description'] = 'start mri'
    log(poll_thread.logfile, poll_thread.joy_status, mode.task_info)
    poll_thread.joy_status['ttl'] = False

if param['start_emg']:
    if mode.debug:
        print 'Start EMG'

    lji.run_stimulation(lj_trigger_emg)
    mode.task_info['time'] = datetime.now().strftime("%H:%M:%S.%f")
    mode.task_info['description'] = 'start EMG'
    log(poll_thread.logfile, poll_thread.joy_status, mode.task_info)
Esempio n. 3
0
#
# start DISPLAY
#
mode = DISPLAY('USB connection', poll_thread, task_info, FPS, fullscreen_on)

#
# write header
#
log_header(poll_thread.logfile, poll_thread.joy_status, mode.task_info)


#
# display calibration
#
mode.display.fill(colors.BLACK)
mode.display_text('CALIBRATION', colors.RED, 100, datetime.now(), 5)
mode.display_text(calibration_string[0], colors.RED, 50, datetime.now(), 2)

running_calibration = True
next_order = True

calibration_string_order = 0

while running_calibration:
    # Fill screen in black
    mode.display.fill(colors.BLACK)
    mode.display_edges()

    if next_order:
    #
    # display order
        mode.display.fill(colors.BLACK)
        mode.display_edges()

        #
        # display all targets
        #
        mode.display_all_targets()

        #
        # display one target
        #
        mode.display_target(False)
        mode.need_display_target = False

        if mode.task_info['numTarget'] > len(param_task['seqUsed'])-1:
            keep_learning = mode.display_text('Continue (y/n) ?', colors.RED, 45, None, 3600, True)
            mode.task_info['numTarget'] = 0
    else:
        num_list = 0
        for recognition in list_seq_recognition:
            answer = 'r'
            while answer == 'r':
                #
                # Example of sequence
                #
                mode.display_sequence(recognition,len(param_task['seqUsed']))

                #
                # Good or Bad sequence or Repeat the sequence
                #
                answer = mode.display_text('Good sequence or not  (y/n or repeat - r)', colors.RED, 45, None, 3600, True)
Esempio n. 5
0
        mode.display.fill(colors.BLACK)
        mode.display_edges()

        #
        # display all targets
        #
        mode.display_all_targets()

        #
        # display one target
        #
        mode.display_target(False)
        mode.need_display_target = False

        if mode.task_info['numTarget'] > len(param_task['seqUsed']) - 1:
            keep_learning = mode.display_text('Continue (y/n) ?', colors.RED,
                                              45, None, 3600, True)
            mode.task_info['numTarget'] = 0
    else:
        num_list = 0
        for recognition in list_seq_recognition:
            answer = 'r'
            while answer == 'r':
                #
                # Example of sequence
                #
                mode.display_sequence(recognition, len(param_task['seqUsed']))

                #
                # Good or Bad sequence or Repeat the sequence
                #
                answer = mode.display_text(
Esempio n. 6
0
if param['start_emg']:
    import labjack_interface as lji
    lji.reset()

if param['mri_trigger']:
    pressFive = False
    while not poll_thread.joy_status['ttl'] and not pressFive:
        for event in pygame.event.get():
            if event.type == KEYDOWN:
                #
                # Quit if something goes wrong
                #
                if event.unicode == u'm':
                    pressFive = True

        mode.display_text('BE READY', colors.RED, 100)

while running:

    if mode.debug:
        print 'Start EMG'

    lji.run_stimulation(lj_trigger_emg)
    mode.display_text(' + ', colors.RED, 100, datetime.now(),
                      param['rest_time'], False, False)
    running = False
    for event in pygame.event.get():
        if event.type == KEYDOWN:
            #
            # Quit if something goes wrong
            #
Esempio n. 7
0
if param['start_emg']:
    import labjack_interface as lji
    lji.reset()

if param['mri_trigger']:
    pressFive = False
    while not poll_thread.joy_status['ttl'] and not pressFive:
        for event in pygame.event.get():
            if event.type == KEYDOWN:
                #
                # Quit if something goes wrong
                #
                if event.unicode == u'm':
                    pressFive = True

        mode.display_text('BE READY', colors.RED, 100)


while running:

    if mode.debug:
        print 'Start EMG'

    lji.run_stimulation(lj_trigger_emg)
    mode.display_text(' + ', colors.RED, 100, datetime.now(), param['rest_time'], False, False)
    running = False
    for event in pygame.event.get():
        if event.type == KEYDOWN:
            #
            # Quit if something goes wrong
            #