Пример #1
0
 def setUp(self):
     self.method = LevMar()
     self.stat = Chi2Gehrels()
     self.est = Covariance()
     self.gro_fname = self.make_path('gro.txt')
     self.gro_delta_fname = self.make_path('gro_delta.txt')        
     return
Пример #2
0
def calc_errors(ys):
    """Return errors for ys using the default statistic.

    Consolidate this code to make it easier to change if the
    default statistic ever changes.
    """

    return Chi2Gehrels.calc_staterror(ys)
Пример #3
0
def test_chi2gehrels_stat(hide_logging, reset_xspec, setup_group):
    fit = Fit(setup_group['data'], setup_group['model'], Chi2Gehrels(),
              NelderMead())
    results = fit.fit()

    _fit_chi2gehrels_results_bench = {
        'succeeded':
        1,
        'numpoints':
        143,
        'dof':
        140,
        'istatval':
        2410.6724538404405,
        'statval':
        100.22120218142433,
        'parvals':
        numpy.array(
            [1.7831198951601808, 5.376678702350025, -1.9152513828120412])
    }

    compare_results(_fit_chi2gehrels_results_bench, results)
Пример #4
0
 def test_chi2gehrels_stat(self):
     fit = Fit(self.data, self.model, Chi2Gehrels(), NelderMead())
     results = fit.fit()
     self.compare_results(self._fit_chi2gehrels_results_bench, results)
Пример #5
0
def fit_asymmetric_err(bench, data):
    model = PowLaw1D('p1')
    fit = Fit(data, model, Chi2Gehrels(), LevMar())
    results = fit.fit()
    compare(bench, results)
    return model