Skip to main content

fibrs

A native, multi-threaded drop-in for avf-spline-generator 0.2.0, Qual's AFV fibre tracer (Qualzz/AVF_SPLINE_GENERATOR @ bee798f). It takes the same flags and writes the same .afv: every metadata value except the per-run uuid, and every fibre row, point block and spatial-index row. The tracing algorithm, the AFV format and the fibre model whose predictions it reads are Qual's; this port changes how fast the tracer runs, not what it writes.

On a 512 × 8169 × 8169 band of PHerc0826, with --threads 4 for both tools, it took 191 s where the original took 11,840 s: 62 times faster, with about 23 times less CPU time, and the same .afv. Tracing runs on the CPU and needs no GPU.

Install

pip install fibrs

Install it into the environment that has numpy (normally the one that runs avf-spline-generator). It adds a fibrs command and a Python module, fibrs. Prebuilt CLI archives for Linux x86-64 (glibc 2.28+) and Apple silicon (macOS 11+) are named fibrs-<version>-<target>.tar.gz.

Use

fibrs --predictions P --array semantic --channel-order VH --tracing-predictions P \
  --tracing-array tracing --voxel-size-um 9.362 --storage compressed --device cpu --threads 4 \
  --output fibers.afv --work-dir work
python -m fibrs ARGS      # the same, from Python

fibrs.run([...]) runs it from Python and returns the exit status.

To make an environment's avf-spline-generator run the port, so scripts that call it need no change:

scripts/install-dropin.sh VENV [BINARY]   # VENV/bin/avf-spline-generator -> fibrs
scripts/install-dropin.sh --restore VENV  # put the original back

BINARY defaults to the fibrs in the archive the script came from, then to the one on PATH. The original entry is kept as avf-spline-generator.reference, and NOTICE and licenses/ are copied to VENV/share/fibrs. Callers that run Path(sys.executable).parent / "avf-spline-generator" need no other change.

Build

cargo build --release
cargo test --release

It builds on Linux and macOS. The wheel is built with maturin from pyproject.toml (maturin build --release; the published Linux wheel uses --zig --compatibility manylinux_2_28, and the macOS wheel MACOSX_DEPLOYMENT_TARGET=11.0).

Numerics

The direction field's eigenvectors come from dsyevd in numpy's own OpenBLAS, on float64 copies as numpy.linalg.eigh computes them, so they match eigh bit for bit. The binary finds that library from its own path (bin/../lib/python*/site-packages/numpy.libs/libscipy_openblas64_*.so), then from $VIRTUAL_ENV, looking in each environment in numpy's copy first and then in the scipy-openblas64 package (site-packages/scipy_openblas64/lib). FIBRS_LAPACK overrides both.

macOS numpy wheels link Accelerate and bundle no OpenBLAS, so on macOS the wheel depends on scipy-openblas64==0.3.31.188.0, the OpenBLAS build that numpy 2.4.6's Linux wheel bundles. With it, a Mac writes the same .afv as Linux.

Inputs

The same arrays the original reads through numpy and zarr 2: .npy files and Zarr v2 arrays or groups of uint8, float16, float32 or float64, in either byte order and either array order. Zarr chunks may use any channel chunking, either dimension separator and the Blosc, Zstd, Zlib, GZip or LZ4 compressor; Blosc frames are decoded by c-blosc 1.21.6, the release numcodecs 0.15 bundles. Missing chunks read as the fill value, including NaN and infinities, which the value check then rejects as the original does. Not supported: Zarr filters, other numcodecs compressors (BZ2, LZMA and so on) and extended-precision floats. tests/fixtures/readers holds one small array in each supported encoding with what the original reads from it; cargo test checks every case.

Same output

On that PHerc0826 band (z 12032–12544), the port's .afv is identical to the original's: 149,780 fibres, 161,887 point blocks and 161,887 spatial-index rows, plus the metadata and schema. The 0.1.0 build was also checked on a 512³ crop of the band: the wheel and the drop-in were installed into a fresh environment beside the original, and the crop was traced through avf-spline-generator and through python -m fibrs. Both outputs were identical to the original's .afv.

CI traces a small synthetic input (tests/fixtures/synthetic) with every build's wheel on Linux and macOS, through the drop-in and through python -m fibrs. Both must write what the original wrote for it, compared by scripts/compare_afv.py: every metadata value except the per-run uuid, the schema and every table row.

Speed

The same band, on an Intel Core Ultra 7 270K Plus (24 cores), with --threads 4 for both tools and other work running on the machine (one-minute load average 17.5–18.8):

Run Wall CPU time Peak memory
avf-spline-generator 0.2.0 11,840 s (3.3 h) about 11,940 s 4.6 GiB
fibrs 191 s 516 s 12.4 GiB
Speedup 62× about 23×

The original uses about one core whatever --threads says, and the port keeps about 2.7 busy. The original's run was interrupted by a reboot and finished with --resume. Its wall time is the sum of the two parts, and the first part's CPU time is estimated from the second part's CPU-to-wall ratio (1.01). An earlier uninterrupted run of the original on the same band took 12,728 s.

Differences from the original

  • Fields live in memory as sparse 32³ bricks instead of a Zarr work store, so peak memory is higher and grows with how much of the band holds fibres: 11–12 GiB against the original's 4.6 GiB on a 512 × 8169 × 8169 band of PHerc0826, and 18.4 GiB on a denser 512 × 7947 × 7947 band of PHerc0813. The peak varies by about a gigabyte between runs of the same band, with thread timing. With --field-cache-mib 4096, 4.1 GiB of that is the chunk cache; a smaller cache lowers the peak by the difference but decodes chunks again (at 16 MiB the PHerc0826 band took about 45% longer). Memory each stage frees goes back to the system before the next stage allocates. FIBRS_DEBUG_MEM=1 logs each stage's field sizes and resident memory.
  • The work directory holds run.json (with a native key, so neither tool resumes the other's directory) and one finished curve file per family. An interrupted family is traced again from its first seed on --resume, instead of from the last 16-seed batch.
  • --storage and --field-cache-mib are validated, and --storage is recorded in run.json as the original records it, but neither selects anything. The chunk cache is bounded by --native-cache-mib plus --field-cache-mib.
  • --device cuda is rejected: the original uses CUDA only for centrality, and this port computes centrality on the CPU.
  • The command line replays argparse's pass, so exit status and selected values match, but help text and usage-error wording differ. Some argparse readings are not reproduced: numbers written with non-ASCII digits; non-UTF-8 bytes in the text options (--array, --tracing-array, --coordinate-space); negative numbers with an underscore or trailing whitespace inside a three-value option or after a numeric option (-0_0, "-1\n"), which this tool rejects and argparse accepts; and a short help cluster followed by a dash (-h-, -h--), which this tool treats as help and argparse rejects.
  • The original's batch-buffer capacity checks are not reproduced. Its smoothing-snapshot limit (--field-cache-mib) is not either, because no snapshot is taken.

Licence

Apache-2.0, like the original; the licence text is licenses/apache-2.0.txt. NOTICE lists the ported code (AVF_SPLINE_GENERATOR, one NumPy sort routine) and the statically linked C libraries; their licence texts are in licenses/.

Metadata

Release files for fibrs 0.1.1

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

Built distributions (wheels)

Table of built distributions (wheels) for fibrs 0.1.1
File Interpreter ABI Platform Actions
fibrs-0.1.1-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for fibrs-0.1.1-py3-none-manylinux_2_28_x86_64.whl
fibrs-0.1.1-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for fibrs-0.1.1-py3-none-macosx_11_0_arm64.whl

Total release size: 4.2 MB

Release files / fibrs-0.1.1-py3-none-manylinux_2_28_x86_64.whl

Download URL fibrs-0.1.1-py3-none-manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
701c0a9b0546df4c948c74df03fdc056dc2acc342dcd3df870bd9a26fde5f519
BLAKE2b-256 checksum
How to use checksums
cf4b6606c635b296e35e7633de5d32e6427e686438a1ae1e5b45826003c1cd76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Release files / fibrs-0.1.1-py3-none-macosx_11_0_arm64.whl

Download URL fibrs-0.1.1-py3-none-macosx_11_0_arm64.whl
Size 2.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2b09db96e581cfafb7d6488030998e5d86b4022616038b4a10f662d34aab8468
BLAKE2b-256 checksum
How to use checksums
c26b94775117e49c751c4563e6a42f83d3d05fcc2f0fe3fb21e96ed976e2b778
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 18, 2026.

Transparency log

Security for fibrs 0.1.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fibrs-0.1.1-py3-none-manylinux_2_28_x86_64.whl

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 18, 2026.

Transparency log

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.

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