Page 1 of 1

Using VecStim() with CVode on

Posted: Tue Dec 04, 2018 6:20 am
by MarkoF

I have a model with multiple excitatory and inhibitory synapses that I feed previously constructed spike trains via VecStim() mechanism. Now in order to speed up the simulation I am thinking of using the variable time step by activating CVode. What I am concerned about is, how are the incoming spikes being integrated if their arrival time doesn't match the current time step?

With the caveat that I don't know the inner workings of CVode, I'm wondering if a situation can occur when I have two spikes arriving at a synapse, one at e.g. 24.2ms of simulation time, the other at 24.8ms, and that they get bundled together and perceived as arriving at the same time due to an increase of simulation time step? Because that is something that I would like to avoid.

In essence, is it better to use a fixed integration time grid when working with VecStim objects?

Re: Using VecStim() with CVode on

Posted: Tue Dec 04, 2018 7:05 am
by ramcdougal
Adaptive integration chooses timesteps to constrain error.

In particular, unlike fixed step integration, it will adapt its timesteps to handle events at the time received and not shift them or group them.

Re: Using VecStim() with CVode on

Posted: Tue Dec 04, 2018 7:07 am
by MarkoF
Oh, but that's perfect then! I can activate CVode and get faster simulations without loss in integration precision. Thank you very much for your answer!

Re: Using VecStim() with CVode on

Posted: Tue Dec 04, 2018 10:59 am
by ted
In principle, adaptive integration should work well for a model that involves only one biophysical model cell--as long as all mechanisms are compatible with CVODE.

But always remember that accuracy is the principal reason to use adaptive integration, not speed. While it is true that adaptive integration may execute faster than fixed time step integration, it may also execute slower--sometimes much slower--than fixed time step execution. A case in point: network models in which spiking activity is often so asynchronous that there is never an interval over which large time steps can be taken. Switching to local variable time step integration generally doesn't help much. This is why medium to large scale network models generally use fixed time step integration.

Three comments about events and integration methods:
1. Fixed time step integration doesn't shift events. It simply handles events only at times that are integer multiples of dt.
2. Nor does adaptive integration shift events. It handles them at the exact times that they are delivered.
3. If a presynaptic neuron is a biophysical model cell and adaptive integration is used, for improved accuracy you may want to specify second order detection of presynaptic spike time--read about the CVode class's condition_order() method ... ion_order