hinsley / PlantChaos

NeurDS lab Plant Chaos paper
0 stars 0 forks source link

Return maps catching Ca reversal #32

Closed jamesjscully closed 1 year ago

jamesjscully commented 1 year ago

When Ca reverses on the last spike, the map is triggered. I tried adding a V threshold to no avail.

hinsley commented 1 year ago

Is this okay to close?

hinsley commented 1 year ago

I looked at the method being used here in the interest of finding a more robust yet similarly efficient callback. The method used (without the V threshold) is to detect the first downward zero crossing (positive to negative) of the calcium derivative:

-(p[13] * u[1] * (p[12] - u[6] + p[17]) - u[5])

One could instead just use Plant.dCa(p, u[5], u[1], u[6]) here without changing the logic (maybe this would interfere with type stability in some way, though, so it's possible this could slow down the callback substantially).

However, this method does not actually use the calcium nullcline as it is being drawn in phase space diagrams. For this nullcline we parametrize an interval in voltage and plot points (Ca_null_Ca(p, V), xinf(p, V)) accordingly to that interval. The definitions of these functions are as follows:

function Ca_null_Ca(p, v)
    return p[13]*xinf(p, v)*(p[12]-v+p[17])
end

xinf(p, V) = 1.0f0 / (1.0f0 + exp(0.15f0 * (p[16] - V - 50.0f0)))

Note p[13] is $Kc$, p[12] is $E{Ca}$, and p[17] is $\Delta_{Ca}$, while p[16] is $\Delta_x$.

The existing method produces this return map at $(\Delta_{Ca}, \Delta_x) = (-38, -1)$: plot_15 From the phase portrait this structure appears to potentially be an unwanted artifact of the callback method -- note the calcium nullcline crossings: plot_14 It does appear that this is due to the calcium nullcline actually being crossed, however.

hinsley commented 1 year ago

I ran this again with the old method which explicitly computes the calcium nullcline and noticed the following with 200 sample points:

Old, slow (but precise) method: plot_44 plot_45

Jack's new, efficient method: plot_46 plot_47

Although the ends of the trajectories appear to differ per method in the phase diagrams, the return maps are identical (except for a small deviation in precisely one sample). Initially the discontinuities in the return maps seemed artificial to me, but seeing the above diagrams I now feel comfortable closing this issue as well as #1.