-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest2.py
97 lines (81 loc) · 2.13 KB
/
test2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 11 14:23:23 2017
@author: wilson
"""
import numpy as np
#import pandas as pd
#import matplotlib.pyplot as plt
#from subprocess import call
#import webbrowser
#import os
#import heapq
##%matplotlib inline
#
from timeDelayEmbedding import embed
from circular_valued_parameterization import circleValuedParametrization
#~~~~~~~~~~~~~~~~~~Noisy Sine~~~~~~~~~~~~~~~~~~~
#
#from generateData import sineData
#wavelength=3
#V = sineData(0, 10, 200, wavelength, std_dev=0.01)
#plt.plot(V[:,0],V[:,1])
#taumax = 140
#elen = 60
#dt = 40
#X = embed(V[:,1], taumax, elen, dt)
#
#X.astype('float64', order='C')
#np.savetxt('data.txt', X, fmt='%0.19f')
#
#circleValuedParametrization('./data.txt', 8)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~Heartbeat~~~~~~~~~~~~~~~~~~~~~~~
#
#import scipy.io.wavfile
#from sklearn import preprocessing
#
#Fs, X = scipy.io.wavfile.read("./audio/Heartbeat.wav")
#X = preprocessing.scale(X[:len(X)/2].reshape(-1,1))
##plt.plot(X)
#
#V = X[::500]
#plt.plot(np.arange(len(V)), V)
#
#dt = 13 #np.argmin(V[:int(len(V)*0.05)])
#taumax = 355 #int(dt + len(V)*0.01)
#elen = 73
#D = embed(V, taumax, elen, dt)
#D=D[0]
#
## save file for dionysus
#D.astype('float64', order='C')
#np.savetxt('data.txt', D, fmt='%0.10f')
#
#circleValuedParametrization('./data.txt', 25)
##
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
#~~~~~~~~~~~~~~~~~~~~~~Beach Waves~~~~~~~~~~~~~~~~~~~~
#
from iterateEmbed import findCircParam
import scipy.io.wavfile
from sklearn import preprocessing
Fs, X = scipy.io.wavfile.read("./audio/Beach Waves.wav")
X = preprocessing.scale(X[:len(X)/2].reshape(-1,1))
#plt.plot(X)
V = X[::1000]
plt.plot(np.arange(len(V)), V)
dt = 60 #np.argmin(V[:int(len(V)*0.05)])
#maxRips = 50
#startWind = 23
#stopWind = 100
#elen, taumax, ep = findCircParam(V[:,0],dt,maxRips,startWind,stopWind)
elen = 150
ep = 60
taumax = V.shape[0] - elen
D = embed(V[:,0], taumax, elen, dt)
D.astype('float64', order='C')
np.savetxt('data.txt', D, fmt='%0.10f')
circleValuedParametrization('./data.txt', ep)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~