Fill EDA NaN values where numPeak is zero. Other small changes.

sociality-task
Primoz 2022-06-21 14:09:49 +00:00
parent a8cd16f88c
commit c851ab0763
7 changed files with 11 additions and 3 deletions

@ -0,0 +1 @@
Subproject commit 98e6207ecc23a23b1f621a11f28eb87cbfb7f9da

View File

@ -3,7 +3,7 @@
######################################################################################################################## ########################################################################################################################
# See https://www.rapids.science/latest/setup/configuration/#participant-files # See https://www.rapids.science/latest/setup/configuration/#participant-files
PIDS: [p02] #p01, p02, p03] PIDS: [p01] #p01, p02, p03]
# See https://www.rapids.science/latest/setup/configuration/#automatic-creation-of-participant-files # See https://www.rapids.science/latest/setup/configuration/#automatic-creation-of-participant-files
CREATE_PARTICIPANT_FILES: CREATE_PARTICIPANT_FILES:
@ -542,6 +542,7 @@ EMPATICA_ELECTRODERMAL_ACTIVITY:
WINDOW_LENGTH: 60 # specify window length in seconds WINDOW_LENGTH: 60 # specify window length in seconds
SECOND_ORDER_FEATURES: ['mean', 'median', 'sd', 'nlargest', 'nsmallest', count_windows, eda_num_peaks_non_zero] SECOND_ORDER_FEATURES: ['mean', 'median', 'sd', 'nlargest', 'nsmallest', count_windows, eda_num_peaks_non_zero]
STANDARDIZE_FEATURES: False STANDARDIZE_FEATURES: False
IMPUTE_NANS: False
SRC_SCRIPT: src/features/empatica_electrodermal_activity/cr/main.py SRC_SCRIPT: src/features/empatica_electrodermal_activity/cr/main.py
# See https://www.rapids.science/latest/features/empatica-blood-volume-pulse/ # See https://www.rapids.science/latest/features/empatica-blood-volume-pulse/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

View File

@ -63,6 +63,11 @@ def cr_features(sensor_data_files, time_segment, provider, filter_data_by_segmen
requested_window_length, time_segment, filter_data_by_segment) requested_window_length, time_segment, filter_data_by_segment)
if calc_windows: if calc_windows:
if provider["WINDOWS"]["IMPUTE_NANS"]:
eda_intraday_features[eda_intraday_features["numPeaks"] == 0] = \
eda_intraday_features[eda_intraday_features["numPeaks"] == 0].fillna(0)
pd.set_option('display.max_columns', None)
so_features_names = provider["WINDOWS"]["SECOND_ORDER_FEATURES"] so_features_names = provider["WINDOWS"]["SECOND_ORDER_FEATURES"]
eda_second_order_features = extract_second_order_features(eda_intraday_features, so_features_names) eda_second_order_features = extract_second_order_features(eda_intraday_features, so_features_names)

View File

@ -28,6 +28,7 @@ else:
elif "empatica" in sensor_key: elif "empatica" in sensor_key:
pd.DataFrame().to_csv(snakemake.output[1], index=False) pd.DataFrame().to_csv(snakemake.output[1], index=False)
if not calc_windows:
sensor_features = fetch_provider_features(provider, provider_key, sensor_key, sensor_data_files, time_segments_file, calc_windows=False) sensor_features = fetch_provider_features(provider, provider_key, sensor_key, sensor_data_files, time_segments_file, calc_windows=False)
if not calc_windows: if not calc_windows:

View File

@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
# path = "/rapids/data/processed/features/all_participants/all_sensor_features.csv" # all features all participants # path = "/rapids/data/processed/features/all_participants/all_sensor_features.csv" # all features all participants
# path = "/rapids/data/interim/p03/empatica_accelerometer_features/empatica_accelerometer_python_cr_windows.csv" # path = "/rapids/data/interim/p03/empatica_accelerometer_features/empatica_accelerometer_python_cr_windows.csv"
path = "/rapids/data/interim/p02/empatica_electrodermal_activity_features/empatica_electrodermal_activity_python_cr_windows.csv" path = "/rapids/data/interim/p01/empatica_electrodermal_activity_features/empatica_electrodermal_activity_python_cr_windows.csv"
# path = "/rapids/data/interim/p02/empatica_inter_beat_interval_features/empatica_inter_beat_interval_python_cr_windows.csv" # path = "/rapids/data/interim/p02/empatica_inter_beat_interval_features/empatica_inter_beat_interval_python_cr_windows.csv"
# path = "/rapids/data/interim/p02/empatica_blood_volume_pulse_features/empatica_blood_volume_pulse_python_cr_windows.csv" # path = "/rapids/data/interim/p02/empatica_blood_volume_pulse_features/empatica_blood_volume_pulse_python_cr_windows.csv"
# path = "/rapids/data/interim/p02/empatica_temperature_features/empatica_temperature_python_cr_windows.csv" # path = "/rapids/data/interim/p02/empatica_temperature_features/empatica_temperature_python_cr_windows.csv"