How to use quadpy - 10 common examples

To help you get started, we’ve selected a few quadpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / quadpy / test / test_sphere.py View on Github external
        (quadpy.sphere.heo_xu_21_3(), 1.0e-6),
        (quadpy.sphere.heo_xu_21_4(), 1.0e-6),
        (quadpy.sphere.heo_xu_21_5(), 1.0e-6),
        (quadpy.sphere.heo_xu_21_6(), 1.0e-6),
        (quadpy.sphere.heo_xu_23_1(), 1.0e-6),
        (quadpy.sphere.heo_xu_23_2(), 1.0e-6),
        (quadpy.sphere.heo_xu_23_3(), 1.0e-6),
        (quadpy.sphere.heo_xu_25_1(), 1.0e-6),
        (quadpy.sphere.heo_xu_25_2(), 1.0e-6),
        (quadpy.sphere.heo_xu_27_1(), 1.0e-6),
        (quadpy.sphere.heo_xu_27_2(), 1.0e-6),
        (quadpy.sphere.heo_xu_27_3(), 1.0e-6),
        (quadpy.sphere.heo_xu_29(), 1.0e-6),
        (quadpy.sphere.heo_xu_31(), 1.0e-6),
        (quadpy.sphere.heo_xu_33(), 1.0e-6),
        (quadpy.sphere.heo_xu_35(), 1.0e-6),
        (quadpy.sphere.heo_xu_37(), 1.0e-6),
github nschloe / quadpy / test / test_sphere.py View on Github external
        (quadpy.sphere.lebedev_029(), 1.0e-11),
        (quadpy.sphere.lebedev_031(), 1.0e-11),
        (quadpy.sphere.lebedev_035(), 1.0e-11),
        (quadpy.sphere.lebedev_041(), 1.0e-11),
        (quadpy.sphere.lebedev_047(), 1.0e-11),
        (quadpy.sphere.lebedev_053(), 1.0e-11),
        (quadpy.sphere.lebedev_059(), 1.0e-11),
        (quadpy.sphere.lebedev_065(), 1.0e-11),
        (quadpy.sphere.lebedev_071(), 1.0e-11),
        (quadpy.sphere.lebedev_077(), 1.0e-11),
        (quadpy.sphere.lebedev_083(), 1.0e-11),
        (quadpy.sphere.lebedev_089(), 1.0e-11),
        (quadpy.sphere.lebedev_095(), 1.0e-11),
        (quadpy.sphere.lebedev_101(), 1.0e-11),
        (quadpy.sphere.lebedev_107(), 1.0e-11),
        (quadpy.sphere.lebedev_113(), 1.0e-11),
        (quadpy.sphere.lebedev_119(), 1.0e-11),
github nschloe / quadpy / test / test_sphere.py View on Github external
        (quadpy.sphere.lebedev_003c(), 1.0e-11),
        (quadpy.sphere.lebedev_005(), 1.0e-11),
        (quadpy.sphere.lebedev_007(), 1.0e-11),
        (quadpy.sphere.lebedev_009(), 1.0e-11),
        (quadpy.sphere.lebedev_011(), 1.0e-11),
        (quadpy.sphere.lebedev_013(), 1.0e-11),
        (quadpy.sphere.lebedev_015(), 1.0e-11),
        (quadpy.sphere.lebedev_017(), 1.0e-11),
        (quadpy.sphere.lebedev_019(), 1.0e-11),
    ]
    + [
        (quadpy.sphere.stroud_u3_3_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_2(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_3(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_4(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_5(), 1.0e-13),
github nschloe / quadpy / test / test_sphere.py View on Github external
        (quadpy.sphere.stroud_u3_8_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_9_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_9_2(), 1.0e-13),
        (quadpy.sphere.stroud_u3_9_3(), 1.0e-13),
        (quadpy.sphere.stroud_u3_11_1(), 1.0e-13),
        # TODO fix equation system in 11_2 for higher precision
        (quadpy.sphere.stroud_u3_11_2(), 1.0e-12),
        (quadpy.sphere.stroud_u3_11_3(), 1.0e-13),
        (quadpy.sphere.stroud_u3_14_1(), 1.0e-13),
    ],
)
def test_scheme_cartesian(scheme, tol):
    def sph_tree_cartesian(x):
        azimuthal, polar = cartesian_to_spherical(x.T).T
        return numpy.concatenate(
            orthopy.sphere.tree_sph(
                polar, azimuthal, scheme.degree + 1, standardization="quantum mechanic"
github nschloe / quadpy / test / test_sphere.py View on Github external
        (quadpy.sphere.heo_xu_21_6(), 1.0e-6),
        (quadpy.sphere.heo_xu_23_1(), 1.0e-6),
        (quadpy.sphere.heo_xu_23_2(), 1.0e-6),
        (quadpy.sphere.heo_xu_23_3(), 1.0e-6),
        (quadpy.sphere.heo_xu_25_1(), 1.0e-6),
        (quadpy.sphere.heo_xu_25_2(), 1.0e-6),
        (quadpy.sphere.heo_xu_27_1(), 1.0e-6),
        (quadpy.sphere.heo_xu_27_2(), 1.0e-6),
        (quadpy.sphere.heo_xu_27_3(), 1.0e-6),
        (quadpy.sphere.heo_xu_29(), 1.0e-6),
        (quadpy.sphere.heo_xu_31(), 1.0e-6),
        (quadpy.sphere.heo_xu_33(), 1.0e-6),
        (quadpy.sphere.heo_xu_35(), 1.0e-6),
        (quadpy.sphere.heo_xu_37(), 1.0e-6),
        (quadpy.sphere.heo_xu_39_1(), 1.0e-6),
        (quadpy.sphere.heo_xu_39_2(), 1.0e-6),
    ]
github nschloe / quadpy / test / test_sphere.py View on Github external
        (quadpy.sphere.lebedev_095(), 1.0e-11),
        (quadpy.sphere.lebedev_101(), 1.0e-11),
        (quadpy.sphere.lebedev_107(), 1.0e-11),
        (quadpy.sphere.lebedev_113(), 1.0e-11),
        (quadpy.sphere.lebedev_119(), 1.0e-11),
        (quadpy.sphere.lebedev_125(), 1.0e-11),
        (quadpy.sphere.lebedev_131(), 1.0e-11),
    ]
    + [
        (quadpy.sphere.stroud_u3_3_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_2(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_3(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_4(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_5(), 1.0e-13),
        (quadpy.sphere.stroud_u3_7_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_7_2(), 1.0e-13),
github nschloe / quadpy / test / test_sphere.py View on Github external
        (quadpy.sphere.lebedev_003b(), 1.0e-11),
        (quadpy.sphere.lebedev_003c(), 1.0e-11),
        (quadpy.sphere.lebedev_005(), 1.0e-11),
        (quadpy.sphere.lebedev_007(), 1.0e-11),
        (quadpy.sphere.lebedev_009(), 1.0e-11),
        (quadpy.sphere.lebedev_011(), 1.0e-11),
        (quadpy.sphere.lebedev_013(), 1.0e-11),
        (quadpy.sphere.lebedev_015(), 1.0e-11),
        (quadpy.sphere.lebedev_017(), 1.0e-11),
        (quadpy.sphere.lebedev_019(), 1.0e-11),
    ]
    + [
        (quadpy.sphere.stroud_u3_3_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_1(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_2(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_3(), 1.0e-13),
        (quadpy.sphere.stroud_u3_5_4(), 1.0e-13),
github nschloe / quadpy / test / test_u3.py View on Github external
        quadpy.u3.heo_xu_39a(),
        quadpy.u3.heo_xu_39b(),
    ]
    + [
        quadpy.u3.lebedev_003a(),
        quadpy.u3.lebedev_003b(),
        quadpy.u3.lebedev_003c(),
        quadpy.u3.lebedev_005(),
        quadpy.u3.lebedev_007(),
        quadpy.u3.lebedev_009(),
        quadpy.u3.lebedev_011(),
        quadpy.u3.lebedev_013(),
        quadpy.u3.lebedev_015(),
        quadpy.u3.lebedev_017(),
        quadpy.u3.lebedev_019(),
    ]
    + [
github nschloe / quadpy / test / test_u3.py View on Github external
        quadpy.u3.heo_xu_27c(),
        quadpy.u3.heo_xu_29(),
        quadpy.u3.heo_xu_31(),
        quadpy.u3.heo_xu_33(),
        quadpy.u3.heo_xu_35(),
        quadpy.u3.heo_xu_37(),
        quadpy.u3.heo_xu_39a(),
        quadpy.u3.heo_xu_39b(),
    ]
    + [
        quadpy.u3.lebedev_003a(),
        quadpy.u3.lebedev_003b(),
        quadpy.u3.lebedev_003c(),
        quadpy.u3.lebedev_005(),
        quadpy.u3.lebedev_007(),
        quadpy.u3.lebedev_009(),
        quadpy.u3.lebedev_011(),
github nschloe / quadpy / test / test_u3.py View on Github external
max_err = numpy.max(err)

    assert k - 1 == scheme.degree, (
        f"{scheme.name} -- observed: {k - 1}, expected: {scheme.degree} "
        f"(max err: {max_err:.3e})"
    )


@pytest.mark.parametrize("scheme", [quadpy.u3.lebedev_007()])
def test_show(scheme):
    scheme.show()
    plt.close()


if __name__ == "__main__":
    scheme_ = quadpy.u3.Stroud("U3 5-2")
    # test_scheme(scheme_)
    test_scheme_spherical(scheme_, tol=1.0e-7)
    # test_show(scheme_)