示例#1
0
 def test_names_partial(self):
     nparam = 8
     names = ['hi']
     names = utilities.generate_names(nparam=nparam, names=names)
     self.assertEqual(names[0], 'hi', msg='First name is hi')
     for ii in range(1, nparam):
         self.assertEqual(names[ii], str('$p_{{{}}}$'.format(ii)))
示例#2
0
 def test_default_names(self):
     nparam = 8
     names = utilities.generate_names(nparam=nparam, names=None)
     self.assertEqual(len(names),
                      nparam,
                      msg='Length of names should match number \
                      of parameters')
     for ii in range(nparam):
         self.assertEqual(names[ii], str('$p_{{{}}}$'.format(ii)))
示例#3
0
 def test_basic_joint_distributions_single_fig(self):
     npar = 2
     chains = np.random.random_sample(size=(100, npar))
     f = MP.plot_joint_distributions(chains=chains)
     names = utilities.generate_names(nparam=npar, names=None)
     for jj in range(2, npar + 1):
         for ii in range(1, jj):
             name1 = names[ii - 1]
             name2 = names[jj - 1]
             self.assertEqual(f.ax_joint.get_xlabel(),
                              name1,
                              msg=str('Should be {}'.format(name1)))
             self.assertEqual(f.ax_joint.get_ylabel(),
                              name2,
                              msg=str('Should be {}'.format(name2)))
     plt.close()
示例#4
0
 def test_basic_joint_distributions_with_settings(self):
     npar = 3
     chains = np.random.random_sample(size=(100, npar))
     f, settings = MP.plot_joint_distributions(chains=chains,
                                               return_settings=True)
     names = utilities.generate_names(nparam=npar, names=None)
     count = 0
     for jj in range(2, npar + 1):
         for ii in range(1, jj):
             name1 = names[ii - 1]
             name2 = names[jj - 1]
             self.assertEqual(f[count].ax_joint.get_xlabel(),
                              name1,
                              msg=str('Should be {}'.format(name1)))
             self.assertEqual(f[count].ax_joint.get_ylabel(),
                              name2,
                              msg=str('Should be {}'.format(name2)))
             count += 1
     self.assertTrue(isinstance(settings, dict),
                     msg='Expect dictionary output')
     plt.close()