コード例 #1
0
ファイル: fit.py プロジェクト: volkerjaenisch/veusz
    def __init__(self, parent, name=None):
        FunctionPlotter.__init__(self, parent, name=name)

        if type(self) == Fit:
            self.readDefaults()

        self.addAction( widget.Action('fit', self.actionFit,
                                      descr = _('Fit function'),
                                      usertext = _('Fit function')) )
コード例 #2
0
ファイル: fit.py プロジェクト: volkerjaenisch/veusz
    def addSettings(klass, s):
        """Construct list of settings."""
        FunctionPlotter.addSettings(s)

        s.add( setting.FloatDict('values',
                                 {'a': 0.0, 'b': 1.0},
                                 descr = _('Variables and fit values'),
                                 usertext=_('Parameters')), 1 )
        s.add( setting.Dataset('xData', 'x',
                               descr = _('Variable containing x data to fit'),
                               usertext=_('X dataset')), 2 )
        s.add( setting.Dataset('yData', 'y',
                               descr = _('Variable containing y data to fit'),
                               usertext=_('Y dataset')), 3 )
        s.add( setting.Bool('fitRange', False,
                            descr = _('Fit only the data between the '
                                      'minimum and maximum of the axis for '
                                      'the function variable'),
                            usertext=_('Fit only range')),
               4 )
        s.add( setting.WidgetChoice(
                'outLabel', '',
                descr=_('Write best fit parameters to this text label '
                        'after fitting'),
                widgettypes=('label',),
                usertext=_('Output label')),
               5 )
        s.add( setting.Str('outExpr', '',
                           descr = _('Output best fitting expression'),
                           usertext=_('Output expression')),
               6, readonly=True )
        s.add( setting.Float('chi2', -1,
                             descr = 'Output chi^2 from fitting',
                             usertext=_('Fit &chi;<sup>2</sup>')),
               7, readonly=True )
        s.add( setting.Int('dof', -1,
                           descr = _('Output degrees of freedom from fitting'),
                           usertext=_('Fit d.o.f.')),
               8, readonly=True )
        s.add( setting.Float('redchi2', -1,
                             descr = _('Output reduced-chi-squared from fitting'),
                             usertext=_('Fit reduced &chi;<sup>2</sup>')),
               9, readonly=True )

        f = s.get('function')
        f.newDefault('a + b*x')
        f.descr = _('Function to fit')

        # modify description
        s.get('min').usertext=_('Min. fit range')
        s.get('max').usertext=_('Max. fit range')