Skip to content

Commit

Permalink
Removed optimization in favor of simplicity
Browse files Browse the repository at this point in the history
- The switch between Ca dependent and voltage dependent gates put
inside for loop instead of having one loop under each condition.
  • Loading branch information
subhacom committed Jul 30, 2024
1 parent 8c4db05 commit da455e2
Showing 1 changed file with 14 additions and 25 deletions.
39 changes: 14 additions & 25 deletions python/moose/neuroml2/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,34 +621,23 @@ def rateFnFromFormula(
if _isConcDep(ctype):
caConcName = _findCaConcVariableName() # moose CaCon element name
req_vars["v"] = "0.0V"
for vv in vtab:
if param_tabs is not None:
params = {
name: np.interp(vv, *tab)
for name, tab in param_tabs.items()
}
for vv in vtab:
if param_tabs is not None:
params = {
name: np.interp(vv, *tab)
for name, tab in param_tabs.items()
}
if _isConcDep(ctype):
req_vars["caConc"] = f"{max(1e-11,vv):g}" # do we need this?
req_vars[caConcName] = f"{max(1e-11,vv):g}"
vals = pynml.evaluate_component(
ctype, req_variables=req_vars, parameter_values=params
)
v = vals.get("x", vals.get("t", vals.get("r", None)))
if v is not None:
rate.append(v)
else:
for vv in vtab:
else:
req_vars["v"] = f"{vv}V"
if param_tabs is not None:
params = {
name: np.interp(vv, *tab)
for name, tab in param_tabs.items()
}
vals = pynml.evaluate_component(
ctype, req_variables=req_vars, parameter_values=params
)
v = vals.get("x", vals.get("t", vals.get("r", None)))
if v is not None:
rate.append(v)
vals = pynml.evaluate_component(
ctype, req_variables=req_vars, parameter_values=params
)
v = vals.get("x", vals.get("t", vals.get("r", None)))
if v is not None:
rate.append(v)
return np.r_[rate]

def calculateRateFn(
Expand Down

0 comments on commit da455e2

Please sign in to comment.