rainbow.read

read(path, precision='auto', hrms=False, requested_files=None, telemetry=False, centroid=False, format=None, bin_width=None)[source]

Reads a chromatogram data directory. Main method of the package.

Increasing the precision may drastically increase memory usage for larger files. Specifying a higher precision mainly affects the parsing of MS data, because intensities are summed within the given precision for each ylabel.

Max precision available for Agilent MS data is 1.

Max precision recommended for Waters MS data is 3.

Agilent HRMS parsing may be slow. Set the flag to enable it.

For Agilent .dx archives, instrument telemetry traces (e.g. pressure, temperature) are skipped unless the telemetry flag is set.

The vendor is normally detected from the path: a .D/.dx path is read as Agilent and a .raw path as Waters. A directory whose name lacks that suffix is identified from its contents instead. Pass format (‘agilent’ or ‘waters’) to override detection entirely.

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

  • precision (int or 'auto', optional) – Number of decimals to round reported m/z (and other ylabels) to. The default 'auto' chooses per file: 4 for high-resolution data (the Agilent HRMS profile and TOF centroids) and 0 (whole numbers) for unit-resolution data (UV, GC/quadrupole MS, Waters). Pass an explicit integer to override (including 0 to force nominal mass).

  • hrms (bool, optional) – Flag for Agilent HRMS (MSProfile.bin) parsing.

  • requested_files (list, optional) – List of filenames to parse.

  • telemetry (bool, optional) – Flag for Agilent .dx telemetry traces.

  • centroid (bool, optional) – Flag for Agilent MassHunter centroid (MSPeak.bin) parsing.

  • format (str, optional) – Force the vendor parser (‘agilent’ or ‘waters’), bypassing extension/content detection.

  • bin_width (float, optional) – Width in daltons of each shared-grid bin for Agilent HRMS profile data. Omit it (the default) to keep the per-scan representation; pass a width to project the scans onto one shared m/z grid (see HRMS Profile Data: Why Each Scan Has Its Own m/z). This is the grid’s only control and is fully independent of precision (which only rounds the reported m/z labels, never the grid). A bin_width finer than 10**-precision is allowed but warns, since two bins may then round to the same m/z label.

Returns:

DataDirectory representing the directory.