pycrostates.io.ChData#

class pycrostates.io.ChData(data, info)[source]#

ChData stores atemporal data with its spatial information.

ChData is similar to a raw instance where temporality has been removed. Only the spatial information, stored as a ChInfo is retained.

Parameters:
dataarray

Data array of shape (n_channels, n_samples).

infomne.Info | ChInfo

Atemporal measurement information. If a mne.Info is provided, it is converted to a ChInfo.

Attributes:
ch_names

Channel names.

compensation_grade

The current gradient compensation grade.

info

Atemporal measurement information.

preload

Preload required by some MNE functions.

Methods

copy([deep])

Return a copy of the instance.

get_channel_types([picks, unique, only_data_chs])

Get a list of channel type for each channel.

get_data([picks])

Retrieve the data array.

get_montage()

Get a DigMontage from instance.

pick(picks[, exclude])

Pick a subset of channels.

set_montage(montage[, match_case, ...])

Set EEG/sEEG/ECoG/DBS/fNIRS channel positions and digitization points.

__contains__(ch_type)#

Check channel type membership.

Parameters:
ch_typestr

Channel type to check for. Can be e.g. 'meg', 'eeg', 'stim', etc.

Returns:
inbool

Whether or not the instance contains the given channel type.

Examples

Channel type membership can be tested as:

>>> 'meg' in inst  
True
>>> 'seeg' in inst  
False
copy(deep=True)[source]#

Return a copy of the instance.

Parameters:
deepbool

If True, deepcopy is used instead of copy.

get_channel_types(picks=None, unique=False, only_data_chs=False)#

Get a list of channel type for each channel.

Parameters:
picksstr | array_like | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. Can also be the string values 'all' to pick all channels, or 'data' to pick data channels. None (default) will pick all channels. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

uniquebool

Whether to return only unique channel types. Default is False.

only_data_chsbool

Whether to ignore non-data channels. Default is False.

Returns:
channel_typeslist

The channel types.

get_data(picks=None)[source]#

Retrieve the data array.

Parameters:
picksstr | array_like | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. Can also be the string values 'all' to pick all channels, or 'data' to pick data channels. None (default) will pick all channels. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

Returns:
dataarray

Data array of shape (n_channels, n_samples).

get_montage()#

Get a DigMontage from instance.

Returns:
montageNone | DigMontage

A copy of the channel positions, if available, otherwise None.

pick(picks, exclude='bads')[source]#

Pick a subset of channels.

Parameters:
picksstr | array_like | slice | None

Channels to include. Slices and lists of integers will be interpreted as channel indices. In lists, channel type strings (e.g., ['meg', 'eeg']) will pick channels of those types, channel name strings (e.g., ['MEG0111', 'MEG2623'] will pick the given channels. Can also be the string values 'all' to pick all channels, or 'data' to pick data channels. None (default) will pick all channels. Note that channels in info['bads'] will be included if their names or indices are explicitly provided.

excludelist | str

Set of channels to exclude, only used when picking based on types (e.g., exclude="bads" when picks="meg").

Returns:
instChData

The instance modified in-place.

set_montage(montage, match_case=True, match_alias=False, on_missing='raise', verbose=None)#

Set EEG/sEEG/ECoG/DBS/fNIRS channel positions and digitization points.

Parameters:
montageNone | str | DigMontage

A montage containing channel positions. If a string or DigMontage is specified, the existing channel information will be updated with the channel positions from the montage. Valid strings are the names of the built-in montages that ship with MNE-Python; you can list those via mne.channels.get_builtin_montages(). If None (default), the channel positions will be removed from the Info.

match_casebool

If True (default), channel name matching will be case sensitive.

Added in version 0.20.

match_aliasbool | dict

Whether to use a lookup table to match unrecognized channel location names to their known aliases. If True, uses the mapping in mne.io.constants.CHANNEL_LOC_ALIASES. If a dict is passed, it will be used instead, and should map from non-standard channel names to names in the specified montage. Default is False.

Added in version 0.23.

on_missing‘raise’ | ‘warn’ | ‘ignore’

Can be 'raise' (default) to raise an error, 'warn' to emit a warning, or 'ignore' to ignore when channels have missing coordinates.

Added in version 0.20.1.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Returns:
instinstance of Raw | Epochs | Evoked

The instance, modified in-place.

Notes

Warning

Only EEG/sEEG/ECoG/DBS/fNIRS channels can have their positions set using a montage. Other channel types (e.g., MEG channels) should have their positions defined properly using their data reading functions.

Warning

Applying a montage will only set locations of channels that exist at the time it is applied. This means when re-referencing make sure to apply the montage only after calling mne.add_reference_channels()

__hash__ = None#
property ch_names#

Channel names.

property compensation_grade#

The current gradient compensation grade.

property info#

Atemporal measurement information.

Type:

ChInfo

property preload#

Preload required by some MNE functions.

Examples using pycrostates.io.ChData#

Subject level analysis with resampling

Subject level analysis with resampling

Group-level analysis from individual clusters

Group-level analysis from individual clusters

Group level analysis from individual GFP peaks

Group level analysis from individual GFP peaks

Evaluating clustering fits

Evaluating clustering fits

Global Field Power peaks

Global Field Power peaks