rustfrc
rustfrc is a Python package with some fast Rust functions that are useful when performing Fourier Ring Correlation (FRC) computations for resolution determination in microscopy (specifically optical nanoscopy). It was originally developed for use in a Bachelor end project for the TU Delft in the period 2021-2022. See the Python package frc for examples of its usage. The test_split.py file in the tests directory also holds some examples.
Since rustfrc contains compiled (Rust) extensions and is not pure Python, it is not available for all platforms, but only for those with available compiled wheels or a Rust toolchain and maturin support (see below). 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
rustfrc has only a few features. The primary one is binom_split(x: ndarray) -> ndarray which samples binomial (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.
Furthermore, there are also (since version 1.1) sqr_abs(a: ndarray) -> ndarray and pois_gen(lam: float, shape: tuple[int, ...]) -> ndarray.
sqr_abs computes the element-wise norm and square of a complex array, while pois_gen generates an array of the specified size using the Poisson distribution and a single parameter λ.
Requirements
- Python 3.8-3.12
- NumPy 1.18+ (exact version might depend on Python version, e.g. Python 3.12 requires NumPy 1.26)
Performance
On an i7-8750H, a decently high performance 6-core chip from 2017, I measured the following speeds:
binom_split: ~210 ms on a 4000x4000 array, with each element Poisson-generated with a mean of 200pois_gen: ~420 ms to generate a 4000x4000 array with mean 200sqr_abs: ~40 ms on a 4000x4000 array, where each element is a complex number with both the real and imaginary parts having a mean of 200
Take this with a grain of salt, but it should provide a decent order of magnitude for larger images.
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. I recommend installing maturin as a global tool (e.g. with cargo binstall).
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, take a look at the GitHub Actions files and pyo3/maturin-action.
Metadata
Release files for rustfrc 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 10.3 MB
Release files / rustfrc-1.1.5-cp312-none-win_amd64.whl
| Download URL | rustfrc-1.1.5-cp312-none-win_amd64.whl |
|---|---|
| Size | 223.5 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2113155e544ee498dcf51a14188dfb6e5d445d7e8ae2136535f64e1e489aaf45
|
|
BLAKE2b-256 checksum How to use checksums |
e7cff2859514a3e72a671225c38b46a380b1a2d2b4918c3a6c7dd8a6f0c56424
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rustfrc-1.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
6a53b3eb1d35c0d161ae657b566481da499558fcf808dae268300a1717bcff73
|
|
BLAKE2b-256 checksum How to use checksums |
b1c900c38c190da1730c62dbc8131f98e30172a0983472d17ba83675743eab66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | rustfrc-1.1.5-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 675.8 kB |
| Tags | CPython 3.12 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
424d9e299c1ace18fb739daa3ecea5f34e8b5cf8a795f77627ea6c2115ae4e43
|
|
BLAKE2b-256 checksum How to use checksums |
edc64bda3badd41d05889fc23db16698510b8b5426f1da9ed65c78ec80ee1deb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp311-none-win_amd64.whl
| Download URL | rustfrc-1.1.5-cp311-none-win_amd64.whl |
|---|---|
| Size | 226.0 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d50c42e8d905a1ffaccd2d97e00ad20db5c44ab9cc615b3915c648a7d6612997
|
|
BLAKE2b-256 checksum How to use checksums |
54954be5549d349786c7f7900dda46a5a9cb965a343861ddb36f5eb7c77e60a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rustfrc-1.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
3078eef7f415816b7423da57038b66d4742ab1ebbf1890038ea4c7dd376ed688
|
|
BLAKE2b-256 checksum How to use checksums |
835b326c9d894220c116cbbd829ffbd4dfb20ef7b75043cdfb751e56ca6526c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | rustfrc-1.1.5-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 684.2 kB |
| Tags | CPython 3.11 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fa910109c2043adc44331ec70418366d978d9bff6d4552d0ffca2f5374f48a40
|
|
BLAKE2b-256 checksum How to use checksums |
cdc11125b163ebca8b3f0a49a81d296a3c4f7f754b0e2a3a96aa197d9a8fe4d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp310-none-win_amd64.whl
| Download URL | rustfrc-1.1.5-cp310-none-win_amd64.whl |
|---|---|
| Size | 225.7 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0cc9685f1a5bded9ebe7624029544169dd72fc7f493892eea785578dfbb51c9f
|
|
BLAKE2b-256 checksum How to use checksums |
ce634cd0e829adc4b2778a7330308ac4fac1764f387640aeb7ea087aa0d9682e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rustfrc-1.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a03e2b1d660e7c5c63f962712899a522a79ee8b38114affb86139ded0971e06d
|
|
BLAKE2b-256 checksum How to use checksums |
2123c0e9d419d6ff4642a1fc3e6692fa6f695f6c2144babdd87584edf2f557f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | rustfrc-1.1.5-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 688.2 kB |
| Tags | CPython 3.10 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3773073d196ab2b4008eeeb81aaa2e89fe1ed2244425e7f40c489c1e06baaa26
|
|
BLAKE2b-256 checksum How to use checksums |
fc319a85b981b2e6f825b9a5a2b7015d8e3d338a37359b23c55d437dff8a1326
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp39-none-win_amd64.whl
| Download URL | rustfrc-1.1.5-cp39-none-win_amd64.whl |
|---|---|
| Size | 226.1 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
86b30f4dd94112ee50c7aa4cefc174678ccad7582943bec62f7a51e6f4e2cc58
|
|
BLAKE2b-256 checksum How to use checksums |
db5591659f9639df6090090c087d6595f3b8820271bdd410dddf32496219e995
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rustfrc-1.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
65dbbef19f6d4f5d86c66310bdbd1c01e49ce094943a5b047100f15c3e1d798f
|
|
BLAKE2b-256 checksum How to use checksums |
1731e5a6fda67529e1241cba0c766d59edacd314c22cee8cb44d7e41c6b6984a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | rustfrc-1.1.5-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 686.5 kB |
| Tags | CPython 3.9 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
824d6e8a6d69ee6946d5e95593f1711e265f628951127629a93ba08c7461b090
|
|
BLAKE2b-256 checksum How to use checksums |
447f254ef7b747003e580911db7d00152c22c8dd30202cb3a2f5145b6521ce90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp38-none-win_amd64.whl
| Download URL | rustfrc-1.1.5-cp38-none-win_amd64.whl |
|---|---|
| Size | 225.4 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2c6709c731000603951e9f8882106e7d91e46af4601d26e3da1acf66e06965b8
|
|
BLAKE2b-256 checksum How to use checksums |
84014d3423d59609dbb6476c6d60a8f94df1ee9eeb9d327f51ff2c116d970614
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | rustfrc-1.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
0e175c0680d3921bf9f1f0ac75585782e1aaa76cb0c3163537e2bdf9f248f093
|
|
BLAKE2b-256 checksum How to use checksums |
c7361f3b482f5b2a9362af706fae36c67a96779db7917cdcd4d266b815b94ebb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Release files / rustfrc-1.1.5-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | rustfrc-1.1.5-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 686.6 kB |
| Tags | CPython 3.8 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e39b32adf705b4df5a91d107367d1464d3519b9c9f65d31855ddd816b3cc6a1b
|
|
BLAKE2b-256 checksum How to use checksums |
97e6c55f64cc7c058ac42d140b0686bc3bd80882ad7d0fb8bf20d4e89e0c5f5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.5.1
|
Security for rustfrc 1.1.5
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.