Пример #1
0
	def _populate_point_label(self, x_val, y_val):
		"""
		Get the text the will populate the point label.
		Give X and Y values for the current point.
		Give values for the channel at the X coordinate.
		@param x_val the current x value
		@param y_val the current y value
		@return a string with newlines
		"""
		#create text
		label_str = '%s: %s\n%s: %s'%(
			self.x_label, common.eng_format(x_val, self.x_units),
			self.y_label, common.eng_format(y_val, self.y_units),
		)
		for channel in sorted(self._channels.keys()):
			samples = self._channels[channel][SAMPLES_KEY]
			num_samps = len(samples)
			if not num_samps: continue
			if isinstance(samples, tuple): continue
			#linear interpolation
			x_index = (num_samps-1)*(x_val-self.x_min)/(self.x_max-self.x_min)
			x_index_low = int(math.floor(x_index))
			x_index_high = int(math.ceil(x_index))
			scale = x_index - x_index_low + self._channels[channel][TRIG_OFF_KEY]
			y_value = (samples[x_index_high] - samples[x_index_low])*scale + samples[x_index_low]
			label_str += '\n%s: %s'%(channel, common.eng_format(y_value, self.y_units))
		return label_str
    def _populate_point_label(self, x_val, y_val):
        """
		Get the text the will populate the point label.
		Give X and Y values for the current point.
		Give values for the channel at the X coordinate.
		@param x_val the current x value
		@param y_val the current y value
		@return a string with newlines
		"""
        #create text
        label_str = '%s: %s\n%s: %s' % (
            self.x_label,
            common.eng_format(x_val, self.x_units),
            self.y_label,
            common.eng_format(y_val, self.y_units),
        )
        for channel in sorted(self._channels.keys()):
            samples = self._channels[channel][SAMPLES_KEY]
            num_samps = len(samples)
            if not num_samps: continue
            if isinstance(samples, tuple): continue
            #linear interpolation
            x_index = (num_samps - 1) * (x_val - self.x_min) / (self.x_max -
                                                                self.x_min)
            x_index_low = int(math.floor(x_index))
            x_index_high = int(math.ceil(x_index))
            scale = x_index - x_index_low + self._channels[channel][
                TRIG_OFF_KEY]
            y_value = (samples[x_index_high] -
                       samples[x_index_low]) * scale + samples[x_index_low]
            label_str += '\n%s: %s' % (
                channel, common.eng_format(y_value, self.y_units))
        return label_str
Пример #3
0
	def _populate_point_label(self, x_val, y_val):
		"""
		Get the text the will populate the point label.
		Give X and Y values for the current point.
		Give values for the channel at the X coordinate.

                Args:
		    x_val: the current x value
		    y_val: the current y value

                Returns:
		    a string with newlines
		"""
		if len(self._bars) == 0: return ''
		scalar = float(len(self._bars)-1)/(self.x_max - self.x_min)
		#convert x val to bar #
		bar_index = scalar*(x_val - self.x_min)
		#if abs(bar_index - round(bar_index)) > self._bar_width/2: return ''
		bar_index = int(round(bar_index))
		bar_start = (bar_index - self._bar_width/2)/scalar + self.x_min
		bar_end = (bar_index + self._bar_width/2)/scalar + self.x_min
		bar_value = self._bars[bar_index]
		return '%s to %s\n%s: %s'%(
			common.eng_format(bar_start, self.x_units),
			common.eng_format(bar_end, self.x_units),
			self.y_label, common.eng_format(bar_value, self.y_units),
		)
Пример #4
0
    def _populate_point_label(self, x_val, y_val):
        """
		Get the text the will populate the point label.
		Give X and Y values for the current point.
		Give values for the channel at the X coordinate.

                Args:
		    x_val: the current x value
		    y_val: the current y value

                Returns:
		    a string with newlines
		"""
        if len(self._bars) == 0: return ''
        scalar = float(len(self._bars) - 1) / (self.x_max - self.x_min)
        #convert x val to bar #
        bar_index = scalar * (x_val - self.x_min)
        #if abs(bar_index - round(bar_index)) > self._bar_width/2: return ''
        bar_index = int(round(bar_index))
        bar_start = (bar_index - self._bar_width / 2) / scalar + self.x_min
        bar_end = (bar_index + self._bar_width / 2) / scalar + self.x_min
        bar_value = self._bars[bar_index]
        return '%s to %s\n%s: %s' % (
            common.eng_format(bar_start, self.x_units),
            common.eng_format(bar_end, self.x_units),
            self.y_label,
            common.eng_format(bar_value, self.y_units),
        )
Пример #5
0
	def _populate_point_label(self, x_val, y_val):
		"""
		Get the text the will populate the point label.
		Give the X value for the current point.
		@param x_val the current x value
		@param y_val the current y value
		@return a value string with units
		"""
		return '%s: %s'%(self.x_label, common.eng_format(x_val, self.x_units))
Пример #6
0
    def _get_tick_label(self, tick, unit):
        """
		Format the tick value and create a gl text.
		@param tick the floating point tick value
		@param unit the axis unit
		@return the tick label text
		"""
        if unit: tick_str = common.sci_format(tick)
        else: tick_str = common.eng_format(tick)
        return gltext.Text(tick_str, font_size=TICK_TEXT_FONT_SIZE)
Пример #7
0
	def _get_tick_label(self, tick, unit):
		"""
		Format the tick value and create a gl text.
		@param tick the floating point tick value
		@param unit the axis unit
		@return the tick label text
		"""
		if unit: tick_str = common.sci_format(tick)
		else: tick_str = common.eng_format(tick)
		return gltext.Text(tick_str, font_size=TICK_TEXT_FONT_SIZE)
    def _populate_point_label(self, x_val, y_val):
        """
		Get the text the will populate the point label.
		Give the X value for the current point.
		@param x_val the current x value
		@param y_val the current y value
		@return a value string with units
		"""
        return '%s: %s' % (self.x_label, common.eng_format(
            x_val, self.x_units))