Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Lumic backend

Lumic is a Python toolkit for spectral unmixing in fluorescence microscopy. It reads CZI and OME-TIFF, fits component contributions from known reference spectra or refines spectra with MCR-ALS, and exports quantitative results. The backend runs without a graphical interface.

Install

Use Python 3.12. This guide uses the 0.1.0rc2 prerelease.

python -m pip install "lumic==0.1.0rc2"

To install the source version from the repository root:

python -m pip install ./Python/lumic

The default install includes the bundled FPbase emission spectra. Optional extras enable Matplotlib previews (visualization), online spectrum retrieval (fpbase), notebook and plotting tools (examples), or pytest (test). Install all four with python -m pip install './Python/lumic[all]'.

Unmix a simulated pixel offline

Sample two bundled spectra through the example 32-channel detector, then estimate how much of each component was mixed into the pixel. The fit uses known references, so it works without microscopy files or internet access.

import numpy as np

from lumic import positive_least_squares
from lumic.simulation import SpectralDetector, load_offline_emission_spectrum

detector = SpectralDetector.from_profile("980_32ch")
references = np.array([
    detector.sample(*load_offline_emission_spectrum(name))
    for name in ("EGFP", "mCherry")
])
references /= references.sum(axis=1, keepdims=True)

# One pixel with contributions of 70 and 30 in total detected counts.
mixed_pixel = np.array([[70.0, 30.0]]) @ references
estimated = positive_least_squares(mixed_pixel, references, solver="auto")
print(np.round(estimated[0], 6))  # [70. 30.]

Download and open a real spectral image

Download the high-SNR mixed COS-7 acquisition (about 145 MB) from BioImage Archive. Later runs reuse the local file. Dataset S-BIAD4448 (CC0)

from lumic.data import download_cos7_data
from lumic.io import load_image

path, = download_cos7_data(progress=True)
image = load_image(path)
print(image.axes, image.data.shape)  # CYX (32, 1504, 1504)

Use snr="medium", snr="low", or snr="all" to select other acquisitions. Set include_references=True to also fetch the single-stain reference files.

Explore the examples

The examples live in the repository’s Python/examples/ directory. From the repository root, install the examples extra, switch to Python/, and run the full workflow:

python -m pip install './Python/lumic[examples]'
cd Python
python -m examples.spectral_image_workflow

This walkthrough creates a three-protein mixture with shot noise, estimates the component maps using known spectra, and plots the residual. It exports the measurement, fitted reconstruction and abundance maps as OME-TIFF, then reconstructs the fitted signal from the reloaded maps and their saved spectra. See the comparison figure for the expected output.

What you want to try Command from Python/
Inspect a CZI or OME-TIFF header before loading pixels. Set LOAD_PIXELS = True in the script to read the selected plane. python -m examples.load_spectral_image
Render a spectral Z stack in RGB and select one Z plane. python -m examples.render_spectral_rgb
Simulate overlapping fluorescent structures and compare the recovered spectra and maps with the known inputs. python -m examples.visualize_overlapping_circles
See how lower photon counts affect the relative noise in a spectral mixture. python -m examples.visualize_poisson_noise_levels
Inspect spectral distinctness in an image and in the projected spectral space. python -m examples.visualize_spectral_uniqueness

These examples use bundled spectra or sample images and run offline once the environment is installed. The separate examples.simulate_fpbase_mixtures script fetches live spectra and needs internet access and the fpbase extra.

Go deeper with the backend guides

  • Work with microscope images. Inspect CZI or OME-TIFF metadata before loading pixels, select a time point or Z plane, and keep track of the image axes as you unfold and refold the data. Save abundance maps as OME-TIFF with the exact fitted spectra so you can reconstruct the fitted signal later. Image I/O guide
  • Build a controlled simulation. Sample reference spectra through a detector model, set the component contributions, and render spatial shapes with optical blur and noise. Keep the original spectra and abundance maps as ground truth for comparing fits. Simulation guide
  • Evaluate a fit. Align components before comparing spectra and abundance maps across runs. When ground truth is unavailable, use signed residual PCA and spatial or spectral correlations to look for patterns the fit leaves unexplained. Evaluation guide

License and data attribution

Lumic is distributed under the MIT license. The bundled spectra carry their FPbase source and attribution notice alongside the CSV files.

Metadata

Release files for lumic 0.1.0rc2

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

Source distribution (sdist)

Source distribution for lumic 0.1.0rc2
File Size Uploaded Provenance Actions
lumic-0.1.0rc2.tar.gz 83.4 kB With provenance Details for lumic-0.1.0rc2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lumic 0.1.0rc2
File Interpreter ABI Platform Actions
lumic-0.1.0rc2-py3-none-any.whl Python 3 none any Details for lumic-0.1.0rc2-py3-none-any.whl

Total release size: 176.9 kB

Release files / lumic-0.1.0rc2.tar.gz

Download URL lumic-0.1.0rc2.tar.gz
Size 83.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0161e02557ffeb9608f2b4f38028dbbac46262e52b1fda760f0254020a15992b
BLAKE2b-256 checksum
How to use checksums
2e3d31a5381cf4ab917efaca11a77aab3fbce705c77e5bb0dcf5c1238645b591
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Transparency log

Release files / lumic-0.1.0rc2-py3-none-any.whl

Download URL lumic-0.1.0rc2-py3-none-any.whl
Size 93.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cce93fd32c01a743f3871800bf30eb4c3d42ea2a6c79b8455b56f9bfc72e6728
BLAKE2b-256 checksum
How to use checksums
5aeea90ccbffad0dbc2038a8bce59f433d902c11a3e7300c2539e6ec4d43e6e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Transparency log

Security for lumic 0.1.0rc2

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 lumic-0.1.0rc2.tar.gz

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 19, 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