def getTimeSpan(self, dataArrayT): datecol = getCol('Date') timecol = getCol('Time') datetimeTup = zip(dataArrayT[datecol], dataArrayT[timecol]) startStr = datetimeTup[0][0] + ' ' + datetimeTup[0][1] endStr = datetimeTup[-1][0] + ' ' + datetimeTup[-1][1] durationObj = date_helpers.dateObjFloat(endStr) - date_helpers.dateObjFloat(startStr) return durationObj.total_seconds()
def firstPlot(self, yvarIns): list_of_times = [] theAxes = yvarIns.axis theYvar = yvarIns.varName ydata = copy.deepcopy(DATA_DICT.get(theYvar)) time_array = copy.deepcopy(DATA_DICT.get(self.xvar)) date_array = copy.deepcopy(DATA_DICT.get("Date")) for index in range(len(time_array)): full_time = date_array[index] + " " + time_array[index] formatted_time = date_helpers.dateObjFloat(full_time) list_of_times += [formatted_time] timeToPlot = matplotlib.dates.date2num(list_of_times) # If reader is still reading, DATA_DICT is changing, # and it is possible for timeToPlot to be a different # length than ydata. In that case, we can wait for # DATA_DICT to update and try again. try: theAxes.plot_date(timeToPlot, ydata, markerfacecolor=yvarIns.color, label = theYvar, markeredgecolor=yvarIns.color) self.timeFrame() except ValueError: time.sleep(0.5) firstPlot(self, yvarIns)
def firstPlot(self, yvarIns): list_of_times = [] theAxes = yvarIns.axis theYvar = yvarIns.varName ydata = copy.deepcopy(DATA_DICT.get(theYvar)) time_array = copy.deepcopy(DATA_DICT.get(self.xvar)) date_array = copy.deepcopy(DATA_DICT.get("Date")) for index in range(len(time_array)): full_time = date_array[index] + " " + time_array[index] formatted_time = date_helpers.dateObjFloat(full_time) list_of_times += [formatted_time] timeToPlot = matplotlib.dates.date2num(list_of_times) # If reader is still reading, DATA_DICT is changing, # and it is possible for timeToPlot to be a different # length than ydata. In that case, we can wait for # DATA_DICT to update and try again. try: theAxes.plot_date(timeToPlot, ydata, markerfacecolor=yvarIns.color, label=theYvar, markeredgecolor=yvarIns.color) self.timeFrame() except ValueError: time.sleep(0.5) firstPlot(self, yvarIns)
def updatePlot(self, row): # turn date/time strings into time objects time_value = date_helpers.dateObjFloat(row[self.colNums[0]] + " " + row[self.colNums[1]]) # plot new point for all y-vars no matter which of the two axis for axis in (self.yvarsL, self.yvarsR): for graphPlots in axis: graphPlots.axis.plot_date(time_value,row[graphPlots.columnNumber], markerfacecolor=graphPlots.color, markeredgecolor=graphPlots.color)
def updatePlot(self, row): # turn date/time strings into time objects time_value = date_helpers.dateObjFloat(row[self.colNums[0]] + " " + row[self.colNums[1]]) # plot new point for all y-vars no matter which of the two axis for axis in (self.yvarsL, self.yvarsR): for graphPlots in axis: graphPlots.axis.plot_date(time_value, row[graphPlots.columnNumber], markerfacecolor=graphPlots.color, markeredgecolor=graphPlots.color)