Skip to content

Commit

Permalink
Add coveralls CI
Browse files Browse the repository at this point in the history
  • Loading branch information
astoeckel committed Jun 2, 2019
1 parent 0bb5281 commit 8653e16
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
build
dist
build/
dist/
htmlcov/
examples/*.cfg
*.egg-info/*
__pycache__
.ipynb_checkpoints
.coverage*
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ env:
- NENGO_VERSION=master
install:
- if [ "$NENGO_VERSION" = "master" ]; then git clone https://github.com/nengo/nengo; cd nengo; pip install .; cd -; else pip install nengo==$NENGO_VERSION; fi
- pip install coveralls pytest-cov
- pip install .
script: OMP_NUM_THREADS=1 pytest nengo_bio/
script: OMP_NUM_THREADS=1 pytest --cov neng_bio nengo_bio/
after_success:
- coveralls
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![NengoBio Logo](doc/logo.png) [![PyPI version](https://badge.fury.io/py/nengo-bio.svg)](https://badge.fury.io/py/nengo-bio)
![NengoBio Logo](doc/logo.png) [![PyPI version](https://badge.fury.io/py/nengo-bio.svg)](https://badge.fury.io/py/nengo-bio) [![Build Status](https://travis-ci.org/astoeckel/nengo-bio.svg?branch=master)](https://travis-ci.org/astoeckel/nengo-bio) [![Coverage Status](https://coveralls.io/repos/github/astoeckel/nengo-bio/badge.svg?branch=master)](https://coveralls.io/github/astoeckel/nengo-bio?branch=master)

# NengoBio ‒ Biologically (more) plausible Nengo models

Expand Down
9 changes: 2 additions & 7 deletions nengo_bio/builder/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def get_connectivity(conn, synapse_types, rng=np.random):
# We're done if both has_mps_E and has_mps_I are true. Otherwise, select
# more neurons up to mps.
if not (has_mps_E and has_mps_I):
# If no maximum number of synapses is set, set it to the maximum number
# of synapses that are still available
# If no maximum number of synapses is set, set it to the maximum
# number of synapses that are still available
if not has_mps:
mps_rem = n_exc + n_inh
else:
Expand Down Expand Up @@ -223,8 +223,6 @@ def remove_bias_current(model, ens):
# Delete the copy operator and instead add a reset operator
del model.operators[i]
model.add_op((nengo.builder.operator.Reset(sig_post_in)))
return True
return False


@nengo.builder.Builder.register(SolverWrapper)
Expand Down Expand Up @@ -256,9 +254,6 @@ def build_solver(model, solver, _, rng, *args, **kwargs):

# Transform the target values
if hasattr(nengo.connection, 'Dense'): # Nengo 2.8 compat
if not isinstance(conn.transform, nengo.connection.Dense):
raise nengo.exceptions.BuildError(
"Non-compositional solvers only work with Dense transforms")
transform = conn.transform.sample(rng=rng)
else:
transform = conn.transform
Expand Down
23 changes: 23 additions & 0 deletions nengo_bio/builder/tests/test_builder_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,26 @@ def test_get_connectivity(nengo_ensembles_and_model):
assert np.sum(connectivity[0, :101, i]) == 4
assert np.sum(connectivity[1, 101:, i]) == 10

# ens_a is excitatory, ens_b is inhibitory
with model.toplevel:
conn = Connection((ens_a, ens_b), ens_c,
max_n_post_synapses_exc=4)
synapse_types = get_multi_ensemble_synapse_types(model, conn.pre_obj)
connectivity = get_connectivity(conn, synapse_types)

for i in range(ens_c.n_neurons):
assert np.sum(connectivity[0, :, i]) == 4
assert np.sum(connectivity[1, :, i]) == 102
assert np.sum(connectivity[0, :101, i]) == 4
assert np.sum(connectivity[1, 101:, i]) == 102

def test_connection_invalid_max_synapses():
with pytest.raises(nengo.exceptions.BuildError) as _:
with nengo.Network() as net:
ens_a = Ensemble(n_neurons=101, dimensions=1)
ens_b = Ensemble(n_neurons=102, dimensions=1)
Connection(ens_a, ens_b,
max_n_post_synapses=10, max_n_post_synapses_exc=10,
max_n_post_synapses_inh=10)
with nengo.Simulator(net) as sim:
pass
1 change: 0 additions & 1 deletion nengo_bio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ def mkcon(synapse_type, synapse):
solver=SolverWrapper(
self.solver, i, self, ns, synapse_type),
kind=str(synapse_type))
return conn
self.connections.append((
mkcon(Excitatory, synapse_exc),
mkcon(Inhibitory, synapse_inh)))
Expand Down

0 comments on commit 8653e16

Please sign in to comment.