Skip to content
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

Update graph_stats.py #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
63 changes: 0 additions & 63 deletions graphutils/graph_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,69 +180,6 @@ def visualize(self, i, savedir=""):

return viz

def visualize(self, i, savedir=""):
"""
Visualize the ith graph of self.graphs, passed-to-ranks.

Parameters
----------
i : int
Graph to visualize.
savedir : str, optional
Directory to save graph into.
If left empty, do not save.
"""

nmax = np.max(self.graphs)

if isinstance(i, int):
graph = pass_to_ranks(self.graphs[i])
sub = self.subjects[i]
sesh = "" # TODO

elif isinstance(i, np.ndarray):
graph = pass_to_ranks(i)
sub = ""
sesh = ""

else:
raise TypeError("Passed value must be integer or np.ndarray.")

viz = heatmap(
graph,
title=f"sub-{sub}_session-{sesh}",
xticklabels=True,
yticklabels=True,
vmin=0,
vmax=1,
)

# set color of title
viz.set_title(viz.get_title(), color="black")

# set color of colorbar ticks
viz.collections[0].colorbar.ax.yaxis.set_tick_params(color="black")

# set font size and color of heatmap ticks
for item in viz.get_xticklabels() + viz.get_yticklabels():
item.set_color("black")
item.set_fontsize(7)

if savedir:
p = Path(savedir).resolve()
if not p.is_dir():
p.mkdir()
plt.savefig(
p / f"sub-{sub}_sesh-{sesh}.png",
facecolor="white",
bbox_inches="tight",
dpi=300,
)
else:
plt.show()

plt.cla()


def url_to_ndmg_dir(urls):
"""
Expand Down