Testing different EDA findPeaks parameters.
parent
c851ab0763
commit
505c3a86b9
|
@ -118,3 +118,6 @@ site/
|
|||
|
||||
# Docker container and other files
|
||||
.devcontainer
|
||||
|
||||
# Calculating features module
|
||||
calculatingfeatures/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
########################################################################################################################
|
||||
|
||||
# See https://www.rapids.science/latest/setup/configuration/#participant-files
|
||||
PIDS: [p01] #p01, p02, p03]
|
||||
PIDS: [p02] #p01, p02, p03]
|
||||
|
||||
# See https://www.rapids.science/latest/setup/configuration/#automatic-creation-of-participant-files
|
||||
CREATE_PARTICIPANT_FILES:
|
||||
|
@ -536,7 +536,7 @@ EMPATICA_ELECTRODERMAL_ACTIVITY:
|
|||
'sigTonicDifference', 'freqFeats','maxPeakAmplitudeChangeBefore', 'maxPeakAmplitudeChangeAfter', 'avgPeakAmplitudeChangeBefore',
|
||||
'avgPeakAmplitudeChangeAfter', 'avgPeakChangeRatio', 'maxPeakIncreaseTime', 'maxPeakDecreaseTime', 'maxPeakDuration', 'maxPeakChangeRatio',
|
||||
'avgPeakIncreaseTime', 'avgPeakDecreaseTime', 'avgPeakDuration', 'signalOverallChange', 'changeDuration', 'changeRate', 'significantIncrease',
|
||||
'significantDecrease', maxPeakResponseSlopeBefore, maxPeakResponseSlopeAfter]
|
||||
'significantDecrease']
|
||||
WINDOWS:
|
||||
COMPUTE: True
|
||||
WINDOW_LENGTH: 60 # specify window length in seconds
|
||||
|
|
|
@ -30,11 +30,13 @@ def extract_eda_features_from_intraday_data(eda_intraday_data, features, window_
|
|||
if window_length is None:
|
||||
eda_intraday_features = \
|
||||
eda_intraday_data.groupby('local_segment').apply(\
|
||||
lambda x: extractGsrFeatures2D(convert_to2d(x['electrodermal_activity'], x.shape[0]), sampleRate=sample_rate, featureNames=features))
|
||||
lambda x: extractGsrFeatures2D(convert_to2d(x['electrodermal_activity'], x.shape[0]), sampleRate=sample_rate, featureNames=features,
|
||||
threshold=.01, offset=1, riseTime=5, decayTime=15))
|
||||
else:
|
||||
eda_intraday_features = \
|
||||
eda_intraday_data.groupby('local_segment').apply(\
|
||||
lambda x: extractGsrFeatures2D(convert_to2d(x['electrodermal_activity'], window_length*sample_rate), sampleRate=sample_rate, featureNames=features))
|
||||
lambda x: extractGsrFeatures2D(convert_to2d(x['electrodermal_activity'], window_length*sample_rate), sampleRate=sample_rate, featureNames=features,
|
||||
threshold=.01, offset=1, riseTime=5, decayTime=15))
|
||||
|
||||
eda_intraday_features.reset_index(inplace=True)
|
||||
|
||||
|
|
|
@ -2,22 +2,27 @@ import pandas as pd
|
|||
import seaborn as sns
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
participant = "p02"
|
||||
|
||||
# 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/p01/empatica_electrodermal_activity_features/empatica_electrodermal_activity_python_cr_windows.csv"
|
||||
path = f"/rapids/data/interim/{participant}/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_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"
|
||||
|
||||
df = pd.read_csv(path)
|
||||
print(df)
|
||||
is_NaN = df. isnull()
|
||||
row_has_NaN = is_NaN. any(axis=1)
|
||||
is_NaN = df.isnull()
|
||||
row_has_NaN = is_NaN.any(axis=1)
|
||||
rows_with_NaN = df[row_has_NaN]
|
||||
print(rows_with_NaN.size)
|
||||
|
||||
print("All rows:", len(df.index))
|
||||
print("\nCount NaN vals:", rows_with_NaN.size)
|
||||
print("\nDf mean:")
|
||||
print(df.mean())
|
||||
|
||||
sns.heatmap(df.isna(), cbar=False)
|
||||
plt.savefig('eda_windows_p02_window_60_thresh_default.png', bbox_inches='tight')
|
||||
plt.savefig(f'eda_{participant}_windows_NaN.png', bbox_inches='tight')
|
||||
|
||||
|
|
@ -3,9 +3,11 @@ import seaborn as sns
|
|||
import matplotlib.pyplot as plt
|
||||
from itertools import compress
|
||||
|
||||
participant = "p02"
|
||||
|
||||
# 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/p01/empatica_electrodermal_activity_features/empatica_electrodermal_activity_python_cr_windows.csv"
|
||||
path = f"/rapids/data/interim/{participant}/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_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"
|
||||
|
@ -17,9 +19,6 @@ columns_num_peaks_zero = df_num_peaks_zero.columns[df_num_peaks_zero.isna().any(
|
|||
df_num_peaks_non_zero = df[df["empatica_electrodermal_activity_cr_numPeaks"] != 0]
|
||||
df_num_peaks_non_zero = df_num_peaks_non_zero[columns_num_peaks_zero]
|
||||
|
||||
print(df_num_peaks_non_zero[df_num_peaks_non_zero["empatica_electrodermal_activity_cr_maxPeakAmplitudeChangeBefore"] != 0])
|
||||
|
||||
|
||||
pd.set_option('display.max_columns', None)
|
||||
|
||||
df_q = pd.DataFrame()
|
||||
|
@ -27,7 +26,7 @@ for col in df_num_peaks_non_zero:
|
|||
df_q[col] = pd.to_numeric(pd.cut(df_num_peaks_non_zero[col], bins=[-1,0,0.000000000001,1000], labels=[-1,0,1], right=False))
|
||||
|
||||
sns.heatmap(df_q)
|
||||
plt.savefig('eda_windows_p01_window_values_non_zero_peak_distribution_0thresh.png', bbox_inches='tight')
|
||||
plt.savefig(f'eda_{participant}_window_non_zero_peak_other_vals.png', bbox_inches='tight')
|
||||
plt.close()
|
||||
|
||||
# Filter columns that do not contain 0
|
||||
|
|
Loading…
Reference in New Issue