Skip to content

Chord diagram and other connectivity plot related refactoring #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
wip: chord diagram
  • Loading branch information
sanjayankur31 committed Nov 7, 2023
commit 088fa8a6028e7ebbdf71dba92e6da4c35da50e4c
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()