Esempio n. 1
0
    def testGetDist(self):
        from getdist.command_line import getdist_command

        os.chdir(self.tempdir)
        res = getdist_command([self.root])
        # Note this can fail if your local analysis defaults changes the default ignore_rows
        self.assertTrue('-Ln(mean like)  = 2.31' in res, res)
        fname = 'testchain_pars.ini'
        getdist_command(['--make_param_file', fname])
        ini = IniFile(fname)
        ini.params['no_plots'] = False
        ini.params['plot_2D_num'] = 1
        ini.params['plot1'] = 'x y'
        ini.params['num_3D_plots'] = 1
        ini.params['3D_plot1'] = 'x y x'
        ini.params['triangle_params'] = '*[xy]*'

        ini.saveFile(fname)
        res = getdist_command([fname, self.root])
        self.assertTrue('-Ln(mean like)  = 2.31' in res)

        def check_run():
            for f in ['.py', '_2D.py', '_3D.py', '_tri.py']:
                pyname = self.root + f
                self.assertTrue(os.path.isfile(pyname))
                subprocess.check_output(['python', pyname])
                pdf = self.root + f.replace('py', 'pdf')
                self.assertTrue(os.path.isfile(pdf))
                os.remove(pdf)
                os.remove(pyname)

        check_run()
Esempio n. 2
0
 def test_chains(self):
     if os.path.exists(self.path):
         root = os.path.join(self.path, 'DES_shear')
         samples = loadMCSamples(root, settings={'ignore_rows': 0.3}, no_cache=True)
         self.assertAlmostEqual(samples.mean('ombh2'), 0.02764592190482377, 6)
         pars = samples.getParamSampleDict(10)
         self.assertAlmostEqual(0.06, pars['mnu'], 6)
         self.assertAlmostEqual(samples.getUpper('ns'), 1.07, 6)
         self.assertAlmostEqual(samples.getLower('ns'), 0.87, 6)
         self.assertEqual(samples.getLower('DES_DzS2'), None)
         self.assertAlmostEqual(0, pars['omk'])
         from getdist.command_line import getdist_command
         res = getdist_command([root])
         self.assertTrue('-log(Like) = 95.49' in res, res)
Esempio n. 3
0
#!/usr/bin/env python

# Once installed this is not used, same as getdist script

import sys
import os

sys.path.append(os.path.realpath(os.path.dirname(__file__)))

from getdist.command_line import getdist_command

getdist_command()