biopsykit.utils.datatype_helper module

A couple of helper functions that ease the use of the typical biopsykit data formats.

biopsykit.utils.datatype_helper.CodebookDataFrame

DataFrame representing a codebook which encodes numerical and categorical values in a standardized format.

A CodebookDataFrame has an index level named variable. The column names are the numerical values (0, 1, …), the dataframe entries then represent the mapping of numerical value to categorical value for the variable.

alias of Union[biopsykit.utils.datatype_helper._CodebookDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.MeanSeDataFrame

DataFrame containing mean and standard error of time-series data in a standardized format.

The resulting dataframe must at least the two columns mean and se. It can have additional index levels, such as phase, subphase or condition.

alias of Union[biopsykit.utils.datatype_helper._MeanSeDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.BiomarkerRawDataFrame

DataFrame containing raw biomarker data in a standardized format.

Data needs to be in long-format and must have a pandas.MultiIndex with index level names:

  • subject: subject ID; can be number or string

  • sample: saliva sample ID; can be number or string

Additionally, the following index levels can be added to identify saliva values, such as:

  • condition: subject condition during the study (e.g., “Control” vs. “Condition”)

  • day: day ID, if saliva samples were collected over multiple days

  • night: night ID, if saliva samples were collected over multiple night

alias of Union[biopsykit.utils.datatype_helper._BiomarkerRawDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SalivaRawDataFrame

DataFrame containing raw saliva data in a standardized format.

Data needs to be in long-format and must have a pandas.MultiIndex with index level names:

  • subject: subject ID; can be number or string

  • sample: saliva sample ID; can be number or string

Additionally, the following index levels can be added to identify saliva values, such as:

  • condition: subject condition during the study (e.g., “Control” vs. “Condition”)

  • day: day ID, if saliva samples were collected over multiple days

  • night: night ID, if saliva samples were collected over multiple night

alias of Union[biopsykit.utils.datatype_helper._BiomarkerRawDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SalivaFeatureDataFrame

DataFrame containing feature computed from saliva data in a standardized format.

The resulting dataframe must at least have a subject index level and all column names need to begin with the saliva marker type (e.g. “cortisol”), followed by the feature name, separated by underscore ‘_’ Additionally, the name of the column index needs to be saliva_feature.

alias of Union[biopsykit.utils.datatype_helper._SalivaFeatureDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SalivaMeanSeDataFrame

DataFrame containing mean and standard error of saliva samples in a standardized format.

The resulting dataframe must at least have a sample index level and the two columns mean and se. It can have additional index levels, such as condition or time.

alias of Union[biopsykit.utils.datatype_helper._SalivaMeanSeDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SleepEndpointDataFrame

DataFrame containing sleep endpoints in a standardized format.

The resulting dataframe must at least have a date index level, and, optionally, further index levels like night.

The columns defining the sleep endpoints should follow a standardized naming convention, regardless of the origin (IMU sensor, sleep mattress, psg, etc.).

Required are the columns:

  • sleep_onset: Sleep Onset, i.e., time of falling asleep, in absolute time

  • wake_onset: Wake Onset, i.e., time of awakening, in absolute time

  • total_sleep_duration: Total sleep duration, i.e., time between Sleep Onset and Wake Onset, in minutes

The following columns are common, but not required:

  • total_duration: Total recording time, in minutes

  • net_sleep_duration: Net duration spent sleeping, in minutes

  • bed_interval_start: Bed Interval Start, i.e, time when participant went to bed, in absolute time

  • bed_interval_end: Bed Interval End, i.e, time when participant left bed, in absolute time

  • sleep_efficiency: Sleep Efficiency, defined as the ratio between net sleep duration and sleep duration in percent

  • sleep_onset_latency: Sleep Onset Latency, i.e., time in bed needed to fall asleep, in minutes

  • getup_latency: Get Up Latency, i.e., time in bed after awakening until getting up, in minutes

  • wake_after_sleep_onset: Wake After Sleep Onset (WASO), i.e., total time awake after falling asleep, in minutes

  • number_wake_bouts: Total number of wake bouts

The following columns are further possible:

  • total_time_light_sleep: Total time of light sleep, in minutes

  • total_time_deep_sleep: Total time of deep sleep, in minutes

  • total_time_rem_sleep: Total time of REM sleep, in minutes

  • total_time_awake: Total time of being awake, in minutes

  • count_snoring_episodes: Total number of snoring episodes

  • total_time_snoring: Total time of snoring, in minutes

  • heart_rate_avg: Average heart rate during recording, in bpm

  • heart_rate_min: Minimum heart rate during recording, in bpm

  • heart_rate_max: Maximum heart rate during recording, in bpm

alias of Union[biopsykit.utils.datatype_helper._SleepEndpointDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SleepEndpointDict

Dictionary containing sleep endpoints in a standardized format.

The dict entries represent the sleep endpoints and should follow a standardized naming convention, regardless of the origin (IMU sensor, sleep mattress, psg, etc.).

Required are the entries:

  • sleep_onset: Sleep Onset, i.e., time of falling asleep, in absolute time

  • wake_onset: Wake Onset, i.e., time of awakening, in absolute time

  • total_sleep_duration: Total sleep duration, i.e., time between Sleep Onset and Wake Onset, in minutes

The following entries are common, but not required:

  • total_duration: Total recording time, in minutes

  • net_sleep_duration: Net duration spent sleeping, in minutes

  • bed_interval_start: Bed Interval Start, i.e, time when participant went to bed, in absolute time

  • bed_interval_end: Bed Interval End, i.e, time when participant left bed, in absolute time

  • sleep_efficiency: Sleep Efficiency, defined as the ratio between net sleep duration and sleep duration in percent

  • sleep_onset_latency: Sleep Onset Latency, i.e., time in bed needed to fall asleep, in minutes

  • getup_latency: Get Up Latency, i.e., time in bed after awakening until getting up, in minutes

  • wake_after_sleep_onset: Wake After Sleep Onset (WASO), i.e., total time awake after falling asleep, in minutes

  • sleep_bouts: List with start and end times of sleep bouts

  • wake_bouts: List with start and end times of wake bouts

  • number_wake_bouts: Total number of wake bouts

The following entries are, for instance, further possible:

  • total_time_light_sleep: Total time of light sleep, in minutes

  • total_time_deep_sleep: Total time of deep sleep, in minutes

  • total_time_rem_sleep: Total time of REM sleep, in minutes

  • total_time_awake: Total time of being awake, in minutes

  • count_snoring_episodes: Total number of snoring episodes

  • total_time_snoring: Total time of snoring, in minutes

  • heart_rate_avg: Average heart rate during recording, in bpm

  • heart_rate_min: Minimum heart rate during recording, in bpm

  • heart_rate_max: Maximum heart rate during recording, in bpm

alias of Dict[str, Any]

biopsykit.utils.datatype_helper.EcgRawDataFrame

DataFrame containing raw ECG data of one subject.

The dataframe is expected to have the following columns:

  • ecg: Raw ECG signal

alias of Union[biopsykit.utils.datatype_helper._EcgRawDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.EcgResultDataFrame

DataFrame containing processed ECG data of one subject.

The dataframe is expected to have the following columns:

  • ECG_Raw: Raw ECG signal

  • ECG_Clean: Cleaned (filtered) ECG signal

  • ECG_Quality: ECG signal quality indicator in the range of [0, 1]

  • ECG_R_Peaks: 1.0 where R peak was detected in the ECG signal, 0.0 else

  • R_Peak_Outlier: 1.0 when a detected R peak was classified as outlier, 0.0 else

  • Heart_Rate: Computed Heart rate interpolated to signal length

alias of Union[biopsykit.utils.datatype_helper._EcgResultDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.RPeakDataFrame

DataFrame containing R-peak locations of one subject extracted from ECG data.

The dataframe is expected to have the following columns:

  • R_Peak_Quality: Signal quality indicator (of the raw ECG signal) in the range of [0, 1]

  • R_Peak_Idx: Array index of detected R peak in the raw ECG signal

  • RR_Interval: Interval between the current and the successive R peak in seconds

  • R_Peak_Outlier: 1.0 when a detected R peak was classified as outlier, 0.0 else

alias of Union[biopsykit.utils.datatype_helper._RPeakDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.HeartRateDataFrame

DataFrame containing heart rate time series data of one subject.

The dataframe is expected to have the following columns:

  • Heart_Rate: Heart rate data. Can either be instantaneous heart rate or resampled heart rate

alias of Union[biopsykit.utils.datatype_helper._HeartRateDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.Acc1dDataFrame

DataFrame containing 1-d acceleration data.

The dataframe is expected to have one of the following column sets:

  • [“acc”]: one level column index

  • [“acc_norm”]: one level column index

alias of Union[biopsykit.utils.datatype_helper._Acc1dDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.Acc3dDataFrame

DataFrame containing 3-d acceleration data.

The dataframe is expected to have one of the following column sets:

  • [“acc_x”, “acc_y”, “acc_z”]: one level column index

  • [(“acc”, “x”), (“acc”, “y”), (“acc”, “z”)]: two-level column index, first level specifying the channel (acceleration), second level specifying the axes

alias of Union[biopsykit.utils.datatype_helper._Acc3dDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.Gyr1dDataFrame

DataFrame containing 1-d gyroscope data.

The dataframe is expected to have one of the following column sets:

  • [“gyr”]: one level column index

  • [“gyr_norm”]: one level column index

alias of Union[biopsykit.utils.datatype_helper._Gyr1dDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.Gyr3dDataFrame

DataFrame containing 3-d gyroscope data.

The dataframe is expected to have one of the following column sets:

  • [“gyr_x”, “gyr_y”, “gyr_z”]: one level column index

  • [(“gyr”, “x”), (“gyr”, “y”), (“gyr”, “z”)]: two-level column index, first level specifying the channel (gyroscope), second level specifying the axes

alias of Union[biopsykit.utils.datatype_helper._Gyr3dDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.ImuDataFrame

DataFrame containing 6-d inertial measurement (IMU) (acceleration and gyroscope) data.

Hence, an ImuDataFrame must both be a AccDataFrame and a GyrDataFrame.

The dataframe is expected to have one of the following column sets:

  • [“acc_x”, “acc_y”, “acc_z”, “gyr_x”, “gyr_y”, “gyr_z”]: one level column index

  • [(“acc”, “x”), (“acc”, “y”), (“acc”, “z”), (“gyr”, “x”), (“gyr”, “y”), (“gyr”, “z”)]: two-level column index, first level specifying the channel (acceleration and gyroscope), second level specifying the axes

alias of Union[biopsykit.utils.datatype_helper._ImuDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SleepWakeDataFrame

DataFrame containing sleep/wake predictions.

The dataframe is expected to have at least the following column(s):

  • [“sleep_wake”]: sleep/wake predictions where 1 indicates sleep and 0 indicates wake

alias of Union[biopsykit.utils.datatype_helper._SleepWakeDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SubjectConditionDataFrame

DataFrame containing subject IDs and condition assignment in a standardized format.

A SubjectConditionDataFrame has an index with subject IDs named subject and a column with the condition assignment named condition.

alias of Union[biopsykit.utils.datatype_helper._SubjectConditionDataFrame, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SubjectConditionDict

Dictionary containing subject IDs and condition assignment in a standardized format.

A SubjectConditionDict contains conditions as dictionary keys and a collection of subject IDs (list, numpy array, pandas Index) as dictionary values.

alias of Dict[str, numpy.ndarray]

biopsykit.utils.datatype_helper.PhaseDict

Dictionary containing general time-series data of one single subject split into different phases.

A PhaseDict is a dictionary with the following format:

{ “phase_1” : dataframe, “phase_2” : dataframe, … }

Each dataframe is a DataFrame with the following format:

alias of Dict[str, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.SubjectDataDict

Dictionary representing time-series data from multiple subjects collected during a psychological protocol.

A SubjectDataDict is a nested dictionary with time-series data from multiple subjects, each containing data from different phases. It is expected to have the level order subject, phase:

{
“subject1” : { “phase_1” : dataframe, “phase_2” : dataframe, … },
“subject2” : { “phase_1” : dataframe, “phase_2” : dataframe, … },
}

This dictionary can, for instance, be rearranged to a biopsykit.utils.datatype_helper.StudyDataDict, where the level order is reversed: phase, subject.

alias of Dict[str, Dict[str, pandas.core.frame.DataFrame]]

biopsykit.utils.datatype_helper.HeartRatePhaseDict

Dictionary containing time-series heart rate data of one single subject split into different phases.

A HeartRatePhaseDict is a dictionary with the following format:

{ “phase_1” : hr_dataframe, “phase_2” : hr_dataframe, … }

Each hr_dataframe is a DataFrame with the following format:

  • time Index: pandas.DatetimeIndex with heart rate sample timestamps

  • Heart_Rate Column: heart rate values

alias of Dict[str, Union[biopsykit.utils.datatype_helper._HeartRateDataFrame, pandas.core.frame.DataFrame]]

biopsykit.utils.datatype_helper.HeartRateSubjectDataDict

Dictionary with time-series heart rate data from multiple subjects collected during a psychological protocol.

A HeartRateSubjectDataDict is a nested dictionary with time-series heart rate data from multiple subjects, each containing data from different phases. It is expected to have the level order subject, phase:

{
“subject1” : { “phase_1” : hr_dataframe, “phase_2” : hr_dataframe, … },
“subject2” : { “phase_1” : hr_dataframe, “phase_2” : hr_dataframe, … },
}

Each hr_dataframe is a DataFrame with the following format:

  • time Index: pandas.DatetimeIndex with heart rate sample timestamps

  • Heart_Rate Column: heart rate values

This dictionary can, for instance, be rearranged to a HeartRateStudyDataDict, where the level order is reversed: phase, subject.

alias of Union[Dict[str, Dict[str, Union[biopsykit.utils.datatype_helper._HeartRateDataFrame, pandas.core.frame.DataFrame]]], Dict[str, Dict[str, Dict[str, Union[biopsykit.utils.datatype_helper._HeartRateDataFrame, pandas.core.frame.DataFrame]]]]]

biopsykit.utils.datatype_helper.HeartRateStudyDataDict

Dictionary with heart rate data from multiple phases collected during a psychological protocol.

A HeartRateStudyDataDict is a nested dictionary with time-series heart rate data from multiple phases, each phase containing data from different subjects. It is expected to have the level order phase, subject:

{
“phase_1” : { “subject1” : hr_dataframe, “subject2” : hr_dataframe, … },
“phase_2” : { “subject1” : hr_dataframe, “subject2” : hr_dataframe, … },
}

Each hr_dataframe is a DataFrame with the following format:

  • time Index: pandas.DatetimeIndex with heart rate sample timestamps

  • Heart_Rate Column: heart rate values

This dict results from rearranging a HeartRateSubjectDataDict by calling rearrange_subject_data_dict().

alias of Dict[str, Dict[str, Union[biopsykit.utils.datatype_helper._HeartRateDataFrame, pandas.core.frame.DataFrame]]]

biopsykit.utils.datatype_helper.StudyDataDict

Dictionary with data from multiple phases collected during a psychological protocol.

A StudyDataDict is a nested dictionary with time-series data from multiple phases, each phase containing data from different subjects. It is expected to have the level order phase, subject:

{
“phase_1” : { “subject1” : dataframe, “subject2” : dataframe, … },
“phase_2” : { “subject1” : dataframe, “subject2” : dataframe, … },
}

This dict results from rearranging a biopsykit.utils.datatype_helper.SubjectDataDict by calling rearrange_subject_data_dict().

alias of Dict[str, Dict[str, pandas.core.frame.DataFrame]]

biopsykit.utils.datatype_helper.MergedStudyDataDict

Dictionary with merged time-series data of multiple subjects, split into different phases.

A MergedStudyDataDict is a dictionary with the following format:

{
“phase_1” : merged_dataframe,
“phase_2” : merged_dataframe,
}

This dict results from merging the inner dictionary into one dataframe by calling merge_study_data_dict().

Note

Merging the inner dictionaries requires that the dataframes of all subjects have same length within each phase.

Each merged_dataframe is a DataFrame with the following format:

  • Index: time. Name of index level: time

  • Columns: time series data per subject, each subject has its own column. Name of the column index level: subject

alias of Dict[str, pandas.core.frame.DataFrame]

biopsykit.utils.datatype_helper.is_subject_condition_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a SubjectConditionDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a SubjectConditionDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SubjectConditionDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SubjectConditionDataFrame

Return type

Optional[bool]

See also

SubjectConditionDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_subject_condition_dict(data, raise_exception=True)[source]

Check whether dataframe is a SubjectConditionDict.

Parameters
  • data (dict) – dict to check if it is a SubjectConditionDict

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SubjectConditionDict

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SubjectConditionDict

Return type

Optional[bool]

See also

SubjectConditionDict

dictionary format

biopsykit.utils.datatype_helper.is_codebook_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a CodebookDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a CodebookDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a CodebookDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a CodebookDataFrame

Return type

Optional[bool]

See also

CodebookDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_mean_se_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a MeanSeDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a MeanSeDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a MeanSeDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a MeanSeDataFrame

Return type

Optional[bool]

See also

MeanSeDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_phase_dict(data, raise_exception=True)[source]

Check whether a dict is a PhaseDict.

Parameters
  • data (dict) – dict to check

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a PhaseDict

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a PhaseDict

Return type

Optional[bool]

See also

PhaseDict

dictionary format

biopsykit.utils.datatype_helper.is_hr_phase_dict(data, raise_exception=True)[source]

Check whether a dict is a HeartRatePhaseDict.

Parameters
  • data (dict) – dict to check

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a HeartRatePhaseDict

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a HeartRatePhaseDict

Return type

Optional[bool]

See also

HeartRatePhaseDict

dictionary format

biopsykit.utils.datatype_helper.is_subject_data_dict(data, raise_exception=True)[source]

Check whether a dict is a SubjectDataDict.

Parameters
  • data (dict) – dict to check

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SubjectDataDict`

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SubjectDataDict

Return type

Optional[bool]

See also

SubjectDataDict

dictionary format

biopsykit.utils.datatype_helper.is_hr_subject_data_dict(data, raise_exception=True)[source]

Check whether a dict is a HeartRateSubjectDataDict.

Parameters
  • data (dict) – dict to check

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a HeartRateSubjectDataDict

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a HeartRateSubjectDataDict

Return type

Optional[bool]

See also

HeartRateSubjectDataDict

dictionary format

biopsykit.utils.datatype_helper.is_study_data_dict(data, raise_exception=True)[source]

Check whether a dict is a StudyDataDict.

Parameters
  • data (dict) – dict to check

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a StudyDataDict

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a StudyDataDict

Return type

Optional[bool]

See also

StudyDataDict

dictionary format

biopsykit.utils.datatype_helper.is_merged_study_data_dict(data, raise_exception=True)[source]

Check whether a dict is a MergedStudyDataDict.

Parameters
  • data (dict) – dict to check

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a MergedStudyDataDict

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a MergedStudyDataDict

Return type

Optional[bool]

See also

MergedStudyDataDict

dictionary format

biopsykit.utils.datatype_helper.is_saliva_raw_dataframe(data, saliva_type, raise_exception=True)[source]

Check whether dataframe is a SalivaRawDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a SalivaRawDataFrame

  • saliva_type (str or list of str) – type of saliva data (or list of saliva types) in the dataframe, e.g., “cortisol” or “amylase”

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SalivaRawDataFrame`

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SalivaRawDataFrame

Return type

Optional[bool]

See also

SalivaRawDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_saliva_feature_dataframe(data, saliva_type, raise_exception=True)[source]

Check whether dataframe is a SalivaFeatureDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a SalivaFeatureDataFrame

  • saliva_type (str or list of str) – type of saliva data in the dataframe, e.g., “cortisol” or “amylase”

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SalivaFeatureDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SalivaFeatureDataFrame

Return type

Optional[bool]

See also

SalivaFeatureDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_saliva_mean_se_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a SalivaMeanSeDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a SalivaMeanSeDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SalivaMeanSeDataFrame`

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SalivaMeanSeDataFrame

Return type

Optional[bool]

See also

SalivaMeanSeDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_sleep_endpoint_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a SleepEndpointDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a SleepEndpointDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SleepEndpointDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SleepEndpointDataFrame

Return type

Optional[bool]

See also

SleepEndpointDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_sleep_endpoint_dict(data, raise_exception=True)[source]

Check whether dictionary is a SleepEndpointDict.

Parameters
  • data (dict) – data to check if it is a SleepEndpointDict

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SleepEndpointDict

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SleepEndpointDict

Return type

Optional[bool]

See also

SleepEndpointDict

dictionary format

biopsykit.utils.datatype_helper.is_ecg_raw_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a EcgRawDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a EcgRawDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a EcgRawDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a EcgRawDataFrame

Return type

Optional[bool]

See also

EcgRawDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_ecg_result_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a EcgResultDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a EcgResultDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a EcgResultDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a EcgResultDataFrame

Return type

Optional[bool]

See also

EcgResultDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_r_peak_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a RPeakDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a RPeakDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a RPeakDataFrame`

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a RPeakDataFrame

Return type

Optional[bool]

See also

RPeakDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_heart_rate_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a HeartRateDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a HeartRateDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a HeartRateDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a HeartRateDataFrame

Return type

Optional[bool]

See also

HeartRateDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_acc1d_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a Acc1dDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a Acc1dDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a Acc1dDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a Acc1dDataFrame

Return type

Optional[bool]

See also

Acc1dDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_acc3d_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a Acc3dDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a Acc3dDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a Acc3dDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a Acc3dDataFrame

Return type

Optional[bool]

See also

Acc3dDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_gyr1d_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a Gyr1dDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a Gyr1dDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a Gyr1dDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a Gyr1dDataFrame

Return type

Optional[bool]

See also

Gyr1dDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_gyr3d_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a Gyr3dDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a Gyr3dDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a Gyr3dDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a Gyr3dDataFrame

Return type

Optional[bool]

See also

Gyr3dDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_imu_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a ImuDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a ImuDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a ImuDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a ImuDataFrame

Return type

Optional[bool]

See also

ImuDataFrame

dataframe format

biopsykit.utils.datatype_helper.is_sleep_wake_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a SleepWakeDataFrame.

Parameters
  • data (DataFrame) – data to check if it is a SleepWakeDataFrame

  • raise_exception (bool, optional) – whether to raise an exception or return a bool value

Returns

  • True if data is a SleepWakeDataFrame

  • False otherwise (if raise_exception is False)

Raises

ValidationError – if raise_exception is True and data is not a SleepWakeDataFrame

Return type

Optional[bool]

See also

SleepWakeDataFrame

dataframe format