コード例 #1
0
def test_spherical_conversions():
    """Test spherical harmonic conversions"""
    # Test our real<->complex conversion functions
    az, pol = np.meshgrid(np.linspace(0, 2 * np.pi, 30), np.linspace(0, np.pi, 20))
    for degree in range(1, int_order):
        for order in range(0, degree + 1):
            sph = _sph_harm(order, degree, az, pol)
            # ensure that we satisfy the conjugation property
            assert_allclose(_sh_negate(sph, order), _sph_harm(-order, degree, az, pol))
            # ensure our conversion functions work
            sph_real_pos = _sh_complex_to_real(sph, order)
            sph_real_neg = _sh_complex_to_real(sph, -order)
            sph_2 = _sh_real_to_complex([sph_real_pos, sph_real_neg], order)
            assert_allclose(sph, sph_2, atol=1e-7)
コード例 #2
0
def test_spherical_conversions():
    """Test spherical harmonic conversions"""
    # Test our real<->complex conversion functions
    az, pol = np.meshgrid(np.linspace(0, 2 * np.pi, 30),
                          np.linspace(0, np.pi, 20))
    for degree in range(1, int_order):
        for order in range(0, degree + 1):
            sph = _sph_harm(order, degree, az, pol)
            # ensure that we satisfy the conjugation property
            assert_allclose(_sh_negate(sph, order),
                            _sph_harm(-order, degree, az, pol))
            # ensure our conversion functions work
            sph_real_pos = _sh_complex_to_real(sph, order)
            sph_real_neg = _sh_complex_to_real(sph, -order)
            sph_2 = _sh_real_to_complex([sph_real_pos, sph_real_neg], order)
            assert_allclose(sph, sph_2, atol=1e-7)
コード例 #3
0
def test_spherical_harmonics():
    """Test spherical harmonic functions"""
    from scipy.special import sph_harm

    az, pol = np.meshgrid(np.linspace(0, 2 * np.pi, 30), np.linspace(0, np.pi, 20))
    # As of Oct 16, 2015, Anancoda has a bug in scipy due to old compilers (?):
    # https://github.com/ContinuumIO/anaconda-issues/issues/479
    if PY3 and LooseVersion(scipy.__version__) >= LooseVersion("0.15") and "Continuum Analytics" in sys.version:
        raise SkipTest("scipy sph_harm bad in Py3k on Anaconda")

    # Test our basic spherical harmonics
    for degree in range(1, int_order):
        for order in range(0, degree + 1):
            sph = _sph_harm(order, degree, az, pol)
            sph_scipy = sph_harm(order, degree, az, pol)
            assert_allclose(sph, sph_scipy, atol=1e-7)
コード例 #4
0
def test_spherical_harmonics():
    """Test spherical harmonic functions"""
    from scipy.special import sph_harm
    az, pol = np.meshgrid(np.linspace(0, 2 * np.pi, 30),
                          np.linspace(0, np.pi, 20))
    # As of Oct 16, 2015, Anancoda has a bug in scipy due to old compilers (?):
    # https://github.com/ContinuumIO/anaconda-issues/issues/479
    if (PY3 and LooseVersion(scipy.__version__) >= LooseVersion('0.15')
            and 'Continuum Analytics' in sys.version):
        raise SkipTest('scipy sph_harm bad in Py3k on Anaconda')

    # Test our basic spherical harmonics
    for degree in range(1, int_order):
        for order in range(0, degree + 1):
            sph = _sph_harm(order, degree, az, pol)
            sph_scipy = sph_harm(order, degree, az, pol)
            assert_allclose(sph, sph_scipy, atol=1e-7)