PyCardinal and Cardinal
Python package
pycardinal is a direct Python port of the original R/Bioconductor Cardinal package for mass-spectrometry imaging data. It ports Cardinal's data containers, imzML I/O, spectral processing, feature and spatial utilities, summary statistics, statistical models, plotting, and ROI helpers into a Python-native API. Some statistical methods remain practical baseline implementations and are documented where they are not yet numerically identical to R Cardinal.
Install the development environment from the repository root:
python -m pip install -e ".[dev,docs]"
The published distribution name is python-cardinal; the Python import name
remains pycardinal.
The default test suite uses deterministic simulated data and does not require private datasets. The completed migration history is in PYTHON_MIGRATION.md.
Quickstart
from pycardinal import PCA, plot_image, process, read_imzml
image = read_imzml("sample.imzML")
image = process(image)
model = PCA(image, ncomp=2)
plot_image(image, i=0)
print(model.sdev)
For a self-contained example without an input file:
from pycardinal import PCA, plot_image, simulate_image
image = simulate_image(preset=1, dim=(10, 10), npeaks=12, random_state=7)
model = PCA(image, ncomp=2)
plot_image(image, i=0)
See the Python documentation, generated API, and parameter reference for details. The maintained fork is hosted at github.com/AmyRouillard/PyCardinal.
Attribution
PyCardinal is maintained by Amy Rouillard as a direct Python port and fork of
the Cardinal mass-spectrometry imaging project. The original R implementation
and its license are preserved on the devel branch. Please acknowledge the
original Cardinal authors and publication when using work derived from Cardinal.
Suggested citation for the original Cardinal work:
Bemis, K. A., Foell, M. C., Guo, D., Lakkimsetty, S. S., and Vitek, O. “Cardinal v.3: a versatile open-source software for mass spectrometry imaging analysis.” Nature Methods 20, 1883–1886 (2023). doi:10.1038/s41592-023-02070-z
Release files for python-cardinal 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_cardinal-0.1.1.tar.gz | 63.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_cardinal-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 127.9 kB
Release files / python_cardinal-0.1.1.tar.gz
| Download URL | python_cardinal-0.1.1.tar.gz |
|---|---|
| Size | 63.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d50ca564c571ce8842a22dd03db798d06390e0d22e798a5cfc45fe91691e1fb7
|
|
BLAKE2b-256 checksum How to use checksums |
ad5f99c99471d1ca1ced2631812d7810c37f4adef40119536b007f3cd2dc7b72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / python_cardinal-0.1.1-py3-none-any.whl
| Download URL | python_cardinal-0.1.1-py3-none-any.whl |
|---|---|
| Size | 63.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
019410952493acd03570cbd85e0074f2a6f2cc67f195f11c1742fc31de7976de
|
|
BLAKE2b-256 checksum How to use checksums |
de120f8c534d039b176309368faaec26c3ec707b3a3c345990c131fe664e7754
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|