Hexoskin#

class epilepsy_tools.hexoskin.RecordingInfo(patient_name, sex, start_time, birth_date, hexoskin_record_id, hexoskin_user_id, signals)#

Stores metadata of the recording (raw signals).

Construct with RecordingInfo.from_file.

Parameters:
patient_name#

The name of the patient of the recording.

Type:

str

sex#

The sex of the patient of the recording.

Type:

str

start_time#

The date and time the recording started.

Type:

datetime.datetime

birth_date#

The birth date of the patient of the recording.

Type:

datetime.date

hexoskin_record_id#

The ID on Hexoskin’s platform of the recording.

Type:

int

hexoskin_user_id#

The ID on Hexoskin’s platform of the patient of the recording.

Type:

int

signals#

The list of signals (channels) in the recording.

Type:

list[SignalHeader]

classmethod from_file(file)#

Get the recording info of a given .edf file or data already loaded.

Parameters:

file (str | os.PathLike) – Path of the .edf file.

Returns:

The information of the recording.

Return type:

RecordingInfo

class epilepsy_tools.hexoskin.SignalHeader(label, sample_rate, dimension)#

Stores information of a signal (or channel).

Parameters:
label#

The label of the signal.

Type:

str

sample_rate#

The sample rate in Hz of the signal.

Type:

float

dimension#

The units of the signal.

Type:

str

epilepsy_tools.hexoskin.load_data(file: str | PathLike, *, as_dataframe: Literal[True] = True) DataFrame#
epilepsy_tools.hexoskin.load_data(file: str | PathLike, *, as_dataframe: Literal[False]) dict[str, pd.Series[float]]

Read a .edf file from the Hexoskin device.

Since not every metric is read with the same sampling rate on the device, you can load the data as a DataFrame with as_dataframe=True (the default) that will contain NaNs for metrics with lower sample rates, or as a dict of Series with as_dataframe=False, what will not contain NaNs but will all be of different length.

In the case of a DataFrame with NaNs, you can fill out the missing values with the method pandas.DataFrame.ffill() that will use the last non-NaN value to fill the DataFrame.

Parameters:
  • file (str | os.PathLike) – Path of the .edf file.

  • as_dataframe (bool, optional) – If the data should be returned in a DataFrame or not (if False, a dict of Series is returned instead), by default True.

Returns:

data – The data inside the .edf file.

Return type:

pandas.DataFrame | dict[str, pandas.Series]

Raises:

ValueError – The file provided is not a .edf file.

Examples#

See examples in Hexoskin Examples.