diff --git a/validation/CMakeLists.txt b/validation/CMakeLists.txt index 8566b787dcaf71fd08cb291ac21f1a3ed6e7383c..009a27aa43ce8974b154ce265e6dd6c75b990f52 100644 --- a/validation/CMakeLists.txt +++ b/validation/CMakeLists.txt @@ -5,12 +5,14 @@ add_custom_target(validation_data) # Helper function because ffs CMake. function(make_unique_target_name name path) - # try and make a broadly human readable target name if possible. + # Try and make a broadly human readable target name if possible. string(REGEX REPLACE ".*/" "" leaf "${path}") string(REGEX REPLACE "[^a-zA-Z0-9_.+-]" "_" canon "${leaf}") - # check against reserved names, of which of course there is no documented list - if(canon MATCHES "^(all|test|clean|help)$") + # Check against reserved names, of which of course there is no documented list + # except in the sodding CMake source code. Seriously. Look at the CMP0037 policy + # text for a laugh. + if(canon MATCHES "^(all|ALL_BUILD|help|install|INSTALL|preinstall|clean|edit_cache|rebuild_cache|test|RUN_TESTS|package|PACKAGE|package_source|ZERO_CHECK)$") set(canon "${canon}_") endif() while((TARGET "${canon}")) diff --git a/validation/ref/numeric/hh_soma.jl b/validation/ref/numeric/hh_soma.jl index 82e7df8b5f6c2c594b8b35f584cbf41a42e58e6b..1db5813f0349b45f90ac3db1dcdef18352716058 100644 --- a/validation/ref/numeric/hh_soma.jl +++ b/validation/ref/numeric/hh_soma.jl @@ -62,11 +62,16 @@ function n_lims(v) return ntau, ninf end -# v = y[1] +# v = y[1] V # m = y[2] # h = y[3] # n = y[4] +# dv/dt = ydot[1] V/s +# dm/dt = ydot[2] /s +# dh/dt = ydot[3] /s +# dn/dt = ydot[4] /s + # choose initial conditions for the system such that the gating variables # are at steady state for the user-specified voltage v function initial_conditions(v) @@ -74,13 +79,13 @@ function initial_conditions(v) htau, hinf = h_lims(v) ntau, ninf = n_lims(v) - return [Float64(v), minf, hinf, ninf] + return [v/V, minf, hinf, ninf] end # calculate the lhs of the ODE system function f(t, y, ydot) # copy variables into helper variable - v = y[1]mV + v = y[1]V m, h, n = y[2], y[3], y[4] # calculate current due to ion channels @@ -94,7 +99,8 @@ function f(t, y, ydot) # calculate current due to stimulus #c.add_stimulus({0,0.5}, {10., 100., 0.1}); ielectrode = 0.0nA / surface_area - if t>=Float64(10ms) && t<Float64(100ms) + time = t*ms + if time>=10ms && time<100ms ielectrode = 0.1nA / surface_area end @@ -107,11 +113,11 @@ function f(t, y, ydot) htau, hinf = h_lims(v) # set the derivatives - # note tha these are in SI units, which are indicated in comments - ydot[1] = Float64(i/c_m) # V*s^-1 - ydot[2] = Float64((minf-m)/mtau) # s^-1 - ydot[3] = Float64((hinf-h)/htau) # s^-1 - ydot[4] = Float64((ninf-n)/ntau) # s^-1 + # note values are in SI units, as determined by the scaling factors: + ydot[1] = i/c_m / (V/s) + ydot[2] = (minf-m)/mtau / (1/s) + ydot[3] = (hinf-h)/htau / (1/s) + ydot[4] = (ninf-n)/ntau / (1/s) return Sundials.CV_SUCCESS end