[visionegg] Re: time and OS es


But let me just give some real life cases where occasional latencies could be a problem:

- The stimulation PC must not miss the 5 millisec-long TTL signals sent from a MRI scanner to synchronize trials with brain scans.

Now, this is a potential problem in any event. Note that in this event missing the critical msec that the signal occurred wouldn't be so bad (100 msec slop on the detection would be pretty meaningless in most fMRI and 30msec would be fine) except that there is no way to make up for it. I suggest that you always latch these outputs. If the scanner triggers it goes high and stays high until the computer resets. That's really some dead simple electronics.

The other solution to this is to only use the first TTL pulse, as a "trigger" for your experiment. You can then use the computer's own internal timing to display your stimulus. If your experiment doesn't start on time, but starts 2 seconds late, you'll know you missed the pulse.



This may introduce some "noise", however, as is pointed out, anything less than a few hundred milliseconds is not going to change your hemodynamic response. Of course, one should be clever in this design - i.e. present stim for 10 frames, then wait 10 frames is a bad design as it will introduce drift, whereas present stim for 10 frames, then wait until absolute start + trial number * time for trial will give you a more accurate presentation.



- In ERP experiments, subliminal stimuli are displayed for 2/3 video frames, several hundreds of times in 10 minutes runs. It is very important that the subject does not see consciously any of the subliminal images because it could change his strategy. So one would like to have frame-by-frame accuracy for several minutes.

agreed, problematic if they see one in that instance. However, in most studies of these type it is OK if they see the occasional sub stimulus (and there is really never any guarantee that they don't). In that case, the odds of missing one of the critical frames is probably perfectly acceptable (and a recordable error).


Which brings out one of the points I made but didn't emphasize. Many experimenters do not record the error of the measurement. A long tradition of canned packages that just give you back what you put in has really promoted this. I'm glad some of the newer ones like Experiment Builder (SRI) and Presenter(?) record what happened.

Presentation (http://nbs.neuro-bs.com/) does this, but is windows only.
Logging uncertainties is a great idea. For most ERP or electrophysiology experiments, tossing trials is a common way around the uncertainty of display.



It occurs to me that some latencies may be completely controlled by a few minor modifications to your flavor of linux distribution. Turning off all services would be a good first start. Recompiling the kernel to exclude unneeded drivers would probably help too (if it is a real psychophysics box, it probably doesn't need that network connection does it?). Recompiling the kernel so that it can't even try to use a network connection will avoid any latencies introduced by having a network interface on the machine. I would think a large amount of the pre-empting is probably from things that don't need to be running. A default Fedora kernel has way too much stuff in it to make sure the kernel works for everyone. Aren't there programs for system profiling to find out where the operating system is spending it's time? (A quick google comes across oprofile: http://oprofile.sourceforge.net). I would think minimally all one would need for visionegg is anything you need for X11 and just PS/2 support for keyboards and mice. USB/network/cdrom are unnecessary for psychophsyics. Doing this and then testing your setup is the only real way to make sure you're consistent.


Most modern distributions even allow easy ways to modify the kernel, and boot loaders to load a specific kernel. One would only need a psychophysics kernel and a general purpose kernel in GRUB to really pull this off (so you could actually bring a stimulus to the machine or use features you'd expect out of a normal linux box).

When it comes down to it, there's two options, use an operating system that you can take over (ala Mac os < 10, windows < 2000), or minimize the effects of a preemptive multi-tasking OS.

Mark

======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: