test_Model.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:MulensModel 作者: rpoleski 项目源码 文件源码
def test_BLPS_02_AC():
    """simple binary lens with extended source and different methods to evaluate magnification
    - version with adaptivecontouring
    """
    params = ModelParameters({
            't_0':2456141.593, 'u_0':0.5425, 't_E':62.63*u.day, 'alpha':49.58*u.deg, 
            's':1.3500, 'q':0.00578, 'rho':0.01})
    model = Model(parameters=params)

    t = (np.array([6112.5, 6113., 6114., 6115., 6116., 6117., 6118., 6119]) + 
        2450000.)
    ac_name = 'AdaptiveContouring'
    methods = [2456113.5, 'Quadrupole', 2456114.5, 'Hexadecapole', 2456116.5, 
        ac_name, 2456117.5]
    accuracy_1 = {'accuracy': 0.04}
    accuracy_2 = {'accuracy': 0.01, 'ld_accuracy': 0.0001}
    model.set_magnification_methods(methods)
    model.set_magnification_methods_parameters({ac_name: accuracy_1})

    data = MulensData(data_list=[t, t*0.+16., t*0.+0.01])
    model.set_datasets([data])
    result = model.data_magnification[0]

    expected = np.array([4.69183078, 2.87659723, 1.83733975, 1.63865704, 
        1.61038135, 1.63603122, 1.69045492, 1.77012807])
    np.testing.assert_almost_equal(result, expected, decimal=3) 

    # Below we test passing the limb coef to VBBL function.
    data.bandpass = 'I'
    model.set_limb_coeff_u('I', 10.) # This is an absurd value but I needed something quick.
    model.set_magnification_methods_parameters({ac_name: accuracy_2})
    result = model.data_magnification[0]
    np.testing.assert_almost_equal(result[5], 1.6366862, decimal=3)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号