Skip to content

Commit

Permalink
Some black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Sep 29, 2023
1 parent e33c266 commit 7381f40
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
15 changes: 6 additions & 9 deletions examples/sonatatest/run_bmtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import sys

def run(config_file, simulator):

if simulator=='NEURON':
def run(config_file, simulator):
if simulator == "NEURON":
from bmtk.simulator import bionet

conf = bionet.Config.from_json(config_file, validate=True)
conf.build_env()
net = bionet.BioNetwork.from_config(conf)
sim = bionet.BioSimulator.from_config(conf, network=net)


elif simulator=='NEST':
elif simulator == "NEST":
from bmtk.simulator import pointnet
conf = pointnet.Config.from_json(config_file)
conf.build_env()
Expand All @@ -22,8 +22,5 @@ def run(config_file, simulator):
sim.run()


if __name__ == '__main__':

run('config.json', 'NEST')


if __name__ == "__main__":
run("config.json", "NEST")
2 changes: 1 addition & 1 deletion neuromllite/MDFHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def _comp_to_mdf_node(self, nmllite_comp, lems_comp_id, size=1, properties=None)
# node["parameters"][sv.name]["value"] = [0]*size

node["output_ports"][sv.name] = {"value": sv.name}
print_v("Adding %s as an output port"%sv.name)
print_v("Adding %s as an output port" % sv.name)
if sv.exposure:
node["output_ports"][sv.exposure] = {"value": sv.name}

Expand Down
19 changes: 9 additions & 10 deletions neuromllite/NetworkGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,9 @@ def generate_network(
if input.weight
else 1
)
if flip * 100.0 < evaluate(input.percentage, nl_model.parameters, rng):
if flip * 100.0 < evaluate(
input.percentage, nl_model.parameters, rng
):
if input.number_per_cell and input.segment_ids:
raise Exception(
"On input: %s, only one of number_per_cell or segment_ids is allowed"
Expand Down Expand Up @@ -1284,17 +1286,17 @@ def generate_value_array(node, index, context='{0}', param='value'):
import sys
def run(config_file, simulator):
if simulator=='NEURON':
def run(config_file, simulator):
if simulator == "NEURON":
from bmtk.simulator import bionet
conf = bionet.Config.from_json(config_file, validate=True)
conf.build_env()
net = bionet.BioNetwork.from_config(conf)
sim = bionet.BioSimulator.from_config(conf, network=net)
elif simulator=='NEST':
elif simulator == "NEST":
from bmtk.simulator import pointnet
conf = pointnet.Config.from_json(config_file)
conf.build_env()
Expand All @@ -1304,11 +1306,8 @@ def run(config_file, simulator):
sim.run()
if __name__ == '__main__':
run('config.json', '%s')
"""
if __name__ == "__main__":
run("config.json", "%s")"""

run_bmtk_file = open("run_bmtk.py", "w")
run_bmtk_file.write(run_bmtk_template % (target_simulator))
Expand Down
2 changes: 2 additions & 0 deletions neuromllite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def load_network_yaml(filename):

return net


def load_simulation(filename):
"""
Load a NeuroMLlite simulation JSON/YAML file
Expand All @@ -89,6 +90,7 @@ def load_simulation(filename):
else:
return load_simulation_json(filename)


def load_simulation_json(filename: str) -> Optional[dict]:
"""
Load a NeuroMLlite simulation JSON file
Expand Down

0 comments on commit 7381f40

Please sign in to comment.