-
Notifications
You must be signed in to change notification settings - Fork 0
/
exp_data.py
89 lines (65 loc) · 2.62 KB
/
exp_data.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
from pylab import *
from scipy import *
import copy, os
import txt_data_processing, rwkbode, pylab_util, rwkos
import pylab_util as PU
#from systemid import Model, PolyHasher
case = 2
if case == 1:
data_dir = rwkos.FindFullPath('siue/Research/modeling/SLFR/data/July_07_2009')
data_mod_name = 'swept_sine_amp_75_July_07_2009_avebodes'
elif case == 2:
relpath = 'siue/Research/SFLR_2010/data/swept_sine/August_2010/after_beam_reattachment'
data_dir = rwkos.FindFullPath(relpath)
data_mod_name = 'swept_sine_kp_1_after_beam_reattachment_amp_75_maxf_20_duration_40000_avebodes'
data_mod_path = os.path.join(data_dir, data_mod_name)
if data_dir not in sys.path:
sys.path.append(data_dir)
#data_mod_name = 'swept_sine_amp_75_July_07_2009_log_downsampled'
#bode_data_set = txt_data_processing.load_avebode_data_set(data_mod_name)
bode_data_set = txt_data_processing.load_avebode_data_set(data_mod_path)
#bode_data_set.Bode_Plot2(func=rwkbode.GenBodePlot, linetype='o')
exp_bodes = bode_data_set.avebodes#[0:2]
th_v_exp = bode_data_set.find_bode('theta','v')
a_v_exp = bode_data_set.find_bode('a','v')
f = bode_data_set.f
a_theta_exp = bode_data_set.find_bode('a','theta')
l1 = log10(0.5)
l2 = log10(50)
flist = arange(0.5, 1, 0.5).tolist()+f.tolist()+arange(26,30, 0.5).tolist()
f2 = array(flist)
def plot_exp(startfi=1, lt='o'):
kwargs = {'clear':True, 'linetype':lt}
rwkbode.GenBodePlot(startfi, f, th_v_exp, **kwargs)
rwkbode.GenBodePlot(startfi+1, f, a_v_exp, **kwargs)
rwkbode.GenBodePlot(startfi+2, f, a_theta_exp, **kwargs)
return startfi+3
freqlim = [0.5, 30.0]
maglims = [(-40,15),(-20,10),(-20,45)]
phaselims = [(-220,0),(-400,120),(-200,220)]
NF = 3
figdir = 'figs'
def _set_lims(startfi=1, maglims=maglims, phaselims=phaselims):
fis = range(startfi, startfi+NF)
for fi, maglim, phaselim in zip(fis, maglims, phaselims):
PU.SetFreqLim(fi, freqlim)
PU.SetMagLim(fi, maglim)
PU.SetPhaseLim(fi, phaselim)
def _save_figs(filenames, startfi=1, del_eps=True):
fis = range(startfi, startfi+NF)
for fi, fname in zip(fis, filenames):
epsname = fname+'.eps'
outpath = os.path.join(figdir, epsname)
PU.mysave(outpath, fi=fi)
if del_eps:
os.remove(outpath)#delete eps but leave pdf
def set_legends(startfi, leg_list, locs):
fis = range(startfi, startfi+NF)
for fi, loc in zip(fis, locs):
PU.SetLegend(fi, leg_list, loc=loc)
if __name__ == '__main__':
plot_exp(lt='-')
olfilenames = ['th_v_ol_bode','a_v_ol_bode','a_th_ol_bode']
_set_lims(1)
_save_figs(olfilenames, 1)
show()