Exemplo n.º 1
0
def extractFeaturesWavelet(data, scales=[2, 4, 8, 16, 32], Class=0):
    features = []
    nObs, nSamp, nCols = data.shape
    oClass = np.ones((nObs, 1)) * Class
    for i in range(nObs):
        scalo_features = np.array([])
        for c in range(nCols):
            scalo, scales = scalogram.scalogramCWT(data[i, :, c], scales)
            scalo_features = np.append(scalo_features, scalo)

        features.append(scalo_features)

    return (np.array(features), oClass)
Exemplo n.º 2
0
def extract_features_wavelet(data, empty_windows, scales=[2, 4, 8, 16, 32]):
    features = []
    n_obs_windows, n_samples, n_cols = data.shape

    for i in range(n_obs_windows):
        if i in empty_windows:
            continue
        scalogram_features = np.array([])
        for c in range(n_cols):
            scalo, fscales = scalogram.scalogramCWT(data[i, :, c], scales)
            scalogram_features = np.append(scalogram_features, scalo)

        features.append(scalogram_features)

    return np.array(features)
Exemplo n.º 3
0
waitforEnter()

# -13- #
import scalogram

for a in range(0, 40, 1):
    plt.clf()
    plt.figure(50)

    x = data1[:, a]
    scales = np.arange(1, 50)
    plt.ion()
    cwt = scalogram.CWTfft(x, scales)
    plt.imshow(abs(cwt), cmap=plt.cm.Blues, aspect='auto')
    plt.show()
    plt.savefig("../imagens/scalogram/scalogramfft" + str(a) + ".png")
    plt.clf()

    plt.figure(51)

    S, scales = scalogram.scalogramCWT(x, scales)
    plt.plot(scales, S)
    plt.show()
    plt.savefig("../imagens/scalogram/scalogramCWT" + str(a) + ".png")

waitforEnter()

# End
waitforEnter()
Exemplo n.º 4
0
f, psd = signal.periodogram(x)
plt.plot(1 / f[:50], psd[:50])
plt.show()

# -13- #
import scalogram

x = data1[:, 2]
scales = np.arange(1, 50)
plt.ion()
plt.figure(11)
cwt = scalogram.CWTfft(x, scales)
plt.imshow(abs(cwt), cmap=plt.cm.Blues, aspect='auto')
plt.show()
plt.figure(12)
S, scales = scalogram.scalogramCWT(x, scales)
plt.plot(scales, S)
plt.show()

# -14- #
# features
M1 = np.mean(data1, axis=0)
Md1 = np.median(data1, axis=0)
V1 = np.var(data1, axis=0)
S1 = stats.skew(data1)
K1 = stats.kurtosis(data1)
p = [25, 50, 75, 90, 95]
Pr1 = np.array(np.percentile(data1, p, axis=0)).T
M2 = np.mean(data2, axis=0)
Md2 = np.median(data2, axis=0)
V2 = np.var(data2, axis=0)