##// END OF EJS Templates
El metodo getTimeLim se ha generalizado y se coloco en a clase base Figure
Miguel Valdez -
r230:ac995a7d4bc5
parent child
Show More
@@ -50,7 +50,35 class Figure:
50 heightscreen = heightplot*nrow
50 heightscreen = heightplot*nrow
51
51
52 return widthscreen, heightscreen
52 return widthscreen, heightscreen
53
54 def getTimeLim(self, x, xmin, xmax):
55
56 thisdatetime = datetime.datetime.fromtimestamp(numpy.min(x))
57 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
58
59 ####################################################
60 #If the x is out of xrange
61 if xmax < (thisdatetime - thisdate).seconds/(60*60.):
62 xmin = None
63 xmax = None
64
65 if xmin == None:
66 td = thisdatetime - thisdate
67 xmin = td.seconds/(60*60.)
68
69 if xmax == None:
70 xmax = xmin + self.__timerange/(60*60.)
53
71
72 mindt = thisdate + datetime.timedelta(0,0,0,0,0, xmin)
73 tmin = time.mktime(mindt.timetuple())
74
75 maxdt = thisdate + datetime.timedelta(0,0,0,0,0, xmax)
76 tmax = time.mktime(maxdt.timetuple())
77
78 self.__timerange = tmax - tmin
79
80 return tmin, tmax
81
54 def init(self, idfigure, nplots, wintitle):
82 def init(self, idfigure, nplots, wintitle):
55
83
56 raise ValueError, "This method has been replaced with createFigure"
84 raise ValueError, "This method has been replaced with createFigure"
@@ -227,34 +227,6 class RTIPlot(Figure):
227
227
228 counter += 1
228 counter += 1
229
229
230 def __getTimeLim(self, x, xmin, xmax):
231
232 thisdatetime = datetime.datetime.fromtimestamp(numpy.min(x))
233 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
234
235 ####################################################
236 #If the x is out of xrange
237 if xmax < (thisdatetime - thisdate).seconds/(60*60.):
238 xmin = None
239 xmax = None
240
241 if xmin == None:
242 td = thisdatetime - thisdate
243 xmin = td.seconds/(60*60.)
244
245 if xmax == None:
246 xmax = xmin + self.__timerange/(60*60.)
247
248 mindt = thisdate + datetime.timedelta(0,0,0,0,0, xmin)
249 tmin = time.mktime(mindt.timetuple())
250
251 maxdt = thisdate + datetime.timedelta(0,0,0,0,0, xmax)
252 tmax = time.mktime(maxdt.timetuple())
253
254 self.__timerange = tmax - tmin
255
256 return tmin, tmax
257
258 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
230 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
259 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
231 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
260 timerange=None,
232 timerange=None,
@@ -306,7 +278,7 class RTIPlot(Figure):
306 wintitle=wintitle,
278 wintitle=wintitle,
307 showprofile=showprofile)
279 showprofile=showprofile)
308
280
309 tmin, tmax = self.__getTimeLim(x, xmin, xmax)
281 tmin, tmax = self.getTimeLim(x, xmin, xmax)
310 if ymin == None: ymin = numpy.nanmin(y)
282 if ymin == None: ymin = numpy.nanmin(y)
311 if ymax == None: ymax = numpy.nanmax(y)
283 if ymax == None: ymax = numpy.nanmax(y)
312 if zmin == None: zmin = numpy.nanmin(avg)*0.9
284 if zmin == None: zmin = numpy.nanmin(avg)*0.9
@@ -741,34 +713,6 class CoherencePlot(Figure):
741
713
742 if showprofile:
714 if showprofile:
743 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
715 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
744
745 def __getTimeLim(self, x, xmin, xmax):
746
747 thisdatetime = datetime.datetime.fromtimestamp(numpy.min(x))
748 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
749
750 ####################################################
751 #If the x is out of xrange
752 if xmax < (thisdatetime - thisdate).seconds/(60*60.):
753 xmin = None
754 xmax = None
755
756 if xmin == None:
757 td = thisdatetime - thisdate
758 xmin = td.seconds/(60*60.)
759
760 if xmax == None:
761 xmax = xmin + self.__timerange/(60*60.)
762
763 mindt = thisdate + datetime.timedelta(0,0,0,0,0, xmin)
764 tmin = time.mktime(mindt.timetuple())
765
766 maxdt = thisdate + datetime.timedelta(0,0,0,0,0, xmax)
767 tmax = time.mktime(maxdt.timetuple())
768
769 self.__timerange = tmax - tmin
770
771 return tmin, tmax
772
716
773 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
717 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
774 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
718 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
@@ -799,7 +743,7 class CoherencePlot(Figure):
799 wintitle=wintitle,
743 wintitle=wintitle,
800 showprofile=showprofile)
744 showprofile=showprofile)
801
745
802 tmin, tmax = self.__getTimeLim(x, xmin, xmax)
746 tmin, tmax = self.getTimeLim(x, xmin, xmax)
803 if ymin == None: ymin = numpy.nanmin(y)
747 if ymin == None: ymin = numpy.nanmin(y)
804 if ymax == None: ymax = numpy.nanmax(y)
748 if ymax == None: ymax = numpy.nanmax(y)
805
749
General Comments 0
You need to be logged in to leave comments. Login now