Skip to content

Commit

Permalink
wip: chord diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed Nov 7, 2023
1 parent e0002de commit 088fa8a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pyneuroml/plot/Connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

import logging
import numpy as np

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
Expand Down Expand Up @@ -41,4 +42,16 @@ def plot_chord_diagram(filename):
:param filename: name of NeuroML file
:type filename: str
"""
pass
from pyneuroml.pynml import read_neuroml2_file
from mne_connectivity.viz import plot_connectivity_circle

doc = read_neuroml2_file(filename)

nodes = [p.id for p in doc.networks[0].populations]
print(f"Nodes for chord diagram are: {nodes}")

con = []
# TODO: logic to get connectivity information
print(f"Connecitivity is {con}")

fix, axes = plot_connectivity_circle(con, nodes)
12 changes: 12 additions & 0 deletions tests/plot/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import pathlib as pl

from pyneuroml.plot import generate_plot, generate_interactive_plot
from pyneuroml.plot.Connectivity import plot_chord_diagram
from .. import BaseTestCase

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -86,6 +87,17 @@ def test_generate_interactive_plot(self):
self.assertIsFile(filename)
pl.Path(filename).unlink()

def test_chord_diagram(self):
"""Test the chord diagram plotter"""
filename = "tests/plot/test_chord_diagram.png"

# remove the file first
try:
pl.Path(filename).unlink()
except FileNotFoundError:
pass
plot_chord_diagram("./Izh2007Cells.net.nml")


if __name__ == "__main__":
unittest.main()

0 comments on commit 088fa8a

Please sign in to comment.