-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Metabolic HH neuron model after Dutta et al. #531
base: master
Are you sure you want to change the base?
Conversation
Nice, do you have any tests for this we could put in? I'll add it to the GraphDynamics support list soon. |
Tests are work in progress. Haris suggested I start the PR now though. I'll add tests and once it's ready I'll request a reviewer for the actual pull. |
Added tests and expanded the docstring. Ready for review. |
function MetabolicHHNeuron( | ||
;name, | ||
namespace=nothing, | ||
neurontype="excitatory", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this neurontype
keyword argument used for? It doesn't seem to affect anything in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch. Thank you! Somehow the part where it's used got washed out throughout the recent edits. "Neurontype" would be used in the connection rule. See the latest commit which has it now. It would determine whether to use excitatory or inhibitory parameters for the synaptic connection depending on the source neuron's type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did want to ask for some help with this as currently it throws an error and I expect the test to fail accordingly.
ERROR: ArgumentERror: System nrn1: variable neurontype doesn't exist.
I understand where it's coming from, but I'm struggling to find a workaround. Would you have any advice? I think the way it is now used to work in the past but I might be wrong. Either way, is there a way I can access the property neurontype in connections?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. It seems that the problem is that @harisorgn added this override for getproperty
last month:
Neuroblox.jl/src/blox/blox_utilities.jl
Lines 1 to 9 in 89cadb8
function Base.getproperty(b::Union{AbstractNeuronBlox, NeuralMassBlox}, name::Symbol) | |
# TO DO : Some of the fields below besides `odesystem` and `namespace` | |
# are redundant and we should clean them up. | |
if (name === :odesystem) || (name === :namespace) || (name === :params) || (name === :output) || (name === :voltage) | |
return getfield(b, name) | |
else | |
return Base.getproperty(Neuroblox.get_namespaced_sys(b), name) | |
end | |
end |
which means that when you do n.field
it redirects it to n.system.field
instead. Not sure how I feel about that one tbh since it's kinda inconvenient for blox like this.
The fix in your case is simple though, you can just replace
if blox_src.neurontype == "excitatory"
with
if getfield(blox_src, :neurontype) == "excitatory"
That said, I think it might be a good idea to have separate types for excitatory versus inhibitory neurons here (or distinguish them by a type parameter like in #532).
If we do want to keep them as one type though, it's usually a little more idiomatic to use a Symbol
here instead of a String
(i.e. :excitatory
instead of "excitatory"
) but for our purposes here it doesn't really matter much.
Thanks for the thorough review and for catching these issues @MasonProtter! I have a follow-up question in one of the comments. |
Closes #393.