Navigation: Tosca User Guide >

Output streaming

 

 

 

The digital input and the analog output run independently. The digital input is indeed typically 500 Hz (resolution set to 2ms on the General Options dialog). The audio output streaming is more complicated and its ability to keep up involves three main parameters: the sampling rate and polling interval (on the General tab of the flowchart editor) and the AO headway (on the General Options dialog).


 

The sampling rate is a minor player. A reasonable value is 100 kHz. If the stimulus is limited to frequency components <= 20 kHz or so, the sampling rate could be lowered to 50 kHz, which might offer some performance increase.


 

The other two parameters are the real players to think about.


 

The polling interval (typically 25 Hz = 40 ms) is the "frame size" of the streaming: the signal gets broken up into 40-ms chunks, and those chunks are sent one-by-one to the output cards. The polling interval, in conjunction with the headway, limits how fast Tosca can turn a stimulus off and switch from one state to another. It sends one frame to the output and then waits (headway X polling interval) before sending the next one. With the default headway of 50% and polling interval of 40 ms, the headway is 20 ms. This means, for example, if the mouse licks the spout right at the halfway point of the current frame, Tosca will be able to modify the next frame to ramp the stimulus off and then advance to the next state, giving a minimum latency of 60 ms between the mouse's action and the beginning of the following state.


 

Tosca was designed for the hardest case: a continuous stimulus that needs to be ramped off to avoid transients at some un-predetermined point in the future and as fast as possible. For this reason, by default it lives on the edge of not providing a new frame of analog output to the hardware in time, starving the hardware of data, causing it to throw the error you attached.


 

Thankfully, the requirements are not so strict in most cases, and one can improve performance by 1) increasing the polling interval (say to 10 Hz = 100 ms) and/or 2) increasing the headway (say to 100% or 150%). If this is on a 2P rig, the polling interval is constrained by the imaging frame rate, so the headway might be the only practical option.


 

Give that a try and see if you get more reliable performance.

 

 

 

Copyright © 2023 Eaton-Peabody Laboratories