@@ -11,89 +11,6 from matplotlib.dates import DayLocator, HourLocator, MinuteLocator, SecondLocat | |||
|
11 | 11 | from matplotlib.ticker import FuncFormatter |
|
12 | 12 | from matplotlib.ticker import * |
|
13 | 13 | |
|
14 | #def init(idfigure, wintitle, width, height, facecolor="w"): | |
|
15 | # | |
|
16 | # matplotlib.pyplot.ioff() | |
|
17 | # fig = matplotlib.pyplot.matplotlib.pyplot.figure(num=idfigure, facecolor=facecolor) | |
|
18 | # fig.canvas.manager.set_window_title(wintitle) | |
|
19 | # fig.canvas.manager.resize(width, height) | |
|
20 | # matplotlib.pyplot.ion() | |
|
21 | # | |
|
22 | # return fig | |
|
23 | # | |
|
24 | #def setWinTitle(fig, title): | |
|
25 | # | |
|
26 | # fig.canvas.manager.set_window_title(title) | |
|
27 | # | |
|
28 | #def setTitle(idfigure, title): | |
|
29 | # fig = matplotlib.pyplot.figure(idfigure) | |
|
30 | # fig.suptitle(title) | |
|
31 | # | |
|
32 | #def makeAxes(idfigure, nrow, ncol, xpos, ypos, colspan, rowspan): | |
|
33 | # fig = matplotlib.pyplot.figure(idfigure) | |
|
34 | # ax = matplotlib.pyplot.subplot2grid((nrow, ncol), (xpos, ypos), colspan=colspan, rowspan=rowspan) | |
|
35 | # return ax | |
|
36 | # | |
|
37 | #def setTextFromAxes(idfigure, ax, title): | |
|
38 | # fig = matplotlib.pyplot.figure(idfigure) | |
|
39 | # ax.annotate(title, xy=(.1, .99), | |
|
40 | # xycoords='figure fraction', | |
|
41 | # horizontalalignment='left', verticalalignment='top', | |
|
42 | # fontsize=10) | |
|
43 | # | |
|
44 | #def pline(ax, x, y, xmin, xmax, ymin, ymax, xlabel, ylabel, title, firsttime): | |
|
45 | # | |
|
46 | # if firsttime: | |
|
47 | # ax.plot(x, y) | |
|
48 | # ax.set_xlim([xmin,xmax]) | |
|
49 | # ax.set_ylim([ymin,ymax]) | |
|
50 | # ax.set_xlabel(xlabel, size=8) | |
|
51 | # ax.set_ylabel(ylabel, size=8) | |
|
52 | # ax.set_title(title, size=10) | |
|
53 | # matplotlib.pyplot.tight_layout() | |
|
54 | # else: | |
|
55 | # ax.lines[0].set_data(x,y) | |
|
56 | # | |
|
57 | #def draw(idfigure): | |
|
58 | # | |
|
59 | # fig = matplotlib.pyplot.figure(idfigure) | |
|
60 | # fig.canvas.draw() | |
|
61 | # | |
|
62 | #def pcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax, xlabel, ylabel, title, firsttime, mesh): | |
|
63 | # | |
|
64 | # if firsttime: | |
|
65 | # divider = make_axes_locatable(ax) | |
|
66 | # ax_cb = divider.new_horizontal(size="4%", pad=0.05) | |
|
67 | # fig1 = ax.get_figure() | |
|
68 | # fig1.add_axes(ax_cb) | |
|
69 | # | |
|
70 | # ax.set_xlim([xmin,xmax]) | |
|
71 | # ax.set_ylim([ymin,ymax]) | |
|
72 | # ax.set_xlabel(xlabel) | |
|
73 | # ax.set_ylabel(ylabel) | |
|
74 | # ax.set_title(title) | |
|
75 | # print x | |
|
76 | # imesh=ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax) | |
|
77 | # matplotlib.pyplot.colorbar(imesh, cax=ax_cb) | |
|
78 | # ax_cb.yaxis.tick_right() | |
|
79 | # for tl in ax_cb.get_yticklabels(): | |
|
80 | # tl.set_visible(True) | |
|
81 | # ax_cb.yaxis.tick_right() | |
|
82 | # matplotlib.pyplot.tight_layout() | |
|
83 | # return imesh | |
|
84 | # else: | |
|
85 | ## ax.set_xlim([xmin,xmax]) | |
|
86 | ## ax.set_ylim([ymin,ymax]) | |
|
87 | # ax.set_xlabel(xlabel) | |
|
88 | # ax.set_ylabel(ylabel) | |
|
89 | # ax.set_title(title) | |
|
90 | # | |
|
91 | # z = z.T | |
|
92 | ## z = z[0:-1,0:-1] | |
|
93 | # mesh.set_array(z.ravel()) | |
|
94 | # | |
|
95 | # return mesh | |
|
96 | ||
|
97 | 14 | ########################################### |
|
98 | 15 | #Actualizacion de las funciones del driver |
|
99 | 16 | ########################################### |
@@ -101,7 +18,7 from matplotlib.ticker import * | |||
|
101 | 18 | def createFigure(idfigure, wintitle, width, height, facecolor="w"): |
|
102 | 19 | |
|
103 | 20 | matplotlib.pyplot.ioff() |
|
104 |
fig = |
|
|
21 | fig = matplotlib.pyplot.figure(num=idfigure, facecolor=facecolor) | |
|
105 | 22 | fig.canvas.manager.set_window_title(wintitle) |
|
106 | 23 | fig.canvas.manager.resize(width, height) |
|
107 | 24 | matplotlib.pyplot.ion() |
@@ -212,7 +129,7 def pline(iplot, x, y, xlabel='', ylabel='', title=''): | |||
|
212 | 129 | |
|
213 | 130 | def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax, |
|
214 | 131 | xlabel='', ylabel='', title='', ticksize = 9, |
|
215 | cblabel='', cbsize="5%", | |
|
132 | colormap='jet',cblabel='', cbsize="5%", | |
|
216 | 133 | XAxisAsTime=False): |
|
217 | 134 | |
|
218 | 135 | divider = make_axes_locatable(ax) |
@@ -225,7 +142,7 def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax, | |||
|
225 | 142 | |
|
226 | 143 | printLabels(ax, xlabel, ylabel, title) |
|
227 | 144 | |
|
228 | imesh = ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax) | |
|
145 | imesh = ax.pcolormesh(x,y,z.T, vmin=zmin, vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap)) | |
|
229 | 146 | cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb) |
|
230 | 147 | cb.set_label(cblabel) |
|
231 | 148 |
@@ -239,7 +239,7 class JROData: | |||
|
239 | 239 | |
|
240 | 240 | _lambda = self.C/self.frequency |
|
241 | 241 | |
|
242 |
vmax = self.getFmax() * _lambda |
|
|
242 | vmax = self.getFmax() * _lambda | |
|
243 | 243 | |
|
244 | 244 | return vmax |
|
245 | 245 | |
@@ -440,14 +440,14 class Spectra(JROData): | |||
|
440 | 440 | |
|
441 | 441 | def getFreqRange(self, extrapoints=0): |
|
442 | 442 | |
|
443 |
delfreq = |
|
|
444 |
freqrange = deltafreq |
|
|
443 | deltafreq = self.getFmax() / self.nFFTPoints | |
|
444 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 | |
|
445 | 445 | |
|
446 | 446 | return freqrange |
|
447 | 447 | |
|
448 | 448 | def getVelRange(self, extrapoints=0): |
|
449 | 449 | |
|
450 |
deltav = |
|
|
450 | deltav = self.getVmax() / self.nFFTPoints | |
|
451 | 451 | velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltav/2 |
|
452 | 452 | |
|
453 | 453 | return velrange |
@@ -79,10 +79,10 class CrossSpectraPlot(Figure): | |||
|
79 | 79 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
80 | 80 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
81 | 81 | |
|
82 | if pairIndexList == []: | |
|
82 | if pairsIndexList == []: | |
|
83 | 83 | return |
|
84 | 84 | |
|
85 |
x = dataOut.get |
|
|
85 | x = dataOut.getFreqRange(1) | |
|
86 | 86 | y = dataOut.getHeiRange() |
|
87 | 87 | z = 10.*numpy.log10(dataOut.data_spc[:,:,:]) |
|
88 | 88 | avg = numpy.average(numpy.abs(z), axis=1) |
@@ -141,7 +141,7 class CrossSpectraPlot(Figure): | |||
|
141 | 141 | title = "Coherence %d%d" %(pair[0], pair[1]) |
|
142 | 142 | axes0 = self.axesList[i*self.__nsubplots+2] |
|
143 | 143 | axes0.pcolor(x, y, coherence, |
|
144 |
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin= |
|
|
144 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1, | |
|
145 | 145 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
146 | 146 | ticksize=9, cblabel='') |
|
147 | 147 | |
@@ -150,7 +150,7 class CrossSpectraPlot(Figure): | |||
|
150 | 150 | axes0.pcolor(x, y, phase, |
|
151 | 151 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180, |
|
152 | 152 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
153 | ticksize=9, cblabel='') | |
|
153 | ticksize=9, cblabel='', colormap='RdBu') | |
|
154 | 154 | |
|
155 | 155 | |
|
156 | 156 |
@@ -606,7 +606,7 class SpectraProc(ProcessingUnit): | |||
|
606 | 606 | self.buffer |
|
607 | 607 | self.dataOut.flagNoData |
|
608 | 608 | """ |
|
609 | fft_volt = numpy.fft.fft(self.buffer,axis=1) | |
|
609 | fft_volt = numpy.fft.fft(self.buffer,axis=1)/numpy.sqrt(self.dataOut.nFFTPoints) | |
|
610 | 610 | dc = fft_volt[:,0,:] |
|
611 | 611 | |
|
612 | 612 | #calculo de self-spectra |
@@ -624,7 +624,7 class SpectraProc(ProcessingUnit): | |||
|
624 | 624 | #calculo de cross-spectra |
|
625 | 625 | cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex') |
|
626 | 626 | for pair in self.dataOut.pairsList: |
|
627 |
cspc[pairIndex,:,:] = |
|
|
627 | cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:]) | |
|
628 | 628 | pairIndex += 1 |
|
629 | 629 | blocksize += cspc.size |
|
630 | 630 |
General Comments 0
You need to be logged in to leave comments.
Login now