Testing files change and remove standardization from hrv sensors main files.
parent
a5480f1369
commit
2d5d23b615
|
@ -66,14 +66,8 @@ 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"].get("STANDARDIZE_FEATURES", False):
|
|
||||||
fo_columns = bvp_intraday_features.columns.values[2:]
|
|
||||||
fo_columns_z_score = [col + "_zscore" for col in fo_columns]
|
|
||||||
bvp_intraday_features[fo_columns_z_score] = StandardScaler().fit_transform(bvp_intraday_features[fo_columns])
|
|
||||||
|
|
||||||
so_features_names = provider["WINDOWS"]["SECOND_ORDER_FEATURES"]
|
so_features_names = provider["WINDOWS"]["SECOND_ORDER_FEATURES"]
|
||||||
bvp_second_order_features = extract_second_order_features(bvp_intraday_features, so_features_names)
|
bvp_second_order_features = extract_second_order_features(bvp_intraday_features, so_features_names)
|
||||||
|
|
||||||
return bvp_intraday_features, bvp_second_order_features
|
return bvp_intraday_features, bvp_second_order_features
|
||||||
|
|
||||||
return bvp_intraday_features
|
return bvp_intraday_features
|
|
@ -71,11 +71,6 @@ 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"].get("STANDARDIZE_FEATURES", False):
|
|
||||||
fo_columns = ibi_intraday_features.columns.values[2:]
|
|
||||||
fo_columns_z_score = [col + "_zscore" for col in fo_columns]
|
|
||||||
ibi_intraday_features[fo_columns_z_score] = StandardScaler().fit_transform(ibi_intraday_features[fo_columns])
|
|
||||||
|
|
||||||
so_features_names = provider["WINDOWS"]["SECOND_ORDER_FEATURES"]
|
so_features_names = provider["WINDOWS"]["SECOND_ORDER_FEATURES"]
|
||||||
ibi_second_order_features = extract_second_order_features(ibi_intraday_features, so_features_names)
|
ibi_second_order_features = extract_second_order_features(ibi_intraday_features, so_features_names)
|
||||||
|
|
||||||
|
|
|
@ -2,27 +2,38 @@ import pandas as pd
|
||||||
import seaborn as sns
|
import seaborn as sns
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
participant = "p02"
|
participant = "p02"
|
||||||
|
all_sensors = ["ibi", "bvp"]#["eda", "bvp", "ibi", "temp", "acc"]
|
||||||
|
|
||||||
# path = "/rapids/data/processed/features/all_participants/all_sensor_features.csv" # all features all participants
|
for sensor in all_sensors:
|
||||||
# path = "/rapids/data/interim/p03/empatica_accelerometer_features/empatica_accelerometer_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)
|
if sensor == "eda":
|
||||||
print(df)
|
path = f"/rapids/data/interim/{participant}/empatica_electrodermal_activity_features/empatica_electrodermal_activity_python_cr_windows.csv"
|
||||||
is_NaN = df.isnull()
|
elif sensor == "bvp":
|
||||||
row_has_NaN = is_NaN.any(axis=1)
|
path = f"/rapids/data/interim/{participant}/empatica_blood_volume_pulse_features/empatica_blood_volume_pulse_python_cr_windows.csv"
|
||||||
rows_with_NaN = df[row_has_NaN]
|
elif sensor == "ibi":
|
||||||
|
path = f"/rapids/data/interim/{participant}/empatica_inter_beat_interval_features/empatica_inter_beat_interval_python_cr_windows.csv"
|
||||||
print("All rows:", len(df.index))
|
elif sensor == "acc":
|
||||||
print("\nCount NaN vals:", rows_with_NaN.size)
|
path = f"/rapids/data/interim/{participant}/empatica_accelerometer_features/empatica_accelerometer_python_cr_windows.csv"
|
||||||
print("\nDf mean:")
|
elif sensor == "temp":
|
||||||
print(df.mean())
|
path = f"/rapids/data/interim/{participant}/empatica_temperature_features/empatica_temperature_python_cr_windows.csv"
|
||||||
|
else:
|
||||||
sns.heatmap(df.isna(), cbar=False)
|
path = "/rapids/data/processed/features/all_participants/all_sensor_features.csv" # all features all participants
|
||||||
plt.savefig(f'eda_{participant}_windows_NaN.png', bbox_inches='tight')
|
|
||||||
|
|
||||||
|
df = pd.read_csv(path)
|
||||||
|
print(df)
|
||||||
|
is_NaN = df.isnull()
|
||||||
|
row_has_NaN = is_NaN.any(axis=1)
|
||||||
|
rows_with_NaN = df[row_has_NaN]
|
||||||
|
|
||||||
|
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(f'{sensor}_{participant}_windows_NaN.png', bbox_inches='tight')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,23 @@ import seaborn as sns
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from itertools import compress
|
from itertools import compress
|
||||||
|
|
||||||
participant = "p02"
|
|
||||||
|
|
||||||
# path = "/rapids/data/processed/features/all_participants/all_sensor_features.csv" # all features all participants
|
participant = "p031"
|
||||||
# path = "/rapids/data/interim/p03/empatica_accelerometer_features/empatica_accelerometer_python_cr_windows.csv"
|
sensor = "eda"
|
||||||
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"
|
if sensor == "eda":
|
||||||
# path = "/rapids/data/interim/p02/empatica_blood_volume_pulse_features/empatica_blood_volume_pulse_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_temperature_features/empatica_temperature_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"
|
||||||
|
|
||||||
|
|
||||||
df = pd.read_csv(path)
|
df = pd.read_csv(path)
|
||||||
df_num_peaks_zero = df[df["empatica_electrodermal_activity_cr_numPeaks"] == 0]
|
df_num_peaks_zero = df[df["empatica_electrodermal_activity_cr_numPeaks"] == 0]
|
||||||
|
|
Loading…
Reference in New Issue