@@ -6,6 +6,7 import numpy | |||||
6 | import datetime |
|
6 | import datetime | |
7 | import numpy as np |
|
7 | import numpy as np | |
8 | import matplotlib |
|
8 | import matplotlib | |
|
9 | import glob | |||
9 | matplotlib.use('TkAgg') |
|
10 | matplotlib.use('TkAgg') | |
10 | import matplotlib.pyplot as plt |
|
11 | import matplotlib.pyplot as plt | |
11 | from mpl_toolkits.axes_grid1 import make_axes_locatable |
|
12 | from mpl_toolkits.axes_grid1 import make_axes_locatable | |
@@ -99,6 +100,28 class PlotData(Operation, Process): | |||||
99 |
|
100 | |||
100 | return x, y, z |
|
101 | return x, y, z | |
101 |
|
102 | |||
|
103 | ''' | |||
|
104 | JM: | |||
|
105 | elimana las otras imagenes generadas debido a que lso workers no llegan en orden y le pueden | |||
|
106 | poner otro tiempo a la figura q no necesariamente es el ultimo. | |||
|
107 | Solo se realiza cuando termina la imagen. | |||
|
108 | Problemas: | |||
|
109 | -Aun no encuentro. | |||
|
110 | ''' | |||
|
111 | def deleteanotherfiles(self): | |||
|
112 | figurenames=[] | |||
|
113 | for n, eachfigure in enumerate(self.figurelist): | |||
|
114 | #add specific name for each channel in channelList | |||
|
115 | ghostfigname = os.path.join(self.save, '{}_{}_{}'.format(self.titles[n].replace(' ',''),self.CODE, | |||
|
116 | datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d'))) | |||
|
117 | figname = os.path.join(self.save, '{}_{}_{}.png'.format(self.titles[n].replace(' ',''),self.CODE, | |||
|
118 | datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S'))) | |||
|
119 | ||||
|
120 | for ghostfigure in glob.glob(ghostfigname+'*'): #ghostfigure will adopt all posible names of figures | |||
|
121 | if ghostfigure != figname: | |||
|
122 | os.remove(ghostfigure) | |||
|
123 | print 'Removing GhostFigures:' , figname | |||
|
124 | ||||
102 | def __plot(self): |
|
125 | def __plot(self): | |
103 |
|
126 | |||
104 | print 'plotting...{}'.format(self.CODE) |
|
127 | print 'plotting...{}'.format(self.CODE) | |
@@ -113,8 +136,11 class PlotData(Operation, Process): | |||||
113 | for n, eachfigure in enumerate(self.figurelist): |
|
136 | for n, eachfigure in enumerate(self.figurelist): | |
114 | if self.show: |
|
137 | if self.show: | |
115 | eachfigure.show() |
|
138 | eachfigure.show() | |
|
139 | ||||
116 | self.plot() # ok? como elijo que figura? |
|
140 | self.plot() # ok? como elijo que figura? | |
117 | plt.tight_layout() |
|
141 | #eachfigure.subplots_adjust(left=0.2) | |
|
142 | #eachfigure.subplots_adjuccst(right=0.2) | |||
|
143 | eachfigure.tight_layout() # ajuste de cada subplot | |||
118 | eachfigure.canvas.manager.set_window_title('{} {} - {}'.format(self.title[n], self.CODE.upper(), |
|
144 | eachfigure.canvas.manager.set_window_title('{} {} - {}'.format(self.title[n], self.CODE.upper(), | |
119 | datetime.datetime.fromtimestamp(self.max_time).strftime('%Y/%m/%d'))) |
|
145 | datetime.datetime.fromtimestamp(self.max_time).strftime('%Y/%m/%d'))) | |
120 |
|
146 | |||
@@ -148,7 +174,7 class PlotData(Operation, Process): | |||||
148 | else : |
|
174 | else : | |
149 | for n, eachfigure in enumerate(self.figurelist): |
|
175 | for n, eachfigure in enumerate(self.figurelist): | |
150 | #add specific name for each channel in channelList |
|
176 | #add specific name for each channel in channelList | |
151 | figname = os.path.join(self.save, '{}_{}_{}.png'.format(self.titles[n],self.CODE, |
|
177 | figname = os.path.join(self.save, '{}_{}_{}.png'.format(self.titles[n].replace(' ',''),self.CODE, | |
152 | datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S'))) |
|
178 | datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S'))) | |
153 |
|
179 | |||
154 | print 'Saving figure: {}'.format(figname) |
|
180 | print 'Saving figure: {}'.format(figname) | |
@@ -202,6 +228,7 class PlotData(Operation, Process): | |||||
202 | self.ended = True |
|
228 | self.ended = True | |
203 | self.isConfig = False |
|
229 | self.isConfig = False | |
204 | self.__plot() |
|
230 | self.__plot() | |
|
231 | self.deleteanotherfiles() #CLPDG | |||
205 | elif seconds_passed >= self.data['throttle']: |
|
232 | elif seconds_passed >= self.data['throttle']: | |
206 | print 'passed', seconds_passed |
|
233 | print 'passed', seconds_passed | |
207 | self.__plot() |
|
234 | self.__plot() |
@@ -1,1 +1,1 | |||||
1 |
<Project description="HF_EXAMPLE" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/media/ci-81/Huancayo/DATA/hfradar_2016/pdata/sp1_f1" /><Parameter format="date" id="191113" name="startDate" value="2016/04/2 |
|
1 | <Project description="HF_EXAMPLE" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/media/ci-81/Huancayo/DATA/hfradar_2016/pdata/sp1_f1" /><Parameter format="date" id="191113" name="startDate" value="2016/04/24" /><Parameter format="date" id="191114" name="endDate" value="2016/04/24" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="cursor" value="8" /><Parameter format="int" id="191119" name="skip" value="18" /><Parameter format="int" id="191120" name="delay" value="10" /><Parameter format="int" id="191121" name="walk" value="1" /><Parameter format="int" id="191122" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="ParametersProc" id="1913" inputId="1911" name="ParametersProc"><Operation id="19131" name="run" priority="1" type="self" /><Operation id="19132" name="SpectralMoments" priority="2" type="other" /><Operation id="19133" name="PublishData" priority="3" type="other"><Parameter format="int" id="191331" name="zeromq" value="1" /></Operation></ProcUnit><ProcUnit datatype="Spectra" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="removeInterference" priority="2" type="self" /></ProcUnit></Project> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now