Exemple #1
0
    def put_splines_on_plot(self):

        XY = self.guiObj.XYjob
        self.guiObj.selected_spline_objL = []

        try:
            self.selected_smoothing = float(self.SmoothValStringVar.get())
        except:
            self.selected_smoothing = 0.0

        if self.selected_smoothing < 0.0:
            self.selected_smoothing = 0.0

        curveL = []
        descStr = ''  # description string of spline(s)

        if (XY.dataset
                and XY.dataset.N > 1) or len(self.selected_spline_nameL) > 0:
            for n, spline_name in enumerate(self.selected_spline_nameL):
                k = self.k_valueD[spline_name]

                if XY.dataset.N > 1 + k:
                    s = Spline(XY.dataset,
                               order=k,
                               smoothing=self.selected_smoothing)
                    self.guiObj.selected_spline_objL.append(s)
                    curveL.append(s)
                    if descStr:
                        descStr += '\n' + '=' * 44 + '\n'
                    descStr += s.get_full_description()

            if self.selected_smoothing == 0:
                mytitle = 'Spline Interpolation'
            else:
                mytitle = 'Smoothed Spline Interpolation\n(StdDev=%g, %% StdDev=%g%%, CorrCoeff=%g)' % (
                    s.std, s.pcent_std, s.corrcoef)

            self.guiObj.PlotWin.make_new_plot(dataset=XY.dataset,
                                              curveL=curveL,
                                              title_str=mytitle)

        if descStr:
            self.new_message(descStr)
            self.ShowHelp_Button.configure(state=NORMAL,
                                           text="Show Help",
                                           width="18",
                                           relief=RAISED)
Exemple #2
0
    def put_splines_on_plot(self):

        XY = self.guiObj.XYjob
        self.guiObj.selected_spline_objL = []

        try:
            self.selected_smoothing = float(self.SmoothValStringVar.get())
        except:
            self.selected_smoothing = 0.0

        if self.selected_smoothing < 0.0:
            self.selected_smoothing = 0.0

        curveL = []
        descStr = ""  # description string of spline(s)

        if (XY.dataset and XY.dataset.N > 1) or len(self.selected_spline_nameL) > 0:
            for n, spline_name in enumerate(self.selected_spline_nameL):
                k = self.k_valueD[spline_name]

                if XY.dataset.N > 1 + k:
                    s = Spline(XY.dataset, order=k, smoothing=self.selected_smoothing)
                    self.guiObj.selected_spline_objL.append(s)
                    curveL.append(s)
                    if descStr:
                        descStr += "\n" + "=" * 44 + "\n"
                    descStr += s.get_full_description()

            if self.selected_smoothing == 0:
                mytitle = "Spline Interpolation"
            else:
                mytitle = "Smoothed Spline Interpolation\n(StdDev=%g, %% StdDev=%g%%, CorrCoeff=%g)" % (
                    s.std,
                    s.pcent_std,
                    s.corrcoef,
                )

            self.guiObj.PlotWin.make_new_plot(dataset=XY.dataset, curveL=curveL, title_str=mytitle)

        if descStr:
            self.new_message(descStr)
            self.ShowHelp_Button.configure(state=NORMAL, text="Show Help", width="18", relief=RAISED)
Exemple #3
0
 def test_get_smooth_linear_spline(self):
     """get LinCurveFit for constant"""
     s = Spline( self.myds, order=1, smoothing=1.0)
     val = s.eval_xrange( 2.5 )
     refVal = 6.869098813825232 #6.5
     self.assertAlmostEqual(val, refVal)
Exemple #4
0
 def test_get_quadratic_spline(self):
     """get Quadratic Spline for constant"""
     s = Spline( self.myds, order=2, smoothing=0.0)
     val = s.eval_xrange( 2.5 )
     refVal = 6.25
     self.assertAlmostEqual(val, refVal)
Exemple #5
0
 def setUp(self):
     unittest.TestCase.setUp(self)
     self.myds = DataSet(xArr, yArr)
     self.myspline = Spline(self.myds, order=2, smoothing=0.0)
     self.mylinterp = Spline(self.myds, order=1, smoothing=0.0)