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