Skip to main content

rainbow

PyPI Documentation Status PyPI - Downloads

rainbow provides programmatic access to the raw data encoded in chromatography and mass spectrometry binary files. This library supports the following vendors and detectors:

Container File Data Parse with
Agilent .D .uv UV spectrum (supports incomplete files)
.ch UV, FID, CAD, and ELSD channels
.ms MS (supports incomplete files)
MSProfile.bin HRMS and ICP-MS profile spectrum hrms=True
MSPeak.bin centroid (peak-picked) spectrum centroid=True
Agilent .dx (OpenLab CDS) .UV DAD spectrum
.CH single-wavelength UV/DAD signals
.IT instrument telemetry, as analog data telemetry=True
Agilent .sirslt (OpenLab CDS result folder) .dx everything a .dx holds (UV/DAD, FID, telemetry)
MSPeak.bin single-quad LC/MS or GC/MS centroid spectrum centroid=True
.acaml instrument, and whether the run is LC or GC (metadata['technique'])
Waters .raw CHRO CAD and ELSD, plus miscellaneous analog data
FUNC UV and MS

There is documentation for rainbow that also details the structure of each binary file format.

Installation

pip install rainbow-api

That installs everything needed to read a file. Four things are separate, because most callers never reach them:

Extra Install What it adds
plot pip install rainbow-api[plot] matplotlib, for DataFile.plot
waters pip install rainbow-api[waters] pandas, for the Waters compound transition table
hrms pip install rainbow-api[hrms] python-lzf, for LZF-compressed MassHunter MSProfile.bin
validate pip install rainbow-api[validate] jsonschema and rfc3339-validator, for the opt-in ASM conformance tests. Both: without the second, timestamp formats are not actually checked

Each says which extra to install if you call it without one, so nothing fails mysteriously.

Prebuilt wheels include an optional compiled accelerator (see Performance); installation never requires a compiler, and rainbow works the same with or without it.

Usage

The easiest way to get started is to give rainbow a directory path. Assume that we have a directory mydata.D that contains a binary file DAD1.uv with UV data.

import rainbow as rb
datadir = rb.read("mydata.D")
datafile = datadir.get_file("DAD1A.uv")

Here, the datadir DataDirectory object contains a DataFile object for DAD1A.uv.

rainbow normally infers the vendor from the path suffix (.D/.dx/.sirslt for Agilent, .raw for Waters). A directory whose name lacks that suffix is identified from its contents instead, so renamed datasets still parse. To force a parser explicitly, pass format:

datadir = rb.read("Caffeine 3", format="waters")

The raw UV data is contained in numpy arrays that are attributes of datafile. Users may find the following particularly useful:

  • datafile.xlabels - 1D numpy array with retention times
  • datafile.ylabels - 1D numpy array with wavelengths
  • datafile.data - 2D numpy array with absorbances

There is a tutorial available. There are also example snippets for basic tasks. Or just check out the full API.

A whole sequence at once

A sequence directory, one injection subdirectory per sample, reads in one call. Injections come back in sorted-name order, which for the names ChemStation writes by default is the order they ran.

sequence = rb.read_sequence("Caffeine_Stability")
first = sequence[0]
one = sequence.get_injection("008-D1F-A1-sample_01.D")

See Sequences.

Getting the data out of the vendor's format

Any run, or any sequence, exports to the Allotrope Simple Model: an open, published JSON format that other tools read, so the data stops depending on rainbow or on the instrument vendor. It reads back, and it validates against the published Allotrope schemas once the run's UTC offset is known: most vendor formats record local wall clock with no offset, and rainbow will not invent one, so pass utc_offset= if you know where the instrument was.

datadir.export_asm("caffeine.asm.json")           # one run
sequence.export_asm("stability.asm.json")         # the whole sequence
back = rb.from_asm(json.load(open("caffeine.asm.json")))

A full-scan MS channel is a 2D grid the format cannot hold faithfully, so ask for the ions you want: datadir.to_asm(ions=[195.1]). See ASM export.

The metadata the normal read leaves behind

A vendor run ships sidecar files the data parsers never touch, holding the acquisition context: module serials, firmware versions, the operator, method details, vial positions, timestamps. rainbow.debug decodes them on demand, and costs nothing if you never call it.

from rainbow import debug
debug.fields("mydata.D")     # one merged record of the whole run
debug.inspect("mydata.D")    # every recognized sidecar, in full

See Debug metadata.

Performance

A few inherently-sequential decode loops are sped up by optional compiled (Cython) extensions: roughly 100x faster, bit-identical, with a transparent pure-Python fallback when no compiler is available (prebuilt PyPI wheels include them). See the Performance page in the documentation for the optimization strategies behind rainbow and the considerations for adding a new format.

Contents

  • rainbow/ contains the code of the Python library.
  • docs/ contains code for generating documentation. To build documentation locally, you will need the packages in docs/requirements.txt (pip install -r docs/requirements.txt); myst-parser is required as well as sphinx and sphinx-rtd-theme, since part of the documentation is Markdown. Then, move to the docs/ directory and run make html. The docpages will be generated under docs/_build.
  • tests/ contains unit tests for the library. These can be run with pytest from the repository root (install the test dependency with pip install -e .[test]).

For development, an editable install (pip install -e .) compiles the optional accelerator in place if a C compiler and Cython are available; otherwise the pure-Python fallback is used. The parity between the two paths is checked by tests/test_accelerator.py.

Metadata

Release files for rainbow-api 1.6.0

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

Source distribution (sdist)

Source distribution for rainbow-api 1.6.0
File Size Uploaded Provenance Actions
rainbow_api-1.6.0.tar.gz 266.6 kB With provenance Details for rainbow_api-1.6.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rainbow-api 1.6.0
File Actions
rainbow_api-1.6.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for rainbow_api-1.6.0-cp313-cp313-win_amd64.whl
rainbow_api-1.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details for rainbow_api-1.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rainbow_api-1.6.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for rainbow_api-1.6.0-cp313-cp313-macosx_11_0_arm64.whl
rainbow_api-1.6.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for rainbow_api-1.6.0-cp312-cp312-win_amd64.whl
rainbow_api-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details for rainbow_api-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rainbow_api-1.6.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for rainbow_api-1.6.0-cp312-cp312-macosx_11_0_arm64.whl
rainbow_api-1.6.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for rainbow_api-1.6.0-cp311-cp311-win_amd64.whl
rainbow_api-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for rainbow_api-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rainbow_api-1.6.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for rainbow_api-1.6.0-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 9.6 MB

Release files / rainbow_api-1.6.0.tar.gz

Download URL rainbow_api-1.6.0.tar.gz
Size 266.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3dfa90d051b4d818bfa123c509fcf7ef94405d40c0e26ccb1d3daf96ea6afb02
BLAKE2b-256 checksum
How to use checksums
54ad295f68b3929ec6f1ba7f4f6bdcfe8a84ef78c0f5067b216cf0014fdce649
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp313-cp313-win_amd64.whl

Download URL rainbow_api-1.6.0-cp313-cp313-win_amd64.whl
Size 936.4 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
31b4df3f0a80805a1a2761d864542d077a4368ad428e917742639754c8982b72
BLAKE2b-256 checksum
How to use checksums
35d800091a677553a8053c4a3a79bc59e388fd39169d05faaaba31c554cfb439
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rainbow_api-1.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.7 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
840cd94aed6263e683f21eabc3d9acd6947f71c7f38770fff677ce37deb3cab6
BLAKE2b-256 checksum
How to use checksums
5d9f0e20970c339d43abb155794928ca126a31e92ff3a7bd25d12988ac5bf002
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp313-cp313-macosx_11_0_arm64.whl

Download URL rainbow_api-1.6.0-cp313-cp313-macosx_11_0_arm64.whl
Size 491.0 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
254b6faf30d3cc50afb138fdc8685ea6ed949fdcff69ae2f3287e305b03cf930
BLAKE2b-256 checksum
How to use checksums
ae868e89ac54883e42a5aa140f36751de3aa04dcb59b0b13232cf2373590a36c
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp312-cp312-win_amd64.whl

Download URL rainbow_api-1.6.0-cp312-cp312-win_amd64.whl
Size 937.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
0e0620ac1786aead68255945c07636f0f88604d51d7c816f678d2405cd355459
BLAKE2b-256 checksum
How to use checksums
24936408745baddc00fe10876ab3a9bc61309567c7547427b95b1b8676a9ec07
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rainbow_api-1.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.7 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
fafe3fe0bd1178e3d187bf6d6307b5d2e5f529081bd577bf82e853ca916d237d
BLAKE2b-256 checksum
How to use checksums
331f00c93280badd7fe8ce414266f76d44f4541335fddd91c5a07b65fed34600
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL rainbow_api-1.6.0-cp312-cp312-macosx_11_0_arm64.whl
Size 491.9 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b28191b4d33e210f6c0c68c85495db33995538b594338af5126d10c442e6e6cb
BLAKE2b-256 checksum
How to use checksums
d9141e05fce249be906c62aa75e22da24e0483724bfb77ca02cf5ef94972a904
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp311-cp311-win_amd64.whl

Download URL rainbow_api-1.6.0-cp311-cp311-win_amd64.whl
Size 935.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
96a6fccef372addc0608cbdd145becbf504fea58b11706552371895f5d05b141
BLAKE2b-256 checksum
How to use checksums
8d98caae1c207946d499819e908e8b7dd93aecb6042b7ea4248d3e1ec6993d48
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL rainbow_api-1.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.7 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
73c79d9e6f1ed47456396350e21c2f1a1533932eeb3413a897bfbf449114dd1d
BLAKE2b-256 checksum
How to use checksums
2b75403cbb44a521bd07b1c0cc50c44e0eb765137f76fa04f70f456c6b33f4be
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 27, 2026.

Transparency log

Release files / rainbow_api-1.6.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL rainbow_api-1.6.0-cp311-cp311-macosx_11_0_arm64.whl
Size 490.7 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
878b5c945e787417bd0cbc28dbc6661c835918967125ed0d1ef0c156d6555867
BLAKE2b-256 checksum
How to use checksums
295324cd5b74829ccd57bcd4b78d6f2230c304c6c9ba5c4e932fa9ef9a80dc92
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 27, 2026.

Transparency log

Security for rainbow-api 1.6.0

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

All 10 files in this release have been uploaded with provenance metadata.

Select from 10 files

Attestation for rainbow_api-1.6.0.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 27, 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.

Release history Release notifications | RSS feed

This release

1.6.0 This release

10 release files Full provenance

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