klabhub / neurostim

Design and run visual neuroscience experiments using Matlab and the Psychophysics Toolbox.
MIT License
5 stars 3 forks source link

Reading MCC input is slow #43

Closed adammorrissirrommada closed 2 years ago

adammorrissirrommada commented 8 years ago

We want to read the digital input each frame for a touchbar "hold" behavior, but DaqDin function currently takes about 21 ms to return a value, causing many framedrops. There is some talk of how to reduce this delay here (https://groups.yahoo.com/neo/groups/psychtoolbox/conversations/topics/10301), but it sounds like it will never be particularly fast.

@bartkrekelberg, it looks to me that for the old Neurostim you got around this by using a background process that samples the (analog) buffer continuously (running the function akin to DaqDInScan). I haven't Googled extensively, but it would seem that we could use that solution here also. Do you have a suggestion based on your experience?

bartkrekelberg commented 8 years ago

Yes, I think you'd have to use cbAInScan. If I remember correctly you tell it where to write (a bit of memory) and then it just fills that memory continuously and you can sample the memory as fast as you want. I am not sure whether I actually tested the delay (between a physical event and the memory being updated) because we never actually used the functionality (it was meant to read IScan analog eye position output).

Because memory access is more limited from matlab the equivalent may be a bit more tricky (it may require a mex file unless something has already been implemented in the MCC toolbox/code in PTB or from MCC itself?)


Bart Krekelberg, PhD Professor, Rutgers University - Newark Associate Director, Center for Molecular and Behavioral and Neuroscience Associate Director, Rutgers Brain Imaging Center Newark, NJ 07102 USA T: 973 353 3602 W: vision.rutgers.edu E: bart@vision.rutgers.edu

On Wed, Apr 20, 2016 at 8:08 AM, adammorrissirrommada < notifications@github.com> wrote:

We want to read the digital input each frame for a touchbar "hold" behavior, but DaqDin function currently takes about 21 ms to return a value, causing many framedrops. There is some talk of how to reduce this delay here ( https://groups.yahoo.com/neo/groups/psychtoolbox/conversations/topics/10301), but it sounds like it will never be particularly fast.

@bartkrekelberg https://github.com/bartkrekelberg, it looks to me that for the old Neurostim you got around this by using a background process that samples the (analog) buffer continuously (running the function akin to DaqDInScan). I haven't Googled extensively, but it would seem that we could use that solution here also. Do you have a suggestion based on your experience?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/klabhub/neurostim-ptb/issues/43

jonaskn commented 8 years ago

I think Till is using a mex file for his mcc communication, but that might be digital only. Might be worth asking him if the toolbox in matlab isn't good enough.

On Wed, Apr 20, 2016, 02:38 Bart Krekelberg notifications@github.com wrote:

Yes, I think you'd have to use cbAInScan. If I remember correctly you tell it where to write (a bit of memory) and then it just fills that memory continuously and you can sample the memory as fast as you want. I am not sure whether I actually tested the delay (between a physical event and the memory being updated) because we never actually used the functionality (it was meant to read IScan analog eye position output).

Because memory access is more limited from matlab the equivalent may be a bit more tricky (it may require a mex file unless something has already been implemented in the MCC toolbox/code in PTB or from MCC itself?)


Bart Krekelberg, PhD Professor, Rutgers University - Newark Associate Director, Center for Molecular and Behavioral and Neuroscience Associate Director, Rutgers Brain Imaging Center Newark, NJ 07102 USA T: 973 353 3602 W: vision.rutgers.edu E: bart@vision.rutgers.edu

On Wed, Apr 20, 2016 at 8:08 AM, adammorrissirrommada < notifications@github.com> wrote:

We want to read the digital input each frame for a touchbar "hold" behavior, but DaqDin function currently takes about 21 ms to return a value, causing many framedrops. There is some talk of how to reduce this delay here (

https://groups.yahoo.com/neo/groups/psychtoolbox/conversations/topics/10301 ), but it sounds like it will never be particularly fast.

@bartkrekelberg https://github.com/bartkrekelberg, it looks to me that for the old Neurostim you got around this by using a background process that samples the (analog) buffer continuously (running the function akin to DaqDInScan). I haven't Googled extensively, but it would seem that we could use that solution here also. Do you have a suggestion based on your experience?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/klabhub/neurostim-ptb/issues/43

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/klabhub/neurostim-ptb/issues/43#issuecomment-212301004

bartkrekelberg commented 5 years ago

We recently added mcc analog reading , which works well and fast (no dropped samples as far as we can tell, because it uses the HUD buffers). This, however, does the read in the afterTrial function so there is no "online" (at frame level) interaction with the analog data. Still it bodes well for an equivalent design for digital in.