@pytest.mark.parametrize('bodies', body_list)
@pytest.mark.parametrize('multihyps', multi_list)
def test_cubic_spline(all_gp, all_mgp, bodies, multihyps):
    '\n    test the predict for mc_simple kernel\n    '
    mgp_model = all_mgp[f'{bodies}{multihyps}']
    delta = 0.0001
    if ('3' in bodies):
        body_name = 'threebody'
    elif ('2' in bodies):
        body_name = 'twobody'
    nmap = len(mgp_model.maps[body_name].maps)
    print('nmap', nmap)
    for i in range(nmap):
        maxvalue = np.max(np.abs(mgp_model.maps[body_name].maps[i].mean.__coeffs__))
        if (maxvalue > 0):
            comp_code = mgp_model.maps[body_name].maps[i].species_code
            if ('3' in bodies):
                c_pt = np.array([[0.3, 0.4, 0.5]])
                (c, cderv) = mgp_model.maps[body_name].maps[i].mean(c_pt, with_derivatives=True)
                cderv = cderv.reshape([(- 1)])
                for j in range(3):
                    a_pt = deepcopy(c_pt)
                    b_pt = deepcopy(c_pt)
                    a_pt[0][j] += delta
                    b_pt[0][j] -= delta
                    a = mgp_model.maps[body_name].maps[i].mean(a_pt)[0]
                    b = mgp_model.maps[body_name].maps[i].mean(b_pt)[0]
                    num_derv = ((a - b) / (2 * delta))
                    print('spline', comp_code, num_derv, cderv[j])
                    assert np.isclose(num_derv, cderv[j], rtol=0.01)
            elif ('2' in bodies):
                center = (np.sum(mgp_model.maps[body_name].maps[i].bounds) / 2.0)
                a_pt = np.array([[(center + delta)]])
                b_pt = np.array([[(center - delta)]])
                c_pt = np.array([[center]])
                a = mgp_model.maps[body_name].maps[i].mean(a_pt)[0]
                b = mgp_model.maps[body_name].maps[i].mean(b_pt)[0]
                (c, cderv) = mgp_model.maps[body_name].maps[i].mean(c_pt, with_derivatives=True)
                cderv = cderv.reshape([(- 1)])[0]
                num_derv = ((a - b) / (2 * delta))
                print('spline', num_derv, cderv)
                assert np.isclose(num_derv, cderv, rtol=0.01)
test the predict for mc_simple kernel
@pytest.mark.parametrize('bodies', body_list)
@pytest.mark.parametrize('multihyps', multi_list)
def test_cubic_spline(all_gp, all_mgp, bodies, multihyps):
    '\n    \n    '
    mgp_model = all_mgp[f'{bodies}{multihyps}']
    delta = 0.0001
    if ('3' in bodies):
        body_name = 'threebody'
    elif ('2' in bodies):
        body_name = 'twobody'
    nmap = len(mgp_model.maps[body_name].maps)
    print('nmap', nmap)
    for i in range(nmap):
        maxvalue = np.max(np.abs(mgp_model.maps[body_name].maps[i].mean.__coeffs__))
        if (maxvalue > 0):
            comp_code = mgp_model.maps[body_name].maps[i].species_code
            if ('3' in bodies):
                c_pt = np.array([[0.3, 0.4, 0.5]])
                (c, cderv) = mgp_model.maps[body_name].maps[i].mean(c_pt, with_derivatives=True)
                cderv = cderv.reshape([(- 1)])
                for j in range(3):
                    a_pt = deepcopy(c_pt)
                    b_pt = deepcopy(c_pt)
                    a_pt[0][j] += delta
                    b_pt[0][j] -= delta
                    a = mgp_model.maps[body_name].maps[i].mean(a_pt)[0]
                    b = mgp_model.maps[body_name].maps[i].mean(b_pt)[0]
                    num_derv = ((a - b) / (2 * delta))
                    print('spline', comp_code, num_derv, cderv[j])
                    assert np.isclose(num_derv, cderv[j], rtol=0.01)
            elif ('2' in bodies):
                center = (np.sum(mgp_model.maps[body_name].maps[i].bounds) / 2.0)
                a_pt = np.array([[(center + delta)]])
                b_pt = np.array([[(center - delta)]])
                c_pt = np.array([[center]])
                a = mgp_model.maps[body_name].maps[i].mean(a_pt)[0]
                b = mgp_model.maps[body_name].maps[i].mean(b_pt)[0]
                (c, cderv) = mgp_model.maps[body_name].maps[i].mean(c_pt, with_derivatives=True)
                cderv = cderv.reshape([(- 1)])[0]
                num_derv = ((a - b) / (2 * delta))
                print('spline', num_derv, cderv)
                assert np.isclose(num_derv, cderv, rtol=0.01)