Skip to content

Commit

Permalink
Serialize graph sources
Browse files Browse the repository at this point in the history
  • Loading branch information
frthjf committed Feb 24, 2024
1 parent 2796e16 commit fc02bd4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/miv_simulator/interface/neuroh5_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def graph(self) -> None:
def __call__(self) -> None:
print("Merging H5 data")
self.network = None
self.distances = None
self.synapses = {}
self.synapse_forest = {}
self.connections = {}
Expand All @@ -26,6 +27,8 @@ def __call__(self) -> None:
name = u.module.replace("miv_simulator.interface.", "")
if name == "network_architecture":
self.network = u
elif name == "distances":
self.distances = u
elif name == "connections":
for p in read_population_names(u.config.forest_filepath):
populations.append(p)
Expand Down Expand Up @@ -69,6 +72,24 @@ def __call__(self) -> None:
for p, c in self.connections.items():
self.graph.import_projections(p, c.output_filepath)

# serialize sources
self.save_file(
"graph.json",
{
"network": self.network.serialize(),
"distances": self.distances.serialize(),
"connections": {
k: v.serialize() for k, v in self.connections.items()
},
"synapse_forest": {
k: v.serialize() for k, v in self.synapse_forest.items()
},
"synapses": {
k: v.serialize() for k, v in self.synapses.items()
},
},
)

def on_compute_predicate(self):
def generate_uid(use):
if getattr(use, "refreshed_at", None) is not None:
Expand Down

0 comments on commit fc02bd4

Please sign in to comment.