supereeg.Brain

class supereeg.Brain(data=None, locs=None, sessions=None, sample_rate=None, meta=None, date_created=None, label=None, kurtosis=None, kurtosis_threshold=10, minimum_voxel_size=3, maximum_voxel_size=20, filter='kurtosis')[source]

Brain data object for the supereeg package

A brain data object contains a single iEEG subject. To create one, at minimum you need data (samples x electrodes), location coordinates in MNI space and the sample rate of the data. Additionally, you can include a session id. If included, all analyses will be performed within session and then aggregated across sessions. You can also include a meta dict, which can contain any other information that might be useful (subject id, recording params, etc).

Parameters:
data : numpy.ndarray or pandas.DataFrame, supereeg.Model, supereeg.Nifti, or Nifti1Image

Samples x electrodes array containing the iEEG data.

If data is a model, returns correlation matrix.

If data is a nifti image (either supereeg.Nifti or Nifti1Image), returns nifti values as samples by electrodes array.

locs : numpy.ndarray or pandas.DataFrame

Electrode by MNI coordinate (x,y,z) array containing electrode locations

session : str, int or numpy.ndarray

Samples x 1 array containing session identifiers for each time sample. If str or int, the value will be copied for each time sample.

sample_rates : float, int or list

Sample rate (Hz) of the data. If different over multiple sessions, this is a list.

meta : dict

Optional dict containing whatever you want.

date created : str

Time created (optional)

label : list

List delineating if location was reconstructed or observed. This is computed in reconstruction.

Returns:
bo : supereeg.Brain

Instance of Brain data object.

Attributes:
data : pandas.DataFrame

Samples x electrodes dataframe containing the EEG data.

locs : pandas.DataFrame

Electrode by MNI coordinate (x,y,z) df containing electrode locations.

sessions : pandas.Series

Samples x 1 array containing session identifiers. If a single value is passed, a single session will be created.

sample_rates : list

Sample rate of the data. If different over multiple sessions, this is a list.

meta : dict

Optional dict containing whatever you want.

n_elecs : int

Number of electrodes

dur : float

Amount of data in seconds for each session

n_sessions : int

Number of sessions

label : list

Label for each session

kurtosis : int

Kurtosis threshold

filter : ‘kurtosis’ or None

If ‘kurtosis’, electrodes that exceed the kurtosis threshold will be removed. If None, no thresholding is applied.

minimum_voxel_size : positive scalar or 3D numpy array

Used to construct Nifti objects; default: 3 (mm)

maximum_voxel_size : positive scalar or 3D numpy array

Used to construct Nifti objects; default: 20 (mm)

Methods

apply_filter([inplace]) Return a filtered copy
get_data() Gets data from brain object
get_locs() Gets locations from brain object
get_slice([sample_inds, loc_inds, inplace]) Indexes brain object data
get_zscore_data() Gets zscored data from brain object
info() Print info about the brain object
next() Return next sample from Brain object (wrapper for self.__next__)
plot_data([filepath, time_min, time_max, ...]) Normalizes and plots data from brain object
plot_locs([pdfpath]) Plots electrode locations from brain object
resample([resample_rate]) Resamples data
save(fname[, compression]) Save method for the brain object
to_nii([filepath, template, vox_size, ...]) Save brain object as a nifti file.
update_filter_inds  
update_info  
__init__(data=None, locs=None, sessions=None, sample_rate=None, meta=None, date_created=None, label=None, kurtosis=None, kurtosis_threshold=10, minimum_voxel_size=3, maximum_voxel_size=20, filter='kurtosis')[source]

Methods

__init__([data, locs, sessions, ...])
apply_filter([inplace]) Return a filtered copy
get_data() Gets data from brain object
get_locs() Gets locations from brain object
get_slice([sample_inds, loc_inds, inplace]) Indexes brain object data
get_zscore_data() Gets zscored data from brain object
info() Print info about the brain object
next() Return next sample from Brain object (wrapper for self.__next__)
plot_data([filepath, time_min, time_max, ...]) Normalizes and plots data from brain object
plot_locs([pdfpath]) Plots electrode locations from brain object
resample([resample_rate]) Resamples data
save(fname[, compression]) Save method for the brain object
to_nii([filepath, template, vox_size, ...]) Save brain object as a nifti file.
update_filter_inds()
update_info()