Skip to content

Commit

Permalink
feat(connectivity-plots): move matrix plot to new sub-module
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Nov 7, 2023
1 parent e2d9123 commit cc7d747
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
35 changes: 35 additions & 0 deletions pyneuroml/plot/Connectivity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
"""
Connectivity plotting methods
File: pyneuroml/plot/Connectivity.py
Copyright 2023 NeuroML contributors
"""

import logging

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


def plot_connectivity_matrix(filename, level):
"""Plot a connectivity matrix
:param filename: name of NeuroML file
:type filename: str
:param level: level at which to plot
:type level: int
"""
from neuromllite.MatrixHandler import MatrixHandler
from neuroml.hdf5.NeuroMLXMLParser import NeuroMLXMLParser

logger.info("Converting %s to matrix form, level %i" % (filename, level))

handler = MatrixHandler(level=level, nl_network=None)

currParser = NeuroMLXMLParser(handler)
currParser.parse(filename)
handler.finalise_document()

logger.info("Done with MatrixHandler...")
17 changes: 2 additions & 15 deletions pyneuroml/pynml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2312,23 +2312,10 @@ def evaluate_arguments(args):
exit_on_fail = True
elif args.matrix:
confirm_neuroml_file(f)
from neuromllite.MatrixHandler import MatrixHandler

level = int(args.matrix[0])
from pyneuroml.plot.Connectivity import plot_connectivity_matrix

logger.info("Converting %s to matrix form, level %i" % (f, level))

from neuroml.hdf5.NeuroMLXMLParser import NeuroMLXMLParser

handler = MatrixHandler(level=level, nl_network=None)

currParser = NeuroMLXMLParser(handler)

currParser.parse(f)

handler.finalise_document()

logger.info("Done with MatrixHandler...")
plot_connectivity_matrix(f, level)

exit(0)
elif args.validate:
Expand Down

0 comments on commit cc7d747

Please sign in to comment.