Importing stimulus waveforms
Posted: Tue Mar 24, 2020 10:20 am
Hi,
I've been simulating various transcranial magnetic stimulation (TMS) waveforms for extracellular stimulation in NEURON using the xtra.mod file approach written by Ted. Typically, I down-sample a recorded waveform to the time step of my simulation (e.g. 1 µs or 5 µs) in Matlab, and then I use vector.play to "play" the normalized waveform into the global "stim" variable with continuous mode on:
I noticed that if, for example, I use a TMS waveform recorded at 1 µs steps and a NEURON simulation time step dt of 5 µs for either of the two following cases, I get different results:
1) Downsample TMS waveform in MATLAB to 5 µs and import to NEURON (downsample.m function, just takes every 5th sample in this case), or
2) Import original TMS waveform (1 µs), and let NEURON handle downsampling at simulation time steps
And by different results, I mean different polarizations for a given compartment in the neuron model at the same stimulus amplitude. Is this due to NEURON using the additional waveform samples between time steps? And if so, is it better practice to just import the recorded waveform with the highest temporal resolution available, rather than downsampling to the simulation time step?
The other concern I had was avoiding anti-aliasing of the waveform, so I apply a 1st order, 200 kHz low-pass filter in MATLAB to reduce anti-aliasing from the subsequent downsampling for simulations. Does NEURON do anything under the hood to deal with aliasing?
I've been simulating various transcranial magnetic stimulation (TMS) waveforms for extracellular stimulation in NEURON using the xtra.mod file approach written by Ted. Typically, I down-sample a recorded waveform to the time step of my simulation (e.g. 1 µs or 5 µs) in Matlab, and then I use vector.play to "play" the normalized waveform into the global "stim" variable with continuous mode on:
Code: Select all
stim_amp.play(&stim_xtra, stim_time, 1)
I noticed that if, for example, I use a TMS waveform recorded at 1 µs steps and a NEURON simulation time step dt of 5 µs for either of the two following cases, I get different results:
1) Downsample TMS waveform in MATLAB to 5 µs and import to NEURON (downsample.m function, just takes every 5th sample in this case), or
2) Import original TMS waveform (1 µs), and let NEURON handle downsampling at simulation time steps
And by different results, I mean different polarizations for a given compartment in the neuron model at the same stimulus amplitude. Is this due to NEURON using the additional waveform samples between time steps? And if so, is it better practice to just import the recorded waveform with the highest temporal resolution available, rather than downsampling to the simulation time step?
The other concern I had was avoiding anti-aliasing of the waveform, so I apply a 1st order, 200 kHz low-pass filter in MATLAB to reduce anti-aliasing from the subsequent downsampling for simulations. Does NEURON do anything under the hood to deal with aliasing?