예제 #1
0
파일: test_direct.py 프로젝트: rth/PyAbel
def test_direct_zeros():
    # just a sanity check
    if not cython_ext:
        raise SkipTest
    n = 64
    x = np.zeros((n,n))
    assert (fabel_direct(x)==0).all()

    assert (iabel_direct(x)==0).all()
예제 #2
0
def test_direct_zeros():
    # just a sanity check
    if not cython_ext:
        raise SkipTest
    n = 64
    x = np.zeros((n, n))
    assert (fabel_direct(x) == 0).all()

    assert (iabel_direct(x) == 0).all()
예제 #3
0
파일: test_direct.py 프로젝트: rth/PyAbel
def test_direct_shape():
    if not cython_ext:
        raise SkipTest
    n = 21
    x = np.ones((n, n))

    recon = fabel_direct(x)

    assert recon.shape == (n, n) 

    recon = iabel_direct(x)

    assert recon.shape == (n, n)
예제 #4
0
def test_direct_shape():
    if not cython_ext:
        raise SkipTest
    n = 21
    x = np.ones((n, n))

    recon = fabel_direct(x)

    assert recon.shape == (n, n)

    recon = iabel_direct(x)

    assert recon.shape == (n, n)
예제 #5
0
파일: test_direct.py 프로젝트: rth/PyAbel
def test_forward_direct_gaussian():
    """Check fabel_direct with a Gaussian"""
    if not cython_ext:
        raise SkipTest
    n = 51
    r_max = 25

    ref = GaussianAnalytical(n, r_max, symmetric=False,  sigma=10)

    recon = fabel_direct(ref.func, dr=ref.dr)

    ratio = absolute_ratio_benchmark(ref, recon, kind='direct')

    assert_allclose(ratio, 1.0, rtol=7e-2, atol=0)
예제 #6
0
def test_forward_direct_gaussian():
    """Check fabel_direct with a Gaussian"""
    if not cython_ext:
        raise SkipTest
    n = 51
    r_max = 25

    ref = GaussianAnalytical(n, r_max, symmetric=False, sigma=10)

    recon = fabel_direct(ref.func, dr=ref.dr)

    ratio = absolute_ratio_benchmark(ref, recon, kind='direct')

    assert_allclose(ratio, 1.0, rtol=7e-2, atol=0)
예제 #7
0

n = 101
r_max = 30
sigma = 10

ref = GaussianAnalytical(n, r_max, sigma, symmetric=False)

fig, ax = plt.subplots(1,2)

ax[0].set_title('Forward transform of a Gaussian')
ax[1].set_title('Inverse transform of a Gaussian')

ax[0].plot(ref.r, ref.abel, 'b', label='Analytical transform')

recon = fabel_direct(ref.func, dr=ref.dr, correction=True, backend='C')
ax[0].plot(ref.r, recon , '--o',c='red', label='direct')
recon = fabel_direct(ref.func, dr=ref.dr, correction=True, backend='Python')
ax[0].plot(ref.r, recon , ':d', c='k', label='direct naive')


ax[1].plot(ref.r, ref.func, 'b', label='Original function')

recon = iabel_direct(ref.abel, dr=ref.dr, correction=True)
ax[1].plot(ref.r, recon , '--o', c='red', label='direct')
recon = iabel_direct(ref.abel, dr=ref.dr, correction=False)
ax[1].plot(ref.r, recon , ':d', c='k', label='direct - naive')

for axi in ax:
    axi.set_xlim(0, 20)
    axi.legend()