def test_2d_ndintegrate():
    """ Test integration of synthetic 2D data with ndintegrate. """
    # generate test scale
    ppm_scale = _build_1d_ppm_scale()
    uc = ng.fileio.fileiobase.uc_from_freqscale(ppm_scale, 100)

    # generate test data
    x, y = np.meshgrid(ppm_scale, ppm_scale)
    pos = np.empty(x.shape + (2,))
    pos[:, :, 0] = x
    pos[:, :, 1] = y
    rv = multivariate_normal([5, 8], [0.01, 0.01])
    data = rv.pdf(pos)

    # import matplotlib.pyplot as plt
    # plt.figure()
    # plt.contour(x, y, data)
    # plt.show()

    limits = ((4, 6), (7, 9))

    assert abs(1.0 - ndintegrate(data, [uc, uc], limits)) <= 1e-10
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/analysis/tests/test_analysis_integration.py/test_2d_ndintegrate/swapped operands of `-`