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.7.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.7.0
File Size Uploaded Provenance Actions
rainbow_api-1.7.0.tar.gz 270.2 kB With provenance Details for rainbow_api-1.7.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rainbow-api 1.7.0
File Actions
rainbow_api-1.7.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for rainbow_api-1.7.0-cp313-cp313-win_amd64.whl
rainbow_api-1.7.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.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rainbow_api-1.7.0-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details for rainbow_api-1.7.0-cp313-cp313-macosx_11_0_arm64.whl
rainbow_api-1.7.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for rainbow_api-1.7.0-cp312-cp312-win_amd64.whl
rainbow_api-1.7.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.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rainbow_api-1.7.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for rainbow_api-1.7.0-cp312-cp312-macosx_11_0_arm64.whl
rainbow_api-1.7.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for rainbow_api-1.7.0-cp311-cp311-win_amd64.whl
rainbow_api-1.7.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.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
rainbow_api-1.7.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for rainbow_api-1.7.0-cp311-cp311-macosx_11_0_arm64.whl

Total release size: 9.6 MB

Release files / rainbow_api-1.7.0.tar.gz

Download URL rainbow_api-1.7.0.tar.gz
Size 270.2 kB
Tags Source
SHA-256 checksum
How to use checksums
96fd40001691cb2b6624af7e19a21d5b392a3f24e541a8f1545300fe76e15d2b
BLAKE2b-256 checksum
How to use checksums
fcc8189726a563e1f361bedd26a70a7570cb15c7c89cd3ff398a1e154b3b1059
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.0-cp313-cp313-win_amd64.whl
Size 939.5 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
cf0aa5e6f540ea1ef30fc3516a284dde64a4db7fe4ca53b62401b99c2e0a67c3
BLAKE2b-256 checksum
How to use checksums
0c6617d3d0c44675a4dd7d4f1fadf5629d5fadecf032d67936be96bca4482283
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.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
d276c1121f7c711389581a0f3170bb2a8b21f2f7ea305107821e1aed84f3bd49
BLAKE2b-256 checksum
How to use checksums
d73e719573fc1ed3c5ab6801556d7eaf906090c80400260d953add86781968ab
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.0-cp313-cp313-macosx_11_0_arm64.whl
Size 494.2 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a9108362d83244c3c79cd89b58d7ef6dd84dc25853c07e1535a9bdaced3f3ffd
BLAKE2b-256 checksum
How to use checksums
8cc7e4f0b164c24b996799d254b84de6937087fbd5ffffcafb35a5ae29a71ffd
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.0-cp312-cp312-win_amd64.whl
Size 940.3 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
e517392a1b6e151302a01c381b4862c82c2c2e3bc6b4ef9afea0d3a67c14586b
BLAKE2b-256 checksum
How to use checksums
8f4d5b8bf69df61ee6d96dc754566c69d34ee7f812905ebda866efb1e5f610a9
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.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
e1064310e5b09e2433079c4870b89dfb03307d22ef5541d4e25230090dfa269e
BLAKE2b-256 checksum
How to use checksums
0d4882b7b0ac6456e9b8b9b3cb7041aa1de94fcd254ddf69d045fb75c2346fa1
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.0-cp312-cp312-macosx_11_0_arm64.whl
Size 495.0 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c7b5e22ba001d8b81cd6f434dceabe715dbc224f63a1a75f7a2f5167db5257b1
BLAKE2b-256 checksum
How to use checksums
d1fb3771d353942609e96bb573befd88b75e7c58ee07620ae08acbe3a6f2d895
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.0-cp311-cp311-win_amd64.whl
Size 938.1 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
08f412955aab2bc1e28c0966e692b64cff4df1f825463ac801c30617032a2c9f
BLAKE2b-256 checksum
How to use checksums
1bb7d9e8ef704911752837f0fa04cd7aa0c08c0f4ea9f6cf146e1addb31d677d
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.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
3a286c1d81c1f30fde7bd5cbc33ef6509c0b92c393d5339d56ffc3605b011d88
BLAKE2b-256 checksum
How to use checksums
5464c6c6f4b8b7358b26e7ae1a39a4a7d360c8d84c3e6d9dae2e330c2dc147bd
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 28, 2026.

Transparency log

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

Download URL rainbow_api-1.7.0-cp311-cp311-macosx_11_0_arm64.whl
Size 493.8 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ae32d0bab2b87bde703674f13ad8521f83a65f6f958e0a0f8259dd4136c7726a
BLAKE2b-256 checksum
How to use checksums
9725497f603e99ea955d527513e241151f26b4f0b5b8557e46b08f75ee2b0001
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 28, 2026.

Transparency log

Security for rainbow-api 1.7.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.7.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 28, 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.7.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