I need to implement the Randles circuit to an existing NEURON network model (running in parallel), reflecting electrodeelectrolyte interface effect. I inserted the schematic of Randles circuit below (from Fig 3 in Lempka et al., 2013). The network model already can calculate&output LFP at each time step, which should be corresponding to φLFP at the top in the schematic. and my task is to get φrec at the bottom, per each time step.
I'm not clear how to do this in the realtime simulation of NEURON. What I have in mind is, perhaps, transfer the entire Randle circuit into frequency domain (by laplace transfer), and calculate the response for φrec in frequency domain, and then convert it into time domain? But how will it be implemented in real time?
Were there any previous models performed similar tasks?
[/img]https://imgur.com/OV0MwJv[/img]
Thanks in advance.
Reference:
Lempka SF, McIntyre CC. Theoretical analysis of the local field potential in deep brain stimulation applications. PLoS One 2013; 8: e59839.
implement Randles circuit in NEURON
Moderator: hines

 Site Admin
 Posts: 5793
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: implement Randles circuit in NEURON
Let's use proper terminology. You mean "time domain simulation" not "realtime simulation." It's clear that you know the difference between time domain and frequency domain, but some who read this thread may not, and we don't want to confuse them.I'm not clear how to do this in the realtime simulation of NEURON.
From the Methods section in Lempka and McIntyre 2013, it looks like they calculated PHI_LFP(t) (local field potential just outside the electrodeelectrolyte interface layer) in the time domain as the weighted sum of the transmembrane currents (each weight being the transfer resistance between the center of a segment and the location of the recording electrode). Then they used FFT to transform PHI_LFP(t) to PHI_LFP(omega) (i.e. the frequency domain counterpart of the time domain signal), determined its power spectrum in 1 Hz wide bins, then multiplied each bin's power by the corresponding component of the FFT of the impulse response of their electrode circuit (obtained by analyzing the circuit in 3A and deriving the algebraic equation that relates PHI_REC(omega) to PHI_LFP(omega)basically a voltage divider equation that involves impedances). Finally, they used the inverse FFT to transform PHI_REC(omega) to the time domain PHI_REC(t). Note that each of the frequency domain steps is computationally detailed but fast (because only algebraic operations are involved).
An alternative approach might be to keep everything in the time domain, solving for PHI_LFP(t) in the course of the simulation and using that value to drive a linear circuit in which the constant phase element is approximated by a chain of 3 or 4 pairs of resistors and capacitors. Of course, that means you have to decide what values to use for these discrete circuit elements. References:
"2.1.4: What is a 'Warburg impedance' and how is it implemented?" Coursera presentation by Gregory Plett, Professor, CU Boulder. https://www.coursera.org/lecture/equiva ... ntedL8JI0 accessed at 11 PM EDT 20200929.
Also see, among others, the following:
Sekushin N.A. Equivalent circuit of Warburg impedance. Russian Journal of Electrochemistry 45:828832, 2009.
Chang JH et al.. Fitting Improvement Using a New Electrical Circuit Model for the ElectrodeElectrolyte Interface. Proceedings of the 3rd International IEEE EMBS Conference on Neural Engineering, Kohala Coast, Hawaii, USA, May 25, 2007.
Wang JC. Realizations of Generalized Warburg Impedance with RC Ladder Networks and Transmission Lines. J. Electrochem. Soc., 134:19151920, 1987.

 Site Admin
 Posts: 5793
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: implement Randles circuit in NEURON
Further comments:
1. The linear circuit could be implemented with the Linear Circuit builder.
2. The simulation of neural activity and calculation of PHI_REC(t) do not have to be done in the same session. Instead, the simulation and calculation of PHI_LFP(t) could be done once, and PHI_LFP(t) saved to a file. Then, in a separate session, the contents of that file could be read into a pair of Vectors (one for the t values, the other for the corresponding values of PHI_LFP) and used to drive the circuit that calculates PHI_REC(t)
3. Depending on the value of dt used to simulate neuronal activity, the discrete element approximation of Warburg impedance could be achievable with sufficient accuracy using 4 or 5 RC pairs with values selected to cover 4 or 5 decades of frequency. For example, with NEURON's default dt == 0.025 ms, the Nyquist limit is 1/(2*dt) = 20 kHz. 4 decades would cover the range from 0.2 Hz to 20 kHz, which should be sufficient for approximate reconstruction of LFP features from ~ 5 s to ~ 0.05 ms. Just to be on the safe side, I'd add a 5th RC pair and select parameters to span the range from 0.06 Hz to 60 kHz.
1. The linear circuit could be implemented with the Linear Circuit builder.
2. The simulation of neural activity and calculation of PHI_REC(t) do not have to be done in the same session. Instead, the simulation and calculation of PHI_LFP(t) could be done once, and PHI_LFP(t) saved to a file. Then, in a separate session, the contents of that file could be read into a pair of Vectors (one for the t values, the other for the corresponding values of PHI_LFP) and used to drive the circuit that calculates PHI_REC(t)
3. Depending on the value of dt used to simulate neuronal activity, the discrete element approximation of Warburg impedance could be achievable with sufficient accuracy using 4 or 5 RC pairs with values selected to cover 4 or 5 decades of frequency. For example, with NEURON's default dt == 0.025 ms, the Nyquist limit is 1/(2*dt) = 20 kHz. 4 decades would cover the range from 0.2 Hz to 20 kHz, which should be sufficient for approximate reconstruction of LFP features from ~ 5 s to ~ 0.05 ms. Just to be on the safe side, I'd add a 5th RC pair and select parameters to span the range from 0.06 Hz to 60 kHz.

 Posts: 94
 Joined: Mon May 19, 2014 10:39 pm
Re: implement Randles circuit in NEURON
Dear Ted,Further comments:
1. The linear circuit could be implemented with the Linear Circuit builder.
2. The simulation of neural activity and calculation of PHI_REC(t) do not have to be done in the same session. Instead, the simulation and calculation of PHI_LFP(t) could be done once, and PHI_LFP(t) saved to a file. Then, in a separate session, the contents of that file could be read into a pair of Vectors (one for the t values, the other for the corresponding values of PHI_LFP) and used to drive the circuit that calculates PHI_REC(t)
3. Depending on the value of dt used to simulate neuronal activity, the discrete element approximation of Warburg impedance could be achievable with sufficient accuracy using 4 or 5 RC pairs with values selected to cover 4 or 5 decades of frequency. For example, with NEURON's default dt == 0.025 ms, the Nyquist limit is 1/(2*dt) = 20 kHz. 4 decades would cover the range from 0.2 Hz to 20 kHz, which should be sufficient for approximate reconstruction of LFP features from ~ 5 s to ~ 0.05 ms. Just to be on the safe side, I'd add a 5th RC pair and select parameters to span the range from 0.06 Hz to 60 kHz.
Thank you very much for your detailed reply the explanations. And sorry for the confusions. What I meant was, I already have the PHI_LFP(t) which is calculated at each simulation time step, and I need to get PHI_REC(t) at each simulation time step also, but was not sure how. What I also meant to ask was, is it possible to do these calculations in frequency domain like in Lempka and McIntyre 2013 and convert results (i.e., PHI_LFP(omega) and PHI_REC(omega)) back to time domain at each simulation time step in NEURON? I guess it might be difficult.
As I need to calculate PHI_REC(t) at each simulation time step, I may not opt for the second suggestion in your further comments, i.e. save PHI_LFP(t) to a file and postprocess it to get PHI_REC(t).
So I think the best option for me is your first suggestion, approximate Randles circuit with the linear circuit that could be implemented with the Linear Circuit builder.
If I model the Randles circuit in NEURON, do you know how to transfer it to a script that I can call at every simulation time step so the LFP can drive it?