Skip to content
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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

bbantal
Copy link

@bbantal bbantal commented Jan 16, 2025

Closes #393.

@MasonProtter
Copy link
Contributor

Nice, do you have any tests for this we could put in? I'll add it to the GraphDynamics support list soon.

@bbantal
Copy link
Author

bbantal commented Jan 16, 2025

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.

@bbantal bbantal requested a review from harisorgn January 18, 2025 07:22
@bbantal
Copy link
Author

bbantal commented Jan 18, 2025

Added tests and expanded the docstring. Ready for review.

src/Neuroblox.jl Outdated Show resolved Hide resolved
src/blox/neuron_models.jl Outdated Show resolved Hide resolved
function MetabolicHHNeuron(
;name,
namespace=nothing,
neurontype="excitatory",
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Author

@bbantal bbantal Jan 19, 2025

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?

Copy link
Contributor

@MasonProtter MasonProtter Jan 19, 2025

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:

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.

test/components.jl Outdated Show resolved Hide resolved
@bbantal
Copy link
Author

bbantal commented Jan 19, 2025

Thanks for the thorough review and for catching these issues @MasonProtter! I have a follow-up question in one of the comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add metabolic HH model (following Dutta et al.)
2 participants