rLIC
Line Integral Convolution for Python, written in Rust
rLIC (pronounced 'relic') is a highly optimized, minimal implementation of the
Line Integral
Convolution algorithm
for in-memory numpy arrays, written in Rust.
Development status
rLIC is currently in beta. As of version 0.5.0, the only public API,
rlic.convolve, is considered feature complete and stable. However, minor
behavior changes may still happen, particularly where performance can be
improved as a result. The library as a whole may still grow additional APIs,
which wouldn't immediately be marked as stable.
Free-threading support
rlic.convolve is trivially thread-safe, because it does not mutate any external
data. As of version 0.5.1, Wheels are not yet distributed for free-threaded
CPython, but this build target is still supported and tested.
Installation
python -m pip install rLIC
Examples
rLIC consists in a single Python function, rlic.convolve, that convolves a
texture image (usually noise) with a 2D vector field described by its
components u and v, via a 1D kernel array. The result is an image where
pixel intensity is strongly correlated along field lines.
Let's see an example. We'll use matplotlib to visualize inputs and outputs.
import matplotlib.pyplot as plt
import numpy as np
import rlic
SHAPE = NX, NY = (256, 256)
prng = np.random.default_rng(0)
texture = prng.random(SHAPE)
x = np.linspace(0, np.pi, NY)
U = np.broadcast_to(np.cos(2 * x), SHAPE)
V = np.broadcast_to(np.sin(x).T, SHAPE)
fig, axs = plt.subplots(ncols=2, sharex=True, sharey=True, figsize=(10, 5))
for ax in axs:
ax.set(aspect="equal", xticks=[], yticks=[])
ax = axs[0]
ax.set_title("Input texture (noise)")
ax.imshow(texture)
ax = axs[1]
ax.set_title("Input vector field")
Y, X = np.mgrid[0:NY, 0:NX]
ax.streamplot(X, Y, U, V)
Now let's compute some convolutions, varying the number of iterations
kernel = 1 - np.abs(np.linspace(-1, 1, 65))
fig_out, axs_out = plt.subplots(ncols=3, figsize=(15, 5))
for ax in axs_out:
ax.set(aspect="equal", xticks=[], yticks=[])
for n, ax in zip((1, 5, 100), axs_out, strict=True):
image = rlic.convolve(
texture,
U,
V,
kernel=kernel,
boundaries="periodic",
iterations=n,
)
ax.set_title(f"Convolution result ({n} iteration(s))")
ax.imshow(image)
Polarization mode
By default, the direction of the vector field affects the result. That is, the
sign of each component matters. Such a vector field is analogous to a velocity
field. However, the sign of u or v may sometimes be irrelevant, and only
their absolute directions should be taken into account. Such a vector field is
analogous to a polarization field. rLIC supports this use case via an
additional keyword argument, uv_mode, which can be either 'velocity'
(default), or 'polarization'. In practice, the difference between these two
modes in only visible around sharps changes in sign in either u or v, and
with certain kernels.
Let's illustrate one such case
import matplotlib.pyplot as plt
import numpy as np
import rlic
SHAPE = NX, NY = (256, 256)
prng = np.random.default_rng(0)
texture = prng.random(SHAPE)
kernel = 1 - np.abs(np.linspace(-1, 1, 65, dtype="float64"))
U0 = np.ones(SHAPE)
ii = np.broadcast_to(np.arange(NX), SHAPE)
U = np.where(ii<NX/2, -U0, U0)
V = np.zeros((NX, NX))
fig, axs = plt.subplots(ncols=3, sharex=True, sharey=True, figsize=(15, 5))
for ax in axs:
ax.set(aspect="equal", xticks=[], yticks=[])
ax = axs[0]
ax.set_title("Input vector field")
Y, X = np.mgrid[0:NY, 0:NX]
ax.streamplot(X, Y, U, V)
for uv_mode, ax in zip(("velocity", "polarization"), axs[1:], strict=True):
image = rlic.convolve(
texture,
U,
V,
kernel=kernel,
uv_mode=uv_mode,
boundaries={"x": "periodic", "y": "closed"},
)
ax.set_title(f"{uv_mode=!r}")
ax.imshow(image)
Memory Usage
rLIC.convolve allocates exactly two buffers with the same size as texture,
u and v, regardless of the number of iterations performed, one of which is
discarded when the function returns. This means that peak usage is about 5/3 of
the amount needed to hold input data in memory, and usage drops to 4/3 on
return.
Metadata
Release files for rlic 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rlic-0.5.3.tar.gz | 27.6 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| rlic-0.5.3-cp310-abi3-win_arm64.whl | CPython 3.10 | abi3 | Windows ARM64 | Details |
| rlic-0.5.3-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| rlic-0.5.3-cp310-abi3-win32.whl | CPython 3.10 | abi3 | Windows x86-32 | Details |
| rlic-0.5.3-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| rlic-0.5.3-cp310-abi3-musllinux_1_2_aarch64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ ARM64 | Details |
| rlic-0.5.3-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| rlic-0.5.3-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| rlic-0.5.3-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| rlic-0.5.3-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 2.1 MB
Release files / rlic-0.5.3.tar.gz
| Download URL | rlic-0.5.3.tar.gz |
|---|---|
| Size | 27.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5a249df38d3cf9203a6cd5ff4e585db1a2c95ea0e2e5f8365025f348ada96e9
|
|
BLAKE2b-256 checksum How to use checksums |
fc9a7c37806970a53e3421f5929a68b60567424ee9685e99c07a7edfc1ff61ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-win_arm64.whl
| Download URL | rlic-0.5.3-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 121.3 kB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0654a6bb757302eb6123c4b36d6dc31835b1fc7f918e0d8cbd1912e38552afdf
|
|
BLAKE2b-256 checksum How to use checksums |
6c55157397a815686121f2016b994e53c96f8454553fa1b7798051c4f8ef3ad4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-win_amd64.whl
| Download URL | rlic-0.5.3-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 129.2 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
2ae650e7f90c8671a466e33b2715611454957766539baa7e4aa6cd46e886cd74
|
|
BLAKE2b-256 checksum How to use checksums |
7837a5fad43f7ff580514f6258a7bb14e32df631656bf8bf011659f86eef6af5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-win32.whl
| Download URL | rlic-0.5.3-cp310-abi3-win32.whl |
|---|---|
| Size | 123.7 kB |
| Tags | CPython 3.10 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
85704ae73d536b4fc9d50408b16ed630d5273a36f7c946c5f51e80e5808bdbb0
|
|
BLAKE2b-256 checksum How to use checksums |
652176ebfdd2d333a2e754baa0dc06bada53ebae3751cff3a869318c0dc82fee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | rlic-0.5.3-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 406.6 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
82ae5459cc44ad092db472bdd87b25eaffedca3cb37716fdde09a22c91405f47
|
|
BLAKE2b-256 checksum How to use checksums |
61f1fa7d10f609d8016b435f159bd9a6c821996af02af8d84bcb47e006142176
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | rlic-0.5.3-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 402.3 kB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
6389e148a999c4259e3229bf2ca656cfd4e2d44fa34c41b90e85ae70708e3c51
|
|
BLAKE2b-256 checksum How to use checksums |
7556b436b544d2ae4969b19bb018a4c7b4bbdc4877ab8bcfd9d8538bbffb31e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | rlic-0.5.3-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 231.0 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f7e601092ff0cfd652974b6ffe7dcf2c4f8548dc0fc24a4726218b8e135bf842
|
|
BLAKE2b-256 checksum How to use checksums |
93e6630935cf03764ccd7beb594213434b0766769e05e88c93172049ce78ad7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | rlic-0.5.3-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 219.6 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
af3ab82e7b21f31fe538a7fbb72c8f53e4e6b38b43ad4f1c8497632918c2b3e8
|
|
BLAKE2b-256 checksum How to use checksums |
6fccaa184fb921632b4613e5b12e66248110e217f8f096a6de88c1958e3d145f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | rlic-0.5.3-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 202.7 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9e6cd4fd2ee1104221a6b92c7a283fbbe4b9cf94209a5a4b42055f722ffd5e24
|
|
BLAKE2b-256 checksum How to use checksums |
72750df89b25c7129bcbf31208f8fa911177e2392334a69152dc59c0d41466b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / rlic-0.5.3-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | rlic-0.5.3-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 212.5 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
badad56ff96f0a77846da41d9f9badb26cc8a7439e7600b7b35b777afec9a46e
|
|
BLAKE2b-256 checksum How to use checksums |
7de72c91817eae45c9a250d6b9d5b8005f0c2fc1e062c93e872cea4311c3c27e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency log