-
Notifications
You must be signed in to change notification settings - Fork 3
/
calc_PESC_sine.py
114 lines (95 loc) · 3.6 KB
/
calc_PESC_sine.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 17 21:00:45 2017
@author: dschaffner
"""
import numpy as np
import matplotlib.pylab as plt
from loadnpyfile import loadnpyfile
from calc_PE_SC import PE, CH, PE_dist, PE_calc_only
#import Cmaxmin as cpl
from collections import Counter
from math import factorial
import os
x=np.arange(100000)
y=np.sin(0.003*x)
#y=np.random.normal(0,1,100000)
#import chaotichenonsave_davidmod as henon
#arr = henon.henonsave(1000)
#y = arr[0,:]#extrat data from function return
x=np.arange(10000)*0.003
y1=np.sin(1*x)
y2=np.sin(2*x)
y3=np.sin(3*x)
y10=np.sin(10*x)
y20=np.sin(20*x)
y100=np.sin(100*x)
ypi=np.sin(np.pi*x)
y = 10*y1+2*y2+4*y10
y = 0.1*y1+10*y3+10*y10+20*y20
y=y1+y2+y3
y1pPi=y1+ypi
#datadir = 'C:\\Users\\dschaffner\\OneDrive - brynmawr.edu\\Galatic Dynamics Data\\Codie Thesis Data\\'
#fileheader = 'qp_(m=4)_(th=30.0)_(t=1.0)_(CR=6.0)_(eps=0.4)_(x0=2.350639412)_(y0=6.62220828293)_(vx0=-243.996156434)_(vy0=40.276745914)_data'
#npy='.npy'
#datafile = loadnpyfile(datadir+fileheader+npy)
#y=datafile[:,0]
num_delays = 999
PEsy1 = np.zeros([num_delays+1])
SCsy1 = np.zeros([num_delays+1])
PEsy2 = np.zeros([num_delays+1])
SCsy2 = np.zeros([num_delays+1])
PEsy10 = np.zeros([num_delays+1])
SCsy10 = np.zeros([num_delays+1])
PEsy20 = np.zeros([num_delays+1])
SCsy20 = np.zeros([num_delays+1])
PEsy100 = np.zeros([num_delays+1])
SCsy100 = np.zeros([num_delays+1])
PEsy1pPi = np.zeros([num_delays+1])
SCsy1pPi = np.zeros([num_delays+1])
delay = 1
embed_delay = 5
nfac = factorial(embed_delay)
for loop_delay in np.arange(1,num_delays+1):
PEsy1[loop_delay],SCsy1[loop_delay] = CH(y1,5,delay=loop_delay)
#PEsy2[loop_delay],SCsy2[loop_delay] = CH(y2,5,delay=loop_delay)
#PEsy10[loop_delay],SCsy10[loop_delay] = CH(y10,5,delay=loop_delay)
#PEsy20[loop_delay],SCsy20[loop_delay] = CH(y20,5,delay=loop_delay)
#PEsy100[loop_delay],SCsy100[loop_delay] = CH(y100,5,delay=loop_delay)
PEsy1pPi[loop_delay],SCsy1pPi[loop_delay] = CH(y1pPi,5,delay=loop_delay)
print ('On Delay ',loop_delay)
#datadir = 'C:\\Users\\dschaffner\\OneDrive - brynmawr.edu\\Galatic Dynamics Data\\'
#filename='PE_SC_sinewave_'+str(num_delays)+'_delays.npz'
#np.savez(datadir+filename,PEs=PEs,SCs=SCs)#,delta_t=delta_t,taus=taus,delays=delays,freq=freq)
"""
fig=plt.figure(num=2,figsize=(3.5,1.5),dpi=300,facecolor='w',edgecolor='k')
left = 0.2 # the left side of the subplots of the figure
right = 0.94 # the right side of the subplots of the figure
bottom = 0.2 # the bottom of the subplots of the figure
top = 0.96 # the top of the subplots of the figure
wspace = 0.2 # the amount of width reserved for blank space between subplots
hspace = 0.1 # the amount of height reserved for white space between subplots
plt.subplots_adjust(left=left, bottom=bottom, right=right, top=top, wspace=wspace, hspace=hspace)
ax1=plt.subplot(1,1,1)
plt.plot(x/10.,y,color='black')
#plt.vlines(81,0,1,color='red',linestyle='dotted',linewidth=0.5)
plt.xticks(fontsize=9)
plt.yticks(fontsize=9)
plt.xlabel(r't[s]',fontsize=9)
#ax1.set_xticklabels([])
#plt.ylabel('Permutation Entropy',fontsize=9)
plt.xlim(1,10)
#plt.ylim(0,0.5)
#plt.grid(b=True,which='both',axis='x',linestyle='dotted',linewidth=0.05)
#plt.legend(loc='lower right',fontsize=5,frameon=False,handlelength=5)
maxx,maxy,minx,miny=Cmaxmin(1000,5)
plt.figure(10)
plt.plot(maxx,maxy)
plt.plot(minx,miny)
plt.plot(PEs[1:],SCs[1:])
plt.figure(20)
plt.plot(x,y)
savefilename='C:\\Users\\dschaffner\\OneDrive - brynmawr.edu\\DSCOVR Data\\henontimeseries.png'
#savefile = os.path.normpath(datadir+savefilename)
#plt.savefig(savefilename,dpi=300,facecolor='w',edgecolor='k')
"""