Skip to content

Commit

Permalink
Fixups.
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc committed Sep 23, 2024
1 parent 7b9225c commit 3f22ed5
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions python/nmodl/ode.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,10 @@ def discretize_derivative(expr):


def transform_expression(expr, transform):
if expr.args is tuple():
if not expr:
return expr

args = list(transform_expression(transform(arg), transform) for arg in expr.args)
args = (transform_expression(transform(arg), transform) for arg in expr.args)
return expr.func(*args)


Expand All @@ -374,21 +374,6 @@ def transform_matrix_elements(mat, transform):
)


def finite_difference_variables(mat):
vars = []

def recurse(expr):
for arg in expr.args:
if isinstance(arg, sp.Derivative):
var = arg.args[1][0]
vars.append((var, finite_difference_step_variable(var)))

for expr in mat:
recurse(expr)

return vars


def needs_finite_differences(mat):
return any(isinstance(expr, sp.Derivative) for expr in sp.preorder_traversal(mat))

Expand Down

0 comments on commit 3f22ed5

Please sign in to comment.