generate-network-graph.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python3
  2. """
  3. Enter one line description here.
  4. File:
  5. Copyright 2023 Ankur Sinha
  6. Author: Ankur Sinha <sanjay DOT ankur AT gmail DOT com>
  7. """
  8. from pyneuroml.pynml import generate_nmlgraph
  9. import matplotlib as mpl
  10. # From pyneuroml.pynml
  11. def generate_matrix_graph(f, level):
  12. """Generate a connectivity matrix graph.
  13. Modified version of the code in pyneuroml.pynml
  14. """
  15. from neuromllite.MatrixHandler import MatrixHandler
  16. from neuroml.hdf5.NeuroMLXMLParser import NeuroMLXMLParser
  17. handler = MatrixHandler(level=level, nl_network=None)
  18. currParser = NeuroMLXMLParser(handler)
  19. currParser.parse(f)
  20. handler.finalise_document()
  21. if __name__ == "__main__":
  22. filename = "HL23Net_0.5.net.nml"
  23. mpl.rcParams['axes.titlesize'] = 30
  24. mpl.rcParams['axes.labelsize'] = 30
  25. mpl.rcParams['xtick.labelsize'] = 20
  26. mpl.rcParams['ytick.labelsize'] = 20
  27. generate_matrix_graph(filename, 1)
  28. generate_nmlgraph(nml2_file_name=filename, level=3, engine="dot",
  29. include_ext_inputs=False)