rainbow.mz_resolution

mz_resolution(path, hrms=False, requested_files=None, centroid=False)[source]

Inspects the m/z grid a run records, the finest spacing the binary actually stores.

This is the practical ceiling on bin_width: a finer bin only inserts empty bins. It is computed by reading the run on a grid finer than any vendor lattice (so the underlying spacing shows through) and measuring the smallest gap between adjacent m/z labels; the high-resolution HRMS profile is measured from one scan’s own axis instead. The read is not cheap, so this is opt-in, never run on an ordinary read().

Parameters:
  • path (str) – Path of the directory.

  • hrms (bool, optional) – Inspect the Agilent HRMS profile (MSProfile.bin).

  • requested_files (list, optional) – Limit to these filenames.

  • centroid (bool, optional) – Inspect the Agilent MassHunter centroid (MSPeak.bin). A centroid run’s MS data is parsed only under this flag, so without it such a run looks like one with no MS at all. A calibrated (TOF) centroid is parsed but not measured: its peaks carry continuous m/z, so there is no lattice to report.

Returns:

Each MS channel name mapped to its finest m/z spacing in

daltons. Agilent quadrupole runs usually step 0.1 Da (the format can express 0.05), Waters between about 0.03 and 0.07 depending on the run.

A channel appears only if a spacing describes it, so the dict can be empty, or smaller than the run’s MS channel count, for a run whose MS was parsed. Selected-ion (SIM) channels are absent, because the gaps between chosen ions are the method’s choice and not a grid, as are calibrated centroids. Key the result rather than assuming a channel is in it:

spacing = rb.mz_resolution(path).get(name)

Return type:

dict