@@ -50,7 +50,35 class Figure: | |||
|
50 | 50 | heightscreen = heightplot*nrow |
|
51 | 51 | |
|
52 | 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 | 82 | def init(self, idfigure, nplots, wintitle): |
|
55 | 83 | |
|
56 | 84 | raise ValueError, "This method has been replaced with createFigure" |
@@ -227,34 +227,6 class RTIPlot(Figure): | |||
|
227 | 227 | |
|
228 | 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 | 230 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', |
|
259 | 231 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
260 | 232 | timerange=None, |
@@ -306,7 +278,7 class RTIPlot(Figure): | |||
|
306 | 278 | wintitle=wintitle, |
|
307 | 279 | showprofile=showprofile) |
|
308 | 280 | |
|
309 |
tmin, tmax = self. |
|
|
281 | tmin, tmax = self.getTimeLim(x, xmin, xmax) | |
|
310 | 282 | if ymin == None: ymin = numpy.nanmin(y) |
|
311 | 283 | if ymax == None: ymax = numpy.nanmax(y) |
|
312 | 284 | if zmin == None: zmin = numpy.nanmin(avg)*0.9 |
@@ -741,34 +713,6 class CoherencePlot(Figure): | |||
|
741 | 713 | |
|
742 | 714 | if showprofile: |
|
743 | 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 | 717 | def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True', |
|
774 | 718 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
@@ -799,7 +743,7 class CoherencePlot(Figure): | |||
|
799 | 743 | wintitle=wintitle, |
|
800 | 744 | showprofile=showprofile) |
|
801 | 745 | |
|
802 |
tmin, tmax = self. |
|
|
746 | tmin, tmax = self.getTimeLim(x, xmin, xmax) | |
|
803 | 747 | if ymin == None: ymin = numpy.nanmin(y) |
|
804 | 748 | if ymax == None: ymax = numpy.nanmax(y) |
|
805 | 749 |
General Comments 0
You need to be logged in to leave comments.
Login now