Beispiel #1
0
import glob
from Conf.Settings import FS_ECG, FS_GSR, FS_RESP, DATASET_PATH
from ECG.ECGFeatures import ECGFeatures
from GSR.GSRFeatures import PPGFeatures, EDAFeatures
from Resp.RespFeatures import RespFeatures
import pandas as pd

data_path = "D:\\usr\\pras\\data\\YAMAHA\\Yamaha-Experiment (2020-10-26 - 2020-11-06)\\data\\*"
ecg_file = "\\ECG\\"
gsr_file = "\\GSR\\"
resp_file = "\\Resp\\"

ecg_features = ECGFeatures(fs=FS_ECG)
ppg_features = PPGFeatures(fs=FS_GSR)
eda_features = EDAFeatures(fs=FS_GSR)
resp_features = RespFeatures(fs=FS_RESP)

for folder in glob.glob(DATASET_PATH + "*"):
    for subject in glob.glob(folder + "\\*-2020-*"):
        print(subject)
        try:
            # filter ecg iPhone
            # ecg = pd.read_csv(glob.glob(subject+ecg_file+"*.csv")[0])
            # ecg_filtered = ecg_features.filterECG(ecg["ecg"].values)
            # ecg["ecg"] = ecg_filtered
            # ecg.to_csv(subject+ecg_file+"filtered_ecg.csv", index=False)
            #
            # # filter PPG and EDA
            # gsr = pd.read_csv(glob.glob(subject + gsr_file + "*.csv")[0],  header=[0,1])
            # time = gsr.iloc[:, 0].values
            # eda = gsr.iloc[:, 5].values
Beispiel #2
0
path = "D:\\usr\\pras\\data\\EmotionTestVR\\Komiya\\"
path_results = path + "results\\GSR\\"
experiment_results = pd.read_csv(path +
                                 "Komiya_M_2020_7_9_15_22_44_gameResults.csv")
gsr_data = pd.read_csv(path + "Komiya_GSR.csv", header=[0, 1])
gsr_data["GSR_Timestamp_Unix_CAL"] = gsr_data["GSR_Timestamp_Unix_CAL"].apply(
    utcToTimeStamp, axis=1)
experiment_results["Time_Start"] = experiment_results["Time_Start"].apply(
    timeToInt)
experiment_results["Time_End"] = experiment_results["Time_End"].apply(
    timeToInt)

format = '%H:%M:%S'
split_time = 45

eda_features_exct = EDAFeatures(FS_GSR)
ppg_features_exct = PPGFeatures(FS_GSR)
min_len = FS_GSR * (split_time + 1)

gsr_features = pd.DataFrame(
    columns=["Idx", "Start", "End", "Valence", "Arousal", "Emotion", "Status"])
idx = 0
for i in range(len(experiment_results)):
    tdelta = experiment_results.iloc[i]["Time_End"] - experiment_results.iloc[
        i]["Time_Start"]
    time_end = experiment_results.iloc[i]["Time_End"]
    valence = experiment_results.iloc[i]["Valence"]
    arousal = experiment_results.iloc[i]["Arousal"]
    emotion = experiment_results.iloc[i]["Emotion"]

    for j in np.arange(0, (tdelta // split_time), 0.4):
from GSR.GSRFeatures import PPGFeatures, EDAFeatures
from Conf import Settings as set
import pandas as pd

data = pd.read_csv("..\\Data\\Dummy\\GSR_sample.csv", header=[0, 1])

#PPG
ppg = data["GSR_PPG_A13_CAL"].iloc[0:900].values

ppgExtract = PPGFeatures(set.FS_GSR)

print(ppgExtract.extractTimeDomain(ppg.flatten()))

print(ppgExtract.extractFrequencyDomain(ppg.flatten()))

print(ppgExtract.extractNonLinear(ppg.flatten()))

#EDA
eda = data["GSR_GSR_Skin_Conductance_CAL"].iloc[0:900].values

edaExtract = EDAFeatures(set.FS_GSR)

print(edaExtract.extractMFCCFeatures(ppg.flatten()))

print(edaExtract.extractSCRFeatures(ppg.flatten()))