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

Raise exception when the voltage becomes unrealistic during a neuron simulation #387

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DrTaDa
Copy link
Contributor

@DrTaDa DrTaDa commented Mar 15, 2022

  • Add a check that raises an exception if the voltage gets unrealistic
  • Replace h.run by hfadvance in the NrnSimulator

- Add a check that raises an exception if the voltage gets unrealistic
@@ -112,12 +112,19 @@ def neuron(self):

return neuron

def check_voltage_valid(self, icell, voltage_bound=200.):
Copy link
Contributor

Choose a reason for hiding this comment

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

I find this dangerous though. Ideally NEURON should detect if it gets values that it can't handle. Do we know what the effect this has on optimizations? I wouldn't be surprised if a lot of initial solutions might be out of bounds here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok,I will open an issue in Neuron

Copy link
Contributor

Choose a reason for hiding this comment

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

Any news?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The engineer who was looking into it is just back from vacation. He will resume working on it.

@@ -163,7 +170,10 @@ def run(
rng.Random123_globalindex(random123_globalindex)

try:
self.neuron.h.run()
self.neuron.h.finitialize()
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure this 'exactly' replicates the 'run()' behavior of Neuron? We don't want to change results if not necessary.

self.neuron.h.finitialize()
while self.neuron.h.t < self.neuron.h.tstop:
self.neuron.h.fadvance()
self.check_voltage_valid(icell)
Copy link
Contributor

Choose a reason for hiding this comment

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

We also need to check how this affects the simulation time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants