Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Add test for nonspecific current#1235

Merged
JCGoran merged 9 commits into
masterfrom
jelic/add_test_nonspecific_current
May 7, 2024
Merged

Add test for nonspecific current#1235
JCGoran merged 9 commits into
masterfrom
jelic/add_test_nonspecific_current

Conversation

@JCGoran

@JCGoran JCGoran commented Apr 8, 2024

Copy link
Copy Markdown
Contributor

Since NEURON's ODE solver is not extremely accurate in the intermediate region where the jump is present, we only compare the final values (without the fix for the conductances, the result of v is a bunch of nans).

This requires updating the references again: BlueBrain/nmodl-references#9

@codecov-commenter

codecov-commenter commented Apr 8, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.67%. Comparing base (70553cc) to head (da9dad0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1235   +/-   ##
=======================================
  Coverage   86.67%   86.67%           
=======================================
  Files         176      176           
  Lines       13176    13176           
=======================================
  Hits        11420    11420           
  Misses       1756     1756           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bbpbuildbot

This comment has been minimized.

@JCGoran JCGoran marked this pull request as ready for review April 8, 2024 11:19
@bbpbuildbot

This comment has been minimized.

@JCGoran JCGoran requested a review from 1uc April 15, 2024 10:28
@1uc

1uc commented Apr 15, 2024

Copy link
Copy Markdown
Collaborator

I would have preferred to not replace the test, but to have both: the existing one to check accuracy of v(t) and the new one to check stability. To have both it might be better to make the constant 0.005 a parameter that we can set from the Python script. Then one can use the same MOD file for both cases.

@bbpbuildbot

This comment has been minimized.

@JCGoran

JCGoran commented Apr 24, 2024

Copy link
Copy Markdown
Contributor Author

To have both it might be better to make the constant 0.005 a parameter that we can set from the Python script.

Since the current workflow is nrnivmodl -> python simulate.py, I don't see a way to set the parameters in the mod file in the Python script itself (that is, unless we add another script beforehand which modifies the AST of the mod file).

@JCGoran JCGoran force-pushed the jelic/add_test_nonspecific_current branch from 81357a0 to ca86f73 Compare April 25, 2024 10:42
@JCGoran JCGoran changed the title Update test for nonspecific current Add test for nonspecific current Apr 25, 2024
@JCGoran

JCGoran commented Apr 25, 2024

Copy link
Copy Markdown
Contributor Author

Added new test (simulate2.py with mod file leonhard2).

@bbpbuildbot

This comment has been minimized.

@1uc

1uc commented May 6, 2024

Copy link
Copy Markdown
Collaborator

You can have global or range variables in the MOD file:


UNITS {
        (mA) = (milliamp)
}

NEURON {
        SUFFIX leonhard2
        NONSPECIFIC_CURRENT il
        RANGE c
}

ASSIGNED {
        il (mA/cm2)
}

BREAKPOINT {
        il = c * (v - 1.5)
}

(or similar). And then set from Python:

s.leonhard_c = 0.05
# s.c_leonhard = 0.05

(or some variant thereof.)

@JCGoran

JCGoran commented May 6, 2024

Copy link
Copy Markdown
Contributor Author

You can have global or range variables in the MOD file:
...

Huh, that's neat, updated!

@bbpbuildbot

This comment has been minimized.

@1uc

1uc commented May 6, 2024

Copy link
Copy Markdown
Collaborator

It's now a bit hard to understand how the two tests are very different. One is about checking the accuracy of v(t). The other is about checking the stability of the numerical method, e.g. that the method is fully implicit.

We check the one my using small time-steps and checking all the value along the way. While, to me, checking stability is about taking a (stupidly) large timestep and checking it doesn't explode. I understand that we can check both by simply cranking c to be a higher value, under the assumption that dt doesn't automatically shrink. However, I can't judge if 0.5 is large enough compared to the sane value 0.005.

The worry is that future maintenance would remove the second compare(0.5) because it's "redundant".

@1uc 1uc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this is a lot clearer to me.

@bbpbuildbot

Copy link
Copy Markdown
Collaborator

Logfiles from GitLab pipeline #209442 (:white_check_mark:) have been uploaded here!

Status and direct links:

@JCGoran JCGoran merged commit 2dc296d into master May 7, 2024
@JCGoran JCGoran deleted the jelic/add_test_nonspecific_current branch May 7, 2024 06:49
JCGoran added a commit to neuronsimulator/nrn that referenced this pull request Mar 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants