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

Fix custom function handling in sympy solve visitor #1563

Merged
merged 2 commits into from
Dec 3, 2024

Conversation

JCGoran
Copy link
Contributor

@JCGoran JCGoran commented Dec 3, 2024

When running NMODL with NEURON codegen on this file:
https://github.com/neuronsimulator/reduced_dentate/blob/master/mechanisms/tca.mod

we get the following kind of error, but the codegen proceeds:

[NMODL] [info] :: Running sympy solve visitor
[NMODL] [warning] :: SympySolverVisitor :: python exception. (--verbose=info)
[NMODL] [info] :: Traceback (most recent call last):
# a lot of stack trace here...
sympy.printing.codeprinter.PrintMethodNotImplementedError: Unsupported by <class 'sympy.printing.c.C99CodePrinter'>: minf
Set the printer option 'strict' to False in order to generate partially printed code.

The problem is that functions defined in mod files are not known to the code generator, so it's complaining it cannot do the codegen for them. A somewhat minimal example of this is the following mod file:

UNITS {(mV) = (millivolt)}
NEURON {SUFFIX test_custom_functions}
STATE {m}
ASSIGNED {v (mV)}
INITIAL {m = minf(v)}
BREAKPOINT {SOLVE states METHOD cnexp}
DERIVATIVE states {m' = minf(v)}
FUNCTION minf(v(mV)) {minf = v}

@JCGoran JCGoran changed the title Fix custom function handling in sympy integrator Fix custom function handling in sympy solve visitor Dec 3, 2024
@JCGoran JCGoran marked this pull request as ready for review December 3, 2024 09:25
@JCGoran JCGoran merged commit f4b5bc7 into master Dec 3, 2024
12 checks passed
@JCGoran JCGoran deleted the jelic/fix_sympy_integrator branch December 3, 2024 10:44
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.

2 participants