Skip to content

Commit

Permalink
Add from_config helper
Browse files Browse the repository at this point in the history
  • Loading branch information
frthjf committed Apr 5, 2024
1 parent 8ddcc44 commit feaf583
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/miv_simulator/interface/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pydantic import BaseModel, Field, ConfigDict
from machinable import Interface, get
from miv_simulator.config import Config
from miv_simulator import mechanisms


class Network(Interface):
Expand Down Expand Up @@ -108,6 +109,15 @@ def launch(self):

return self

def version_from_config(self, config_filepath: str):
source = os.path.dirname(os.path.dirname(config_filepath))
return {
"config_filepath": f"{config_filepath}",
"mechanisms_path": mechanisms.compile(f"{source}/mechanisms"),
"template_path": f"{source}/templates",
"morphology_path": f"{source}/morphology",
}

def compute_context(self):
context = super().compute_context()
del context["config"]
Expand Down

0 comments on commit feaf583

Please sign in to comment.