Exemple #1
0
    def test_proj_bubble(self):
        self.run_thread('proj_bubble')
        # Fit -- Results from reminimize
        self.assertEqualWithinTol(self.locals['mek1'].kt.val, 17.8849, 1e-2)
        self.assertEqualWithinTol(self.locals['mek1'].norm.val, 4.15418e-06,
                                  1e-2)

        # Covar
        self.assertEqualWithinTol(ui.get_covar_results().parmins[0], -0.328832,
                                  1e-2)
        self.assertEqualWithinTol(ui.get_covar_results().parmins[1],
                                  -8.847916e-07, 1e-2)
        self.assertEqualWithinTol(ui.get_covar_results().parmaxes[0], 0.328832,
                                  1e-2)
        self.assertEqualWithinTol(ui.get_covar_results().parmaxes[1],
                                  8.847916e-07, 1e-2)

        # Proj -- Upper bound of kT can't be found
        self.assertEqualWithinTol(ui.get_proj_results().parmins[0], -12.048069,
                                  1e-2)
        self.assertEqualWithinTol(ui.get_proj_results().parmins[1],
                                  -9.510913e-07, 1e-2)
        self.assertEqual(ui.get_proj_results().parmaxes[0], None)
        self.assertEqualWithinTol(ui.get_proj_results().parmaxes[1],
                                  2.403640e-06, 1e-2)
Exemple #2
0
    def test_proj_bubble(self):
        self.run_thread('proj_bubble')
        # Fit -- Results from reminimize
        self.assertEqualWithinTol(self.locals['mek1'].kt.val, 17.8849, 1e-2)
        self.assertEqualWithinTol(self.locals['mek1'].norm.val, 4.15418e-06,
                                  1e-2)

        # Covar
        self.assertEqualWithinTol(ui.get_covar_results().parmins[0],
                                  -0.328832, 1e-2)
        self.assertEqualWithinTol(ui.get_covar_results().parmins[1],
                                  -8.847916e-07, 1e-2)
        self.assertEqualWithinTol(ui.get_covar_results().parmaxes[0],
                                  0.328832, 1e-2)
        self.assertEqualWithinTol(ui.get_covar_results().parmaxes[1],
                                  8.847916e-07, 1e-2)

        # Proj -- Upper bound of kT can't be found
        self.assertEqualWithinTol(ui.get_proj_results().parmins[0],
                                  -12.048069, 1e-2)
        self.assertEqualWithinTol(ui.get_proj_results().parmins[1],
                                  -9.510913e-07, 1e-2)
        self.assertEqual(ui.get_proj_results().parmaxes[0], None)
        self.assertEqualWithinTol(ui.get_proj_results().parmaxes[1],
                                  2.403640e-06, 1e-2)
Exemple #3
0
    def test_proj_bubble(self):

        def cmp_proj_bubble(mylocals, convarerr, proj, conf):
            mek1 = mylocals['mek1']
            assert covarerr[0] == approx(0, rel=1e-4)
            assert covarerr[1] == approx(8.74608e-07, rel=1e-3)
            assert mek1.kt.val == approx(17.8849, rel=1e-2)
            assert mek1.norm.val == approx(4.15418e-06, rel=1e-2)
            # Proj -- Upper bound of kT can't be found
            #
            assert proj.parmins[0] == approx(-12.048069, rel=0.01)
            assert proj.parmins[1] == approx(-9.510913e-07, rel=0.01)
            assert proj.parmaxes[1] == approx(2.403640e-06, rel=0.01)
            assert proj.parmaxes[0] is None
            assert conf.parmins[0] == approx(-12.1073, rel=0.01)
            assert conf.parmaxes[0] == approx(62.0585, rel=0.01)
            assert conf.parmins[1] == approx(-9.5568e-07, rel=0.01)
            assert conf.parmaxes[1] == approx(2.39937e-06, rel=0.01)

        self.run_thread('proj_bubble')
        fit_results = ui.get_fit_results()
        covarerr = sqrt(fit_results.extra_output['covar'].diagonal())
        proj = ui.get_proj_results()
        conf = ui.get_conf_results()
        cmp_proj_bubble(self.locals, covarerr, proj, conf)

        self.run_thread('proj_bubble_ncpus')
        fit_results = ui.get_fit_results()
        covarerr = sqrt(fit_results.extra_output['covar'].diagonal())
        proj = ui.get_proj_results()
        conf = ui.get_conf_results()
        cmp_proj_bubble(self.locals, covarerr, proj, conf)
Exemple #4
0
def test_proj_bubble(parallel, clean_astro_ui, fix_xspec, run_thread):

    # How sensitive are the results to the change from bcmc to vern
    # made in XSPEC 12.10.1? It looks like the mekal best-fit
    # temperature can jump from ~17.9 to 18.6, so require bcmc
    # in this test (handled by fix_xspec).
    #
    # Note that the error on kT is large, so we can expect that
    # changes to the system could change these results. In particular,
    # the covariance errors on kt are < 1 but from other error
    # analysis they are > 10 or even unbound, so it is likely that the
    # covariance error results can change significantly.
    #
    # The fit results change in XSPEC 12.10.0 since the mekal model
    # was changed (FORTRAN to C++). A 1% difference is used for the
    # parameter ranges from covar and proj (matches the tolerance for
    # the fit results). Note that this tolerance has been relaced to
    # 10% for the kT errors, as there is a significant change seen
    # with different XSPEC versions for the covariance results.
    #
    # fit_results is unused
    def cmp_thread(fit_results, mek1, covarerr):

        assert covarerr[0] == approx(0, rel=1e-4)
        assert covarerr[1] == approx(8.74608e-07, rel=1e-3)
        assert mek1.kt.val == approx(17.8849, rel=1e-2)
        assert mek1.norm.val == approx(4.15418e-06, rel=1e-2)

    check_thread(run_thread, 'proj_bubble', parallel, cmp_thread, ['mek1'])

    # Covar
    #
    # TODO: should this check that parmaxes is -1 * parmins instead?
    covar = ui.get_covar_results()
    assert covar.parmins[0] == approx(-0.653884, rel=0.1)
    assert covar.parmins[1] == approx(-8.94436e-07, rel=0.01)
    assert covar.parmaxes[0] == approx(0.653884, rel=0.1)
    assert covar.parmaxes[1] == approx(8.94436e-07, rel=0.01)

    # Proj -- Upper bound of kT can't be found
    #
    proj = ui.get_proj_results()
    assert proj.parmins[0] == approx(-12.048069, rel=0.01)
    assert proj.parmins[1] == approx(-9.510913e-07, rel=0.01)
    assert proj.parmaxes[0] is None
    assert proj.parmaxes[1] == approx(2.403640e-06, rel=0.01)

    # Conf
    #
    conf = ui.get_conf_results()
    assert conf.parmins[0] == approx(-12.1073, rel=0.01)
    assert conf.parmins[1] == approx(-9.5568e-07, rel=0.01)
    assert conf.parmaxes[0] is None
    assert conf.parmaxes[1] == approx(2.39937e-06, rel=0.01)
Exemple #5
0
def test_proj_bubble(run_thread):

    # How sensitive are the results to the change from bcmc to vern
    # made in XSPEC 12.10.1? It looks like the mekal best-fit
    # temperature can jump from ~17.9 to 18.6, so require bcmc
    # in this test.
    #
    xspec.set_xsxsect('bcmc')
    models = run_thread('proj_bubble')

    fit_results = ui.get_fit_results()
    covarerr = sqrt(fit_results.extra_output['covar'].diagonal())
    assert covarerr[0] == approx(0, rel=1e-4)
    assert covarerr[1] == approx(8.74608e-07, rel=1e-2)

    # Fit -- Results from reminimize
    assert models['mek1'].kt.val == approx(17.8849, rel=1e-2)
    assert models['mek1'].norm.val == approx(4.15418e-06, rel=1e-2)

    # Fit -- Results from reminimize

    # The fit results change in XSPEC 12.10.0 since the mekal model
    # was changed (FORTRAN to C++). A 1% difference is used for the
    # parameter ranges from covar and proj (matches the tolerance for
    # the fit results). Note that this tolerance has been relaced to
    # 10% for the kT errors, as there is a significant change seen
    # with different XSPEC versions for the covariance results.
    #

    # Covar
    #
    # TODO: should this check that parmaxes is -1 * parmins instead?
    covar = ui.get_covar_results()
    assert covar.parmins[0] == approx(-0.328832, rel=0.1)
    assert covar.parmins[1] == approx(-8.847916e-7, rel=0.01)
    assert covar.parmaxes[0] == approx(0.328832, rel=0.1)
    assert covar.parmaxes[1] == approx(8.847916e-7, rel=0.01)

    # Proj -- Upper bound of kT can't be found
    #
    proj = ui.get_proj_results()
    assert proj.parmins[0] == approx(-12.048069, rel=0.01)
    assert proj.parmins[1] == approx(-9.510913e-07, rel=0.01)
    assert proj.parmaxes[1] == approx(2.403640e-06, rel=0.01)

    assert proj.parmaxes[0] is None