コード例 #1
0
ファイル: _spline.py プロジェクト: Spinmob/spinmob
    def plot_fixed_y(self, y_values, x_derivative=0, steps=1000, smooth=0, simple='auto', xmin="auto", xmax="auto", format=True, clear=1):
        """
        plots the data at a fixed y-value, so z vs y
        """
        if simple=='auto': simple=self.simple


        # get the min and max
        if xmin=="auto": xmin = self.xmin
        if xmax=="auto": xmax = self.xmax
        if clear: _pylab.gca().clear()

        if not type(y_values) in [type([]), type(_pylab.array([]))]: y_values = [y_values]

        for y in y_values:
            # define a new simple function to plot, then plot it
            def f(x): return self.evaluate(x, y, x_derivative, smooth, simple)
            _pylab_help.plot_function(f, xmin, xmax, steps, 0, True)

            # label it
            a = _pylab.gca()
            th = "th"
            if x_derivative == 1: th = "st"
            if x_derivative == 2: th = "nd"
            if x_derivative == 3: th = "rd"
            if x_derivative: a.set_ylabel(str(x_derivative)+th+" "+self.xlabel+" derivative of "+self.zlabel+" spline")
            else:            a.set_ylabel(self.zlabel)
            a.set_xlabel(self.xlabel)
            a.set_title(self._path+"\nSpline array plot at fixed y "+self.ylabel)
            a.get_lines()[-1].set_label("y ("+self.ylabel+") = "+str(y))
        if format: _s.format_figure()
        return a
コード例 #2
0
ファイル: _spline.py プロジェクト: Spinmob/spinmob
    def plot_fixed_x(self, x_values, x_derivative=0, steps=1000, smooth=0, simple='auto', ymin="auto", ymax="auto", format=True, clear=1):
        """
        plots the data at fixed x-value, so z vs x
        """
        if simple=='auto': simple=self.simple
        
        # get the min and max
        if ymin=="auto": ymin = self.ymin
        if ymax=="auto": ymax = self.ymax
        if clear: _pylab.gca().clear()

        if not type(x_values) in [type([]), type(_pylab.array([]))]: x_values = [x_values]

        for x in x_values:
    
            # define a new simple function to plot, then plot it
            def f(y): return self.evaluate(x, y, x_derivative, smooth, simple)
            _pylab_help.plot_function(f, ymin, ymax, steps, 0, False)

            # label it
            a = _pylab.gca()
            a.set_xlabel(self.ylabel)
            if x_derivative: a.set_ylabel(str(x_derivative)+" "+str(self.xlabel)+" derivative of "+self.zlabel)
            else:            a.set_ylabel(self.zlabel)
            a.set_title(self._path+"\nSpline array plot at fixed x = "+self.xlabel)
            a.get_lines()[-1].set_label("x ("+self.xlabel+") = "+str(x))

        if format: _s.format_figure()
        return a
コード例 #3
0
ファイル: _spline.py プロジェクト: streitho/spinmob
    def plot_range_fixed_y(
        self, ymin="auto", ymax="auto", ysteps=21, xmin="auto", xmax="auto", xsteps=200, clear=True, x_derivative=0
    ):
        if ymin == "auto":
            ymin = self.ymin
        if ymax == "auto":
            ymax = self.ymax

        self.plot_fixed_y(_pylab.linspace(ymin, ymax, ysteps), x_derivative, xsteps, xmin, xmax, False, clear)
        _s.format_figure()
コード例 #4
0
    def plot_range_fixed_y(self,
                           ymin="auto",
                           ymax="auto",
                           ysteps=21,
                           xmin="auto",
                           xmax="auto",
                           xsteps=200,
                           clear=True,
                           x_derivative=0):
        if ymin == "auto": ymin = self.ymin
        if ymax == "auto": ymax = self.ymax

        self.plot_fixed_y(_pylab.linspace(ymin, ymax, ysteps), x_derivative,
                          xsteps, xmin, xmax, False, clear)
        _s.format_figure()
コード例 #5
0
    def plot_fixed_y(self,
                     y_values,
                     x_derivative=0,
                     steps=1000,
                     smooth=0,
                     simple='auto',
                     xmin="auto",
                     xmax="auto",
                     format=True,
                     clear=1):
        """
        plots the data at a fixed y-value, so z vs y
        """
        if simple == 'auto': simple = self.simple

        # get the min and max
        if xmin == "auto": xmin = self.xmin
        if xmax == "auto": xmax = self.xmax
        if clear: _pylab.gca().clear()

        if not type(y_values) in [type([]), type(_pylab.array([]))]:
            y_values = [y_values]

        for y in y_values:
            # define a new simple function to plot, then plot it
            def f(x):
                return self.evaluate(x, y, x_derivative, smooth, simple)

            _pylab_help.plot_function(f, xmin, xmax, steps, 0, True)

            # label it
            a = _pylab.gca()
            th = "th"
            if x_derivative == 1: th = "st"
            if x_derivative == 2: th = "nd"
            if x_derivative == 3: th = "rd"
            if x_derivative:
                a.set_ylabel(
                    str(x_derivative) + th + " " + self.xlabel +
                    " derivative of " + self.zlabel + " spline")
            else:
                a.set_ylabel(self.zlabel)
            a.set_xlabel(self.xlabel)
            a.set_title(self._path + "\nSpline array plot at fixed y " +
                        self.ylabel)
            a.get_lines()[-1].set_label("y (" + self.ylabel + ") = " + str(y))
        if format: _s.format_figure()
        return a
コード例 #6
0
    def plot_fixed_x(self,
                     x_values,
                     x_derivative=0,
                     steps=1000,
                     smooth=0,
                     simple='auto',
                     ymin="auto",
                     ymax="auto",
                     format=True,
                     clear=1):
        """
        plots the data at fixed x-value, so z vs x
        """
        if simple == 'auto': simple = self.simple

        # get the min and max
        if ymin == "auto": ymin = self.ymin
        if ymax == "auto": ymax = self.ymax
        if clear: _pylab.gca().clear()

        if not type(x_values) in [type([]), type(_pylab.array([]))]:
            x_values = [x_values]

        for x in x_values:

            # define a new simple function to plot, then plot it
            def f(y):
                return self.evaluate(x, y, x_derivative, smooth, simple)

            _pylab_help.plot_function(f, ymin, ymax, steps, 0, False)

            # label it
            a = _pylab.gca()
            a.set_xlabel(self.ylabel)
            if x_derivative:
                a.set_ylabel(
                    str(x_derivative) + " " + str(self.xlabel) +
                    " derivative of " + self.zlabel)
            else:
                a.set_ylabel(self.zlabel)
            a.set_title(self._path + "\nSpline array plot at fixed x = " +
                        self.xlabel)
            a.get_lines()[-1].set_label("x (" + self.xlabel + ") = " + str(x))

        if format: _s.format_figure()
        return a