'Test MexicanHat kernels against SciPy ndimage gaussian laplace filters.'

@pytest.mark.skipif(u'not    HAS_SCIPY')
@pytest.mark.parametrize(u'width', WIDTHS_ODD)
def test_scipy_filter_gaussian_laplace(self, width):

    mexican_kernel_1D = MexicanHat1DKernel(width)
    mexican_kernel_2D = MexicanHat2DKernel(width)
    astropy_1D = convolve(delta_pulse_1D, mexican_kernel_1D, boundary=u'fill', normalize_kernel=False)
    astropy_2D = convolve(delta_pulse_2D, mexican_kernel_2D, boundary=u'fill', normalize_kernel=False)
    with pytest.raises(Exception) as exc:
        astropy_1D = convolve(delta_pulse_1D, mexican_kernel_1D, boundary=u'fill', normalize_kernel=True)
    assert (u'sum    is    close    to    zero' in exc.value.args[0])
    with pytest.raises(Exception) as exc:
        astropy_2D = convolve(delta_pulse_2D, mexican_kernel_2D, boundary=u'fill', normalize_kernel=True)
    assert (u'sum    is    close    to    zero' in exc.value.args[0])
    scipy_1D = (- filters.gaussian_laplace(delta_pulse_1D, width))
    scipy_2D = (- filters.gaussian_laplace(delta_pulse_2D, width))
    assert_almost_equal(astropy_1D, scipy_1D, decimal=5)
    assert_almost_equal(astropy_2D, scipy_2D, decimal=5)
