fMRI triggers and non-slip timing issues

Dear PsychoPy Community,

Sorry to interrupt you. I am going to run my fMRI experiment and will use PsychoPy to present stimuli. I have two questions about triggers and timing in fMRI. Hence I would like to ask here for help.

1.Overview of the fMRI task: My task is a very simple block-design. There are two types of blocks: a task block and a rest block, each of them will last for 15s. In the task block a word ‘TAP’ will be presented, whereas in the rest block a fixation cross ‘+’ will be presented. There is NO need to press any buttons or give behavioral responses. People just need to watch these two words and do simple finger-tapping behavior.
2. My questions:

  1. The scanner will Emmulate a keypress ‘5’ to rigger my experiment at the start the task. I am unsure whether I write the correct psychopy code.
  2. I need to record the start time for each block (e.g., 0, 15, 30, 45, etc). Given that a non-slip global clock timing is recommended. I am unsure whether I write the correct psychopy code.

3. What I would like to kindly ask?
Could I ask someone to check my code and see whether I solved the above-mentioned two questions correctly? If NOT, might you give me some corrections?

Thank you very much in advance, any suggestions are very welcome and highly appreciated.
finger_tap_task.py (2.1 KB)

Hi @jon , sorry for the disturb, may I have your inputs?

Sorry, no. PsychoPy has 40,000 users. There’s no way I (or the community) can individually check their python scripts for errors. Please use the forum to solve specific questions.

Hi @jon , thank you for the reply.
However, as you might notice that, I put this question on forum. But not everyone get replies. I wonder is there a mechanism or some solutions in this forum to solve this? Otherwise some people’s questions never get replies.

I think the reason you didn’t get a response is because you asked for people to “check your code”. That’s a time-consuming request so, again, not very sustainable if everybody started asking the same question

Challenging to check your code without the dependencies like the fingerTap_sequence_X.txt files. The code looks fine. But the easiest way to check is to use a stop-watch and/or write out log files with the times things start and stop. A little bit of drift in fMRI isn’t going to matter, we (fMRI folks) measure things (for the most part) in seconds, so if you’re missing a few dozen (or even hundred) milliseconds at the end of your task, it’s going to be fine.