biopsykit.example_data module

Module providing functions to load different example data.

The data is either taken from the local file system in case biopsykit was installed manually or the example data is downloaded into the local user folder.

biopsykit.example_data.get_condition_list_example()[source]

Return example data for subject condition assignment.

Returns

dataframe with example subject condition assignment

Return type

SubjectConditionDataFrame

biopsykit.example_data.get_saliva_example_plate_format(sample_id_col=None, data_col=None, id_col_names=None, regex_str=None, sample_times=None, condition_list=None)[source]

Return example saliva data from “plate” format.

Parameters
  • sample_id_col (str, optional) – column name of the Excel sheet containing the sample ID. Default: “sample ID”

  • data_col (str, optional) – column name of the Excel sheet containing saliva data to be analyzed. Default: Select default column name based on biomarker_type, e.g. cortisol => cortisol (nmol/l)

  • id_col_names (list of str, optional) – names of the extracted ID column names. None to use the default column names ([‘subject’, ‘day’, ‘sample’])

  • regex_str (str, optional) – regular expression to extract subject ID, day ID and sample ID from the sample identifier. None to use default regex string (r"(Vp\d+) (S\d)")

  • sample_times (list of int, optional) – times at which saliva samples were collected

  • condition_list (1d-array, optional) – list of conditions which subjects were assigned to

Returns

data – saliva data in SalivaRawDataFrame format

Return type

SalivaRawDataFrame

See also

load_saliva_plate()

loader function for saliva data in plate format

biopsykit.example_data.get_saliva_example(sample_times=None)[source]

Return saliva example data.

Parameters

sample_times (list of int, optional) – sample times of saliva samples in minutes

Returns

dataframe with example raw saliva data

Return type

SalivaRawDataFrame

biopsykit.example_data.get_saliva_mean_se_example()[source]

Return dictionary with mean and standard error from example data for different saliva types.

Returns

dictionary with SalivaMeanSeDataFrame from different saliva types

Return type

dict

biopsykit.example_data.get_mist_hr_example()[source]

Return heart rate time-series example data collected during MIST from one subject.

Returns

dictionary with heart rate time-series data from one subject during multiple phases

Return type

HeartRatePhaseDict

biopsykit.example_data.get_hr_result_sample()[source]

Return heart rate results example data.

The heart rate results example data consists of the mean normalized heart rate for different subjects, different study phases, and study subphases.

Returns

dataframe with heart rate results example data

Return type

DataFrame

biopsykit.example_data.get_hr_ensemble_sample()[source]

Return heart rate ensemble example data.

The example data consists of time-series heart rate of multiple subjects for different study phases, each synchronized and resampled to 1 Hz, and normalized to baseline heart rate.

Returns

dictionary with pandas dataframes containing heart rate ensemble data

Return type

dict

biopsykit.example_data.get_hr_subject_data_dict_example()[source]

Return heart rate example data in the form of a HeartRateSubjectDataDict.

Returns

dictionary with heart rate time-series data from multiple subjects, each containing data from different phases.

Return type

HeartRateSubjectDataDict

biopsykit.example_data.get_hr_subject_data_dict_tuple_example()[source]

Return HR example data as a HeartRateSubjectDataDict, but with tuples as keys instead of strings.

Returns

dictionary with heart rate time-series, each containing data from different phases.

Return type

HeartRateSubjectDataDict

biopsykit.example_data.get_ecg_processing_results_path_example()[source]

Return folder path to ECG processing results.

Returns

path to folder with ECG processing results

Return type

Path or str

biopsykit.example_data.get_ecg_path_example()[source]

Return folder path to ECG example data.

Returns

path to folder with ECG raw files

Return type

Path or str

biopsykit.example_data.get_ecg_example()[source]

Return raw ECG example data from one subject.

Returns

  • DataFrame – dataframe with raw ECG data

  • sampling_rate (float) – sampling rate of recorded data

Return type

Tuple[pandas.core.frame.DataFrame, float]

biopsykit.example_data.get_ecg_example_02()[source]

Return second raw ECG example data from another subject.

Returns

  • DataFrame – dataframe with raw ECG data

  • sampling_rate (float) – sampling rate of recorded data

Return type

Tuple[pandas.core.frame.DataFrame, float]

biopsykit.example_data.get_eeg_example()[source]

Return raw EEG example data collected from a Muse EEG headband.

Returns

  • data (DataFrame) – dataframe with raw EEG data

  • sampling_rate (float) – sampling rate of recorded data

Return type

biopsykit.io.eeg.MuseDataset

biopsykit.example_data.get_sleep_analyzer_raw_file_unformatted(data_source)[source]

Return unformatted Withings Sleep Analyzer raw data example file.

Parameters

data_source (str) – Withings Sleep Analyzer data source name. Must be one of [‘heart_rate’, ‘respiration_rate’, ‘sleep_state’, ‘snoring’].

Returns

Dataframe with unformatted example raw data

Return type

DataFrame

biopsykit.example_data.get_sleep_analyzer_raw_file(data_source, split_into_nights=True)[source]

Return Withings Sleep Analyzer raw data example file.

Parameters
  • data_source (str) – Withings Sleep Analyzer data source name. Must be one of [‘heart_rate’, ‘respiration_rate’, ‘sleep_state’, ‘snoring’].

  • split_into_nights (bool, optional) – whether to split the dataframe into the different recording nights (and return a dictionary of dataframes) or not. Default: True

Returns

dataframe (or dict of dataframes, if split_into_nights is True) with Sleep Analyzer data

Return type

DataFrame or dict of such

biopsykit.example_data.get_sleep_analyzer_raw_example(split_into_nights=True)[source]

Return Withings Sleep Analyzer example raw data.

Parameters

split_into_nights (bool, optional) – True to split data into single dataframes per recording night, and return a dict of dataframes, False to keep all data in one dataframe. Default: True

Returns

dataframe with raw sleep analyzer data or a dict of such if split_into_nights is True

Return type

DataFrame or dict

biopsykit.example_data.get_sleep_analyzer_summary_example()[source]

Return Withings Sleep Analyzer example summary data.

Returns

dataframe with example sleep endpoints computed from Withings Sleep Analyzer Summary data

Return type

SleepEndpointDataFrame

biopsykit.example_data.get_sleep_imu_example()[source]

Return raw IMU example data collected from a wrist-worn IMU sensor during night.

Returns

  • data (DataFrame) – dataframe with raw IMU data

  • sampling_rate (float) – sampling rate of recorded data

Return type

Tuple[pandas.core.frame.DataFrame, float]

biopsykit.example_data.get_time_log_example()[source]

Return time log example data.

Returns

data – dataframe with example time log information. The time log match the data from the two ECG data example functions get_ecg_example() and get_ecg_example_02()

Return type

DataFrame

biopsykit.example_data.get_questionnaire_example()[source]

Return questionnaire example data.

Returns

data – dataframe with questionnaire example data

Return type

DataFrame

biopsykit.example_data.get_questionnaire_example_wrong_range()[source]

Return questionnaire example data with score in the wrong range.

In this example the items of the “PSS” questionnaire are coded in the wrong range ([1, 5] instead of [0, 4]) originally defined in the paper.

This example data is used to demonstrate BioPsyKit’s feature of asserting that questionnaire score items are provided in the correct score range according to the original definition of the questionnaire.

Returns

data – dataframe with questionnaire example data where the items of the PSS questionnaire are coded in the wrong range

Return type

DataFrame

biopsykit.example_data.get_stats_example()[source]

Return example data for statistical analysis.

Returns

data – dataframe with example data that can be used for statistical analysis

Return type

DataFrame