def __init__(self, calanfpga):
        Animator.__init__(self, calanfpga)
        self.snapshots = self.settings.snapshots

        self.n_inputs = len(self.snapshots)
        self.figure = CalanFigure(n_plots=self.n_inputs, create_gui=True)
        for i, snapshot in enumerate(self.snapshots):
            self.figure.create_axis(i, SnapshotAxis, 
                self.settings.snap_samples, snapshot)
Beispiel #2
0
    def __init__(self, dpi: int, 
                 figsize: Tuple[int], interval: int) -> None:
        """
        The constructor.

        Parameters:
         dpi: dots per inches, which controls the resolution.
         fisize: tuple of two ints, which sets the size of the plot.
         animation_interval: set the animation interval in milliseconds
         between each animation frame.
        """
        Animator.__init__(self, dpi, figsize, interval)
        ax = self.figure.add_subplot(1, 1, 1)
        # self.t = np.linspace(-np.pi, np.pi, 256)
        if "Number of points" in config.config:
            n = config.config["Number of points"]
            self.t = np.linspace(-np.pi, np.pi, n)
        else:
            self.t = np.linspace(-np.pi, np.pi, 1024)
        ax.grid()
        if "function" in config.config:
            f = config.config["function"]
            self.function = FunctionRtoR(f, abc.x)
            ax.set_title("f(x) = %s" % (f))
        else:
            self.function = FunctionRtoR("sin(x)", abc.x)
            ax.set_title("f(x) = sin(x)")
        default_values = self.function.get_default_values()
        self.params = (default_values[key] for key in default_values)
        self.y = self.function(self.t, *self.params)
        ax.set_xlim(np.amin(self.t), np.amax(self.t))
        ax.set_xlabel("x")
        if "Plot Colour" in config.config:
            color = config.config["Plot Colour"]
            line, = ax.plot(self.t, self.y, color=color)
        else:
            line, = ax.plot(self.t, self.y)
        self.line = line