Exemple #1
0
 def plot(self, ax=None, mark=None, ymin=-0.1, ymax=1.1, **kwargs):
     if ax == None:
         self.fig, self.ax = plt.subplots()
     else:
         self.ax = ax
     box = functional_models.Box1D()
     self.x = np.linspace(self.a, self.b, 100)
     self.y = box.evaluate(self.x,
                           amplitude=1.,
                           x_0=self.center,
                           width=self.width)
     self.ax.plot(self.x, self.y, **kwargs)
     self.ax.set_ylim(ymin, ymax)
     self.ax.vlines(self.a, 0, 1, color="black", linestyle="--")
     self.ax.vlines(self.b, 0, 1, color="black", linestyle="--")
     self.ax.set_ylabel(self.name)
     if mark != None:
         self.ax.vlines(mark, 0, 1, color="orange", linestyle="--")
 def from_tree_transform(cls, node, ctx):
     return functional_models.Box1D(amplitude=node['amplitude'],
                                    x_0=node['x_0'],
                                    width=node['width'])