From 2139d66d7b3cf7055696b269a8f06df46637354c Mon Sep 17 00:00:00 2001 From: Sam Yates <halfflat@gmail.com> Date: Thu, 20 Oct 2016 12:35:47 +0200 Subject: [PATCH] Address comments on PR#33 * Expand comments, function documentation in Julia script. * Use '#' for top level headers in `README.md` --- scripts/PassiveCable.jl | 55 ++++++++++++++++++++++++++++++++++------- scripts/README.md | 9 +++---- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/scripts/PassiveCable.jl b/scripts/PassiveCable.jl index 7c50a645..76450490 100644 --- a/scripts/PassiveCable.jl +++ b/scripts/PassiveCable.jl @@ -12,7 +12,12 @@ export cable_normalize, cable, rallpack1 # ∂g/∂x (0, t) = 1 # ∂g/∂x (L, t) = 0 # -# (This implementation converges slowly for small t) +# Parameters: +# x, t, L: as described above +# tol: absolute error tolerance in result +# +# Return: +# g(x, t) function cable_normalized(x, t, L; tol=1e-8) if t<=0 @@ -32,7 +37,7 @@ function cable_normalized(x, t, L; tol=1e-8) break end end - return ginf+sum + return ginf+sum end end @@ -56,18 +61,37 @@ end # # L: length of cable # r: linear axial resistivity -# g: linear membrane conductance -# c: linear membrane capacitance. +# g: linear membrane conductivity +# c: linear membrane capacitance # V: membrane reversal potential -# I: injected current on the left end (x = 0) of the cable. +# I: injected axial current on the left end (x = 0) of the cable. +# +# Note that r, g and c are specific 1-d quantities that differ from +# the cable resistivity r_L, specific membrane conductivity ḡ and +# specific membrane capacitance c_m as used elsewhere. If the +# cross-sectional area is A and cable circumference is f, then +# these quantities are related by: +# +# r = r_L/A +# g = ḡ·f +# c = c_m·f +# +# Parameters: +# x: displacement along cable +# t: time +# L, lambda, tau, r, V, I: as described above +# tol: absolute error tolerance in result +# +# Return: +# computed potential at (x,t) on cable. function cable(x, t, L, lambda, tau, r, V, I; tol=1e-8) scale = I*r*lambda; if scale == 0 - return V + return V else tol_n = abs(tol/scale) - return scale*cable_normalized(x/lambda, t/tau, L/lambda, tol=tol_n) + V + return scale*cable_normalized(x/lambda, t/tau, L/lambda, tol=tol_n) + V end end @@ -82,8 +106,21 @@ end # d = 1 µm cable diameter # EM = -65 mV reversal potential # I = 0.1 nA injected current -# L = 1 mm cable length +# L = 1 mm cable length. +# +# (This notation aligns with that used in the Rallpacks paper.) +# +# Note that the injected current as described in the Rallpack model +# is trans-membrane, not axial. Consequently we need to swap the +# sign on I when passing to the cable function. +# +# Parameters: +# x: displacement along cable [m] +# t: time [s] +# tol: absolute tolerance for reported potential. # +# Return: +# computed potential at (x,t) on cable. function rallpack1(x, t; tol=1e-8) RA = 1 @@ -101,4 +138,4 @@ function rallpack1(x, t; tol=1e-8) return cable(x, t, L, lambda, tau, r, EM, -I, tol=tol) end -end #module +end # module PassiveCable diff --git a/scripts/README.md b/scripts/README.md index bd8c6111..373f9f13 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,5 +1,4 @@ -tsplot -====== +#tsplot The `tsplot` script is a wrapper around matplotlib for displaying a collection of time series plots. @@ -78,8 +77,7 @@ of the timeseries data. Use the `-o` or `--output` option to save the plot as an image, instead of displaying it interactively. -profstats -========= +#profstats `profstats` collects the profiling data output from multiple MPI ranks and performs a simple statistical summary. @@ -92,8 +90,7 @@ are reported instead. Output is in CSV format. -PassiveCable.jl -=============== +#PassiveCable.jl Compute analytic solutions to the simple passive cylindrical dendrite cable model with step current injection at one end from t=0. -- GitLab