Skip to content

Commit

Permalink
Merge pull request #270 from NeuroML/feat/graphviz-handler
Browse files Browse the repository at this point in the history
feat(graph-generator): allow passing kwargs to GraphVizHandler
  • Loading branch information
sanjayankur31 authored Nov 7, 2023
2 parents 4bb5e12 + 888bd52 commit a3caa2f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions pyneuroml/pynml.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,22 @@ def convert_to_units(nml2_quantity: str, unit: str) -> float:
return new_value


def generate_nmlgraph(nml2_file_name: str, level: int = 1, engine: str = "dot") -> None:
def generate_nmlgraph(
nml2_file_name: str, level: int = 1, engine: str = "dot", **kwargs
) -> None:
"""Generate NeuroML graph.
:nml2_file_name (string): NML file to parse
:level (string): level of graph to generate (default: '1')
:engine (string): graph engine to use (default: 'dot')
:param nml2_file_name: NML file to parse
:type nml2_file_name: str
:param level: level of graph to generate (default: '1')
:type level: int
:param engine: graph engine to use (default: 'dot')
:type engine: str
:param kwargs: other key word agruments to pass to GraphVizHandler
See the GraphVizHandler in NeuroMLlite for information on permissible
arguments:
https://github.com/NeuroML/NeuroMLlite/blob/master/neuromllite/GraphVizHandler.py
"""
from neuromllite.GraphVizHandler import GraphVizHandler
Expand All @@ -618,7 +628,7 @@ def generate_nmlgraph(nml2_file_name: str, level: int = 1, engine: str = "dot")
% (nml2_file_name, level, engine)
)

handler = GraphVizHandler(level=level, engine=engine, nl_network=None)
handler = GraphVizHandler(level=level, engine=engine, nl_network=None, **kwargs)
currParser = NeuroMLXMLParser(handler)
currParser.parse(nml2_file_name)
handler.finalise_document()
Expand Down

0 comments on commit a3caa2f

Please sign in to comment.