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. From the repository root, install with:

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.]

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.0rc1

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.0rc1
File Size Uploaded Provenance Actions
lumic-0.1.0rc1.tar.gz 81.1 kB With provenance Details for lumic-0.1.0rc1.tar.gz

Built distribution (wheel)

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

Total release size: 172.2 kB

Release files / lumic-0.1.0rc1.tar.gz

Download URL lumic-0.1.0rc1.tar.gz
Size 81.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d84e9069eac2b0903bf5cc29c9d8a9d40b76727e647abc18477fb7ad3fee51cc
BLAKE2b-256 checksum
How to use checksums
c6a39c3f0d152ad521e15469099f021dda7e19fdd3917108d234e89eedccca34
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 18, 2026.

Transparency log

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

Download URL lumic-0.1.0rc1-py3-none-any.whl
Size 91.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3401fb1daff2160194c9d7db039280b7b0615d8e4119456d448968222a099d1
BLAKE2b-256 checksum
How to use checksums
e26641e79d9b3bea73bb7df9e219d921755d11995dc1e7d7602c110a7315c938
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 18, 2026.

Transparency log

Security for lumic 0.1.0rc1

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.0rc1.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 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