psychopy.org | Reference | Downloads | Github

Getting time print outs on data file to characterize delays

OS: Win 7
PsychoPy version (e.g. 1.84.x): 3.0
Standard Standalone? (y/n): yes

Hi all,
I am relatively new to PsychoPy and very new to python. I’m sure this is an easy question, and I’ve been pouring over this forum and the psychopy website but am still feeling lost. I need to characterize the delay between when words are presented on a screen and when a TMS coil is firing. I am currently using builder to build this experiment. Below is a description of my experiment.

In my experiment, subjects see crosshairs, a blank screen, a word, blank screen, crosshairs, repeat. I need a TMS coil to fire as close to 250 ms after the word appears as possible. I have things set up to send a trigger from PsychoPy via parallel port to another computer to stimulate with a Magstim TMS coil (using CED Signal), which is currently working.

I am not exactly sure how to characterize the delay between word onset and TMS coil firing, but a few things would be helpful to start me off. What is the best way to get a frame number, global time, or relative time output on each component of the experiment? I.e., how do I get the data file to also record when the parallel port trigger is sending in relation to the appearance of words?

I’ve seen suggestions to add certain components directly into the code, but am unsure of where to add these. For example, adding thisExp.addData(‘trial_duration’, t), exp.addData(‘TextOnset’, text.tStart)exp.addData(‘TextOffset’, text.tEnd), etc.

However, my data output file hasn’t changed, most likely because I have no idea where to place these components in the code to actually change the data output. Can anyone help me place these components (or suggest others) either in builder or in the code (might be a bit more challenging for me but with detailed instructions I could do this!) to give me global time and/or frame number of the start of the word presentation and the start of the trigger? I’ve attached a simplified version of my experiment.PilotTrigger.psyexp (8.7 KB)

Aren’t you defining it to be 250 ms?

Hello!
Yes, I am defining it to be 250 ms. However, I am sure that’s not actually the exact time between the word appearing and the TMS coil firing. I’m trying to measure the delays of the equipment and programs essentially.

I was able to get various timing parameters printed on the data output sheet! I placed <thisExp.addData(‘trial_duration’,t) thisExp.addData(TestTextStartSeconds’,TestText.tStart) thisExp.addData(‘TestTextGlobalTime’, globalClock.getTime())> directly in the code (in the “Ending Routine” segment of the TestWord component) to get some timing parameters. Hopefully this will help, but I’m not totally sure where to go from here.

I just tried adding <thisExp.addData(‘AbsTime’,globalClock.getAbsTime())> in the same spot as the other data printout modifications (end routine section of the TestWord component)
to get the absolute time that the Test Text is appearing. I thought I could try to do something similar on the computer triggering the TMS coil to fire and then simple math would get me a delay! However, I receive the following error:

“AttributeError: ‘Clock’ object has no attribute ‘getAbsTime’”

PilotTriggerTimeDataPrint.py (17.8 KB)

Any idea how to fix this? Code attatched.

It appears that getAbsTime is not a defined function. Is there another library I need to import in order to use this?

Please don’t post the same question in different topics. It means that two people spend time writing replies to your single issue.