Skip to content

Commit

Permalink
fix black
Browse files Browse the repository at this point in the history
  • Loading branch information
Helveg committed Mar 28, 2024
1 parent d9fa68f commit 7e10933
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
4 changes: 1 addition & 3 deletions bsb_nest/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ def create_connections(self, simdata, pre_nodes, post_nodes, cs):
def predict_mem_iterator(self, pre_nodes, post_nodes, cs):
avmem = psutil.virtual_memory().available
predicted_all_mem = (
len(pre_nodes) * 8 * 2
+ len(post_nodes) * 8 * 2
+ len(cs) * 6 * 8 * (16 + 2)
len(pre_nodes) * 8 * 2 + len(post_nodes) * 8 * 2 + len(cs) * 6 * 8 * (16 + 2)
) * MPI.get_size()
predicted_local_mem = predicted_all_mem / len(cs.get_local_chunks("out"))
if predicted_local_mem > avmem / 2:
Expand Down
3 changes: 1 addition & 2 deletions bsb_nest/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def get_target_nodes(self, adapter, simulation, simdata):
node_collector = (
simdata.populations[model][targets]
for model, targets in simdata.populations.items()
if not self.targetting.cell_models
or model in self.targetting.cell_models
if not self.targetting.cell_models or model in self.targetting.cell_models
)
return sum(node_collector, start=nest.NodeCollection())

Expand Down
6 changes: 5 additions & 1 deletion bsb_nest/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ class KernelWarning(Warning):
class NestError(Exception):
pass


class NestKernelError(NestError):
pass


class NestModuleError(NestKernelError):
pass


class NestModelError(NestError):
pass


class NestConnectError(NestError):
pass
pass
16 changes: 4 additions & 12 deletions tests/test_nest.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,8 @@ def test_brunel(self):
self.assertIsNotNone(sr_exc)
self.assertIsNotNone(sr_inh)

rate_ex = (
len(sr_exc) / simcfg.duration * 1000.0 / sr_exc.annotations["pop_size"]
)
rate_in = (
len(sr_inh) / simcfg.duration * 1000.0 / sr_inh.annotations["pop_size"]
)
rate_ex = len(sr_exc) / simcfg.duration * 1000.0 / sr_exc.annotations["pop_size"]
rate_in = len(sr_inh) / simcfg.duration * 1000.0 / sr_inh.annotations["pop_size"]

self.assertAlmostEqual(rate_in, 50, delta=1)
self.assertAlmostEqual(rate_ex, 50, delta=1)
Expand All @@ -145,12 +141,8 @@ def test_brunel_with_conn(self):
self.assertIsNotNone(sr_exc)
self.assertIsNotNone(sr_inh)

rate_ex = (
len(sr_exc) / simcfg.duration * 1000.0 / sr_exc.annotations["pop_size"]
)
rate_in = (
len(sr_inh) / simcfg.duration * 1000.0 / sr_inh.annotations["pop_size"]
)
rate_ex = len(sr_exc) / simcfg.duration * 1000.0 / sr_exc.annotations["pop_size"]
rate_in = len(sr_inh) / simcfg.duration * 1000.0 / sr_inh.annotations["pop_size"]

self.assertAlmostEqual(rate_in, 50, delta=1)
self.assertAlmostEqual(rate_ex, 50, delta=1)
Expand Down

0 comments on commit 7e10933

Please sign in to comment.