Running Continuous MST with Psychopy

104 views
Skip to first unread message

Daniel Callow

unread,
Jan 5, 2020, 8:51:26 PM1/5/20
to Mnemonic Similarity Task (MST)
Hello.

I am a Ph.D. student at the University of Maryland and am currently using your standalone version of the MST in a behavioral study for my dissertation work (Thank you again for sharing this fantastic resource!). For the next step, I would like to run the continuous MST in the scanner.

Based on the documentation and discussions I could find it seems like the continuous psychopy version of the MST might be my best bet?

I am not super familiar with psychopy (my previous lab used Eprime), but have looked into it a bit to try and get your psychopy script running. 

On my lab computer I have installed psychopy through Anaconda and tried running the script through psychopy with the following result.

(psychopy) bash-3.2$ python /Volumes/DANIEL/MST-master/MST_Continuous_PsychoPy.py 

2020-01-05 20:31:29.796 python[74300:2392541] -[NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x7ff2f1680440

2020-01-05 20:31:29.798 python[74300:2392541] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication transformToForegroundApplication]: unrecognized selector sent to instance 0x7ff2f1680440'

*** First throw call stack:

(

0   CoreFoundation                      0x00007fff3ae4fe45 __exceptionPreprocess + 256

1   libobjc.A.dylib                     0x00007fff65a843c6 objc_exception_throw + 48

2   CoreFoundation                      0x00007fff3aeca54b -[NSObject(NSObject) __retain_OA] + 0

3   CoreFoundation                      0x00007fff3adf1e98 ___forwarding___ + 1478

4   CoreFoundation                      0x00007fff3adf1848 _CF_forwarding_prep_0 + 120

5   libwx_osx_cocoau_core-3.0.0.4.0.dylib 0x0000001a25f19d7e _ZN5wxApp9DoInitGuiEv + 478

6   _core.so                            0x0000001a2583116e _ZN10sipwxPyApp9OnInitGuiEv + 110

7   libwx_osx_cocoau_core-3.0.0.4.0.dylib 0x0000001a25f69872 _ZN5wxApp10InitializeERiPPw + 242

8   libwx_baseu-3.0.0.4.0.dylib         0x0000001a2656f633 _Z12wxEntryStartRiPPw + 179

9   libwx_baseu-3.0.0.4.0.dylib         0x0000001a2656fb50 _Z12wxEntryStartRiPPc + 32

10  _core.so                            0x0000001a2583071a _ZN7wxPyApp13_BootstrapAppEv + 442

11  _core.so                            0x0000001a25835232 _ZL26meth_wxPyApp__BootstrapAppP7_objectS0_ + 114

12  libpython2.7.dylib                  0x000000010db9c8b4 PyEval_EvalFrameEx + 22980

13  libpython2.7.dylib                  0x000000010db96c94 PyEval_EvalCodeEx + 2164

14  libpython2.7.dylib                  0x000000010db18923 function_call + 355

15  libpython2.7.dylib                  0x000000010daefe15 PyObject_Call + 101

16  libpython2.7.dylib                  0x000000010daff212 instancemethod_call + 162

17  libpython2.7.dylib                  0x000000010daefe15 PyObject_Call + 101

18  libpython2.7.dylib                  0x000000010db52fef slot_tp_init + 175

19  libpython2.7.dylib                  0x000000010db4eea9 type_call + 313

20  libpython2.7.dylib                  0x000000010daefe15 PyObject_Call + 101

21  libpython2.7.dylib                  0x000000010db9c538 PyEval_EvalFrameEx + 22088

22  libpython2.7.dylib                  0x000000010db96c94 PyEval_EvalCodeEx + 2164

23  libpython2.7.dylib                  0x000000010db96412 PyEval_EvalCode + 34

24  libpython2.7.dylib                  0x000000010dbb5144 PyImport_ExecCodeModuleEx + 212

25  libpython2.7.dylib                  0x000000010dbb8353 load_source_module + 995

26  libpython2.7.dylib                  0x000000010dbb870f load_package + 367

27  libpython2.7.dylib                  0x000000010dbb7e1f import_submodule + 319

28  libpython2.7.dylib                  0x000000010dbb7bef ensure_fromlist + 575

29  libpython2.7.dylib                  0x000000010dbb6771 PyImport_ImportModuleLevel + 817

30  libpython2.7.dylib                  0x000000010db91549 builtin___import__ + 153

31  libpython2.7.dylib                  0x000000010daefe15 PyObject_Call + 101

32  libpython2.7.dylib                  0x000000010db9b0d2 PyEval_EvalFrameEx + 16866

33  libpython2.7.dylib                  0x000000010db96c94 PyEval_EvalCodeEx + 2164

34  libpython2.7.dylib                  0x000000010db96412 PyEval_EvalCode + 34

35  libpython2.7.dylib                  0x000000010dbb5144 PyImport_ExecCodeModuleEx + 212

36  libpython2.7.dylib                  0x000000010dbb8353 load_source_module + 995

37  libpython2.7.dylib                  0x000000010dbb7e1f import_submodule + 319

38  libpython2.7.dylib                  0x000000010dbb7bef ensure_fromlist + 575

39  libpython2.7.dylib                  0x000000010dbb6771 PyImport_ImportModuleLevel + 817

40  libpython2.7.dylib                  0x000000010db91549 builtin___import__ + 153

41  libpython2.7.dylib                  0x000000010daefe15 PyObject_Call + 101

42  libpython2.7.dylib                  0x000000010db9b0d2 PyEval_EvalFrameEx + 16866

43  libpython2.7.dylib                  0x000000010db96c94 PyEval_EvalCodeEx + 2164

44  libpython2.7.dylib                  0x000000010db96412 PyEval_EvalCode + 34

45  libpython2.7.dylib                  0x000000010dbc3eed PyRun_FileExFlags + 157

46  libpython2.7.dylib                  0x000000010dbc3a30 PyRun_SimpleFileExFlags + 816

47  libpython2.7.dylib                  0x000000010dbda402 Py_Main + 3506

48  libdyld.dylib                       0x00007fff672a93d5 start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

Abort trap: 6


Am I going about this the correct way? Should I be using this script for the fMRI task? And would accessing the script through psychopy in this manner be the correct approach (indicating I may have installed incorrectly along the way)?


Thank you for any advice or help you can provide. I know this forum is not necessarily for debugging these tasks so if you could point me in the direction of some type of directions or extensive documentation for running the task it would be GREATLY appreciated.


Thank you.

Daniel Callow

unread,
Jan 6, 2020, 9:37:03 AM1/6/20
to Mnemonic Similarity Task (MST)
Sorry, I was able to download psychopy3 (which I assume is okay to run with your psychopy script -- even though the shebang indicates python2?) and pull up the MST_continuous psychopy code (no longer get the above error). However, when I try to run the psychopy code I get the following error after providing it with all of the task parameters? 

######## Running: /Volumes/DANIEL/MST-master/MST_Continuous_PsychoPy.py ########
2020-01-06 09:23:50.299 python[81481:2556121] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
{'ID': 1001, 'Duration': 2.0, 'ISI': 0.5, 'LagSet': 'AllShort_Set1', 'Order': 1, 'Set': '1', 'Resp1Keys': '1VC', 'Resp2Keys': '2B', 'Resp3Keys': '3NM', 'SelfPaced': True, 'TwoChoice': False, 'Randomization': -1}
Traceback (most recent call last):
  File "/Volumes/DANIEL/MST-master/MST_Continuous_PsychoPy.py", line 533, in <module>
    set_bins = np.array(check_files(params['Set']))
  File "/Volumes/DANIEL/MST-master/MST_Continuous_PsychoPy.py", line 120, in check_files
    for row in reader:
_csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)


Have I set up things incorrectly? It seems to be an issue with the for loop which then crashes the csv.reader command?

Craig E.L. Stark

unread,
Jan 6, 2020, 7:23:43 PM1/6/20
to Mnemonic Similarity Task (MST)
Two things here -- first, it's unfortunate that we have Python2 vs. Python3 and PsychoPy2 vs. PsychoPy3.  These are orthogonal.  There have been PsychoPy2 versions that use Python2 as a back-end and ones that use Python3 as a back-end.  IIRC, at least early versions of PsychoPy3 could come with either Python2 or Python3 at your choice.  So, there's that.

The error that's coming up here is easily fixed and I can, once this grant is out, take care of the GitHub page.  See the line in check_files() that says:
 with open("Set"+str(SetName)+" bins.txt","rb"as bin_file:
Change it to:

with open("Set"+str(SetName)+" bins.txt","r"as bin_file:

That will fix it for you. Right now, it's opening as a binary file ("rb" - read, binary) and that's a bug. Earlier versions of Python treated it well enough and were tolerant, but current ones aren't.

Craig


Reply all
Reply to author
Forward
0 new messages