from __future__ import division from psychopy import visual, core, event, logging, sound from ld_utils import createWindow, createOutputFile from numpy import inf from ld_messages import readyMessage from ld_rhythmMenu import getParamMenu import numpy as np import sys print 'Using %s(with %s) for sounds' % (sound.audioLib, sound.audioDriver) #Menu infos = getParamMenu() #Log logging.addLevel(logging.EXP + 1, 'StartExp') logging.addLevel(logging.EXP + 2, 'StartPerformance') logging.addLevel(logging.EXP + 4, 'StartRest') logDat = logging.LogFile( createOutputFile(), filemode='w', # if you set this to 'a' it will append instead of overwriting level=logging.DEBUG ) # errors, data and warnings will be sent to this logfile #Create Window @TODO Check multiple monitor and flip currWindow = createWindow() # Create Sound tone = sound.Sound('F', octave=5, sampleRate=44100, secs=0.050) # Create Cross before starting the experiment
if run_configuration.OK: DBIC_ID = run_configuration.data[0] accession = run_configuration.data[1] participant = str(run_configuration.data[2]) run = int(run_configuration.data[3]) elif not run_configuration.OK: core.quit() # Start PsychoPy's clock (mostly for logging) run_clock = core.Clock() # Add a new logging level name called bids # we will use this level to log information that will be saved # in the _events.tsv file for this run BIDS = 26 logging.addLevel(BIDS, 'BIDS') def logbids(msg, t=None, obj=None): """logbids(message) logs a BIDS related message """ logging.root.log(msg, level=BIDS, t=t, obj=obj) # BIDS TEMPLATE logbids("onset\tduration\tstim_type\tstim_fn") template_bids = '{onset:.3f}\t{duration:.3f}\t{stim_type}\t{stim_fn}' # Set up all the relevant directories here HERE = abspath(dirname(__file__))
if myDlg.OK: # then the user pressed OK confInfo = myDlg.data if DEBUG: print confInfo else: if DEBUG: print 'user cancelled' core.quit() # SETUP LOGGING & CLOCKING testClock = core.Clock() logging.setDefaultClock( testClock ) myLogLevel = logging.CRITICAL + 1 logging.addLevel( myLogLevel, '' ) myLog = logging.LogFile( '.'+s+'logs'+s+''+confInfo[0] +'.log', filemode='w', level=myLogLevel, encoding='utf8') logThis('Subj ID: ' + confInfo[0] ) logThis('Run: ' + str(datetime.utcnow()) ) logThis('Age: ' + str(confInfo[1]) ) logThis('Group: ' + confInfo[2]) logThis('Config: ' + confInfo[3]) logThis('--------------------------------------------------------') logThis('INFO') logThis('timestamp1 CUE [block] [trial] CUE') logThis('timestamp1 STM [block] [trial] STIMULUS[state for each rule G1 G2 L1 L2 : 0,1,2,3]RULE[current rule]') logThis('timestamp1 TGT [block] [trial] TARGET[states for each card / Up, Right, Down, Left: 0,1,2,3; 0,1,2,3;...]') logThis('timestamp1 RSP [block] [trial] RESPONSE[correct: 1/0][current rule: G1, G2, L1, L2]ANSWER[card selected: 1(up), 2(right), 3(down), 4(left)]') logThis('timestamp1 FDB [block] [trial] FEEDBACK[correct/fail][correct answers]/[series length]')
from psychopy import logging MESSAGE = 31 logging.addLevel(MESSAGE, 'MESSAGE') logging.msg = lambda msg: logging.log(msg, MESSAGE)
from __future__ import division from psychopy import visual, core, event, logging from ld_utils import createWindow, createOutputFile, getCircleColor from ld_config import congruency_circleFillColor, congruency_circleRadius, congruency_circleLineColor, congruency_jitter from ld_congruencyMenu import getParamMenu from ld_messages import readyMessage import numpy as np from random import randint, uniform #Menu infos = getParamMenu() #Log logging.addLevel(logging.EXP + 1, 'StartExp') logging.addLevel(logging.EXP + 2, 'StartPerformance') logging.addLevel(logging.EXP + 4, 'StartRest') logging.addLevel(logging.EXP + 5, 'Key') logging.addLevel(logging.EXP + 6, 'Answer') logDat = logging.LogFile( createOutputFile(), filemode='w', # if you set this to 'a' it will append instead of overwriting level=logging.EXP + 1) # errors, data and warnings will be sent to this logfile #Create Window @TODO Check multiple monitor and flip currWindow = createWindow() #Create Mouse object but keep it invisible m = event.Mouse(visible=False, win=currWindow)
from psychopy import parallel, core from psychopy import logging # add a logging level in between the EXP and INFO level logging.addLevel(21, 'TRIG') class Trigger(): trigger = dict( acquisition=dict(start=10, end=11, interrupt=12), trial=dict(start=20, consigne=21, feedback=22, end=29), general=dict(init=0, fixationcross=30, consigne=34), condition=dict( nAmb_nKp=40, # 40 + 0x00 nAmb_Kp=41, # 40 + 0x01 Amb_nKp=42, # 40 + 0x10 Amb_Kp=43, # 40 + 0x11 end=49), keypress=dict( nopercept=80, # 80 + 0b000 left=84, # 80 + 0b100 right=81, # 80 + 0b001 up=82, # 80 + 0b010 left_up=86, # 80 + 0b110 up_right=83, # 80 + 0b011 left_right=85, # 80 + 0b101 left_up_right=87, # 80 + 0b111 esc=89), stimulus=dict( transpL=94, # 90 + 0b100 transpR=91, # 90 + 0b001