siibra.features.tabular.interareal_connectivity
Classes
Two-dimensional, size-mutable, potentially heterogeneous tabular data. |
|
Parcellation-averaged connectivity, providing one or more matrices of a |
Functions
|
Module Contents
- class siibra.features.tabular.interareal_connectivity.DFWithMeta(data=None, index: pandas._typing.Axes | None = None, columns: pandas._typing.Axes | None = None, dtype: pandas._typing.Dtype | None = None, copy: bool | None = None)

Two-dimensional, size-mutable, potentially heterogeneous tabular data.
Data structure also contains labeled axes (rows and columns). Arithmetic operations align on both row and column labels. Can be thought of as a dict-like container for Series objects. The primary pandas data structure.
- Parameters:
data (ndarray (structured or homogeneous), Iterable, dict, or DataFrame) –
Dict can contain Series, arrays, constants, dataclass or list-like objects. If data is a dict, column order follows insertion-order. If a dict contains Series which have an index defined, it is aligned by its index. This alignment also occurs if data is a Series or a DataFrame itself. Alignment is done on Series/DataFrame inputs.
If data is a list of dicts, column order follows insertion-order.
index (Index or array-like) – Index to use for resulting frame. Will default to RangeIndex if no indexing information part of input data and no index provided.
columns (Index or array-like) – Column labels to use for resulting frame when data does not have them, defaulting to RangeIndex(0, 1, 2, …, n). If data contains column labels, will perform column selection instead.
dtype (dtype, default None) – Data type to force. Only a single dtype is allowed. If None, infer.
copy (bool or None, default None) –
Copy data from inputs. For dict data, the default of None behaves like
copy=True. For DataFrame or 2d ndarray input, the default of None behaves likecopy=False. If data is a dict containing one or more Series (possibly of different dtypes),copy=Falsewill ensure that these inputs are not copied.Changed in version 1.3.0.
See also
DataFrame.from_recordsConstructor from tuples, also record arrays.
DataFrame.from_dictFrom dicts of Series, arrays, or dicts.
read_csvRead a comma-separated values (csv) file into DataFrame.
read_tableRead general delimited file into DataFrame.
read_clipboardRead text from clipboard into DataFrame.
Notes
Please reference the User Guide for more information.
Examples
Constructing DataFrame from a dictionary.
>>> d = {'col1': [1, 2], 'col2': [3, 4]} >>> df = pd.DataFrame(data=d) >>> df col1 col2 0 1 3 1 2 4
Notice that the inferred dtype is int64.
>>> df.dtypes col1 int64 col2 int64 dtype: object
To enforce a single dtype:
>>> df = pd.DataFrame(data=d, dtype=np.int8) >>> df.dtypes col1 int8 col2 int8 dtype: object
Constructing DataFrame from a dictionary including Series:
>>> d = {'col1': [0, 1, 2, 3], 'col2': pd.Series([2, 3], index=[2, 3])} >>> pd.DataFrame(data=d, index=[0, 1, 2, 3]) col1 col2 0 0 NaN 1 1 NaN 2 2 2.0 3 3 3.0
Constructing DataFrame from numpy ndarray:
>>> df2 = pd.DataFrame(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), ... columns=['a', 'b', 'c']) >>> df2 a b c 0 1 2 3 1 4 5 6 2 7 8 9
Constructing DataFrame from a numpy ndarray that has labeled columns:
>>> data = np.array([(1, 2, 3), (4, 5, 6), (7, 8, 9)], ... dtype=[("a", "i4"), ("b", "i4"), ("c", "i4")]) >>> df3 = pd.DataFrame(data, columns=['c', 'a']) ... >>> df3 c a 0 3 1 1 6 4 2 9 7
Constructing DataFrame from dataclass:
>>> from dataclasses import make_dataclass >>> Point = make_dataclass("Point", [("x", int), ("y", int)]) >>> pd.DataFrame([Point(0, 0), Point(0, 3), Point(2, 3)]) x y 0 0 0 1 0 3 2 2 3
Constructing DataFrame from Series/DataFrame:
>>> ser = pd.Series([1, 2, 3], index=["a", "b", "c"]) >>> df = pd.DataFrame(data=ser, index=["a", "c"]) >>> df 0 a 1 c 3
>>> df1 = pd.DataFrame([1, 2, 3], index=["a", "b", "c"], columns=["x"]) >>> df2 = pd.DataFrame(data=df1, index=["a", "c"]) >>> df2 x a 1 c 3
- class siibra.features.tabular.interareal_connectivity.InterarealConnectivityMatrix(cohort: str, modality: str, regions: list, connector: siibra.retrieval.repositories.RepositoryConnector, decode_func: Callable, files: Dict[str, str], anchor: siibra.features.anchor.AnatomicalAnchor, description: str = '', datasets: list = [], prerelease: bool = False, id: str = None)

Parcellation-averaged connectivity, providing one or more matrices of a given modality for a given parcellation.
- class ConnectivityConnector(url: str)

Base class for repository connectors.
- class ZipFileLoader(zipfile, filename, decode_func, meta=None)
Loads a file from the zip archive, but mimics the behaviour of cached http requests used in other connectors.
- property cached
- cachefile
- property data
- filename
- func
- meta = None
- zipfile
- get_loader(filename, folder='', decode_func=None)
Get a lazy loader for a file, for loading data only once loader.data is accessed.
- compute_centroids(space)
Computes the list of centroid coordinates corresponding to matrix rows, in the given reference space.
- classmethod decode_meta(spec)
- get_matrix(subject: str = None)
Returns a matrix as a pandas dataframe.
- Parameters:
subject (str, default: None) – Name of the subject (see ConnectivityMatrix.subjects for available names). If None, the mean is taken in case of multiple available matrices.
- Returns:
A square matrix with region names as the column and row names.
- Return type:
pd.DataFrame
- get_profile(region: str | siibra.core.region.Region, subject: str = None, min_connectivity: float = 0, max_rows: int = None, direction: Literal['column', 'row'] = 'column')
Extract a regional profile from the matrix, to obtain a tabular data feature with the connectivity as the single column. Rows are be sorted by descending connection strength.
- Parameters:
subject (str, default: None) –
min_connectivity (float, default: 0) – Regions with connectivity less than this value are discarded.
max_rows (int, default: None) – Max number of regions with highest connectivity.
direction (str, default: 'column') – Choose the direction of profile extraction particularly for non-symmetric matrices. (‘column’ or ‘row’)
- plot(subject: str = None, regions: str = None, logscale: bool = False, *args, backend='nilearn', **kwargs)
Plots the heatmap of the connectivity matrix using nilearn.plotting.
- Parameters:
subject (str) – Name of the subject (see ConnectivityMatrix.subjects for available names). If “mean” or None is given, the mean is taken in case of multiple available matrices.
regions (list[str]) – Display the matrix only for selected regions. By default, shows all the regions. It can only be a subset of regions of the feature.
logscale (bool) – Display the data in log10 scale
backend (str) – “nilearn” or “plotly”
**kwargs – Can take all the arguments nilearn.plotting.plot_matrix can take. See the doc at https://nilearn.github.io/stable/modules/generated/nilearn.plotting.plot_matrix.html
- plot_matrix(subject: str = None, regions: List[str] = None, logscale: bool = False, *args, backend='nilearn', **kwargs)
Plots the heatmap of the connectivity matrix using nilearn.plotting.
- Parameters:
subject (str) – Name of the subject (see ConnectivityMatrix.subjects for available names). If “mean” or None is given, the mean is taken in case of multiple available matrices.
regions (list[str]) – Display the matrix only for selected regions. By default, shows all the regions. It can only be a subset of regions of the feature.
logscale (bool) – Display the data in log10 scale
backend (str) – “nilearn” or “plotly”
**kwargs – Can take all the arguments nilearn.plotting.plot_matrix can take. See the doc at https://nilearn.github.io/stable/modules/generated/nilearn.plotting.plot_matrix.html
- plot_profile(region: str | siibra.core.region.Region, subject: str = None, min_connectivity: float = 0, max_rows: int = None, direction: Literal['column', 'row'] = 'column', logscale: bool = False, *args, backend='matplotlib', **kwargs)
- cohort
- property data
- property name
Returns a short human-readable name of this feature.
- regions
- property subjects
Returns the subject identifiers for which matrices are available.
- siibra.features.tabular.interareal_connectivity.name_to_code(name)