예제 #1
0
    def update(self, fit_minimizers, fit_minimizer_errors):
        try:
            x = fit_minimizers[self.fit_param_name]
            delta_x = fit_minimizer_errors[self.fit_param_name]
        except KeyError as e:
            if not self.has_warned:
                logger.warn(
                    "Unknown reference to fit parameter '%s' in point of interest",
                    str(e))
                self.has_warned = True
            # TODO: Remove POI.
            return

        if np.isnan(delta_x) or delta_x == 0.0:
            # If the covariance extraction failed, just don't display the
            # confidence interval at all.
            delta_x = 0.0
            label = str(x)
        else:
            label = uncertainty_to_string(
                x * self.x_data_to_display_scale,
                delta_x * self.x_data_to_display_scale)
        self.center_line.label.setFormat(label + self.x_unit_suffix)

        self.left_line.setPos(x - delta_x)
        self.center_line.setPos(x)
        self.right_line.setPos(x + delta_x)
예제 #2
0
    def _redraw(self):
        x = self._position_source.get()
        if x is None:
            return

        if not self._added_to_plot:
            self._view_box.addItem(self._left_line, ignoreBounds=True)
            self._view_box.addItem(self._center_line, ignoreBounds=True)
            self._view_box.addItem(self._right_line, ignoreBounds=True)
            self._added_to_plot = True

        delta_x = None
        if self._uncertainty_source:
            delta_x = self._uncertainty_source.get()

        if delta_x is None or numpy.isnan(delta_x) or delta_x == 0.0:
            # If the covariance extraction failed, just don't display the
            # confidence interval at all.
            delta_x = 0.0
            label = str(x * self._x_data_to_display_scale)
        else:
            label = uncertainty_to_string(
                x * self._x_data_to_display_scale,
                delta_x * self._x_data_to_display_scale)
        self._center_line.label.setFormat(label + self._x_unit_suffix)

        self._left_line.setPos(x - delta_x)
        self._center_line.setPos(x)
        self._right_line.setPos(x + delta_x)