Skip to main content

RoughPy

RoughPy is a package for working with streaming data as rough paths, and working with algebraic objects such as free tensors, shuffle tensors, and elements of the free Lie algebra.

This library is currently in an alpha stage, and as such many features are still incomplete or not fully implemented. Please bear this in mind when looking at the source code.

Please refer to the documentation and to the examples folder for details on how to use RoughPy. If you want to implement more complex functions built on top of RoughPy, you may also want to check out the roughpy/tensor_functions.py file to see how the "LOG" function is implemented for free tensor objects.

Important

This release is expected to be one of the last minor releases before a major overhaul of RoughPy. We expect the next major release to introduce substantial interface changes as the library evolves. If you are building new code against RoughPy today, please be aware that some APIs and usage patterns are likely to change significantly in the forthcoming major version.

Installation

RoughPy can be installed from PyPI using pip on Windows, Linux, and MacOS (Intel based Mac only, sorry not Apple Silicon support yet). Simply run

pip install roughpy

to get the latest version.

Alternatively, the wheel files can be downloaded from the Releases page.

Installing from source

RoughPy can be installed from source, although this is not the recommended way to install. The build system requires vcpkg in order to obtain the necessary dependencies (except for MKL on x86 platforms, which is installed via pip). You will need to make sure that vcpkg is available on your system before attempting to build RoughPy. The following commands should be sufficient to set up the environment for building RoughPy:

git clone https://github.com/Microsoft/vcpkg.git tools/vcpkg
tools/vcpkg/bootstrap-vcpkg.sh
export CMAKE_TOOLCHAIN_FILE=$(pwd)/tools/vcpkg/scripts/buildsystems/vcpkg.cmake

With this environment variable set, most of the dependencies will be installed automatically during the build process.

You should now be able to pip install either using the PyPI source distribution (using the --no-binary :roughpy: flag), or directly from GitHub (recommended):

pip install git+https://github.com/datasig-ac-uk/RoughPy.git

It will take some time to build.

Intervals in RoughPy

RoughPy is very careful in how it works with intervals. One design goal is that it should be able to handle jumps in the underlying signal that occur at particular times, including the beginning or end of the interval, and still guarantee that if you combine the signature over adjacent interval, you always get the signature over the entire interval. This implies that there has to be a decision about whether data at the exact beginning or exact end of the interval is included. The convention in RoughPy are that we use clopen intervals, and that data at beginning of the interval is seen, and data at the end of the interval is seen in the next interval. A second design goal is that the code should be efficient, and so the internal representation of a stream involves caching the signature over dyadic intervals of different resolutions. Recovering the signature over any interval using the cache has logarithmic complexity (using at most 2n tensor multiplications, when n is the internal resolution of the stream). Resolution refers to the length of the finest granularity at which we will store information about the underlying data. Any event occurs within one of these finest granularity intervals, multiple events occur within the same interval resolve to a more complex log-signature which correctly reflects the time sequence of the events within this grain of time. However, no query of the stream is allowed to see finer resolution than the internal resolution of the stream, it is only allowed to access the information over intervals that are a union of these finest resolution granular intervals. For this reason, a query over any interval is replaced by a query is replaced by a query over an interval whose endpoints have been shifted to be consistent with the granular resolution, obtained by rounding these points to the contained end-point of the unique clopen granular interval containing this point. In particular, if both the left-hand and right-hand ends of the interval are contained in the clopen granular interval, we round the interval to the empty interval. Specifying a resolution of 32 or 64 equates to using integer arithmetic.

Support

If you have a specific problem, the best way to record this is to open an issue on GitHub. We welcome any feedback or bug reports.

Contributing

In the future, we will welcome pull requests to implement new features, fix bugs, add documentation or examples, or add tests to the project. However, at present, we do not have robust CI pipelines set up to rigorously test incoming changes, and therefor will not be accepting pull requests made from outside the current team.

Contributors

The full list of contributors is listed in THANKS alongside this readme. The people mentioned in this document constitute The RoughPy Developers.

License

RoughPy is licensed under a BSD-3-Clause license. This was chosen specifically to match the license of NumPy.

Changelog

Version 0.3.0

  • Added wheel-installed roughpy_compute headers and Python get_include() helpers so downstream projects can locate RoughPy's packaged headers.
  • Added a README notice that this release is likely to be one of the last minor releases before a larger interface overhaul.
  • Corrected the lead-lag transform for TickStream (@feelingsonice PR #299)
  • Added VSCode .devcontainer settings for containerised developer environment for debugging tests. See .devcontainer/README.md for instructions (@alexallmont #148)

Version 0.1.2

  • Documentation is now in sync with the main branch (@philipparubin PR #85)
  • Fixed a fault when constructing with larger than expected array (Issue #70, @inakleinbottle PR #72)
  • Updated README to remove old information, users should now read roughpy.org (Issue #74, @inakleinbottle PR #71, #78)
  • Fixed degree argument on basis size function (Issue #75, @inakleinbottle PR #79)
  • Fixed unknown keyword arguments not flagged (Issue #77, @inakleinbottle PR #81)
  • Fixed partition intermediates unchecked by Python constructor (Issue #80, @inakleinbottle PR #82)
  • Fixed path constructors now accept Lies (Issue #83, @inakleinbottle PR #87)

Version 0.1.1:

  • Fixed type promotions in scalar arithmetic - left hand types are now promoted when appropriate.
  • Added "tensor_functions" module for implementing additional functions on tensors. Currently only Log is implemented.
  • Fixed a few bugs in the build system

Version 0.1.0:

  • Added framework for integrating device support and redesigned scalars module to accommodate the changes.
  • Made changes to type deduction in constructors to avoid exceptions when providing lists of python ints/floats.
  • Changed the implementation of array for algebra types. A copy is always made, and the size of the array is always equal to the dimension of the chosen width/depth composition.
  • Changed the behaviour when no resolution is given. RoughPy now uses a heuristic to compute a suitable resolution for computing signatures if none is given.

Version 0.0.8:

  • Disabled linking to BLAS/LAPACK to reduce compile times whilst under development.
  • Greatly expanded the serialization support internally.
  • Many classes can now be pickled/unpickled for transport across process boundaries. (Note that this is not yet a safe means of storing and transmitting stream data.)
  • Overlay triplets are now forced for all builds. This should improve reproducibility.
  • Restructured the algebra module to improve build times.
  • Added CMake detection of headers to help builds with non-compliant compilers.
  • Fixed an error in the construction of PyLieKey in PyLieKeyIterator. #40

Version 0.0.7:

  • Overhaul the (internal) ScalarType API: . the overloads of convert_copy have been removed in favour of the variant that takes two ScalarPointers; . the single versions of add(_inplace) and friends have been replaced with more flexible add_into; batch compute methods and friends; . replaced single value uminus with uminus into with similar signature to to add_into and friends; . removed single value copy method;
  • Added constructor for ScalarPointer from type_id and pointer.
  • Implementations of ScalarType methods that are essentially the same for all types are implemented in a common implementation layer.
  • Added threading support in platform
  • add_into and friends have threading support if available and enabled.
  • Added default implementation of type_id_of so that non-specialized types look for a ScalarType object.
  • Greatly simplified the design of ScalarMatrix - it now only supports full, dense matrices.
  • Redesigned the interface between the Scalar linear algebra and MKL/BLAS+LAPACK.
  • Added function to query ring characteristics of a ScalarType - currently unused.
  • Added KeyScalarStream for constructing streams from array-like data more easily.
  • Implemented the from_type_details function for scalar types. This fixes a bug when constructing objects using the dlpack protocol.
  • Overhaul constructor for LieIncrementStreams from increment data to reduce number of copies (if possible) and to handle non-contiguous or oddly shaped data correctly.
  • Change implementation of LieIncrementStream to allow adding the parameter channel during construction.
  • Change implementation of TickStream to allow adding parameter channel during construction.

Version 0.0.6:

  • Externally sourced streams (sound-file streams) now support setting channel types/schema in factory function.
  • Added option for customising file name macro in exception throws.
  • Made some improvements to the internal interface of ScalarType to allow more efficient implementations of vectorised operations.
  • Added fast "is_zero" method to Python algebra objects.

Version 0.0.5:

  • Added free functions for performing free-tensor, shuffle, half-shuffle multiplication between pairs of tensors (of either kind).
  • Added free function for applying the adjoint of left free tensor multiplication to arbitrary tensors.
  • Improved exception usage, messages now include filename, lineno, and function name to help locate c++ exceptions passed through to Python.
  • Basis objects in Python are now iterable.
  • Added split_n and to_index methods to Tensor key.

Version 0.0.4:

  • Overhauled the RPY_CHECK macro so it now gives much better contextual information.
  • Readme updated to reflect PyPI installation with wheels.
  • Antipode is now implemented in libalgebra_lite, and exposed to Python for Free tensors.
  • Streams now carry a support interval, outside of which the signature will be return trivial.
  • Build requirements fixed for non x86 platforms.
  • Expanded coverage of pytype stub file.

Version 0.0.3:

  • Added datetime interval support.
  • Integrated schema reparametrisation into stream signature methods.
  • Fixed bug in names of scalar types, names now display correctly.
  • Fixed bfloat16 given wrong scalar type code.
  • Added half precision float and bfloat16 to py module
  • Added real partition class and Python interface.
  • Implemented simplify method on Streams.
  • Added polynomial coefficients
  • started an examples folder

Version 0.0.2-alpha:

  • Added datetime and timedelta object support to tick data parsing.
  • Expanded build system to include more versions of Python.
  • Stabilised compilation on all three platforms.
  • Fixed numerous bugs in the build system.

Version 0.0.1-alpha:

  • First alpha release.

Release files for RoughPy 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RoughPy 0.3.0
File Size Uploaded
roughpy-0.3.0.tar.gz 1.3 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for RoughPy 0.3.0
File
roughpy-0.3.0-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
roughpy-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
roughpy-0.3.0-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
roughpy-0.3.0-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
roughpy-0.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
roughpy-0.3.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
roughpy-0.3.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
roughpy-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
roughpy-0.3.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
roughpy-0.3.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
roughpy-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
roughpy-0.3.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
roughpy-0.3.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
roughpy-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
roughpy-0.3.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 59.5 MB

Release files / roughpy-0.3.0.tar.gz

Download URL roughpy-0.3.0.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
db5d5ee5319c504603061687756c7f88cdd28a3103b58ecc01a411e98dfa0119
BLAKE2b-256 checksum
How to use checksums
5b554fe9b66e60adfd93e208924364b45e1684d3014f11bb1d466daf42a3ddbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp314-cp314t-win_amd64.whl

Download URL roughpy-0.3.0-cp314-cp314t-win_amd64.whl
Size 3.4 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
874841610275cff8553cf462c6fb0e595c32e518a1ef8e4bd3ce0f866234cf2e
BLAKE2b-256 checksum
How to use checksums
14d78491bf2bb937fc6af47c535bfa8b7b1c445ec235217fff242086a8b482e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL roughpy-0.3.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 4.9 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
27244a3da0347d4511e463c326516a849ddde0eec49681cf682e2a8bc523d5f5
BLAKE2b-256 checksum
How to use checksums
a9cc73efe95cbd597a65d41a0da43ca02f53f2423ae0c20650b6ff3a2dc55581
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp314-cp314t-macosx_11_0_arm64.whl

Download URL roughpy-0.3.0-cp314-cp314t-macosx_11_0_arm64.whl
Size 3.4 MB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e263bbaf7342113c067a8e442a1c3bc6e9cd9bcb6544d9e4e042f247da28ebc6
BLAKE2b-256 checksum
How to use checksums
5299c8597e0a89b85894946211d5a3a1ac5c494581bd8aa6335d18a1381f0de3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp314-cp314-win_amd64.whl

Download URL roughpy-0.3.0-cp314-cp314-win_amd64.whl
Size 3.4 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
770cc1a50e0b656884b91c9a6fcaafdc9c03691e06cce5b9395c7d00de13c7aa
BLAKE2b-256 checksum
How to use checksums
77c2ba9a99baf5c8ee2352309da400a055b91f0d2244e8eb939903f504946807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL roughpy-0.3.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.0 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
31ee7bb9d1c27c78fd34a5d909d50e0478ad9546838c2975f4a844cfda3a6964
BLAKE2b-256 checksum
How to use checksums
f639f7f09fe7820688723cfff9feab69bc4793643f9ee3248002bf3bf966d23a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL roughpy-0.3.0-cp314-cp314-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
94ae43cb931041e88ab41381bcdb5cad8abeb4415e70eebbc6d38d50fc85a856
BLAKE2b-256 checksum
How to use checksums
64c3ed376e55f5c7d3cfb7d51b05c53efe0625924c654aabd7c1f1c6455cd757
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp313-cp313-win_amd64.whl

Download URL roughpy-0.3.0-cp313-cp313-win_amd64.whl
Size 3.3 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
53a7a15fa80f352651503e9b23070c04d86e0f8200931d8dcd2a7e5e5d5d91f9
BLAKE2b-256 checksum
How to use checksums
323fb0965a8173d90dbdfd8baf1a9fb178b23f5ca74e9ccee15f591650d49a7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL roughpy-0.3.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.0 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3ccaeeace6b6e72db02e00c38c19c55bfe40b9d08347ef69225a0db06778647c
BLAKE2b-256 checksum
How to use checksums
e10252cbe5b1cb8331bf4bddfdcc283142c8f0a9a06d5e0f8aa5581a445b60ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL roughpy-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e866096a640e3fc09ea60cac308bd591aa5a82079f79dcf22bf6484b0a307404
BLAKE2b-256 checksum
How to use checksums
06d4afe59b3547ec07c6f2413e09407b8223f4a6f3b2876f3c6c8eb277be2c8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp312-cp312-win_amd64.whl

Download URL roughpy-0.3.0-cp312-cp312-win_amd64.whl
Size 3.3 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
efcf9edfaf22a5380f5b5f81ac4aaee515b56612a2f358366494cd87915daa3e
BLAKE2b-256 checksum
How to use checksums
7915f4a3283e6440f6e974b6f4ce77af1562594cad4d091fc35c26ab0afde7cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL roughpy-0.3.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.0 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6f59328905a6f9a033dbc5dab8193d4d7e554592d296f3bbb2d6330d44946e33
BLAKE2b-256 checksum
How to use checksums
f5aefcd9650b9fcc4bd16bf9a15169de2ae9934ce8d37b81a13a9f53767e74af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL roughpy-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a2d11e54a36b32ca7718d1b1e21e87bf413f71a9899801a0dc46e1257a8a745a
BLAKE2b-256 checksum
How to use checksums
ee967d3ba6a9c742aa4d013d042d410159b935f6c31046daaa01d21b569d0372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp311-cp311-win_amd64.whl

Download URL roughpy-0.3.0-cp311-cp311-win_amd64.whl
Size 3.3 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
0109ae64a77ac1c90d87185fbb93b543e68b166252010a18de1b1992f09698e1
BLAKE2b-256 checksum
How to use checksums
8d157ab6dc01ea65d2e8919309776207518e39c9d7dab7d066689dfd43e5c2d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL roughpy-0.3.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.0 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
c5724832ca986704a0df607c919b9f263e44edb1dd393f5079939c011a80aad0
BLAKE2b-256 checksum
How to use checksums
521621e0b4ef28da5f0396616332dcd0c74912db66659b71f73fd9ad1cd21b30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / roughpy-0.3.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL roughpy-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
37a3c9b0aaf8c623732c27bbae5054befa2fd536bace6b376c04471215fc3079
BLAKE2b-256 checksum
How to use checksums
04813be1e66bfdcf993fa78b6bd2818c04d9072efbc62f4270b115cea05a556c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page