Skip to content

Commit

Permalink
Merge branch 'feature/spike_encoder' of https://github.com/GazzolaLab…
Browse files Browse the repository at this point in the history
…/MiV-Simulator into feature/spike_encoder
  • Loading branch information
iraikov committed Nov 1, 2023
2 parents 7de2731 + 1c38899 commit fee54a4
Show file tree
Hide file tree
Showing 17 changed files with 1,148 additions and 2,325 deletions.
2,686 changes: 538 additions & 2,148 deletions poetry.lock

Large diffs are not rendered by default.

15 changes: 2 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ packages = [
python = ">=3.9,<3.12"
numpy = "^1.22.4"
scipy = "^1.8.1"
mpi4py = "^3.1.3"
mpi4py = "^3.1.5"
h5py = "^3.7.0"
Cython = "^0.29.30"
PyYAML = "^6.0"
Expand All @@ -26,19 +26,8 @@ neuroh5 = {git = "https://github.com/iraikov/neuroh5.git"}
future = "^0.18.3"
matplotlib = "^3.6.0"
quantities = "^0.13.0"
sphinx = {version = "<6", optional = true}
pydata-sphinx-theme = {version = "^0.12.0", optional = true}
readthedocs-sphinx-search = {version = "^0.2.0", optional = true}
sphinx-autodoc-typehints = {version = "^1.21.8", optional = true}
numpydoc = {version = "^1.5.0", optional = true}
sphinx-togglebutton = {version = "^0.3.2", optional = true}
sphinx-copybutton = {version = "^0.5.1", optional = true}
sphinx-click = {version = "^4.4.0", optional = true}
sphinxcontrib-mermaid = {version = "^0.7.1", optional = true}
update = {version = "^0.0.1", optional = true}
myst-nb = {version = "^0.17.1", optional = true}
myst-parser = {version = "^0.18.1", optional = true}
pydantic = "^2.3.0"
neuron = "^8.2.3"


[tool.poetry.dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/miv_simulator/coding.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
SpikeTimesLike = EventArray[NDArray[np.float_], "SpikeTimesLike ..."]
"""Potentially unsorted or scalar data that can be transformed into `SpikeTimes`"""

SpikeTimes = EventArray[NDArray[np.float_], "SpikeTimes T ..."]
SpikeTimes = EventArray[NDArray[np.float64], "SpikeTimes T ..."]
"""Sorted array of absolute spike times"""


Expand Down
3 changes: 2 additions & 1 deletion src/miv_simulator/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
BaseModel as _BaseModel,
Field,
conlist,
AfterValidator,
BeforeValidator,
)
from typing import Literal, Dict, Any, List, Tuple, Optional, Union, Callable
from enum import IntEnum
from collections import defaultdict
import numpy as np
from typing_extensions import Annotated
from pydantic.functional_validators import AfterValidator, BeforeValidator

# Definitions

Expand Down
4 changes: 3 additions & 1 deletion src/miv_simulator/interface/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging

from machinable import Component
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict
from miv_simulator import config, simulator
from typing import Optional, Dict
from miv_simulator.utils import from_yaml
Expand All @@ -12,6 +12,8 @@

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

filepath: str = Field("???")
forest_filepath: str = Field("???")
axon_extents: config.AxonExtents = Field("???")
Expand Down
4 changes: 3 additions & 1 deletion src/miv_simulator/interface/distances.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional, Tuple

import logging
from pydantic import BaseModel
from pydantic import BaseModel, ConfigDict

from machinable import Component
from machinable.config import Field
Expand All @@ -11,6 +11,8 @@

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

filepath: str = Field("???")
cell_distributions: config.CellDistributions = Field("???")
layer_extents: config.LayerExtents = Field("???")
Expand Down
4 changes: 3 additions & 1 deletion src/miv_simulator/interface/h5_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from machinable import Component
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict
from miv_simulator import config
from mpi4py import MPI
from miv_simulator.utils import io as io_utils, from_yaml
Expand All @@ -8,6 +8,8 @@

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

cell_distributions: config.CellDistributions = Field("???")
synapses: config.Synapses = Field("???")

Expand Down
4 changes: 3 additions & 1 deletion src/miv_simulator/interface/network_architecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
from miv_simulator import config, simulator
from miv_simulator.utils import io as io_utils, from_yaml
from mpi4py import MPI
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict


class NetworkArchitecture(Component):
"""Creates the network architecture by generating the soma coordinates within specified layer geometry."""

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

filepath: str = Field("???")
cell_distributions: config.CellDistributions = Field("???")
synapses: config.Synapses = Field("???")
Expand Down
4 changes: 2 additions & 2 deletions src/miv_simulator/interface/neuroh5_graph.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from machinable import Component
from miv_simulator import simulator
from neuroh5.io import read_population_names
from typing import Dict
from miv_simulator.utils.io import H5FileManager


class NeuroH5Graph(Component):
Expand All @@ -12,7 +12,7 @@ def __init__(self, *args, **kwargs):
@property
def graph(self) -> None:
if self._graph is None:
self._graph = simulator.nh5.Graph(self.local_directory())
self._graph = H5FileManager(self.local_directory())
return self._graph

def __call__(self) -> None:
Expand Down
4 changes: 3 additions & 1 deletion src/miv_simulator/interface/synapse_forest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from machinable import Component
from miv_simulator import config, simulator
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict


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

filepath: str = Field("???")
population: config.PopulationName = Field("???")
morphology: config.SWCFilePath = Field("???")
Expand Down
4 changes: 3 additions & 1 deletion src/miv_simulator/interface/synapses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
from machinable import Component
from miv_simulator import config
from miv_simulator import simulator
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, ConfigDict
from typing import Optional, Dict
from miv_simulator.utils import from_yaml
from mpi4py import MPI


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

forest_filepath: str = Field("???")
cell_types: config.CellTypes = Field("???")
population: str = Field("???")
Expand Down
10 changes: 5 additions & 5 deletions src/miv_simulator/simulator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
__doc__ = """Contains the end-user public API of the MiV-Simulator"""

from miv_simulator.utils.io import create_neural_h5
from miv_simulator.simulator.distribute_synapses import distribute_synapses
from miv_simulator.simulator.generate_connections import generate_connections
from miv_simulator.simulator.generate_network_architecture import (
generate_network_architecture,
)
from miv_simulator.simulator.measure_distances import measure_distances
from miv_simulator.simulator.generate_synapse_forest import (
generate_synapse_forest,
)
from miv_simulator.simulator.distribute_synapses import distribute_synapses
from miv_simulator.simulator.generate_connections import generate_connections
from miv_simulator.simulator import nh5
from miv_simulator.simulator.measure_distances import measure_distances
from miv_simulator.simulator.execution_environment import ExecutionEnvironment
from miv_simulator.utils.io import create_neural_h5
from miv_simulator.utils.neuron import configure_hoc
Loading

0 comments on commit fee54a4

Please sign in to comment.