Skip to content

Commit

Permalink
wip: simulation widget
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Aug 19, 2024
1 parent 0ee56b6 commit d301154
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions neuroml_widgets/simulation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
Widgets for NeuroML simulations
File: neuroml_widgets/simulation.py
Copyright 2024 NeuroML contributors
"""

import logging

import ipywidgets
from pyneuroml.io import read_lems_file

logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)

logger.debug(f"Logger setup for {__name__}")


def simulation_manager(simfile: str):
"""Simulation manager widget.
This allows changing the step, length, seed of a simulation and re-running
it after generating a new LEMS file.
:param simfile: complete path to simulation LEMS file
:type simfile: str
"""
model = read_lems_file(simfile)
simdict = {}

for am in model.components:
if am.type == "Simulation":
simdict = am.parameters

logger.debug(f"Simdict is {simdict}")
# TODO: create widget and run button etc.print(simdict)
# TODO: is this the best way, or should I be reading the file as XML so
# that we don't lose the other bits?

0 comments on commit d301154

Please sign in to comment.