Skip to content

Commit

Permalink
Reduce required synapse configuration for h5type creation
Browse files Browse the repository at this point in the history
  • Loading branch information
frthjf committed Oct 27, 2023
1 parent 9815199 commit 1a1bb08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/miv_simulator/interface/h5_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
from miv_simulator import config
from mpi4py import MPI
from miv_simulator.utils import io as io_utils, from_yaml
from typing import Dict
from typing import Dict, List


class H5Types(Component):
class Config(BaseModel):
model_config = ConfigDict(extra="forbid")

cell_distributions: config.CellDistributions = Field("???")
synapses: config.Synapses = Field("???")
projections: Dict[
config.PostSynapticPopulationName,
List[config.PreSynapticPopulationName],
] = Field("???")

def config_from_file(self, filename: str) -> Dict:
return from_yaml(filename)
Expand All @@ -25,6 +28,9 @@ def __call__(self) -> None:
io_utils.create_neural_h5(
self.output_filepath,
self.config.cell_distributions,
self.config.synapses,
synapses={
post: {pre: True for pre in v}
for post, v in self.config.projections.items()
},
)
MPI.COMM_WORLD.barrier()
2 changes: 0 additions & 2 deletions src/miv_simulator/interface/network_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class Config(BaseModel):

filepath: str = Field("???")
cell_distributions: config.CellDistributions = Field("???")
synapses: config.Synapses = Field("???")
layer_extents: config.LayerExtents = Field("???")
rotation: config.Rotation = (0.0, 0.0, 0.0)
cell_constraints: config.CellConstraints = {}
Expand Down Expand Up @@ -123,7 +122,6 @@ def generate_connections(self, version=None, uses=None):
[
{
"filepath": self.config.filepath,
"synapses": self.config.synapses,
"coordinates_namespace": self.config.coordinate_namespace,
}
]
Expand Down

0 comments on commit 1a1bb08

Please sign in to comment.