Fast utility functions useful for Fourier Ring/Shell Correlation: binomial splitting of arrays.
Project description
rustfrc
rustfrc is a Python package with some fast Rust functions for use with FRC resolution determination for microscopy. It is in development for use during a Bachelor end project for the TU Delft in 2021-2022.
Since rustfrc contains compiled extensions and is not pure Python, it is not available for all platforms, but only for those with available compiled wheels. They are available for Windows (x86_64), macOS (x86_64 and universal2, which includes Apple Silicon) and Linux (x86_64). However, since Rust and Python are supported on many platforms, it is not difficult to compile for other platforms (see below).
Features
Currently, rustfrc does not have many features. The primary one is binom_split(x: np.ndarray) -> np.ndarray
which samples Binom ~ (n, 0.5) with n as the array element value. The operation is fully parallelized and somewhere between 3-10x faster than sampling using NumPy.
Requirements
- Python 3.7 or greater
- NumPy 1.18 or greater
Installation
You can most easily install rustfrc as follows:
pip install rustfrc
However, for an optimal Python experience, use poetry and install it using poetry add rustfrc
.
From source (using maturin)
rustfrc uses poetry as its Python dependency manager. For best results, create a poetry
virtualenv (be sure to install virtualenv as a systems package) with the pyproject.toml
and run poetry update
to install the required packages.
Installing maturin manually should also work. It is also necessary to have a Rust toolchain installed on your computer. Rust can be easily installed using rustup.
Build a wheel file like this (if using poetry, append poetry run
before the command) from the project directory:
maturin build --release
If you want to choose which versions of Python to build for, you can write e.g. maturin build --release -i python3.9 python3.8 python3.7
. Here, for example 'python3.7
' should be an available Python command installed on your computer.
This generates .whl
files in \target\wheels
. Then, create a Python environment of your choosing (with numpy ^1.18
and python ^3.7
), drop the .whl
file in it and run pip install <.whl filename>
, for example: pip install rustfrc-0.1.0-cp39-none-win_amd64.whl
. Then, use import rustfrc
in your Python script to be able to use the Rust functions. This should be generally valid for all platforms. The only real requirement is the availability of a Rust toolchain and Python for your platform.
Take a look at PyO3 for other installation options as the only true requirement for building is using a tool that understands PyO3 bindings, as those are used in the Rust code.
Manylinux
If you want to build .whl files that are compatible with a wide range of Linux distributions and can be uploaded to PyPI, using a manylinux container is necessary.
This example assumes a manylinux2014 (x86_64) target, using other docker base images should work to compile for other targets. Go into the rustfrc/docker
directory and run:
docker pull quay.io/pypa/manylinux2014_x86_64
docker build --no-cache -t tmtenbrink/manylinux2014-rustfrc --build-arg PY_ABI=cp39-cp39 .
After the image is built, run it as a container:
docker run -it tmtenbrink/manylinux2014-rustfrc
The repository should now be installed at /opt/rustfrc
, with its dependencies and maturin
installed. Then follow the same steps as above, but when the wheels are built run the following, which should resolve any issues:
find . -name '*.whl' -exec auditwheel repair {} \;
The complete wheel files can now be found in a /wheelhouse
directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for rustfrc-1.0.3-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82d02bb5a432e4aa4328da2e7eedddb58f2962b0553645e33d9198fab2c24dae |
|
MD5 | acfde368303c9f6ebe9f8ced8b13cc6a |
|
BLAKE2b-256 | bcd9a896eccf66bff31ec2a78eb897e2ce657bec8f7ce87033ac57fbdd466cb8 |
Hashes for rustfrc-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5cb7538776d514b323aa25ab9d4dbf5875daad9891a97ca40f63d7a0e478dd20 |
|
MD5 | 079a0eb7e53dd2d1ba3fd11f3febc228 |
|
BLAKE2b-256 | 19f382785aa55f4ece8a50fb4242d43eba529cd96318691d051e4ddc59ed534b |
Hashes for rustfrc-1.0.3-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46689238d4d00f1f7e759eb22542ad42263a2ecee111fae7b2c8283eb6ca73e1 |
|
MD5 | cbfc6be342542851af32fcc015389dc2 |
|
BLAKE2b-256 | c153878f7dca54f6aa15c5d49031f4ae5ed335aee60ed0c9c9a51eb59fb84f94 |
Hashes for rustfrc-1.0.3-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f758deb085c504a141f170f9a4ef96888d45349ec33e94a9d09937447f32581d |
|
MD5 | ed0abb6b2a9dd57ef35a085f9482239d |
|
BLAKE2b-256 | e8510758e5db9398bc14221c09d10891b7fe02c8873d60f4a41a6e819eae07e3 |
Hashes for rustfrc-1.0.3-cp39-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4feccf8597bc4d9afee75d60dc52e80356cbde271101355c7fd587d58627f2a4 |
|
MD5 | a9d36691e179ea1eb78921046d5140bd |
|
BLAKE2b-256 | 52302b892d775f0bd7546d2937fc1b0ecd9c6bdd35b286300cf324d030381a56 |
Hashes for rustfrc-1.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5915ed66e28af07cd601305a5b0167b6a2d1d2a77c537cfd0c08ccb25e9dace |
|
MD5 | 0745141d77d79dcaf124e79d20068113 |
|
BLAKE2b-256 | 39f5d1b38c9fe1af63b5d4dee9cac5d804465453159c6cb12bb2c12d54b9d86f |
Hashes for rustfrc-1.0.3-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81f46bf69cdcaaadc62a90196b134763d1672337824e5ac6797bebe4c9ee41e5 |
|
MD5 | c54413aef6f60d58a9b1207671cca192 |
|
BLAKE2b-256 | 5750d2bde93c1e34e14700bfd8ed6a24ecefb45d8c9d543aa6e7c1cefb8468a4 |
Hashes for rustfrc-1.0.3-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b70e2aa0b8e155745be9cfc61dafdc9c82009f2be685c7a491d27824019849da |
|
MD5 | dc2e0be1576b9061c564ce8f57b6b533 |
|
BLAKE2b-256 | b9c6d2132c7815143f0519662eb18a4a06bff1d1161d2a98f4a6c97b969e38ae |
Hashes for rustfrc-1.0.3-cp38-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1da0e490c9e0221696c076964b69972593b9dbd799d2ae165d29e2fc83dda78b |
|
MD5 | 5260dc4972da4930be126f5897551927 |
|
BLAKE2b-256 | a88fde804540442850c7626d8de0ae938e122b9cee3590726b5305fb3f2f7b91 |
Hashes for rustfrc-1.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72b6c3b8f4b95ddb981ef0115d331e437fef5526f8dbaf88202c3e80bd0fae1b |
|
MD5 | 2052c6a0bb09c2efead3eafa8c010c9d |
|
BLAKE2b-256 | fa1a11e9546cedcd671961e2aadfdaaa26147b4aa419a556621e4baf4a1e1726 |
Hashes for rustfrc-1.0.3-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f2e765d8aef2dbda4aa4f42444772301cc852aa1bb461c1ae87932df07a54b4 |
|
MD5 | 5b27cca78a6d1ff570fec6290710690d |
|
BLAKE2b-256 | d41de47a772fcd288e98605459c99ae17bf1ffdd0704dd17235010b68ca88345 |
Hashes for rustfrc-1.0.3-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f726d220185c21df429bae75fbb58fffe23cfa7f2a6bcf3b7ecb4b09123bc448 |
|
MD5 | 6557e2d2d31e08d38b2a260d4f0417cb |
|
BLAKE2b-256 | 01c06c00ee7be08ebe9ac3ba909592c270d2712f07f0290ac24f6ce14c9bcf6e |
Hashes for rustfrc-1.0.3-cp37-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 623d1c11e9c59ed5cf36a04c862d6f9207e33eda473558a2f3aabb2a2f26df00 |
|
MD5 | 5da2fd5b5236a457118f0a2d5e663483 |
|
BLAKE2b-256 | 54f6e79bdb3a21959d192e57f8a8b4b50b6f60ee79d354a0a3e535390fc37521 |
Hashes for rustfrc-1.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6bd68e28460b520c56bef18a3c80f9c63d21a7ea3887cc299edf382aeb15d72 |
|
MD5 | ba7dc619c7be470f1d00aa10edf54751 |
|
BLAKE2b-256 | 825368bb9b9a548cc49240b29f1401831cc3cfe2d493a7a11bf4b49ae1a3f7f7 |
Hashes for rustfrc-1.0.3-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e5c7dfd5a452350ec64a380027bdc08e1e8c6debb4cdbb50cb1de29a203523d |
|
MD5 | 1f18e2c92e400b9ffd9ccad06ac36b19 |
|
BLAKE2b-256 | 1c77540debca29fd92a51b8ce382d10d895265ca41baea53ecf5997e9df2faa5 |
Hashes for rustfrc-1.0.3-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 284ae125f6fe20c976e6a9862274edf0ce560e5541abfb6aeb7a4e27db4d67d5 |
|
MD5 | f269af13b1bd75e8b4e95e575e65a079 |
|
BLAKE2b-256 | 224cac3d12bc1800b3a33d8462bba784ccd40c1f69dec28c32afbb3100ac83cc |