Ejemplo n.º 1
0
def test_hilbert_replace_min_value():
    x = np.linspace(-100, 100, 1000)
    y = 2 / (2**2 + x**2)
    hilb_y = hilbertfft(y, pad_factor=10, min_value=100)
    hilb_y_analytical = x / (2**2 + x**2)
    assert_array_almost_equal(100, hilb_y, decimal=4)

    x = np.linspace(-100, 100, 1000)
    y = 2 / (2**2 + x**2)
    hilb_y = hilbertfft(y, pad_factor=10, min_value=0)
    hilb_y_analytical = x / (2**2 + x**2)
    assert_array_almost_equal(hilb_y_analytical, hilb_y, decimal=4)
Ejemplo n.º 2
0
def test_pyfftw_hilbert_no_pad():
    x = np.linspace(-100, 100, 1000)
    y = 2 / (2**2 + x**2)
    hilb_y = hilbertfft(y, pad_factor=0, use_pyfftw=True)
    hilb_y_analytical = x / (2**2 + x**2)
    print(hilb_y.shape)
    assert_array_almost_equal(hilb_y_analytical, hilb_y, decimal=2)
Ejemplo n.º 3
0
def test_hilbert_in_place():
    x = np.linspace(-100, 100, 1000)
    y = 2 / (2**2 + x**2)

    out = hilbertfft(y, pad_factor=10, copy=False)
    assert out is None

    hilb_y_analytical = x / (2**2 + x**2)
    assert_array_almost_equal(hilb_y_analytical, y, decimal=4)
Ejemplo n.º 4
0
def test_hilbert_pad():
    x = np.linspace(-100, 100, 1000)
    y = 2 / (2**2 + x**2)
    hilb_y = hilbertfft(y, pad_factor=10, use_pyfftw=False)
    hilb_y_analytical = x / (2**2 + x**2)
    assert_array_almost_equal(hilb_y_analytical, hilb_y, decimal=4)
Ejemplo n.º 5
0
def test_hilbert_pad():
    x = np.linspace(-100, 100, 1000)
    y = 2/(2**2 + x**2)
    hilb_y = hilbertfft(y, pad_factor=10, use_pyfftw=False)
    hilb_y_analytical = x/(2**2 + x**2)
    assert_array_almost_equal(hilb_y_analytical, hilb_y, decimal=4)