示例#1
0
def test_obs_to_log():
    eps = guess_epsilon.epsilon()
    obs = {'dnu': [10.0, 0.1],
           'numax': [100.0, 1.0],
           'teff': [4000.0, 100.0],
           'bp_rp': [1.3, 0.05]}
    eps.obs_to_log(obs)
    assert_almost_equal(eps.log_obs['dnu'][0], 1.0, 0.01)
示例#2
0
def test_make_kde():
    '''
    Check we can read in the prior data
    and make a kde.
    '''
    eps = guess_epsilon.epsilon()
    eps.read_prior_data()
    eps.make_kde()
示例#3
0
    def run_epsilon(self, bw_fac=1.0):
        """
        Runs the epsilon code and makes plots if self.make_plots is set.
        """
        self.epsilon = epsilon(bw_fac=bw_fac)
        self.epsilon_result = self.epsilon(dnu=self.dnu,
                                           numax=self.numax,
                                           teff=self.teff,
                                           bp_rp=self.bp_rp)

        if self.make_plots:
            self.epsilon.plot(self.pg).savefig(self.bpath + os.sep +
                                               f'epsilon_{self.ID}.png')
            self.epsilon.plot_corner().savefig(self.bpath + os.sep +
                                               f'epsilon_corner_{self.ID}.png')
示例#4
0
def test_epsilon():
    ''' Test init '''
    eps = guess_epsilon.epsilon()
示例#5
0
def test_application_sparse_teff():
    eps = guess_epsilon.epsilon()
    res = eps(teff = [4800.0, 70.0])
    assert_almost_equal(res[0], 1.2, 0.2)
示例#6
0
def test_application_sparse_numax():
    eps = guess_epsilon.epsilon()
    res = eps(numax = [120.0, 1.0])
    assert_almost_equal(res[0], 1.2, 0.2)
示例#7
0
def test_application_sparse():
    eps = guess_epsilon.epsilon()
    res = eps(dnu = [10.0, 0.1])
    assert_almost_equal(res[0], 1.2, 0.2)
示例#8
0
def test_application():
    eps = guess_epsilon.epsilon()
    res = eps(dnu = [10.0, 0.1],
              numax = [120.0, 1.0],
              teff = [4800.0, 70.0])
    assert_almost_equal(res[0], 1.2, 0.2)
示例#9
0
def test_to_log10():
    eps = guess_epsilon.epsilon()
    ret = eps.to_log10(10, 0.1)
    assert_almost_equal(ret[0], 1.0, 0.01)
    assert_almost_equal(ret[1], 0.01, 0.001)
示例#10
0
def test_normal():
    eps = guess_epsilon.epsilon()
    assert_almost_equal(eps.normal(0.0, 0.00001, 1.0), 0.0, 0.01)
示例#11
0
def test_read_prior_data():
    ''' Check we can read in the prior data '''
    eps = guess_epsilon.epsilon()
    eps.read_prior_data()