neurostatx.network.viz
Classes
| Name | Description |
|---|---|
NetworkLayout | NetworkX layout names used when placing graph nodes. |
Functions
| Name | Description |
|---|---|
create_cmap_from_list | Map per-subject values to node colors. |
creating_node_colormap | Map each node to a color from its highest percentile cluster. |
membership_distribution | Write histograms of top membership values and their delta. |
NetworkLayoutclass#
class NetworkLayout(StrEnum, Enum)Bases: StrEnum, Enum
NetworkX layout names used when placing graph nodes.
create_cmap_from_listfunction#
def create_cmap_from_list(array)Map per-subject values to node colors.
Integer zeros are drawn as "darkgrey"; other integers use tab10.
Float arrays are ranked and mapped through plasma.
Parameters
| Name | Type | Description |
|---|---|---|
array | np.array | Per-subject values. Integers are treated as discrete conditions; floats are treated as a continuous scale. |
Returns
nodes_cmaplist- Color for each subject.
Examples
>>> import numpy as np>>> from neurostatx.network.viz import create_cmap_from_list>>> colors = create_cmap_from_list(np.array([0, 1, 2]))>>> colors[0]'darkgrey'creating_node_colormapfunction#
def creating_node_colormap(percentile_dict)Map each node to a color from its highest percentile cluster.
Parameters
| Name | Type | Description |
|---|---|---|
percentile_dict | dict | Mapping of cluster keys to per-node percentile arrays. |
Returns
nodes_cmaplist- Color for each node. Nodes with a max of 0 are
"black".
Examples
>>> from neurostatx.network.viz import creating_node_colormap>>> colors = creating_node_colormap({"c1": [0, 1], "c2": [0, 0]})>>> colors[0]'black'membership_distributionfunction#
def membership_distribution(mat, output='./membership_distribution.png')Write histograms of top membership values and their delta.
Parameters
Examples
>>> import numpy as np>>> from neurostatx.network.viz import membership_distribution>>> mat = np.array([[0.8, 0.2], [0.3, 0.7]])>>> membership_distribution(mat, output="membership.png")