UniDecImporter
UniDecImporter is a standalone Python package for reading mass-spectrometry data into NumPy arrays. It was extracted from UniDec, but has no runtime dependency on UniDec or IsoDec.
The same high-level API covers single spectra, LC-MS, CD-MS, and ion-mobility MS:
from UniDecImporter import get_importer
with get_importer("run.mzML") as reader:
spectrum = reader.get_avg_scan(time_range=(2.0, 2.5))
tic = reader.get_tic()
Installation
python -m pip install UniDecImporter
For Thermo RAW support on Windows x86-64, install the optional bridge too:
python -m pip install "UniDecImporter[thermo]"
Python 3.10–3.13 is supported on Windows, macOS, and Linux. Open formats work on all three operating systems. The package includes Windows-only Thermo .NET assemblies as data files, but importing and using open-format readers does not load them.
Thermo proprietary software: Installing or using the bundled Thermo RawFileReader assemblies means you accept Thermo's separate license, included in the distribution. End users may not redistribute those assemblies. Commercial exploitation requires Thermo's prior written consent. The BSD license covers this project's Python code, not the Thermo binaries. See
THERMO_RAWFILEREADER_TERMS.md.RawFileReader reading tool. Copyright © 2016 by Thermo Fisher Scientific, Inc. All rights reserved.
Format support
| Format | Data types | Platforms | Reader dependency |
|---|---|---|---|
| mzML, indexed mzML.gz | LC-MS, MS/MS, CD-MS, IM-MS | Windows, macOS, Linux | pymzML |
| mzXML | LC-MS, MS/MS, CD-MS | Windows, macOS, Linux | pyteomics |
| TXT, DAT, CSV | Single scan, CD-MS, IM-MS | Windows, macOS, Linux | NumPy |
| NPZ, BIN | Single scan, CD-MS | Windows, macOS, Linux | NumPy |
| I2MS, DMT | CD-MS | Windows, macOS, Linux | Python sqlite3 |
| Thermo RAW | LC-MS, MS/MS, CD-MS | Windows x86-64 only | Thermo RawFileReader + pythonnet |
| Waters RAW directory | LC-MS, IM-MS | Windows x86-64 only | Waters MassLynx SDK |
Agilent .d |
LC-MS, MS/MS | Windows x86-64 only | Agilent MassHunter Data Access SDK + pythonnet |
The four Thermo RawFileReader assemblies are bundled under their separate proprietary
terms. Waters and Agilent SDK licenses do not permit this project to redistribute those
binaries, so users must obtain them separately. Set THERMO_RAW_FILE_READER_DIR to
override the bundled Thermo assembly directory, MASSLYNX_RAW_DLL to a licensed Waters
DLL, or AGILENT_DA_SDK_DIR to a licensed Agilent Data Access assembly directory.
Unsupported platforms and missing runtimes raise VendorReaderUnavailableError with an
actionable message.
Core API
get_importer(path, **options) returns the appropriate reader. The common methods are:
get_single_scan(scan)→N x 2array (m/z, intensity)get_all_scans()→ list ofN x 2arraysget_avg_scan(scan_range=..., time_range=...)→ mergedN x 2arrayget_tic()/get_eic(mass, mz_tol, rt_range=None)→ chromatogramN x 2arraysget_cdms_data()→N x 5(m/z, intensity, scan, inverse injection time, time)get_imms_scan(scan)/get_imms_avg_scan(...)→N x 3(m/z, drift time, intensity)get_polarity(),get_ms_order(scan), scan/time conversion helpers, andclose()
Check reader.chrom_support, reader.cdms_support, and reader.imms_support before
calling specialized methods. Readers are context managers, so with is preferred.
For a two-column single spectrum:
from UniDecImporter import get_importer
reader = get_importer("spectrum.csv")
data = reader.get_avg_scan()
assert data.shape[1] == 2
For CD-MS:
with get_importer("ions.dmt") as reader:
events = reader.get_cdms_data()
mz, intensity, scan, inverse_injection_time, time = events.T
Development
Large test fixtures use Git LFS:
git clone https://github.com/michaelmarty/UniDecImporter.git
cd UniDecImporter
git lfs pull
python -m pip install -e ".[test]"
python -m pytest
The suite includes fast numerical/unit tests, cross-platform integration tests against the bundled open formats, and separately marked Windows vendor tests:
python -m pytest -m "not integration and not vendor"
python -m pytest -m "integration and not vendor"
python -m pytest -m vendor
See the documentation,
PUBLISHING.md, and THIRD_PARTY_NOTICES.md
for full details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unidecimporter-0.1.0.tar.gz.
File metadata
- Download URL: unidecimporter-0.1.0.tar.gz
- Upload date:
- Size: 484.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38a60fdcd07311de346836d0516be0a88aa77794cf0178cc7d91e695252ed8d3
|
|
| MD5 |
71f0d2d6648b3497c32389cb3f390552
|
|
| BLAKE2b-256 |
09c4208f2c0a6e9c3ae3159b1e6b183abbbe29750c806c1d597d34703f382d63
|
Provenance
The following attestation bundles were made for unidecimporter-0.1.0.tar.gz:
Publisher:
publish.yml on michaelmarty/UniDecImporter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unidecimporter-0.1.0.tar.gz -
Subject digest:
38a60fdcd07311de346836d0516be0a88aa77794cf0178cc7d91e695252ed8d3 - Sigstore transparency entry: 2517829099
- Sigstore integration time:
-
Permalink:
michaelmarty/UniDecImporter@19c4993d0e71eeb4c10729591661c7d509450539 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/michaelmarty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@19c4993d0e71eeb4c10729591661c7d509450539 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file unidecimporter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: unidecimporter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 481.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2ef48111af8b1b306ff395582144c115466a5a6bb6c697c3fdb221779f079be
|
|
| MD5 |
43f35f8951c564692af4a9df3d7fe146
|
|
| BLAKE2b-256 |
3e1ae545fb956509ed7e7487d67a0f6017bfc69a663e0285e39a3c404fcdf90e
|
Provenance
The following attestation bundles were made for unidecimporter-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on michaelmarty/UniDecImporter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unidecimporter-0.1.0-py3-none-any.whl -
Subject digest:
f2ef48111af8b1b306ff395582144c115466a5a6bb6c697c3fdb221779f079be - Sigstore transparency entry: 2517829192
- Sigstore integration time:
-
Permalink:
michaelmarty/UniDecImporter@19c4993d0e71eeb4c10729591661c7d509450539 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/michaelmarty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@19c4993d0e71eeb4c10729591661c7d509450539 -
Trigger Event:
workflow_dispatch
-
Statement type: