rainbow-api 1.4.0__tar.gz → 1.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rainbow_api-1.5.1/CHANGELOG.md +707 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/MANIFEST.in +10 -0
- {rainbow_api-1.4.0/rainbow_api.egg-info → rainbow_api-1.5.1}/PKG-INFO +78 -7
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/README.md +64 -2
- rainbow_api-1.5.1/pyproject.toml +82 -0
- rainbow_api-1.5.1/rainbow/__init__.py +750 -0
- rainbow_api-1.5.1/rainbow/_arguments.py +83 -0
- rainbow_api-1.5.1/rainbow/_binning.py +186 -0
- rainbow_api-1.5.1/rainbow/agilent/__init__.py +291 -0
- rainbow_api-1.5.1/rainbow/agilent/acaml.py +193 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/agilent/chemstation.py +307 -65
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/agilent/masshunter.py +394 -110
- rainbow_api-1.5.1/rainbow/agilent/method.py +380 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/agilent/openlab.py +41 -6
- rainbow_api-1.5.1/rainbow/agilent/sequence.py +341 -0
- rainbow_api-1.5.1/rainbow/asm.py +2596 -0
- rainbow_api-1.5.1/rainbow/datadirectory.py +235 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/datafile.py +17 -4
- rainbow_api-1.5.1/rainbow/datasequence.py +230 -0
- rainbow_api-1.5.1/rainbow/debug/__init__.py +233 -0
- rainbow_api-1.5.1/rainbow/debug/_util.py +88 -0
- rainbow_api-1.5.1/rainbow/debug/chemstation_header.py +199 -0
- rainbow_api-1.5.1/rainbow/debug/chemstation_text.py +688 -0
- rainbow_api-1.5.1/rainbow/debug/dotnet.py +170 -0
- rainbow_api-1.5.1/rainbow/debug/ini.py +122 -0
- rainbow_api-1.5.1/rainbow/debug/method.py +115 -0
- rainbow_api-1.5.1/rainbow/debug/mzxml.py +165 -0
- rainbow_api-1.5.1/rainbow/debug/reg.py +112 -0
- rainbow_api-1.5.1/rainbow/debug/waters_header.py +128 -0
- rainbow_api-1.5.1/rainbow/debug/waters_inf.py +160 -0
- rainbow_api-1.5.1/rainbow/debug/xml.py +490 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/waters/__init__.py +23 -8
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/waters/masslynx.py +148 -28
- {rainbow_api-1.4.0 → rainbow_api-1.5.1/rainbow_api.egg-info}/PKG-INFO +78 -7
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow_api.egg-info/SOURCES.txt +20 -9
- rainbow_api-1.5.1/rainbow_api.egg-info/requires.txt +21 -0
- rainbow_api-1.4.0/pyproject.toml +0 -54
- rainbow_api-1.4.0/rainbow/__init__.py +0 -222
- rainbow_api-1.4.0/rainbow/_binning.py +0 -72
- rainbow_api-1.4.0/rainbow/agilent/__init__.py +0 -118
- rainbow_api-1.4.0/rainbow/datadirectory.py +0 -143
- rainbow_api-1.4.0/rainbow_api.egg-info/requires.txt +0 -10
- rainbow_api-1.4.0/tests/test_accelerator.py +0 -170
- rainbow_api-1.4.0/tests/test_agilent.py +0 -63
- rainbow_api-1.4.0/tests/test_binning.py +0 -95
- rainbow_api-1.4.0/tests/test_datadirectory.py +0 -85
- rainbow_api-1.4.0/tests/test_datafile.py +0 -111
- rainbow_api-1.4.0/tests/test_masshunter.py +0 -1285
- rainbow_api-1.4.0/tests/test_read.py +0 -81
- rainbow_api-1.4.0/tests/test_waters.py +0 -31
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/COPYING +0 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/COPYING.LESSER +0 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/agilent/_chdelta.pyx +0 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/agilent/_msprofile.pyx +0 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow/agilent/_uvdelta.pyx +0 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow_api.egg-info/dependency_links.txt +0 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/rainbow_api.egg-info/top_level.txt +0 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/setup.cfg +0 -0
- {rainbow_api-1.4.0 → rainbow_api-1.5.1}/setup.py +0 -0
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `rainbow-api` are documented here. This project adheres
|
|
4
|
+
to [Semantic Versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
## [1.5.1] - 2026-08-27
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- **`rb.from_asm` dropped a peak's compound name.** A processing method that
|
|
10
|
+
identified a peak writes the compound under `written name`; rainbow read
|
|
11
|
+
every quantity on the peak and discarded the name, leaving a peak list of
|
|
12
|
+
anonymous retention times with no way to follow a component across the
|
|
13
|
+
injections of a study. It is now read as the peak's `name`, and written back
|
|
14
|
+
on export.
|
|
15
|
+
- **`rb.from_asm` kept only the first of several integrations.** An Agilent
|
|
16
|
+
OpenLab or Empower export writes one processed data document per result
|
|
17
|
+
version, so a channel can arrive with the same run integrated up to six
|
|
18
|
+
times, under different processing methods and at different dates. rainbow
|
|
19
|
+
read the first and dropped the rest without a word, and the peak lists
|
|
20
|
+
genuinely differ: a reintegration finds or loses whole peaks. Every peak list
|
|
21
|
+
is now read. The first is still the group's `peaks`, so existing code is
|
|
22
|
+
unaffected; the rest are in the group's new `alternates`, each labelled with
|
|
23
|
+
the integration that produced it, and the group's new `processing` records
|
|
24
|
+
which integration the default peaks came from. Document order is not
|
|
25
|
+
processing order, so a group that carries alternates now warns. Re-export
|
|
26
|
+
writes them all back.
|
|
27
|
+
- **A channel of an OpenLab export had no wavelength.** rainbow read the
|
|
28
|
+
wavelength only from the device control document's `detector wavelength
|
|
29
|
+
setting`, which that exporter does not write, so every channel came back with
|
|
30
|
+
an empty y-axis label and a three-signal injection was three
|
|
31
|
+
indistinguishable traces. The wavelength is now also read from the cube
|
|
32
|
+
label, which is where that exporter names it, and the label itself is kept as
|
|
33
|
+
the channel's and the peak group's `description`.
|
|
34
|
+
|
|
35
|
+
## [1.5.0] - 2026-08-27
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
- **`rainbow.debug` metadata-inspection subsystem.** A new opt-in module with
|
|
39
|
+
two entry points, `rb.debug.inspect(path)` and `rb.debug.fields(path)`, that
|
|
40
|
+
decode the many vendor sidecar files a run directory ships (ChemStation
|
|
41
|
+
registers and INIs, .NET and XML blobs, mzXML and Waters headers, method and
|
|
42
|
+
macro dumps, audit trails) into structured fields on demand. It is never run
|
|
43
|
+
by the normal `rb.read` path, and is imported only on first use, so it adds
|
|
44
|
+
no overhead unless called. A catalogue of the formats it decodes is part of
|
|
45
|
+
the documentation.
|
|
46
|
+
- **Allotrope Simple Model (ASM) export and import.** Any `DataDirectory`
|
|
47
|
+
exports to one open, JSON-based ASM document with `datadir.to_asm()` (a dict)
|
|
48
|
+
or `datadir.export_asm(path)` (a file); `rb.from_asm(document)` reconstructs a
|
|
49
|
+
`DataDirectory`. Export is detector-driven and covers UV (a chromatogram cube
|
|
50
|
+
per single-wavelength trace and a 3D spectrum cube per diode-array
|
|
51
|
+
acquisition), charged-aerosol, evaporative-light-scattering, and
|
|
52
|
+
refractive-index channels, mass spectrometry (every monitored ion of a SIM
|
|
53
|
+
acquisition automatically, and chosen ions of a full scan via
|
|
54
|
+
`to_asm(ions=[...])`), and flame-ionization channels, which route to a
|
|
55
|
+
gas-chromatography document. Integrated peaks become processed data. New
|
|
56
|
+
documentation page, "Open data: the Allotrope Simple Model"
|
|
57
|
+
(`docs/source/asm.rst`). Documents target Allotrope revision `REC/2026/06`,
|
|
58
|
+
the current one, and an opt-in test suite validates rainbow's own output
|
|
59
|
+
against the published liquid- and gas-chromatography schemas.
|
|
60
|
+
- **`rb.from_asm` also reads ASM documents rainbow did not write** (for example
|
|
61
|
+
a third-party converter's richer envelope): it reconstructs the UV traces it
|
|
62
|
+
recognizes, ignores unfamiliar fields, and skips cubes it cannot represent
|
|
63
|
+
rather than failing.
|
|
64
|
+
- **`rb.read_sequence(path)` and the `DataSequence` container** for Agilent
|
|
65
|
+
multi-injection sequences: a container of per-injection `DataDirectory`
|
|
66
|
+
objects, with the shared instrument, operator, and injection count as
|
|
67
|
+
metadata. `rb.read_sequence(path, peaks=True)` attaches each injection's
|
|
68
|
+
integrated peaks. A whole sequence exports to one ASM document with
|
|
69
|
+
`sequence.to_asm()` / `sequence.export_asm(path)`, or to one document per
|
|
70
|
+
injection with `export_asm(directory, per_injection=True)`, and
|
|
71
|
+
`rb.sequence_from_asm` reconstructs it. `DataSequence` is exported at the
|
|
72
|
+
package level. The sequence workflow is Agilent-only. New "Sequences"
|
|
73
|
+
documentation guide (`docs/source/sequences.rst`).
|
|
74
|
+
- **Per-injection method and sample metadata** read from the Agilent `acq.macaml`
|
|
75
|
+
and `SAMPLE.XML` sidecars (injection volume, column temperature, flow rate,
|
|
76
|
+
modules, dilution, operator), merged onto each injection. This also enriches
|
|
77
|
+
the metadata returned by a single `rb.read`.
|
|
78
|
+
- **MS acquisition-mode tagging.** Each MS `DataFile` carries a
|
|
79
|
+
`metadata['acquisition_mode']` of `'SIM'` or `'Scan'`, read from authoritative
|
|
80
|
+
vendor metadata (Agilent `acqmeth.txt`, Waters `_FUNCTNS.INF` function types)
|
|
81
|
+
rather than guessed from the data.
|
|
82
|
+
- **The ASM export options are keyword-only.** `to_asm`, `export_asm`, their
|
|
83
|
+
sequence equivalents and the `DataDirectory` / `DataSequence` methods take
|
|
84
|
+
their run or file positionally and everything else by name, so no caller has
|
|
85
|
+
to remember an order and the list stays free to grow. Nothing here shipped
|
|
86
|
+
before 1.5.0, so no existing call changes meaning.
|
|
87
|
+
- **Controls for ASM document size.** `to_asm` / `export_asm` accept
|
|
88
|
+
`export_dad_cube=False` to omit the large diode-array spectrum cube,
|
|
89
|
+
`wavelengths=[...]` to keep only chosen wavelengths, and `decimal_places=N` to
|
|
90
|
+
round emitted numbers. `export_asm` streams one injection document at a time,
|
|
91
|
+
so even a long sequence of large spectra never has to fit in memory at once.
|
|
92
|
+
- **`rb.mz_resolution(path)`** reports the finest m/z spacing a run actually
|
|
93
|
+
records, the practical ceiling on `bin_width`. It is opt-in and never runs
|
|
94
|
+
during an ordinary `rb.read`.
|
|
95
|
+
- **`lxml`-accelerated sequence parsing.** The large `sequence.acaml` is read
|
|
96
|
+
with a tag-filtered iterparse, with the same output as the standard-library
|
|
97
|
+
fallback.
|
|
98
|
+
- **Refractive index detector (RID) support** for Agilent data.
|
|
99
|
+
- **More `.dx` archive manifest metadata** surfaced from the OpenLab `.dx`
|
|
100
|
+
manifest.
|
|
101
|
+
- **Opt-in ASM conformance tests** against a pinned Allotrope schema and the
|
|
102
|
+
Allotrope Foundation Ontology (AFO), enabled with `RAINBOW_TEST_ASM_SCHEMA=1`.
|
|
103
|
+
- **ASM export covers the Agilent MassHunter DAD support added in 1.4.0.**
|
|
104
|
+
Export routes on the detector rather than the file format, so a MassHunter
|
|
105
|
+
run's signals and spectra map as a Chemstation `.ch`/`.uv` pair does: one
|
|
106
|
+
chromatogram cube per single-wavelength signal and one 3D spectrum cube for
|
|
107
|
+
the wavelength grid, both honouring `export_dad_cube` and `wavelengths`. A
|
|
108
|
+
DAD's telemetry stays analog data and is never exported as a detector
|
|
109
|
+
channel.
|
|
110
|
+
- **`rb.iso_timestamp(value)`** converts a vendor timestamp to ISO 8601, or
|
|
111
|
+
returns `None` for a spelling rainbow cannot read. The vendors write
|
|
112
|
+
day-first wall clock and name the month, so `metadata['date']` does not sort
|
|
113
|
+
chronologically as text; this is the conversion the ASM export uses, and what
|
|
114
|
+
it returns does sort. The "Sequences" guide uses it to recover acquisition
|
|
115
|
+
order.
|
|
116
|
+
- **`DataDirectory.path`**, the path the run was read from, alongside the
|
|
117
|
+
`name` it already carried. `DataSequence` has had both all along.
|
|
118
|
+
|
|
119
|
+
### Changed
|
|
120
|
+
- **A diode-array channel in a 179 `.ch` container is now read as UV, not
|
|
121
|
+
FID. Breaking:** the container version says how the data is encoded, not what
|
|
122
|
+
measured it, and Chemstation writes both kinds into the same one. (The 181
|
|
123
|
+
layout of the same container records no signal string, so there is nothing to
|
|
124
|
+
read a detector from and a 181 file is still always read as FID.) The
|
|
125
|
+
detector now comes from the channel's own signal string, so a channel
|
|
126
|
+
reporting `DAD1A,Sig=210,4 Ref=off` in mAU is ultraviolet absorbance at
|
|
127
|
+
210 nm rather than a flame ionization trace in pA. `DataDirectory.detectors`
|
|
128
|
+
and `by_detector` change accordingly for such a run, and
|
|
129
|
+
`get_detector('FID')` on one now raises where it previously returned the
|
|
130
|
+
diode-array channels. Those channels also gain a `wavelength` ylabel and
|
|
131
|
+
their optics in metadata. Reading the detector from the version byte was also
|
|
132
|
+
what sent whole liquid chromatography runs out as gas chromatography
|
|
133
|
+
documents measuring picoamps.
|
|
134
|
+
- **A binned Waters function's ylabels are `float64` rather than `float32`.**
|
|
135
|
+
The values are unchanged; the array they are handed back in is wider. This
|
|
136
|
+
is the binning change above reaching the axis, so it applies to the formats
|
|
137
|
+
that bin: a function whose labels come from `_FUNCTNS.INF` rather than from
|
|
138
|
+
the data (the 2- and 4-byte formats, which include every single-wavelength
|
|
139
|
+
UV function) is still `float32`. Code that concatenates axes across vendors
|
|
140
|
+
should keep widening rather than assume one dtype.
|
|
141
|
+
- **Chemstation header strings are decoded as UTF-16 rather than by taking
|
|
142
|
+
every other byte.** The two agree while the text is ASCII; for anything else
|
|
143
|
+
the mangled bytes were not valid UTF-8, so the field was dropped and came
|
|
144
|
+
back empty. Headers written in any other script now read correctly, which
|
|
145
|
+
can add `notebook`, `method`, and similar fields to `DataFile.metadata` for
|
|
146
|
+
runs where they were previously missing.
|
|
147
|
+
- **`import rainbow` is about five times faster** (roughly 165 ms to 35 ms on
|
|
148
|
+
the machine this was measured on). `pandas`, needed only for the Waters
|
|
149
|
+
transition table, was imported at module load and was by a wide margin the
|
|
150
|
+
largest cost of importing the package. It is now imported where it is used,
|
|
151
|
+
as `matplotlib` already was, and `rainbow.debug`, the next largest cost, is
|
|
152
|
+
imported on first use.
|
|
153
|
+
- **Declared `requires-python = ">=3.8"`.** rainbow already needed 3.8, but
|
|
154
|
+
said so nowhere pip could see, so an older interpreter would install this and
|
|
155
|
+
fail at import instead of resolving an older rainbow. No upper bound.
|
|
156
|
+
- **`matplotlib` and `pandas` are no longer installed by default. Breaking:**
|
|
157
|
+
neither is needed to read a file. `DataFile.plot` is the only thing that
|
|
158
|
+
draws, and one Waters helper is the only thing that returns a DataFrame, so
|
|
159
|
+
a default install no longer carries either. Both now say which extra to
|
|
160
|
+
install if called without it: `pip install rainbow-api[plot]` and
|
|
161
|
+
`pip install rainbow-api[waters]`. `lxml` stays a default dependency, since
|
|
162
|
+
without it `rb.read_metadata` is about 2.5 times slower.
|
|
163
|
+
- **rainbow reads without `lxml` if it has to.** The vendor XML paths that used
|
|
164
|
+
lxml-only XPath were rewritten against the standard library, and the parsers
|
|
165
|
+
fall back to it when lxml is absent; every bundled fixture parses to an
|
|
166
|
+
identical result either way. This is a robustness fallback, not the intended
|
|
167
|
+
configuration, and `rainbow.debug` still needs lxml outright: recovering
|
|
168
|
+
structure from malformed and mis-encoded sidecars is exactly what its
|
|
169
|
+
recovering parser is for.
|
|
170
|
+
- **m/z binning split into `display_precision` and `bin_width`. Breaking:** the
|
|
171
|
+
`precision` argument to `rb.read` (and the vendor parsers) is replaced by two
|
|
172
|
+
independent controls. `display_precision` (default `'auto'`) is cosmetic and
|
|
173
|
+
rounds only the displayed m/z labels; `bin_width` is the lossy step that sums
|
|
174
|
+
intensities into a shared m/z grid, and applies to MS channels only.
|
|
175
|
+
`bin_width` defaults to nominal mass (1 Da) for unit-resolution data, and for
|
|
176
|
+
HRMS profile data defaults to the per-scan axis (no shared grid at all), so
|
|
177
|
+
binned output is unchanged by default. A `display_precision` too coarse to
|
|
178
|
+
label a `bin_width`'s bins distinctly is raised to fit, so labels always name
|
|
179
|
+
the columns one to one, and a per-scan centroid is left unrounded because its
|
|
180
|
+
labels are its data. Use `rb.mz_resolution(path)` to see how fine a
|
|
181
|
+
`bin_width` a run can actually support. Code passing `precision=` must now
|
|
182
|
+
pass `display_precision=`, or `bin_width=` to control the binning step.
|
|
183
|
+
**A positional call changes meaning silently.** `precision` sat where
|
|
184
|
+
`display_precision` now sits, so `rb.read(path, 3)` still runs and no longer
|
|
185
|
+
bins: it used to mean a 0.001 Da grid and now means nominal mass with three
|
|
186
|
+
label decimals. A keyword call gets a `TypeError` naming the replacement; a
|
|
187
|
+
positional one cannot be told apart from a deliberate `display_precision`.
|
|
188
|
+
Search for positional calls before upgrading.
|
|
189
|
+
|
|
190
|
+
`display_precision` no longer applies to a per-scan channel at all: on an
|
|
191
|
+
HRMS profile or a centroid, `mass_labels(i)` is the m/z axis itself rather
|
|
192
|
+
than a display of it, so rounding it discarded measured precision. A
|
|
193
|
+
calibrated TOF centroid kept only 4 decimals on read, and an HRMS profile at
|
|
194
|
+
the vendor default of 0 decimals returned 105,152 points under 2,398 distinct
|
|
195
|
+
labels. `ProfileDataFile.mz_decimals` now defaults to `None` and can still be
|
|
196
|
+
set on the returned file.
|
|
197
|
+
- **`rb.read(path, centroid=True)` returns a `CentroidDataFile`. Breaking:** a
|
|
198
|
+
MassHunter `MSPeak.bin` holds a separate peak list per scan, so there is no
|
|
199
|
+
one m/z axis to put them on. The returned object exposes `scan(i)` and
|
|
200
|
+
`mass_labels(i)` and deliberately refuses the shared-axis operations
|
|
201
|
+
(`ylabels`, `data`, `extract_traces`, `to_csvstr`, `plot`), each with an
|
|
202
|
+
explanation, rather than inventing a grid. Pass a `bin_width` to opt into one.
|
|
203
|
+
- **`ProfileDataFile.tof` is renamed `flight_times`. Breaking:** the attribute
|
|
204
|
+
holds the shared flight-time axis, and the old name read as though it were the
|
|
205
|
+
instrument rather than the quantity.
|
|
206
|
+
- **`display_precision` is bounded above as well as below.** Past about 306
|
|
207
|
+
decimals numpy's rounding overflows and every m/z label becomes NaN, which
|
|
208
|
+
breaks the rule that the labels name their columns one to one. The read entry
|
|
209
|
+
points now refuse a `display_precision` above 17, the point at which a float64
|
|
210
|
+
label stops carrying more information.
|
|
211
|
+
- **A `bin_width` of infinity or NaN is refused.** Infinity is greater than
|
|
212
|
+
zero, and then divides every m/z into one bin, so a run came back as a single
|
|
213
|
+
column labelled NaN that matched any ion asked for. NaN lost every comparison
|
|
214
|
+
and reached the parser's overflow guard, which reported a width that was too
|
|
215
|
+
small.
|
|
216
|
+
- **`rb.agilent.read` and `rb.waters.read` validate their arguments.** They are
|
|
217
|
+
documented entry points, but only `rb.read` checked `display_precision` and
|
|
218
|
+
`bin_width`, so a negative width silently produced duplicate m/z labels there
|
|
219
|
+
and a non-integer precision raised a `TypeError` from inside the parser.
|
|
220
|
+
- **`MZ_FLOORS['agilent']` is 0.05, not 0.1.** A Chemstation `.ms` stores each
|
|
221
|
+
m/z as a big-endian short over 20, a 0.05 Da lattice. Chemstation usually
|
|
222
|
+
writes one decimal place, so a run resolves 0.1 and every bundled fixture
|
|
223
|
+
does, but warning that 0.05 is too fine would be false of a file that
|
|
224
|
+
resolves it. `rb.mz_resolution` still answers per file.
|
|
225
|
+
- **Injections are looked up without regard to case**, the way
|
|
226
|
+
`DataDirectory.get_file` already matched a channel: `sequence["RUN.D"]`,
|
|
227
|
+
`"run.d" in sequence` and `get_injection` all agree. `by_name` still spells
|
|
228
|
+
each name the way its directory does.
|
|
229
|
+
|
|
230
|
+
### Fixed
|
|
231
|
+
- **A UV channel's wavelength ylabel is a number.** It arrived as text out of
|
|
232
|
+
the signal string, so `extract_traces(254.0)` raised on a ChemStation or
|
|
233
|
+
OpenLab channel and worked on the MassHunter channel beside it, and the
|
|
234
|
+
spelling followed the vendor's own (`'210'` against `'210.0'`). A channel
|
|
235
|
+
with no wavelength (FID, CAD, ELSD, a bare analog input) has no number to
|
|
236
|
+
give and keeps the empty label it always had.
|
|
237
|
+
- **ASM export no longer writes absorbance a thousand times too small.** The
|
|
238
|
+
AU-to-mAU normalization was keyed on an exact `"AU"`, while every other unit
|
|
239
|
+
table in the exporter case-folds and strips. The unit is whatever text the
|
|
240
|
+
vendor file carried, so a Waters run spelling it `au` exported unscaled into
|
|
241
|
+
a document that then passed strict validation.
|
|
242
|
+
- **A relabeled RID channel says so.** The detector documentation promised that
|
|
243
|
+
CAD, ELSD and RID all warn when the values go out under a measure they are
|
|
244
|
+
not in; the absorbance path returned early and RID's `nRIU` was the one
|
|
245
|
+
relabeled detector that stayed quiet.
|
|
246
|
+
- **A malformed member no longer aborts a `.dx` inspection.** `zipfile` raises
|
|
247
|
+
`NotImplementedError` for an unsupported compression method and
|
|
248
|
+
`RuntimeError` for an encrypted member, neither of which is an `OSError`, and
|
|
249
|
+
the archive walk is advanced outside `inspect`'s per-file guard, so one bad
|
|
250
|
+
member took down the whole run.
|
|
251
|
+
- **`rainbow.debug` recovers Windows-codepage characters** instead of replacing
|
|
252
|
+
them. The documented latin-1 fallback was unreachable, because decoding with
|
|
253
|
+
`errors="replace"` never raises, so a cp1252 copyright sign or an accented
|
|
254
|
+
operator name became U+FFFD.
|
|
255
|
+
- **`rainbow.debug.xml` reports a UTF-16 placeholder as empty,** not as a
|
|
256
|
+
malformed document: only the UTF-8 BOM was stripped before the emptiness
|
|
257
|
+
test, and these sidecars are commonly UTF-16.
|
|
258
|
+
- **The first line of a ChemStation report is classified by its own
|
|
259
|
+
neighbours.** `is_banner[i - 1]` wrapped to the last line of the file when
|
|
260
|
+
`i` was 0.
|
|
261
|
+
- **The mzXML reader closes the file it abandons.** It stops at the first scan,
|
|
262
|
+
which left the handle open until the iterator was collected.
|
|
263
|
+
- **The instrument module inventory is read from the `acq.macaml` Agilent
|
|
264
|
+
actually writes.** It looked for section headers spelled `DAD (G7117B)`;
|
|
265
|
+
ChemStation names the section for the module and puts the model in the
|
|
266
|
+
section ID, so the inventory was empty for every real acquisition method and
|
|
267
|
+
`metadata['modules']` was absent. The ASM device system fell back to the bare
|
|
268
|
+
chromatograph entry as a result.
|
|
269
|
+
- **`rainbow.debug.fields` returns the same answer on every filesystem.** The
|
|
270
|
+
walk sorted names within a directory but took sibling directories in
|
|
271
|
+
`readdir` order, which is creation order on APFS and a hash order on ext4.
|
|
272
|
+
Since a scalar field keeps the first value seen, the reported instrument and
|
|
273
|
+
method depended on the machine. The whole stream is now sorted by relpath,
|
|
274
|
+
which is what the walk already claimed.
|
|
275
|
+
- **UTF-16 method and macro files are parsed rather than called binary.** The
|
|
276
|
+
text-or-binary test counted non-printable bytes in the raw file, and UTF-16
|
|
277
|
+
is about half NUL, so every UTF-16 member of that family was classified
|
|
278
|
+
binary and skipped. Seven of the nine committed `.MTH`/`.MAC` fixtures are
|
|
279
|
+
UTF-16.
|
|
280
|
+
- **`rainbow.debug` decodes BOM-less UTF-16BE.** The byte order is now inferred
|
|
281
|
+
from where the NULs fall rather than assumed little endian, which turned
|
|
282
|
+
every big-endian sidecar into mojibake.
|
|
283
|
+
- **`rainbow.debug.xml.canonical` no longer raises on an empty root.** A
|
|
284
|
+
document like `<Sample/>` converts to a bare string rather than a mapping,
|
|
285
|
+
and the handlers read fields off a mapping. `fields` hid the `AttributeError`
|
|
286
|
+
behind a blanket except; the documented `canonical(parse(path))` call did not.
|
|
287
|
+
- **The lxml sequence parser no longer drops peaks from a nested document.** It
|
|
288
|
+
pruned earlier siblings unconditionally after each matched element, so a
|
|
289
|
+
`Signal` inside a `SignalResult` destroyed the `Signal_ID` and `Peak`
|
|
290
|
+
siblings that `SignalResult` had not been read for yet. Agilent's own exports
|
|
291
|
+
do not nest that way, but the reader is pointed at documents rainbow did not
|
|
292
|
+
write, and the two backends are documented to agree.
|
|
293
|
+
- **The m/z probe reaches partial `.ms` files.** `_labels_only` was not passed
|
|
294
|
+
to the partial reader, so `rb.mz_resolution` built the full intensity grid for
|
|
295
|
+
those channels to read nothing but the axis off it.
|
|
296
|
+
- **ASM export refuses a non-finite value instead of writing `NaN`.** Bare
|
|
297
|
+
`NaN` and `Infinity` are not JSON, and a document holding one is rejected by
|
|
298
|
+
any strict reader outside Python.
|
|
299
|
+
- **`export_asm` no longer truncates a file on a handle that cannot hold
|
|
300
|
+
Unicode.** It forced characters through as themselves, so a handle the caller
|
|
301
|
+
opened as cp1252 or latin-1 raised `UnicodeEncodeError` partway through and
|
|
302
|
+
left a file that looked complete. Such a handle now gets escaped JSON, which
|
|
303
|
+
says the same thing; a UTF handle is unchanged.
|
|
304
|
+
- **ASM export says when it emits a timestamp with no UTC offset.** That is the
|
|
305
|
+
single reason a default export of most ChemStation and Waters runs does not
|
|
306
|
+
validate, and only the changelog and the concepts page said so. Warned once
|
|
307
|
+
per document, and not at all when the source recorded an offset or
|
|
308
|
+
`utc_offset=` supplied one.
|
|
309
|
+
- **A Waters sequence directory is told why it cannot be read.** It was told it
|
|
310
|
+
holds no injection subdirectories, which was untrue of a directory full of
|
|
311
|
+
`.raw` injections; the reason is that sequence reading is implemented for
|
|
312
|
+
Agilent.
|
|
313
|
+
- **`pip install rainbow-api[test]` installs `python-lzf`,** so CI runs the two
|
|
314
|
+
LZF `MSProfile.bin` decode tests instead of skipping them.
|
|
315
|
+
- **ASM timestamps are ISO 8601.** `measurement time` and `injection time`
|
|
316
|
+
passed the vendor's own spelling straight through, so an exported document
|
|
317
|
+
carried values like `27-Feb-18, 10:11:50` where the Allotrope core schema
|
|
318
|
+
types an ISO 8601 timestamp ("All timestamps MUST be in ISO8601 date/time
|
|
319
|
+
format"). Every vendor path was affected except OpenLab `.dx`, which already
|
|
320
|
+
stores ISO. The ChemStation, Waters, and Agilent sequence spellings are now
|
|
321
|
+
converted; one rainbow cannot parse is omitted rather than passed through,
|
|
322
|
+
since a vendor-format string there is a value no ASM reader can read.
|
|
323
|
+
|
|
324
|
+
Most of those formats record local wall clock with no UTC offset, and rainbow
|
|
325
|
+
will not invent one: a fabricated offset would move the recorded instant by
|
|
326
|
+
up to a day. So the default output is ISO 8601 without an offset, which is
|
|
327
|
+
not strict RFC 3339 (what `format: date-time` means). Pass the new
|
|
328
|
+
`utc_offset=` argument to `to_asm`, `export_asm`, and their sequence
|
|
329
|
+
equivalents to supply the offset and get a fully conforming document; an
|
|
330
|
+
offset the source did record is never overridden. See the ASM documentation.
|
|
331
|
+
- **The ASM conformance test now checks string formats.** It built its
|
|
332
|
+
validator without a format checker, and jsonschema treats `format` as an
|
|
333
|
+
annotation unless you supply one, so the suite validated structure and never
|
|
334
|
+
checked a single timestamp. That is why the non-ISO timestamps above passed
|
|
335
|
+
it. The `validate` extra now also installs `rfc3339-validator`, without which
|
|
336
|
+
jsonschema silently skips `date-time` even when a checker is supplied, and
|
|
337
|
+
the test skips loudly rather than passing vacuously if it is missing.
|
|
338
|
+
- **A non-ultraviolet detector module is no longer reported as an ultraviolet
|
|
339
|
+
one** in a document's instrument inventory. Any module whose type was
|
|
340
|
+
`detector`, or whose name merely contained the word, was filed under the
|
|
341
|
+
ultraviolet class, so an FID, RID, ELSD, mass-spectrometer, or
|
|
342
|
+
charged-aerosol module contradicted the very cube it described. Each now maps
|
|
343
|
+
to the AFO class its cube already uses, matched as whole words with an
|
|
344
|
+
optional module index (`FID1`, `RID1A`, `FID_2`) so `hybrid` and `cascade`
|
|
345
|
+
are not mistaken for detectors. Thermal-conductivity, electron-capture, and
|
|
346
|
+
fluorescence modules get their own AFO classes, and the spelled-out
|
|
347
|
+
ultraviolet names (`Variable Wavelength Detector`, `TUV`, `PDA`) are
|
|
348
|
+
recognized alongside the acronyms.
|
|
349
|
+
- **A detector in a gas chromatography document is no longer typed as a liquid
|
|
350
|
+
chromatography one.** AFO makes `liquid chromatography detector` and `gas
|
|
351
|
+
chromatography detector` disjoint siblings, so the generic class used for a
|
|
352
|
+
detector AFO cannot name (a charged-aerosol detector, an analog input) has to
|
|
353
|
+
follow the document it rides in; it was fixed at the liquid one. This applies
|
|
354
|
+
to both the instrument inventory and the per-channel device control document.
|
|
355
|
+
A run with no module inventory at all likewise now declares itself a
|
|
356
|
+
`gas chromatograph` rather than a `liquid chromatograph` when exported as GC.
|
|
357
|
+
- **`rb.from_asm` no longer raises on documents rainbow did not write.** It
|
|
358
|
+
tolerated one shape and crashed on the rest: a missing measurement aggregate,
|
|
359
|
+
a lone object where a list is declared, an empty device-control list, and a
|
|
360
|
+
cube described without its `data` member, which the published cube structure
|
|
361
|
+
does not require. It also no longer raises when a field holds something other
|
|
362
|
+
than its declared type: a cube, injection document, or device system that is
|
|
363
|
+
not an object, a device document that is not a list, a name or analyst that is
|
|
364
|
+
not a string, a timestamp written in the `{"value": ...}` form the core schema
|
|
365
|
+
also permits, or cube values that are not the numbers the cube declares.
|
|
366
|
+
Anything it cannot represent is skipped, as an unrepresentable cube always
|
|
367
|
+
was, and an unreadable field costs only itself: the channel still comes back.
|
|
368
|
+
Verified by mutating every field of five documents, rainbow's own and two
|
|
369
|
+
third-party, to each of eleven wrong shapes (10,362 reads, no exception).
|
|
370
|
+
- **`rb.read(path, centroid=True, bin_width=...)` no longer warns falsely.** The
|
|
371
|
+
m/z floors describe unit-resolution data, but were applied to calibrated
|
|
372
|
+
MassHunter TOF centroids, which resolve far below them, so a perfectly
|
|
373
|
+
sensible bin was reported as too fine.
|
|
374
|
+
- **`rb.mz_resolution(path, centroid=True)`** can inspect a centroid run. MS
|
|
375
|
+
data in an `MSPeak.bin` is parsed only under that flag, so such a run
|
|
376
|
+
previously came back as though it had no MS at all. A quantized centroid
|
|
377
|
+
(an uncalibrated quadrupole, whose peak m/z sit near nominal mass) reports
|
|
378
|
+
its quantization. A calibrated TOF centroid is parsed but reports nothing:
|
|
379
|
+
its peaks carry continuous m/z, so there is no lattice to state, and the
|
|
380
|
+
channel is absent from the result rather than given an invented number.
|
|
381
|
+
- **`DataDirectory.list_analog()` no longer raises on a MassHunter DAD's
|
|
382
|
+
telemetry.** It read a trace's description from a key MassHunter does not
|
|
383
|
+
use, so listing the analog traces of a run acquired with a DAD raised
|
|
384
|
+
`KeyError` instead of printing them.
|
|
385
|
+
- **`rainbow.debug` reports a missing `lxml` instead of hiding it.**
|
|
386
|
+
`inspect()` recorded the failure per file and `fields()` returned an empty
|
|
387
|
+
record, so an environment without `lxml` looked like a run with no metadata.
|
|
388
|
+
- **The `sequence.acaml` reader closes its file deterministically.** The parse
|
|
389
|
+
stops as soon as it has the instrument, which abandons the iterator
|
|
390
|
+
mid-document and left the handle to be closed whenever the interpreter got
|
|
391
|
+
round to it. It is now closed as the reader unwinds.
|
|
392
|
+
- **An Agilent MassHunter DAD signal now reports its optics.** The `.cd`
|
|
393
|
+
descriptor gives each signal the same `Sig=`/`Ref=` description Chemstation
|
|
394
|
+
writes, but it was left unparsed, so a `.cg` channel carried no `wavelength`,
|
|
395
|
+
`bandwidth`, or reference band in its metadata while the equivalent `.ch`
|
|
396
|
+
channel did. They are now read with the parser the `.ch` and `.dx` readers
|
|
397
|
+
already share. An ASM export of a MassHunter DAD consequently records each
|
|
398
|
+
channel's detector wavelength setting, and a document that had lost the
|
|
399
|
+
wavelength on the way back through `rb.from_asm` now round-trips intact.
|
|
400
|
+
|
|
401
|
+
## [1.4.0] - 2026-08-13
|
|
402
|
+
|
|
403
|
+
### Added
|
|
404
|
+
- **Agilent MassHunter DAD support.** A MassHunter `.d` stores its DAD data in
|
|
405
|
+
four files that the Chemstation decoders do not read, so until now a `.d`
|
|
406
|
+
acquired with a diode-array detector returned no UV data at all - silently,
|
|
407
|
+
since MassHunter parsing is opt-in and an unread detector looks the same as
|
|
408
|
+
an absent one. `rb.read` now parses them: `DAD1.cd` describes the signals in
|
|
409
|
+
`DAD1.cg` (one chromatogram each), and `DAD1.sd` describes the spectra in
|
|
410
|
+
`DAD1.sp` - the same two views the Chemstation format splits into `.ch` and
|
|
411
|
+
`.uv` files.
|
|
412
|
+
|
|
413
|
+
The spectra become a single (retention time x wavelength) `DataFile` named
|
|
414
|
+
after the `.sp`, and each signal its own, carrying the Chemstation signal
|
|
415
|
+
letter (`DAD1A.cg`, `DAD1B.cg`, ...) since here they share one file. Both
|
|
416
|
+
descriptors give the byte offset of every record they describe, so the data
|
|
417
|
+
files are indexed rather than walked at an assumed stride - signals sampled at
|
|
418
|
+
different rates, and spectra that are not evenly spaced, are read correctly.
|
|
419
|
+
Unlike the Chemstation `.uv`/`.ch` formats there is no delta encoding and no
|
|
420
|
+
scaling factor: the values are plain little-endian float64.
|
|
421
|
+
|
|
422
|
+
Spectra whose wavelength axis changes during a run cannot form one grid, and
|
|
423
|
+
are declined with a warning rather than reshaped.
|
|
424
|
+
- `rb.read(..., telemetry=True)` also parses the traces a DAD records beside
|
|
425
|
+
its signals (lamp voltage, board and optical-unit temperature). Off by
|
|
426
|
+
default and returned as analog data, matching `.dx` telemetry — including
|
|
427
|
+
that naming one in `requested_files` parses it regardless of the flag.
|
|
428
|
+
- `tests/test_masshunter.py::test_dad_*` and the `bronze.D` fixture: a
|
|
429
|
+
four-retention-time slice of a real QQQ+DAD acquisition keeping all five
|
|
430
|
+
absorbance signals, all three telemetry traces, and the full 190-550 nm axis,
|
|
431
|
+
with the telemetry deliberately at a different point count from the signals.
|
|
432
|
+
|
|
433
|
+
### Changed
|
|
434
|
+
- **The MassHunter parser is now always consulted for a `.d`, not only under
|
|
435
|
+
`hrms`/`centroid`.** DAD data is parsed unconditionally, as the Chemstation
|
|
436
|
+
UV formats are; the MS parsing inside remains gated on those flags. A `.d`
|
|
437
|
+
that holds DAD data therefore yields UV `DataFile`s where it previously
|
|
438
|
+
yielded none.
|
|
439
|
+
|
|
440
|
+
### Fixed
|
|
441
|
+
- **`rb.read_metadata()` now reports a MassHunter run's DAD files** alongside
|
|
442
|
+
its MS ones. The MassHunter branch returned as soon as it had found
|
|
443
|
+
`MSProfile.bin`/`MSPeak.bin`, so a run carrying both came back as MS-only
|
|
444
|
+
while `rb.read()` returned its chromatograms and spectra.
|
|
445
|
+
|
|
446
|
+
## [1.3.1] - 2026-07-22
|
|
447
|
+
|
|
448
|
+
### Added
|
|
449
|
+
- **`hrms` optional-dependency extra** (`pip install rainbow-api[hrms]`), which
|
|
450
|
+
installs `python-lzf` for LZF-compressed Agilent MassHunter `MSProfile.bin`
|
|
451
|
+
segments. The extra was referenced in the docs but never declared, so the
|
|
452
|
+
install warned the extra did not exist and silently installed nothing.
|
|
453
|
+
- **`hrms_available` metadata hint** on `rb.read(path)` and
|
|
454
|
+
`rb.read_metadata(path)`, mirroring `centroid_available`: a MassHunter `.D`
|
|
455
|
+
whose `MSProfile.bin` was not parsed now advertises that profile data is
|
|
456
|
+
present and needs `hrms=True`.
|
|
457
|
+
|
|
458
|
+
### Fixed
|
|
459
|
+
- **`rb.read_metadata()` on Agilent MassHunter `.D` folders** now reports the
|
|
460
|
+
`MSProfile.bin`/`MSPeak.bin` datafiles (plus the `hrms_available` /
|
|
461
|
+
`centroid_available` hints) instead of returning an empty datafile list.
|
|
462
|
+
|
|
463
|
+
## [1.3.0] - 2026-06-24
|
|
464
|
+
|
|
465
|
+
### Changed
|
|
466
|
+
- **Agilent HRMS profile data is now per-scan by default. Breaking:**
|
|
467
|
+
`rb.read(path, hrms=True)` returns the faithful per-scan representation (a
|
|
468
|
+
`rainbow.agilent.masshunter.ProfileDataFile` per flight-time grid) instead of
|
|
469
|
+
the shared-grid `DataFile`. A Q-TOF/TOF `MSProfile.bin` has a per-scan m/z
|
|
470
|
+
axis (the flight-time-to-m/z calibration drifts between scans), so projecting
|
|
471
|
+
every scan onto one shared grid inserts zeros and merges peaks. Pass a
|
|
472
|
+
`bin_width` to opt into the shared grid.
|
|
473
|
+
- **`prec` renamed to `precision`** on `rb.read` (and the vendor parsers).
|
|
474
|
+
**Breaking:** code passing `prec=` must now pass `precision=`.
|
|
475
|
+
- **`precision` now defaults to `'auto'` and is resolved per file from the
|
|
476
|
+
actual data type:** 4 decimals for high-resolution data (the HRMS profile and
|
|
477
|
+
TOF centroids) and 0 (whole numbers) for unit-resolution data (UV,
|
|
478
|
+
GC/quadrupole MS, ICP-MS, Waters). Previously the default was a flat `0`,
|
|
479
|
+
which silently reduced high-resolution m/z to nominal mass. Pass an explicit
|
|
480
|
+
integer to override (including `0`).
|
|
481
|
+
|
|
482
|
+
### Added
|
|
483
|
+
- **Per-scan (unbinned) HRMS profile representation** (now the default; see
|
|
484
|
+
Changed). `ProfileDataFile` exposes `scan(i)`, `mass_labels(i)`, the shared
|
|
485
|
+
`tof` axis, and the raw `data` matrix. It has no single `ylabels`, and the
|
|
486
|
+
`DataFile` operations that need one shared m/z axis (`ylabels`,
|
|
487
|
+
`extract_traces`, `to_csvstr`, `export_csv`, `plot`) raise a clear error
|
|
488
|
+
pointing at `scan(i)`/`mass_labels(i)` and the documentation. New
|
|
489
|
+
documentation page, "HRMS Profile Data"
|
|
490
|
+
(`docs/source/agilent/hrms_data_model.rst`).
|
|
491
|
+
- **`bin_width` argument on `rb.read`** is the single switch for HRMS
|
|
492
|
+
shared-grid binning: omit it for the per-scan representation, pass a width (in
|
|
493
|
+
daltons) to project onto one shared grid. It is fully independent of
|
|
494
|
+
`precision` (which only rounds the reported m/z labels and has no effect on the
|
|
495
|
+
grid). A `bin_width` finer than `10**-precision` is allowed but warns, since
|
|
496
|
+
two bins may then round to the same m/z label.
|
|
497
|
+
|
|
498
|
+
### Fixed
|
|
499
|
+
- **`MSProfile.bin` RLE segments whose first scan opens with a literal run
|
|
500
|
+
(#27).** The run-length-encoded intensity stream is `[point-count word]
|
|
501
|
+
[negated leading-zero count][token stream]`, with the token stream opening at
|
|
502
|
+
4-byte width. The reader instead read a second int32 as a "width flag", which
|
|
503
|
+
happened to decode correctly only when the first token was a width switch
|
|
504
|
+
(the common case) but raised `Malformed MSProfile.bin RLE segment` on
|
|
505
|
+
high-signal scans that open with a literal 4-byte intensity. Fixed in both the
|
|
506
|
+
pure-Python `decompress_inten_list` and the Cython accelerator
|
|
507
|
+
(`_msprofile.pyx`); validated on two real Agilent Q-TOF datasets (every scan's
|
|
508
|
+
decoded maximum matches the independently stored `MaxY`, 0 mismatches across
|
|
509
|
+
all 1256 scans of each).
|
|
510
|
+
- **Shared-grid binning no longer emits all-zero columns.** A column of the
|
|
511
|
+
shared grid is meant to be a bin some scan actually filled (empty bins are
|
|
512
|
+
dropped), but the sparse-path branch of `bin_to_grid` keyed its columns off
|
|
513
|
+
point presence rather than nonzero intensity, so points whose recorded
|
|
514
|
+
intensity is `0` produced phantom all-zero columns (about 90 of ~315,000 on
|
|
515
|
+
the default fine grid). The sparse path now drops zero-sum columns, matching
|
|
516
|
+
the dense path.
|
|
517
|
+
|
|
518
|
+
## [1.2.0] - 2026-06-22
|
|
519
|
+
|
|
520
|
+
### Added
|
|
521
|
+
- **Agilent MassHunter ICP-MS support (issue #25).** ICP-MS `.D` directories
|
|
522
|
+
(e.g. Agilent 7700 / 8900) now parse via a new `parse_icpmsdata`, detected by
|
|
523
|
+
the presence of `MSScan_XSpecific.bin`. Single tune mode and one measurement
|
|
524
|
+
per isotope. Contributed by Jeremy Hourigan (UC Santa Cruz).
|
|
525
|
+
- **`format` argument on `rb.read` and `rb.read_metadata`** to force the vendor
|
|
526
|
+
parser (`'agilent'` or `'waters'`), bypassing detection.
|
|
527
|
+
- **Content-based vendor detection.** A directory whose name lacks a
|
|
528
|
+
`.D`/`.raw`/`.dx` suffix is identified from its contents; suffixed paths are
|
|
529
|
+
unaffected.
|
|
530
|
+
- **Optional Cython accelerator for the Agilent `.ch` decode**
|
|
531
|
+
(`rainbow/agilent/_chdelta.pyx`) - ~11x faster, bit-identical, with a
|
|
532
|
+
transparent pure-Python fallback.
|
|
533
|
+
|
|
534
|
+
### Changed
|
|
535
|
+
- **Faster MS spectrum parsing.** Vectorized binning (shared
|
|
536
|
+
`rainbow/_binning.py`) and lookup-table exponentials replace the per-scan
|
|
537
|
+
loops in the Waters `_FUNC.DAT` and Agilent `.ms` decoders. Output unchanged;
|
|
538
|
+
~2-3x faster.
|
|
539
|
+
- **Test suite migrated to pytest** (added a `test` extra; run with `pytest`).
|
|
540
|
+
|
|
541
|
+
## [1.1.0] - 2026-06-17
|
|
542
|
+
|
|
543
|
+
### Fixed
|
|
544
|
+
- **MassHunter HRMS profile data is parsed when scans also store centroids.**
|
|
545
|
+
When an acquisition writes `MSPeak.bin` alongside `MSProfile.bin`, each
|
|
546
|
+
`MSScan.bin` record carries two `SpectrumParamValues` blocks (a profile and a
|
|
547
|
+
centroid block; the schema element is `maxOccurs="unbounded"`) instead of one.
|
|
548
|
+
The reader assumed exactly one block, so after the first scan it mis-parsed
|
|
549
|
+
the centroid block as the next scan's fields and crashed (`struct.error`).
|
|
550
|
+
`rainbow` now reads each record at its true stride - taken from the MSTS.xml
|
|
551
|
+
scan count when consistent, otherwise inferred from the record geometry - and
|
|
552
|
+
reads the profile block. Validated on real Agilent Q-TOF (issue #27) and
|
|
553
|
+
TOF-MS datasets.
|
|
554
|
+
- **HRMS calibration without `MSMassCal.bin`.** Some Q-TOF/TOF acquisitions omit
|
|
555
|
+
the per-scan `MSMassCal.bin` and keep only the default calibration in
|
|
556
|
+
`DefaultMassCal.xml`; the parser raised `FileNotFoundError` opening the former.
|
|
557
|
+
`rainbow` now falls back to reconstructing each scan's calibration row from
|
|
558
|
+
`DefaultMassCal.xml` (by `CalibrationID`). The per-scan refinement is sub-ppm,
|
|
559
|
+
so the m/z reproduce the per-scan values to <0.0001 Da (checked against the
|
|
560
|
+
`magenta`/`cyan` fixtures, which carry both files).
|
|
561
|
+
- **Interrupted acquisitions no longer fail.** When `MSScan.bin` describes more
|
|
562
|
+
scans than `MSProfile.bin` actually contains (an aborted run, sometimes with a
|
|
563
|
+
stale `MSTS.xml` scan count), `rainbow` keeps the complete leading scans
|
|
564
|
+
instead of raising on the truncated segment.
|
|
565
|
+
|
|
566
|
+
### Added
|
|
567
|
+
- **Agilent MassHunter centroid (`MSPeak.bin`) support (issue #37).** `MSPeak.bin`
|
|
568
|
+
stores the peak-picked (centroid) spectrum of each scan - the counterpart to
|
|
569
|
+
the dense profile trace in `MSProfile.bin`. `rb.read(..., centroid=True)` now
|
|
570
|
+
parses it (off by default, like `hrms`). GC-quadrupole centroids are stored as
|
|
571
|
+
m/z directly (validated to 7e-5 relative agreement against the same
|
|
572
|
+
acquisition's `data.ms`); Q-TOF/TOF centroids are stored as time-of-flight and
|
|
573
|
+
are calibrated with the same `DefaultMassCal.xml`/`MSMassCal.bin` path as the
|
|
574
|
+
profile. When a `.D` contains `MSPeak.bin` but is read without the flag,
|
|
575
|
+
`centroid_available` is set in the directory metadata so the option is
|
|
576
|
+
discoverable. The centroid decoding was contributed by denisshragin.
|
|
577
|
+
- `tests/test_masshunter.py::TestMasshunterMultiBlock` and
|
|
578
|
+
`TestMasshunterCentroid`: trimmed real TOF-MS fixtures (`gold.D`, a 3-scan
|
|
579
|
+
profile+centroid slice; `copper.D`, the same with a truncated `MSProfile.bin`)
|
|
580
|
+
covering the two-block record stride, the `DefaultMassCal.xml` calibration
|
|
581
|
+
fallback, geometry-based stride inference, incomplete-acquisition recovery, and
|
|
582
|
+
the centroid path (block selection, GC-quad and calibrated-TOF axes, the
|
|
583
|
+
`centroid=True` flag, and the metadata note).
|
|
584
|
+
|
|
585
|
+
## [1.0.16] - 2026-06-17
|
|
586
|
+
|
|
587
|
+
### Added
|
|
588
|
+
- **Agilent MassHunter HRMS Q-TOF profile support (issue #27).** Q-TOF
|
|
589
|
+
acquisitions store `MSProfile.bin` intensities with a run-length encoding
|
|
590
|
+
rather than LZF compression, which made the parser raise `ValueError: error
|
|
591
|
+
in compressed data`. `rainbow` now detects the encoding from each scan
|
|
592
|
+
segment's own header and decodes it (`decompress_inten_list`). The decode is
|
|
593
|
+
validated against two real datasets (474 and 1256 scans): every scan's
|
|
594
|
+
decoded maximum intensity matches the `MaxY` value stored independently in
|
|
595
|
+
`MSScan.bin`.
|
|
596
|
+
- Support for the newer MassHunter `MSScan.xsd` variant, whose complex-type
|
|
597
|
+
references are qualified with the schema's target-namespace prefix (e.g.
|
|
598
|
+
`mstns:ScanRecordType`). These previously raised `KeyError` while reading
|
|
599
|
+
`MSScan.bin`.
|
|
600
|
+
- **Polynomial m/z calibration for HRMS.** When `DefaultMassCal.xml` provides a
|
|
601
|
+
polynomial `ValueUseFlags`, `rainbow` now applies the polynomial correction
|
|
602
|
+
(`MSMassCal.bin` stores `[coeff, base, left, right, c0..c5]` per scan) on top
|
|
603
|
+
of the traditional calibration. Validated to <0.0001 Da against m/z that
|
|
604
|
+
Agilent MassHunter BioConfirm exports for the reporter's spectra; the
|
|
605
|
+
traditional calibration alone is ~1-2 ppm off. Files without
|
|
606
|
+
`DefaultMassCal.xml` keep the traditional calibration.
|
|
607
|
+
- **Optional compiled accelerator for the MSProfile.bin run-length decode**
|
|
608
|
+
(`rainbow/agilent/_msprofile.pyx`). The decode is an inherently sequential,
|
|
609
|
+
variable-width byte loop; the Cython version is ~100x faster than the
|
|
610
|
+
pure-Python loop and bit-identical. Like the `.uv` accelerator it is optional
|
|
611
|
+
— without a compiler or Cython, `rainbow` falls back to pure Python.
|
|
612
|
+
- `tests/test_masshunter.py`: parses trimmed real Q-TOF profile fixtures
|
|
613
|
+
(`magenta.D`, `cyan.D`) end to end without `python-lzf`, cross-checking the
|
|
614
|
+
decoded intensities and validating the calibrated m/z against BioConfirm.
|
|
615
|
+
`tests/test_accelerator.py` adds parity tests for the `_msprofile` extension.
|
|
616
|
+
|
|
617
|
+
### Changed
|
|
618
|
+
- **MassHunter HRMS no longer requires `MSTS.xml`.** The number of retention
|
|
619
|
+
times is now recovered by reading `MSScan.bin` to EOF instead of from
|
|
620
|
+
`MSTS.xml`, which is absent from Agilent OpenLab `.rslt`/`.sirslt` result
|
|
621
|
+
folders. Validated against the `yellow` fixture (centroided) and two real
|
|
622
|
+
HRMS profile datasets, where the recovered count matches `MSTS.xml` exactly.
|
|
623
|
+
- The `python-lzf` import is now lazy and only happens when an LZF-compressed
|
|
624
|
+
`MSProfile.bin` segment is actually encountered, so the rest of the
|
|
625
|
+
MassHunter module - including the run-length-encoded Q-TOF profile path -
|
|
626
|
+
imports and runs without `python-lzf` installed.
|
|
627
|
+
- **Faster HRMS profile parsing (~8x end to end** on large files; e.g. a 185 MB
|
|
628
|
+
`MSProfile.bin` went from ~35 s to ~4.5 s). The compiled decoder removes the
|
|
629
|
+
decode bottleneck, the per-scan m/z arrays are concatenated instead of routed
|
|
630
|
+
through a ~100M-element Python list, and the (retention time x m/z) grid is
|
|
631
|
+
binned with integer keys in a single pass instead of a global sort (with a
|
|
632
|
+
memory-bounded fallback to the sort-based path). Output is unchanged.
|
|
633
|
+
|
|
634
|
+
## [1.0.15] - 2026-06-17
|
|
635
|
+
|
|
636
|
+
### Added
|
|
637
|
+
- **Agilent OpenLab CDS (`.dx`) support.** OpenLab 2.x exports a single OPC
|
|
638
|
+
(zip) archive rather than a `.D` directory. `rb.read` now accepts a `.dx`
|
|
639
|
+
path and parses its payloads with the existing Chemstation decoders: the DAD
|
|
640
|
+
spectrum (`.UV`), single-wavelength signals (`.CH`), and—opt-in—instrument
|
|
641
|
+
telemetry (`.IT`). Trace names, units, and detector roles are recovered from
|
|
642
|
+
the `injection.acmd` manifest, since the payload files are named by GUID. The
|
|
643
|
+
DAD spectrum's absorbance is corrected by a `2**-17` fixed-point shift unique
|
|
644
|
+
to this format, validated against the file's own single-wavelength channels.
|
|
645
|
+
Decoding and test data were contributed by an anonymous collaborator.
|
|
646
|
+
- `rb.read(..., telemetry=True)` parses `.dx` instrument-telemetry traces
|
|
647
|
+
(pressure, temperature, flow, etc.) as analog data. Off by default, since
|
|
648
|
+
most users only want the detector signals; a telemetry trace named in
|
|
649
|
+
`requested_files` is parsed regardless of the flag.
|
|
650
|
+
- `tests/test_agilent.py::test_teal` and `test_teal_telemetry_off`: a `.dx`
|
|
651
|
+
fixture (DAD spectrum, two wavelength channels, two telemetry traces)
|
|
652
|
+
verified end-to-end, plus coverage of the telemetry opt-in behavior.
|
|
653
|
+
|
|
654
|
+
### Changed
|
|
655
|
+
- The `OL` `.uv` decoder (`decode_uv_array`) now reads its raw-double data
|
|
656
|
+
with a single strided NumPy view instead of a per-value Python loop, decoding
|
|
657
|
+
roughly **30× faster** with bit-identical output. This speeds up both `.dx`
|
|
658
|
+
spectra and the existing `131 OL` `.uv` files.
|
|
659
|
+
|
|
660
|
+
## [1.0.14] - 2026-06-16
|
|
661
|
+
|
|
662
|
+
### Fixed
|
|
663
|
+
- **Cross-platform determinism in directory parsing.** `parse_allfiles` now
|
|
664
|
+
iterates the `.D` directory in sorted order instead of raw `os.listdir`
|
|
665
|
+
order. Directory-level metadata (date, vial position) is chosen by
|
|
666
|
+
`Counter.most_common`, whose tie-break follows insertion order; with an
|
|
667
|
+
unsorted listing this made the chosen value depend on the filesystem's
|
|
668
|
+
ordering, so a `.D` containing files with differently-formatted date strings
|
|
669
|
+
could yield different metadata on macOS vs. Linux. Parsing is now identical
|
|
670
|
+
on every platform.
|
|
671
|
+
|
|
672
|
+
### Added
|
|
673
|
+
- Pre-merge CI (`.github/workflows/ci.yml`): runs the test suite on Python 3.8
|
|
674
|
+
and 3.13 and builds a wheel + sdist on every pull request, so packaging and
|
|
675
|
+
test regressions are caught before merge rather than at release time.
|
|
676
|
+
|
|
677
|
+
## [1.0.13] - 2026-06-16
|
|
678
|
+
|
|
679
|
+
### Added
|
|
680
|
+
- **Optional compiled accelerator for Agilent `.uv` (DAD) decoding.** The
|
|
681
|
+
retention-time × wavelength absorbance "cube" is delta-encoded and inherently
|
|
682
|
+
sequential, so it cannot be vectorized with NumPy. A new Cython extension
|
|
683
|
+
(`rainbow/agilent/_uvdelta.pyx`) runs this inner loop in C, decoding large
|
|
684
|
+
diode-array files roughly **100× faster** while producing **bit-identical**
|
|
685
|
+
results. See the Performance section of the README.
|
|
686
|
+
- `tests/test_accelerator.py`: parity tests asserting the compiled path matches
|
|
687
|
+
the pure-Python fallback across all `.uv` decode paths (delta, partial,
|
|
688
|
+
array), plus a truncated-input safety test.
|
|
689
|
+
|
|
690
|
+
### Changed
|
|
691
|
+
- Releases now build **cross-platform binary wheels** with `cibuildwheel`
|
|
692
|
+
(Linux/macOS/Windows, CPython 3.8–3.13) alongside a source distribution, so
|
|
693
|
+
`pip install rainbow-api` ships the accelerator with no compiler required.
|
|
694
|
+
- Unit tests compare decoded absorbance arrays with a floating-point tolerance
|
|
695
|
+
instead of exact text equality, fixing pre-existing 1-ULP failures from
|
|
696
|
+
retention-time accumulation (`test_yellow`, `test_orange`).
|
|
697
|
+
|
|
698
|
+
### Fixed
|
|
699
|
+
- The accelerator is fully optional and transparent: if the extension is not
|
|
700
|
+
built (no compiler or no Cython), `rainbow` falls back to a pure-Python
|
|
701
|
+
decoder with identical output.
|
|
702
|
+
- Truncated or corrupt `.uv` streams now raise `ValueError` from the compiled
|
|
703
|
+
path instead of risking an out-of-bounds read (the extension disables Cython
|
|
704
|
+
bounds checks for speed, so the bounds are guarded explicitly).
|
|
705
|
+
- The source distribution now includes `_uvdelta.pyx`, so installs on platforms
|
|
706
|
+
without a prebuilt wheel compile the accelerator from source instead of
|
|
707
|
+
failing the build.
|