##// END OF EJS Templates
test for localtime plotting issues
Juan C. Espinoza -
r1218:afa054b492c7
parent child
Show More
@@ -162,6 +162,7 class Plot(Operation):
162 self.isPlotConfig = False
162 self.isPlotConfig = False
163 self.save_counter = 1
163 self.save_counter = 1
164 self.sender_counter = 1
164 self.sender_counter = 1
165 self.data = None
165
166
166 def __fmtTime(self, x, pos):
167 def __fmtTime(self, x, pos):
167 '''
168 '''
@@ -243,11 +244,7 class Plot(Operation):
243
244
244 self.setup()
245 self.setup()
245
246
246 self.time_label = 'LT' if self.localtime else 'UTC'
247 self.time_label = 'LT' if self.localtime else 'UTC'
247 if self.data.localtime:
248 self.getDateTime = datetime.datetime.fromtimestamp
249 else:
250 self.getDateTime = datetime.datetime.utcfromtimestamp
251
248
252 if self.width is None:
249 if self.width is None:
253 self.width = 8
250 self.width = 8
@@ -729,25 +726,27 class Plot(Operation):
729 raise NotImplementedError
726 raise NotImplementedError
730
727
731 def run(self, dataOut, **kwargs):
728 def run(self, dataOut, **kwargs):
732
729 '''
733 if dataOut.error:
730 Main plotting routine
734 coerce = True
731 '''
735 else:
736 coerce = False
737
732
738 if self.isConfig is False:
733 if self.isConfig is False:
739 self.__setup(**kwargs)
734 self.__setup(**kwargs)
740 if dataOut.type == 'Parameters':
735 if dataOut.type == 'Parameters':
741 self.tmin = dataOut.utctimeInit
736 t = dataOut.utctimeInit
742 else:
737 else:
743 self.tmin = dataOut.utctime
738 t = dataOut.utctime
744
739
745 if dataOut.useLocalTime:
740 if dataOut.useLocalTime:
746 if not self.localtime:
741 self.getDateTime = datetime.datetime.fromtimestamp
747 self.tmin += time.timezone
742 else:
743 self.getDateTime = datetime.datetime.utcfromtimestamp
744
745 if self.xmin is None:
746 self.tmin = t
748 else:
747 else:
749 if self.localtime:
748 self.tmin = (self.getDateTime(t).replace(hour=self.xmin, minute=0, second=0) - datetime.datetime(1970, 1, 1)).total_seconds()
750 self.tmin -= time.timezone
749
751 self.data.setup()
750 self.data.setup()
752 self.isConfig = True
751 self.isConfig = True
753 if self.plot_server:
752 if self.plot_server:
@@ -762,14 +761,12 class Plot(Operation):
762 else:
761 else:
763 tm = dataOut.utctime
762 tm = dataOut.utctime
764
763
765 if dataOut.useLocalTime:
764 if not dataOut.useLocalTime and self.localtime:
766 if not self.localtime:
765 tm -= time.timezone
767 tm += time.timezone
766 if dataOut.useLocalTime and not self.localtime:
768 else:
767 tm += time.timezone
769 if self.localtime:
770 tm -= time.timezone
771
768
772 if self.xaxis is 'time' and self.data and (tm - self.tmin) >= self.xrange*60*60:
769 if self.xaxis is 'time' and self.data and (tm - self.tmin) >= self.xrange*60*60:
773 self.save_counter = self.save_period
770 self.save_counter = self.save_period
774 self.__plot()
771 self.__plot()
775 self.xmin += self.xrange
772 self.xmin += self.xrange
@@ -788,7 +785,7 class Plot(Operation):
788 if self.realtime:
785 if self.realtime:
789 self.__plot()
786 self.__plot()
790 else:
787 else:
791 self.__throttle_plot(self.__plot, coerce=coerce)
788 self.__throttle_plot(self.__plot)#, coerce=coerce)
792
789
793 figpause(0.01)
790 figpause(0.01)
794
791
General Comments 0
You need to be logged in to leave comments. Login now