Vorpy
A Python package for (usually math-related) code that I've written that finds use over and over.
Vorpy is short for "VictOR dods' PYthon package". Plus if you Google "vorpy", you come up with some pretty hilarious shit, so it seems like a good name choice.
Contents
- vorpy : The root module for the vorpy package.
- vorpy.apply_along_axes : Multi-dimensional
generalization of
numpy.apply_along_axis. - vorpy.pickle : A module which facilitates disk-based caching of data via pickle files. Useful when using data that is time-consuming to generate but does not often change.
- vorpy.symbolic : Symbolic calculus module. This module eases
use of
sympy, facilitating the use of vector/tensor calculus (vianumpy.ndarrays of symbols), and which allows compilation of symbolic functions into Python code, caching the generated code if desired. That process is known as 'lambdification' insympy. Take a look at thecached_lambdifiedfunction within this source. - vorpy.symplectic_integration : Module implementing symplectic integrators; available is a family of separable Hamiltonian integrators and a nonseparable Hamiltonian integrator.
- vorpy.tensor : Module providing functions for working with tensor values, notably the
contractfunction, which does the same thing asnumpy.einsumbut allowsdtype=object.
How to Install
Vorpy can be installed via pip using the following command:
pip install vorpy
Or, it can be installed directly from this github.com repository using the following command:
pip install --upgrade git+https://github.com/vdods/vorpy.git
Installation can also be made from a local copy of the vorpy package repo:
pip install --upgrade path/to/vorpy
where path/to/vorpy is the root directory of the project; the path containing setup.py (as well as this README.md file). Apropos: see pip install --editable <path/url>
To uninstall, use the following obvious command:
pip uninstall vorpy
A tarball of a particular tagged version can be obtained from github using a particular link. The latest version, with
git tag v0.4.3, can be downloaded from:
https://github.com/vdods/vorpy/archive/v0.4.3.tar.gz
Extracting this will create and populate the vorpy-0.4.3 directory.
Running Tests
The suite of unit tests can be run via the command:
python setup.py test
Release Notes
0.9.0: Addedintegrate_tangent_flow, added stuff tovorpy.tensorandvorpy.symplectic, added code for Bernstein polynomials and Bezier curves, some experimental work on strongly typed manifolds concepts, and a bunch of other miscellaneous work and improvements.0.8.0: Added thevorpy.linalgmodule.0.7.0: Modification to the symbolic polynomial generating functions.0.6.0: Added thevorpy.manifoldandvorpy.symplecticmodules, which implement some basic calculus in those categories.0.5.1: Fixed a bug where the Python 2reducewas moved to thefunctoolsmodule, and so caused a NameError in Python 3.0.5.0: Addedvorpy.tensor.0.4.3: More updates to be able to submit topypi. Made tests generate files to thetest_artifactsdirectory.0.4.2: Updates to be able to submit topypi-- the Python Package Index. Also a minor exception printing improvement.0.4.1: Changedvorpy.pickleto use thedillmodule (which can pickle lambda expressions) instead of the builtinpicklemodule.0.4.0: Addedvorpy.pickle.0.3.1: Added a means to salvage results from symplectic integration if an exception is raised during integration.0.3.0: Addedvorpy.symplectic_integration.nonseparable_hamiltonian.0.2.0: Addedvorpy.symplectic_integration.separable_hamiltonian.0.1.0: Addedvorpy.apply_along_axes.0.0.0: Initial release. Addedvorpy.symbolic.
To-Do List
-
Maybe use boost's python numpy stuff to write C++ using numpy constructs (ndarray) -- https://jitcode.readthedocs.io/en/v1.4.0/
-
Look into using JiTCODE to make fast numerics -- https://jitcode.readthedocs.io/en/v1.4.0/
-
Use L^inf norm for local truncation error estimate, instead of L^2 norm. This should be faster to compute.
-
Need to add a shape check in
vorpy.symbolic.lambdifiedto verify that the argument has the expected shape. Ran into a hard-to-find bug that was the result of passing in the wrong shape and it happily not complaining. -
Make a version of
vorpy.tensor.contractwhich allows for general contractions, instead of fixed letter-based contractions. -
Reorganize module structure to reflect the category theory of the subjects (e.g.
vorpy.manfor the category of manifolds,vorpy.vecfor the category of vector spaces,vorpy.man.symplfor the category of symplectic manifolds,vorpy.man.riemfor the category of Riemannian manifolds, etc). -
Add parsing of 'ij,kl->iljk' style string (as in
numpy.einsum) tovorpy.tensor.contract, which will just replace theoutputkwarg. -
Make sure
testsdoesn't get installed (it looks like it is). OR, put tests under vorpy module (this is probably better). -
Look into using pytorch for faster numerics.
-
Consolidate vorpy.symbolic.multiindex_iterator and vorpy.tensor.multiindex_iterator (probably use the one in symbolic because it looks fancier, but it does belong within the vorpy.tensor module).
-
Include tests in the dist package, so they can be tested at the install site.
-
Make the
symbolicmodule aware of vectorized operations so that fastnumpy-implementedndarrayfunctions can be used instead of structure-forgetting symbolic expressions that are fully written out. For example, the 1st and 2nd total derivatives of a quadratic form are simply matrix expressions which have simplenumpyexpressions. -
Verify that
vorpy.apply_along_axesis automatically parallelized. -
Require
numpy.ndarrayortuplebe the type of the input array(s) forapply_along_axes, so that extra parens to form a trivial tuple are not necessary in the basic case where there is a single input array. -
In
apply_along_axes, allow the base case whereinput_array_v[0].shape == ()andinput_axis_v == []. -
Increasing the order of Tao's nonseparable Hamiltonian integrator doesn't actually do what it should, even when using very small timesteps (expected behavior is that the error is orders smaller, but what actually happens is that it's of the same order as say order=2). Examine why this is happening (perhaps published version of Tao paper is updated with correction).
-
Create a [symplectic] integrator using the Jacobi-Maupertuis principle.
-
Specify an upper bound for integrator on H error, which abs(H - H(qp(0))). When computing the next step, if the H error is above the upper bound, recompute that step with a lower dt. This will involve defining a search strategy for dt that doesn't make it too small.
-
Move
PendulumNdandKeplerNdfrom tests dir into vorpy and write tests to symbolically verify all the formulas are correct. The goal would be to create more of these to provide a whole family of dynamical systems that can be used and experimented with. -
Have tests create a
test_artifactssubdir which all files that the tests produce are put in, so there's an easy single thing to delete after tests run (or tests can clean this up themselves). -
Switch to pytest.
-
For
sys.stderr.write-based warnings, create a flag that can be set within thevorpymodule to silence them. -
Use
hashlibfor data caching layer on top ofvorpy.pickle. -
Make a human-readable hash, which concatenates words to represent elements of a hash space. This should be convertable to/from a binary string. Examples:
StupidlyWalkingPerson BigThing TreeMaybe also tack on the remaining bits to the end as a decimal or hex number. Examples:
StupidlyWalkingPersonA07BE5 Tree10034See this.
-
Use hashing in
vorpy.symbolic.cached_lambdifiedon what gets lambdified so that changes to the function automatically cause the cache to be updated. -
Make a module that provides a nice abstraction for concurrent.futures.ProcessPoolExecutor for parallel processing.
-
Allow multiply-nested dirs for cache_dirname in cached_lambdified -- this would correspond to multiply-nested modules for the cached code. Use os.makedirs instead of os.mkdir
References
-
[http://docs.python-guide.org/en/latest/writing/structure/]
-
[https://en.wikipedia.org/wiki/Symplectic_integrator]
-
[https://en.wikipedia.org/wiki/Energy_drift]
-
[https://journals.aps.org/pre/abstract/10.1103/PhysRevE.94.043303] - Molei Tao - Explicit symplectic approximation of nonseparable Hamiltonians: Algorithm and long time performance
-
The package index for dill (which is imported by
vorpy.pickle) makes the following request:If you use dill to do research that leads to publication, we ask that you acknowledge use of dill by citing the following in your publication: M.M. McKerns, L. Strand, T. Sullivan, A. Fang, M.A.G. Aivazis, "Building a framework for predictive science", Proceedings of the 10th Python in Science Conference, 2011; http://arxiv.org/pdf/1202.1056 Michael McKerns and Michael Aivazis, "pathos: a framework for heterogeneous computing", 2010- ; http://trac.mystic.cacr.caltech.edu/project/pathos Please see http://trac.mystic.cacr.caltech.edu/project/pathos or http://arxiv.org/pdf/1202.1056 for further information.
Metadata
Release files for vorpy 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vorpy-0.9.0.tar.gz | 97.0 kB | Without provenance | Details for vorpy-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vorpy-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for vorpy-0.9.0-py3-none-any.whl |
Total release size: 206.0 kB
Release files / vorpy-0.9.0.tar.gz
| Download URL | vorpy-0.9.0.tar.gz |
|---|---|
| Size | 97.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1841ae86c6af97a7fa7764fa04ca089984381fdd522623793b078579f988bf4d
|
|
BLAKE2b-256 checksum How to use checksums |
d1b81f6ea31562496d275184f8c58caba30edb84ac65a23b7b1fa1b8935d7f91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.20.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9
|
Release files / vorpy-0.9.0-py3-none-any.whl
| Download URL | vorpy-0.9.0-py3-none-any.whl |
|---|---|
| Size | 109.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85a4ba67b60308761b299c07273c2cadea3e796ac7dc3498d9c648667d5e564a
|
|
BLAKE2b-256 checksum How to use checksums |
8b411a79d0a023eb281633e592cfac9dc2c017ddf13c22a04104ed48fdf44747
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.20.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9
|
Security for vorpy 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.