2022-06-10 14:34:48 +02:00
|
|
|
import pandas as pd
|
|
|
|
import seaborn as sns
|
|
|
|
import matplotlib.pyplot as plt
|
2022-06-14 17:09:14 +02:00
|
|
|
from itertools import compress
|
2022-06-10 14:34:48 +02:00
|
|
|
|
2022-07-06 09:35:39 +02:00
|
|
|
|
|
|
|
participant = "p031"
|
|
|
|
sensor = "eda"
|
|
|
|
|
|
|
|
if sensor == "eda":
|
|
|
|
path = f"/rapids/data/interim/{participant}/empatica_electrodermal_activity_features/empatica_electrodermal_activity_python_cr_windows.csv"
|
|
|
|
elif sensor == "bvp":
|
|
|
|
path = f"/rapids/data/interim/{participant}/empatica_blood_volume_pulse_features/empatica_blood_volume_pulse_python_cr_windows.csv"
|
|
|
|
elif sensor == "ibi":
|
|
|
|
path = f"/rapids/data/interim/{participant}/empatica_inter_beat_interval_features/empatica_inter_beat_interval_python_cr_windows.csv"
|
|
|
|
elif sensor == "acc":
|
|
|
|
path = f"/rapids/data/interim/{participant}/empatica_accelerometer_features/empatica_accelerometer_python_cr_windows.csv"
|
|
|
|
elif sensor == "temp":
|
|
|
|
path = f"/rapids/data/interim/{participant}/empatica_temperature_features/empatica_temperature_python_cr_windows.csv"
|
|
|
|
else:
|
|
|
|
path = "/rapids/data/processed/features/all_participants/all_sensor_features.csv" # all features all participants"
|
|
|
|
|
2022-06-10 14:34:48 +02:00
|
|
|
|
|
|
|
df = pd.read_csv(path)
|
2022-06-14 17:09:14 +02:00
|
|
|
df_num_peaks_zero = df[df["empatica_electrodermal_activity_cr_numPeaks"] == 0]
|
|
|
|
columns_num_peaks_zero = df_num_peaks_zero.columns[df_num_peaks_zero.isna().any()].tolist()
|
|
|
|
|
2022-06-15 15:57:46 +02:00
|
|
|
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]
|
|
|
|
|
2022-06-14 17:09:14 +02:00
|
|
|
pd.set_option('display.max_columns', None)
|
2022-06-15 15:57:46 +02:00
|
|
|
|
2022-06-14 17:09:14 +02:00
|
|
|
df_q = pd.DataFrame()
|
|
|
|
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)
|
2022-06-30 17:15:37 +02:00
|
|
|
plt.savefig(f'eda_{participant}_window_non_zero_peak_other_vals.png', bbox_inches='tight')
|
2022-06-14 17:09:14 +02:00
|
|
|
plt.close()
|
|
|
|
|
|
|
|
# Filter columns that do not contain 0
|
|
|
|
non_zero_cols = list(compress(columns_num_peaks_zero, df_num_peaks_non_zero.all().tolist()))
|
|
|
|
zero_cols = list(set(columns_num_peaks_zero) - set(non_zero_cols))
|
|
|
|
|
|
|
|
print(non_zero_cols, "\n")
|
|
|
|
print(zero_cols)
|
|
|
|
|
2022-06-10 14:34:48 +02:00
|
|
|
|