Brain activity recordings

class braindynamics_starprotocol.trialbraindata.TrialBrainData[source]

Bases: object

Abstract class for representing brain actvity recordings from multiple experimental trials.

trial_nr

number of trials.

Type:

int

chan_nr

number of channels.

Type:

int

trials_len

length of trials.

Type:

int or list[int]

samp_freq

sampling frequency in Hz.

Type:

float

samp_mat_list

list of 2D sample matrices (of shape chan_nr, trials_len).

Type:

list[np.ndarray]

info_dict

dictionary for storing meta data (e.g. channel labels).

Type:

dict

clear()[source]

Function that clears all data.

load(samp_mat_list: list[ndarray], samp_freq: float, info_dict: dict = None) None[source]

Function that loads object from input parameters.

Parameters:
  • samp_mat_list (list[np.ndarray]) – list of 2D sample matrices

  • samp_freq (float) – sampling frequency in Hz

  • info_dict (dict, optional) – dictionary for storing meta data. Defaults to None.

Raises:
  • ValueError – uneven number of channels in different trials

  • ValueError – negative sampling frequency

load_from_files(info_json_path: str, samp_bin_path: str) None[source]

Load brain activity recording data from two files.

Parameters:
  • info_json_path (str) – path to json file containing information about the recording (i.e. number of channels, trials, trial lengths, channel names, etc.)

  • samp_bin_path (str) – path to binary file storing 3D array of shape (number of trials, number of channels, trial length) of 32-bit floating point values