Closed JRS92 closed 3 years ago
this is interesting -- could you share your custom getCurrent()
function?
double optiSlowKV5::getCurrent(double V_){ return g * (V_/25)* (exp((V_-E)/25) - 1)/((exp(V_/25) - 1)); }
i'm still trying to understand the issue, but in the meantime, can you try your model with
x.use_current = 1;
where x
is your xolotl model?
That does not change the output. Sorry, are you not able to reproduce the problem? I'm able to do this with any conductance...no matter what getCurrent
looks like, I_clamp
will always show the default g*(V-E)
.
Here is some example code. Swap that getCurrent
into liu/ACurrent...or use any 'getCurrent' that you want as long as it's not the same as the default g * (V-E);
x = xolotl;
x.add('compartment','AB','A',.0017);
x.AB.add('liu/ACurrent','gbar',20);
x.dt = 0.1;
x.t_end = 100;
x.V_clamp = 40;
x.output_type = 1;
results = x.integrate;
plot(results.AB.I_clamp,'Color', 'k'); hold on
plot(results.AB.ACurrent.I * x.AB.A,'Color','m');
ylim([-0.5 2]);
aaah, thanks, i understand the problem now:
when voltage clamping, the clamping currents are calculated assuming Ohmic currents and do not respect the getCurrent method in the conductance....right?
this line is where the clamping current is calculated, and as you correctly guessed, it's Ohmic.
thanks for this bug report -- it's a nasty one. i'll fix it today.
@JRS92 fixed, let me know if this works.
Works great! Thanks
I would think that if you voltage clamp a compartment with a single conductance, the current density reported by integrate() (with output_type = 1) multiplied by the surface area of the compartment should be equal to I_clamp minus the capacitance artifact. However, this does not seem to be the case.
In this figure, I_clamp is plotted on the left, and the current density multiplied by the surface area of the single-conductance compartment is on the right. This is multiple sweeps of a simple voltage ladder.
The conductance uses a custom getCurrent() function. Removing that function (inheriting default getCurrent) makes I_clamp match density * surface area.
Thus, I believe this is something related to how current densities are calculated? I wonder if this also carries over to calculating the "dominant current" such as in this example: https://xolotl.readthedocs.io/en/master/tutorials/first-neuron/.