Esempio n. 1
0
        # extract eda features
        #scr_features = eda_features_exct.extractSCRFeatures(eda)

        #extract cvx of eda and time domain of ppg to check whether the inputs are not disorted
        cvx_features = eda_features_exct.extractCVXEDA(eda)
        ppg_time = ppg_features_exct.extractTimeDomain(ppg)
        if (cvx_features.shape[0] != 0) & (ppg_time.shape[0] != 0):
            eda_features = np.concatenate([
                cvx_features,
                eda_features_exct.extractMFCCFeatures(eda, min_len=min_len)
            ])

            # extract PPG features
            ppg_features = np.concatenate([
                ppg_time,
                ppg_features_exct.extractFrequencyDomain(ppg),
                ppg_features_exct.extractNonLinear(ppg)
            ])

            if (np.sum(np.isinf(ppg_features)) ==
                    0 | np.sum(np.isnan(ppg_features)) == 0):
                # print(eda_features.shape)
                # save features
                np.save(path_results + "eda_" + str(idx) + ".npy",
                        eda_features)
                np.save(path_results + "ppg_" + str(idx) + ".npy",
                        ppg_features)
                status = 1
            else:
                status = 0
        else:
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()))