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

Useful error messages for representing infinity #1280

Closed
tcstewar opened this issue Mar 26, 2017 · 1 comment · Fixed by #1286
Closed

Useful error messages for representing infinity #1280

tcstewar opened this issue Mar 26, 2017 · 1 comment · Fixed by #1286

Comments

@tcstewar
Copy link
Contributor

If you accidentally create a Node that can output infinity, nengo gives a rather cryptic error message:

import numpy as np
import nengo

model = nengo.Network()
with model:
    def problematic_func(t):
        return np.ones(1)/0
    n = nengo.Node(problematic_func)
    ens = nengo.Ensemble(n_neurons=100, dimensions=1)
    nengo.Connection(n, ens)

Building finished in 0:00:01.                                                   
Traceback (most recent call last):
  File "c:\users\terry\documents\github\nengo_gui\nengo_gui\page.py", line 496, in runner
    self.sim.step()
  File "c:\users\terry\documents\github\nengo\nengo\simulator.py", line 308, in step
    step_fn()
  File "c:\users\terry\documents\github\nengo\nengo\builder\neurons.py", line 68, in step_simneurons
    self.neurons.step_math(dt, J, output, *states)
  File "c:\users\terry\documents\github\nengo\nengo\neurons.py", line 326, in step_math
    -(voltage[spiked_mask] - 1) / (J[spiked_mask] - 1))
FloatingPointError: invalid value encountered in true_divide

It would be really nice if it at least indicated which Ensemble was receiving infinity or NaN as an input, as that can help identify where the problem is.

@jgosmann
Copy link
Collaborator

This is a variation on #1178.

@jgosmann jgosmann self-assigned this Mar 29, 2017
jgosmann added a commit that referenced this issue Mar 29, 2017
@jgosmann jgosmann removed their assignment Mar 29, 2017
tbekolay pushed a commit that referenced this issue Apr 4, 2017
adityagilra pushed a commit to adityagilra/nengo that referenced this issue Jun 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants