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

Test probes #169

Merged
merged 4 commits into from Jan 31, 2019

Conversation

Projects
None yet
3 participants
@hunse
Copy link
Contributor

hunse commented Jan 17, 2019

This adds a test for neuron input (current) probes, which were not working correctly (due to negative values not being cast correctly, and integers not being filtered correctly). This also corrects both these issues.

TODO:

  • Add a test for voltage probes as well. The voltage should go negative, to test that we're dealing with negatives correctly. Do we currently allow min_voltage < 0 for e.g. LIF neurons?
@tbekolay
Copy link
Member

tbekolay left a comment

Looking good! I have a few questions in inline comments and we should add a changelog entry, as this fixes bugs and supports lif.min_voltage. This may also allow some Nengo tests to pass, though I don't see any xpasses in TravisCI. It could be a simple tolerance issue though since Loihi min voltages are rounded, in which case we would have to wait for pytest-allclose to allow changing tolerances, so probably let's not worry about the Nengo tests for now.

The part of the coverage diff that isn't covered is on the chip (loihi_interface.py stuff), so another question is whether to wait for the CI running on hardware stuff. My vote would be no, but this also will be easy to rebase later on so either way :shrug:

@@ -800,7 +800,7 @@ def _filter_probe(self, cx_probe, data):
shape = data[0].shape
synapse = cx_probe.synapse
rng = None
step = (synapse.make_step(shape, shape, dt, rng, dtype=data.dtype)
step = (synapse.make_step(shape, shape, dt, rng, dtype=np.float32)

This comment has been minimized.

@tbekolay

tbekolay Jan 23, 2019

Member

Any particular reason for float32 over float64 here? My default would be float64 since that's what float and np.float_ are.

This comment has been minimized.

@hunse

hunse Jan 23, 2019

Author Contributor

Just to use less memory when we have a lot of probe data. Since the underlying values are all limited precision (since they come from Loihi), I figured that not much would be lost by using float32 instead of float64.

@@ -822,6 +822,7 @@ def get_probe_output(self, cx_probe):
if cx_probe.use_snip:
data = self._snip_probe_data[cx_probe]
if cx_probe.synapse is not None:
data = np.asarray(data, dtype=np.float32)

This comment has been minimized.

@tbekolay

tbekolay Jan 23, 2019

Member

Ditto float32 vs 64 here

@@ -198,11 +198,12 @@ def _configure_filter(self, tau_s, dt):
"Current (U) scaling is required. Perhaps a synapse time "
"constant is too large in your model.")

def configure_lif(self, tau_rc=0.02, tau_ref=0.001, vth=1, dt=0.001):
def configure_lif(self, tau_rc=0.02, tau_ref=0.001, vth=1, dt=0.001,
min_voltage=0):

This comment has been minimized.

@tbekolay

tbekolay Jan 23, 2019

Member

Since we're touching this, can we add a docstring and document these parameters?

@hunse

This comment has been minimized.

Copy link
Contributor Author

hunse commented Jan 23, 2019

Addressed the requested changes. I've also added changelogs for both the probe fixes and the min_voltage.

@hunse hunse force-pushed the test-probes branch 2 times, most recently from c02f7e7 to 1728e5b Jan 29, 2019

hunse added some commits Jan 17, 2019

Cast snip data as int32 to deal with negatives
In the snip, the data is int32. When being read by Python, it needs
to be explicitly interpreted as int32, otherwise it treats it as
int64 and negative numbers become large positive numbers.

This should fix probing of negative neuron inputs and voltages.

@drasmuss drasmuss force-pushed the test-probes branch 2 times, most recently from 523793e to 8888669 Jan 31, 2019

@hunse

This comment has been minimized.

Copy link
Contributor Author

hunse commented Jan 31, 2019

Fixups look good to me.

hunse added some commits Jan 22, 2019

Allow configuration of min_voltage on LIF neurons
Document CxGroup.configure* functions
Test neuron current and voltage probes
These probes were untested and not working correctly on chip

test_voltage_decode no longer hangs

@drasmuss drasmuss force-pushed the test-probes branch from 8888669 to df77cf8 Jan 31, 2019

@drasmuss
Copy link
Contributor

drasmuss left a comment

Looks good to me

Comments addressed

@drasmuss drasmuss merged commit df77cf8 into master Jan 31, 2019

@drasmuss drasmuss deleted the test-probes branch Jan 31, 2019

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