@@ -255,7 +255,7 @@ def __init__(
255
255
and value is not None
256
256
and not isinstance (value , str )
257
257
):
258
- raise TypeError (f"{ value } must be string or None" "" )
258
+ raise TypeError (f"{ value } must be string or None" )
259
259
if key in edit_list and value is None :
260
260
self ._exp_info [key ] = get_keyboard_input (f"{ key } : " )
261
261
else :
@@ -272,7 +272,7 @@ def __init__(
272
272
os .mkdir (output_dir )
273
273
basename = op .join (
274
274
output_dir ,
275
- "{}_{}" "" .format (
275
+ "{}_{}" .format (
276
276
self ._exp_info ["participant" ], self ._exp_info ["date" ]
277
277
),
278
278
)
@@ -298,8 +298,7 @@ def __init__(
298
298
safe_flipping = not (get_config ("SAFE_FLIPPING" , "" ).lower () == "false" )
299
299
if not safe_flipping :
300
300
logger .warning (
301
- "Expyfun: Unsafe flipping mode enabled, flip "
302
- "timing not guaranteed"
301
+ "Expyfun: Unsafe flipping mode enabled, flip timing not guaranteed"
303
302
)
304
303
self .safe_flipping = safe_flipping
305
304
@@ -323,7 +322,7 @@ def __init__(
323
322
req_mon_keys = ["SCREEN_WIDTH" , "SCREEN_DISTANCE" , "SCREEN_SIZE_PIX" ]
324
323
missing_keys = [key for key in req_mon_keys if key not in monitor ]
325
324
if missing_keys :
326
- raise KeyError (f"monitor is missing required keys { missing_keys } " "" )
325
+ raise KeyError (f"monitor is missing required keys { missing_keys } " )
327
326
mon_size = monitor ["SCREEN_SIZE_PIX" ]
328
327
monitor ["SCREEN_DPI" ] = monitor ["SCREEN_SIZE_PIX" ][0 ] / (
329
328
monitor ["SCREEN_WIDTH" ] * 0.393701
@@ -365,7 +364,7 @@ def __init__(
365
364
response_device = get_config ("RESPONSE_DEVICE" , "keyboard" )
366
365
if response_device not in ["keyboard" , "tdt" , "cedrus" ]:
367
366
raise ValueError (
368
- 'response_device must be "keyboard", "tdt", ' ' "cedrus", or None'
367
+ 'response_device must be "keyboard", "tdt", "cedrus", or None'
369
368
)
370
369
self ._response_device = response_device
371
370
@@ -447,7 +446,7 @@ def __init__(
447
446
window_size = [int (w ) for w in window_size ]
448
447
window_size = np .array (window_size )
449
448
if window_size .ndim != 1 or window_size .size != 2 :
450
- raise ValueError ("window_size must be 2-element array-like or " " None" )
449
+ raise ValueError ("window_size must be 2-element array-like or None" )
451
450
452
451
# open window and setup GL config
453
452
self ._setup_window (window_size , exp_name , full_screen , screen )
@@ -458,7 +457,7 @@ def __init__(
458
457
elif response_device == "tdt" :
459
458
if not isinstance (self ._ac , TDTController ):
460
459
raise ValueError (
461
- 'response_device can only be "tdt" if ' " tdt is used for audio"
460
+ 'response_device can only be "tdt" if tdt is used for audio'
462
461
)
463
462
self ._response_handler = self ._ac
464
463
self ._ac ._add_keyboard_init (self , force_quit )
@@ -489,13 +488,12 @@ def __init__(
489
488
f"{ known_keys } , got { set (trigger_controller )} "
490
489
)
491
490
logger .info (
492
- f' Expyfun: Initializing { trigger_controller [" TYPE" ]} ' ' triggering mode'
491
+ f" Expyfun: Initializing { trigger_controller [' TYPE' ]} triggering mode"
493
492
)
494
493
if trigger_controller ["TYPE" ] == "tdt" :
495
494
if not isinstance (self ._ac , TDTController ):
496
495
raise ValueError (
497
- 'trigger_controller can only be "tdt" if '
498
- "tdt is used for audio"
496
+ 'trigger_controller can only be "tdt" if tdt is used for audio'
499
497
)
500
498
self ._tc = self ._ac
501
499
elif trigger_controller ["TYPE" ] == "sound_card" :
@@ -543,9 +541,9 @@ def __init__(
543
541
# finish initialization
544
542
logger .info ("Expyfun: Initialization complete" )
545
543
logger .exp (
546
- "Expyfun: Participant: {0}" "" .format (self ._exp_info ["participant" ])
544
+ "Expyfun: Participant: {0}" .format (self ._exp_info ["participant" ])
547
545
)
548
- logger .exp ("Expyfun: Session: {0}" "" .format (self ._exp_info ["session" ]))
546
+ logger .exp ("Expyfun: Session: {0}" .format (self ._exp_info ["session" ]))
549
547
ok_log = partial (self .write_data_line , "trial_ok" , None )
550
548
self ._on_trial_ok .append (ok_log )
551
549
self ._on_trial_ok .append (self .flush )
@@ -558,7 +556,7 @@ def __init__(
558
556
559
557
def __repr__ (self ):
560
558
"""Return a useful string representation of the experiment"""
561
- string = '<ExperimentController ({3}): "{0}" {1} ({2})>' "" .format (
559
+ string = '<ExperimentController ({3}): "{0}" {1} ({2})>' .format (
562
560
self ._exp_info ["exp_name" ],
563
561
self ._exp_info ["participant" ],
564
562
self ._exp_info ["session" ],
@@ -792,9 +790,7 @@ def start_stimulus(self, start_of_trial=True, flip=True, when=None):
792
790
"""
793
791
if start_of_trial :
794
792
if self ._trial_progress != "identified" :
795
- raise RuntimeError (
796
- "Trial ID must be stamped before starting " "the trial"
797
- )
793
+ raise RuntimeError ("Trial ID must be stamped before starting the trial" )
798
794
self ._trial_progress = "started"
799
795
extra = "flipping screen and " if flip else ""
800
796
logger .exp (f"Expyfun: Starting stimuli: { extra } playing audio" )
@@ -1392,7 +1388,7 @@ def check_force_quit(self):
1392
1388
def text_input (
1393
1389
self ,
1394
1390
stop_key = "return" ,
1395
- instruction_string = "Type" " response below" ,
1391
+ instruction_string = "Type response below" ,
1396
1392
pos = (0 , 0 ),
1397
1393
color = "white" ,
1398
1394
font_name = "Arial" ,
@@ -1863,12 +1859,12 @@ def load_buffer(self, samples):
1863
1859
"""
1864
1860
if self ._playing :
1865
1861
raise RuntimeError (
1866
- "Previous audio must be stopped before loading " " the buffer"
1862
+ "Previous audio must be stopped before loading the buffer"
1867
1863
)
1868
1864
samples = self ._validate_audio (samples )
1869
1865
if not np .isclose (self ._stim_scaler , 1.0 ):
1870
1866
samples = samples * self ._stim_scaler
1871
- logger .exp (f"Expyfun: Loading { samples .size } samples to buffer" "" )
1867
+ logger .exp (f"Expyfun: Loading { samples .size } samples to buffer" )
1872
1868
self ._ac .load_buffer (samples )
1873
1869
1874
1870
def play (self ):
@@ -1997,7 +1993,7 @@ def _validate_audio(self, samples):
1997
1993
max_samples = 4000000 - 1
1998
1994
if samples .shape [0 ] > max_samples :
1999
1995
raise RuntimeError (
2000
- f"Sample too long { samples .shape [0 ]} > { max_samples } " ""
1996
+ f"Sample too long { samples .shape [0 ]} > { max_samples } "
2001
1997
)
2002
1998
2003
1999
# resample if needed
@@ -2066,7 +2062,7 @@ def set_rms_checking(self, check_rms):
2066
2062
"""
2067
2063
if check_rms not in [None , "wholefile" , "windowed" ]:
2068
2064
raise ValueError (
2069
- 'check_rms must be one of "wholefile", "windowed"' " , or None."
2065
+ 'check_rms must be one of "wholefile", "windowed", or None.'
2070
2066
)
2071
2067
self ._slow_rms_warned = False
2072
2068
self ._check_rms = check_rms
@@ -2235,7 +2231,7 @@ def identify_trial(self, **ids):
2235
2231
)
2236
2232
ll = max ([len (key ) for key in ids .keys ()])
2237
2233
for key , id_ in ids .items ():
2238
- logger .exp (f"Expyfun: Stamp trial ID to { key .ljust (ll )} : { str (id_ )} " "" )
2234
+ logger .exp (f"Expyfun: Stamp trial ID to { key .ljust (ll )} : { str (id_ )} " )
2239
2235
if isinstance (id_ , dict ):
2240
2236
self ._id_call_dict [key ](** id_ )
2241
2237
else :
@@ -2318,7 +2314,7 @@ def stamp_triggers(self, ids, check="binary", wait_for_last=True):
2318
2314
_vals = [1 , 2 , 4 , 8 ]
2319
2315
if not all (id_ in _vals for id_ in ids ):
2320
2316
raise ValueError (
2321
- 'with check="binary", ids must all be ' f" 1, 2, 4, or 8: { ids } "
2317
+ f 'with check="binary", ids must all be 1, 2, 4, or 8: { ids } '
2322
2318
)
2323
2319
self ._stamp_ttl_triggers (ids , wait_for_last , False )
2324
2320
0 commit comments