rainbow.datadirectory.DataDirectory
- class DataDirectory(path, datafiles, metadata)[source]
Bases:
objectClass representing a chromatogram data directory.
- Parameters:
path (str) – Path of the directory.
datafiles (list) – All DataFile objects for the directory.
metadata (dict) – Metadata for the directory.
- Attributes:
name (str) – Name of the DataDirectory.
datafiles (list) – DataFile objects with a detector. This does not include miscellaneous analog data.
detectors (set) – String detector names in the DataDirectory. Options: UV, MS, FID, CAD, ELSD.
by_name (dict) – Maps filenames to DataFile objects.
by_detector (dict) – Maps detector names to lists of DataFile objects.
analog (list) – DataFile objects with miscellaneous analog data.
metadata (dict) – Depends on the vendor.
- get_file(filename)[source]
Returns a DataFile object by
filename.Raises an exception if the
filenameis not in the DataDirectory.- Parameters:
filename (str) – DataFile name.
- get_detector(detector)[source]
Returns a list of DataFile objects by
detector.Raises an exception if the
detectoris invalid.- Parameters:
detector (str) – Detector name.
- extract_traces(filename, labels=None)[source]
Extracts data corresponding to the specified DataFile and
labels.- Parameters:
filename (str) – DataFile name.
labels (int/float/list, optional) – Ylabel(s) to extract.
- Returns:
2D numpy array containing data for the specified ylabel(s). The rows correspond to the ylabels and the columns corrrespond to the retention times.
- export_csv(in_filename, out_filename, labels=None, delim=',')[source]
Outputs a CSV with data for the specified DataFile and
labels.- Parameters:
in_filename (str) – DataFile name.
out_filename (str) – Filename for the output CSV.
labels (int/float/list, optional) – Ylabel(s) to export.
delim (str, optional) – Delimiter used in the output CSV.