biopsykit.utils.dtypes module

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

biopsykit.utils.dtypes.Acc1dDataFrame = biopsykit.utils.dtypes._Acc1dDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.Acc3dDataFrame = biopsykit.utils.dtypes._Acc3dDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.BPointDataFrame = biopsykit.utils.dtypes._BPointDataFrame | pandas.core.frame.DataFrame

DataFrame containing B-Point locations extracted from ICG data.

The dataframe is expected to have at least the following columns:

  • b_point_sample: The sample index of the B-point in the ICG signal

Optionally, the dataframe can contain additional columns, such as:

  • nan_reason: Reason why the B-point was set to NaN (e.g., “c_point_nan”, “no_zero_crossing”)

biopsykit.utils.dtypes.BiomarkerRawDataFrame = biopsykit.utils.dtypes._BiomarkerRawDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.CPointDataFrame = biopsykit.utils.dtypes._CPointDataFrame | pandas.core.frame.DataFrame

DataFrame containing C-Point locations extracted from ICG data.

The dataframe is expected to have at least the following columns:

  • c_point_sample: The sample index of the C-point in the ICG signal

Optionally, the dataframe can contain additional columns, such as:

  • nan_reason: Reason why the C-point was set to NaN (e.g., “no_local_maxima”)

biopsykit.utils.dtypes.CodebookDataFrame = biopsykit.utils.dtypes._CodebookDataFrame | pandas.core.frame.DataFrame

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.

biopsykit.utils.dtypes.EcgRawDataFrame = biopsykit.utils.dtypes._EcgRawDataFrame | pandas.core.frame.DataFrame

DataFrame containing raw ECG data of one subject.

The dataframe is expected to have the following columns:

  • ecg: Raw ECG signal

biopsykit.utils.dtypes.EcgResultDataFrame = biopsykit.utils.dtypes._EcgResultDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.Gyr1dDataFrame = biopsykit.utils.dtypes._Gyr1dDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.Gyr3dDataFrame = biopsykit.utils.dtypes._Gyr3dDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.HeartRateDataFrame = biopsykit.utils.dtypes._HeartRateDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.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

biopsykit.utils.dtypes.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().

biopsykit.utils.dtypes.HeartRateSubjectDataDict = dict[str, dict[str, biopsykit.utils.dtypes._HeartRateDataFrame | pandas.core.frame.DataFrame]] | dict[str, dict[str, dict[str, biopsykit.utils.dtypes._HeartRateDataFrame | pandas.core.frame.DataFrame]]]

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.

biopsykit.utils.dtypes.HeartbeatSegmentationDataFrame = biopsykit.utils.dtypes._HeartbeatSegmentationDataFrame | pandas.core.frame.DataFrame

DataFrame containing results of heartbeat segmentation.

The dataframe is expected to have at least the following columns:

  • start_sample: Start sample of segmented heartbeat

  • end_sample: End sample of segmented heartbeat

  • r_peak_sample: R-peak sample of segmented heartbeat

biopsykit.utils.dtypes.IcgRawDataFrame = biopsykit.utils.dtypes._IcgRawDataFrame | pandas.core.frame.DataFrame

DataFrame containing raw ICG data of one subject.

The dataframe is expected to have one of the following columns:

  • icg: Raw ICG signal

  • icg_der: Derivative of the ICG signal

biopsykit.utils.dtypes.ImuDataFrame = biopsykit.utils.dtypes._ImuDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.MeanSeDataFrame = biopsykit.utils.dtypes._MeanSeDataFrame | pandas.core.frame.DataFrame

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.

biopsykit.utils.dtypes.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

biopsykit.utils.dtypes.PepResultDataFrame = biopsykit.utils.dtypes._PepResultDataFrame | pandas.core.frame.DataFrame

DataFrame containing results of PEP extraction.

The dataframe is expected to have at least the following columns:

  • heartbeat_start_sample: Start sample of segmented heartbeat

  • heartbeat_end_sample: End sample of segmented heartbeat

  • r_peak_sample: R-peak sample of segmented heartbeat

  • q_peak_sample: Q-peak sample of segmented heartbeat

  • b_point_sample: B-point sample of segmented heartbeat

  • pep_sample: Pre-ejection period (PEP) in samples

  • pep_ms: Pre-ejection period (PEP) in milliseconds

Additionally, the dataframe can contain the following columns:

  • rr_interval_sample: RR interval between the previous and the current heartbeat in samples

  • rr_interval_ms: RR interval between the previous and the current heartbeat in milliseconds

  • heart_rate_bpm: Heart rate in beats per minute, derived from RR interval

  • nan_reason: Reason why the PEP was set to NaN (e.g., “r_peak_nan”, “no_zero_crossing”)

biopsykit.utils.dtypes.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:

biopsykit.utils.dtypes.QPeakDataFrame = biopsykit.utils.dtypes._QPeakDataFrame | pandas.core.frame.DataFrame

DataFrame containing Q-peak locations extracted from ECG data.

The dataframe is expected to have at least the following columns:

  • q_peak_sample: The sample index of the Q-peak in the ECG signal

Optionally, the dataframe can contain additional columns, such as:

  • nan_reason: Reason why the Q-peak was set to NaN (e.g., “r_peak_nan”, “no_zero_crossing”)

biopsykit.utils.dtypes.RPeakDataFrame = biopsykit.utils.dtypes._RPeakDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.SalivaFeatureDataFrame = biopsykit.utils.dtypes._SalivaFeatureDataFrame | pandas.core.frame.DataFrame

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.

biopsykit.utils.dtypes.SalivaMeanSeDataFrame = biopsykit.utils.dtypes._SalivaMeanSeDataFrame | pandas.core.frame.DataFrame

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.

biopsykit.utils.dtypes.SalivaRawDataFrame = biopsykit.utils.dtypes._BiomarkerRawDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.SleepEndpointDataFrame = biopsykit.utils.dtypes._SleepEndpointDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.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

biopsykit.utils.dtypes.SleepWakeDataFrame = biopsykit.utils.dtypes._SleepWakeDataFrame | pandas.core.frame.DataFrame

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

biopsykit.utils.dtypes.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.dtypes.SubjectDataDict by calling rearrange_subject_data_dict().

biopsykit.utils.dtypes.SubjectConditionDataFrame = biopsykit.utils.dtypes._SubjectConditionDataFrame | pandas.core.frame.DataFrame

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.

biopsykit.utils.dtypes.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.

biopsykit.utils.dtypes.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.dtypes.StudyDataDict, where the level order is reversed: phase, subject.

biopsykit.utils.dtypes.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

bool | None

See also

Acc1dDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

Acc3dDataFrame

dataframe format

biopsykit.utils.dtypes.is_b_point_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a BPointDataFrame.

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

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

Returns

  • True if data is a BPointDataFrame

  • False otherwise (if raise_exception is False)

Raises

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

Return type

bool | None

See also

BPointDataFrame

dataframe format

biopsykit.utils.dtypes.is_biomarker_raw_dataframe(data, biomarker_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

  • biomarker_type (str | list[str]) –

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

bool | None

See also

SalivaRawDataFrame

dataframe format

biopsykit.utils.dtypes.is_c_point_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a CPointDataFrame.

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

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

Returns

  • True if data is a CPointDataFrame

  • False otherwise (if raise_exception is False)

Raises

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

Return type

bool | None

See also

CPointDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

CodebookDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

EcgRawDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

EcgResultDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

Gyr1dDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

Gyr3dDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

HeartRateDataFrame

dataframe format

biopsykit.utils.dtypes.is_heartbeat_segmentation_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a HeartbeatSegmentationDataFrame.

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

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

Returns

  • True if data is a HeartbeatSegmentationDataFrame

  • False otherwise (if raise_exception is False)

Raises

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

Return type

bool | None

See also

HeartbeatSegmentationDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

HeartRatePhaseDict

dictionary format

biopsykit.utils.dtypes.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

bool | None

See also

HeartRateSubjectDataDict

dictionary format

biopsykit.utils.dtypes.is_icg_raw_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a IcgRawDataFrame.

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

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

Returns

  • True if data is a IcgRawDataFrame

  • False otherwise (if raise_exception is False)

Raises

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

Return type

bool | None

See also

IcgRawDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

ImuDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

MeanSeDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

MergedStudyDataDict

dictionary format

biopsykit.utils.dtypes.is_pep_result_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a PepResultDataFrame.

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

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

Returns

  • True if data is a PepResultDataFrame

  • False otherwise (if raise_exception is False)

Raises

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

Return type

bool | None

See also

PepResultDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

PhaseDict

dictionary format

biopsykit.utils.dtypes.is_q_peak_dataframe(data, raise_exception=True)[source]

Check whether dataframe is a QPeakDataFrame.

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

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

Returns

  • True if data is a QPeakDataFrame

  • False otherwise (if raise_exception is False)

Raises

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

Return type

bool | None

See also

QPeakDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

RPeakDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

SalivaFeatureDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

SalivaMeanSeDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

SalivaRawDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

SleepEndpointDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

SleepEndpointDict

dictionary format

biopsykit.utils.dtypes.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

bool | None

See also

SleepWakeDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

StudyDataDict

dictionary format

biopsykit.utils.dtypes.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

bool | None

See also

SubjectConditionDataFrame

dataframe format

biopsykit.utils.dtypes.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

bool | None

See also

SubjectConditionDict

dictionary format

biopsykit.utils.dtypes.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

bool | None

See also

SubjectDataDict

dictionary format