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

Missing erev #61

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions pyneuroml/neuron/mview_neuroml2.hoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ proc init() {local i
nrnpython("from pyneuroml.neuron.nrn_export_utils import get_segment_group_name")
nrnpython("from pyneuroml.neuron.nrn_export_utils import set_erev_for_mechanism")
nrnpython("from pyneuroml.neuron.nrn_export_utils import get_erev_for_mechanism")
nrnpython("from pyneuroml.neuron.nrn_export_utils import NO_REV")
nrnpython("from neuron import h")
}

Expand Down Expand Up @@ -540,19 +541,6 @@ proc xmlwrite_biophysics() {
print "---------------------------------------------"
print "Handling mechanism: ", dmech.name

strdef passiveAttr
passiveAttr = ""
// If mech name is built in passive conductance in NEURON
if (strcmp(dmech.name,"pas") == 0) {
// Not used in nml2
//////passiveAttr = " passive_conductance=\"true\""
}
// If mech name is default passive conductance from neuroConstruct
if (strcmp(dmech.name,"LeakConductance") == 0) {
// Not used in nml2
/////passiveAttr = " passive_conductance=\"true\""
}

for j=0, dmech.location.subset.size()-1 {
secref = cellref.secanal.all.object(dmech.location.subset.x(j))
// printsec(cellnml2file, secref)
Expand Down Expand Up @@ -633,8 +621,8 @@ proc xmlwrite_biophysics() {

if (strcmp(paramNameToUse, "condDensity")==0) {

cellnml2file.printf(" <channelDensity ionChannel=\"%s\" id=\"%s_XXX\"%s ", dmech.name, dmech.name, passiveAttr)
cellnml2file.printf(" <channelDensity ionChannel=\"%s\" id=\"%s\" ", dmech.name, dparm.name)

printparmval(cellnml2file, cellref.secanal.all, paramNameToUse, dpelm.parms.object(l), factor, comment, dmech.name, units)

if (hoc_sf_.substr(dmech.name,"Na")>=0) {
Expand All @@ -643,7 +631,9 @@ proc xmlwrite_biophysics() {
cellnml2file.printf(" erev=\"%fmV\" ", erev_K)
} else {
value = p.get_erev_for_mechanism(dmech.name)
cellnml2file.printf(" erev=\"%fmV\" ", value)
if (value && value != p.NO_REV) {
cellnml2file.printf(" erev=\"%fmV\" ", value)
}
}

cellnml2file.printf("/>\n\n")
Expand Down
4 changes: 3 additions & 1 deletion pyneuroml/neuron/nrn_export_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ def get_segment_group_name(nrn_section_name):

mechs_vs_erevs = {}

NO_REV = float('inf')

def set_erev_for_mechanism(mech, erev):
mechs_vs_erevs[mech] = erev
print(">> mechs_vs_erevs: %s"%mechs_vs_erevs)

def get_erev_for_mechanism(mech):

print(">> mechs_vs_erevs: %s"%mechs_vs_erevs)
return mechs_vs_erevs[mech]
return mechs_vs_erevs.get(mech, NO_REV)


if __name__ == '__main__':
Expand Down