Skip to content

Commit

Permalink
Fix config docstrings and remove obsolete YAML config file constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
frthjf committed Sep 22, 2023
1 parent c82d7ce commit 168431c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
16 changes: 8 additions & 8 deletions src/miv_simulator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,20 @@ def _cast(v) -> int:
ParametricCoordinate = Tuple[U_Coordinate, V_Coordinate, L_Coordinate]
Rotation = Tuple[float, float, float]

"""One of the layers defined in the LayersDef enum."""

LayerName = str
"""For a given neuron kind, this defines the distribution (i.e. numbers) of neurons accross the different layers."""
"""One of the layers defined in the LayersDef enum."""

CellDistribution = Dict[LayerName, int]
"""Describes a volume extent"""
"""For a given neuron kind, this defines the distribution (i.e. numbers) of neurons accross the different layers."""

LayerExtents = Dict[LayerName, List[ParametricCoordinate]]
"""Describes constraints on the distribution of neurons in a given layer."""
"""Describes a volume extent"""

CellConstraints = Optional[
Dict[PopulationName, Dict[LayerName, Tuple[float, float]]]
]
"""Describes constraints on the distribution of neurons in a given layer."""


# Pydantic data models
Expand Down Expand Up @@ -264,7 +268,3 @@ def probabilities_sum_to_one(x):


CellDistributions = Dict[PopulationName, CellDistribution]


def path(*append) -> str:
return os.path.join(os.path.dirname(__file__), *append)
12 changes: 0 additions & 12 deletions src/miv_simulator/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import click
import numpy as np
import yaml
from miv_simulator.config import path as config_path
from mpi4py import MPI
from numpy import float64, uint32
from scipy import signal, sparse
Expand Down Expand Up @@ -316,19 +315,8 @@ def include(self, node: ScalarNode) -> Dict[str, Any]:
with open(filename) as f:
return yaml.load(f, IncludeLoader)

def include_default(self, node: ScalarNode) -> Dict[str, Any]:
"""
:param node:
:return:
"""
filename = os.path.join(config_path(), self.construct_scalar(node))
with open(filename) as f:
return yaml.load(f, IncludeLoader)


IncludeLoader.add_constructor("!include", IncludeLoader.include)
IncludeLoader.add_constructor("!include_default", IncludeLoader.include_default)


class ExplicitDumper(yaml.SafeDumper):
Expand Down

0 comments on commit 168431c

Please sign in to comment.