The repository or configuration that created this release differ from a previous release. View details.
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 the COS-7 CZI in RGB and copy a plane. Set the input path to try a Z stack. | 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.0rc3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Change of provenance
The repository or configuration that created these release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lumic-0.1.0rc3.tar.gz | 84.3 kB | With provenance | Details for lumic-0.1.0rc3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lumic-0.1.0rc3-py3-none-any.whl | Python 3 | none | any | Details for lumic-0.1.0rc3-py3-none-any.whl |
Total release size: 179.3 kB
Release files / lumic-0.1.0rc3.tar.gz
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | lumic-0.1.0rc3.tar.gz |
|---|---|
| Size | 84.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b240daa34c421047b46801d920c20fe64c33916b46cf85fb8defb42074767e2
|
|
BLAKE2b-256 checksum How to use checksums |
5e1fd0fb0a093ebe5c5add8e6d2c8347481b385ca219f239b12c6ea8773d42cf
|
| 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 20, 2026.
Transparency logRelease files / lumic-0.1.0rc3-py3-none-any.whl
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | lumic-0.1.0rc3-py3-none-any.whl |
|---|---|
| Size | 94.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab8d63411ee8cf8f458b4ebe1c004c5b5d1b806aef5d46a2241c6cea13961e58
|
|
BLAKE2b-256 checksum How to use checksums |
6efec3ea0a86632d07fe2e2feeca402d5b56240156a603ac590e18f8452d6a9e
|
| 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 20, 2026.
Transparency logSecurity for lumic 0.1.0rc3
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.
Change of provenance
The repository and configuration that created this release differ from a previous release.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Repository
- Removed 0.1.0rc2 github.com/CCI-GU-Sweden/spectral-unmixing-microscopy
- Added 0.1.0rc3 github.com/CCI-GU-Sweden/lumic
Configuration
Attestation for lumic-0.1.0rc3.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 20, 2026.
Transparency logA 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.