Chromatogram¶
mzmlpy.spectra.Chromatogram
dataclass
¶
Bases: _ParamGroup, _BinaryDataArrayMixin
An mzML chromatogram element.
Exposes rt (seconds) and intensity binary arrays, optional precursor and product structures,
and a chromatogram_type property (e.g. "tic", "basepeak", "srm").
id_dict
property
¶
Parse the native id into its key=value components (integer values coerced to int).
default_array_length
property
¶
Get chromatogram default array length, or None if not present.
source_file_ref
property
¶
Get chromatogram source file reference, or None if not present.
rt
property
¶
Time array (MS:1000595) in seconds as a new float64 array, or None if not present.
Values recorded in milliseconds, minutes or hours are converted to seconds. A time array with no unit, or a unit that is not a time unit, is taken as seconds and warns once per unit.
intensity
property
¶
Get intensity array as a numpy array, or None if not present.
precursor
property
¶
precursor: Precursor | None
Get a Precursor object for the precursor of this chromatogram, or None if no precursor is present.
product
property
¶
product: Product | None
Get a Product object for the product of this chromatogram, or None if no product is present.
data_processing_ref
property
¶
Get chromatogram data processing reference, or None if not present.
chromatogram_type
property
¶
Get chromatogram type (e.g. TIC, BPC, etc.) for this chromatogram.
Covers every child of MS:1000626 "chromatogram type". The most specific term wins when a chromatogram carries both a type and its parent (e.g. TIC and ion current).
cv_params
cached
property
¶
cv_params: tuple[CvParam, ...]
The element's cvParams, in document order.
user_params
cached
property
¶
user_params: tuple[UserParam, ...]
The element's userParams, in document order.
ref_params
cached
property
¶
ref_params: tuple[ReferenceableParamGroupRef, ...]
The element's referenceableParamGroupRefs, in document order.
binary_arrays
cached
property
¶
binary_arrays: tuple[BinaryDataArray, ...]
The binary data arrays, in document order.
get_cv_param
¶
get_cv_param(id: str) -> CvParam | None
Get a cvParam by accession or name, or None if absent.
cv_float
¶
Return a cvParam's value as a float, or None if the term is absent or has no value.
Raises MzmlError naming the term and its bad value if the value is present but not numeric — more actionable than a bare "could not convert string to float".
Source code in src/mzmlpy/elems/dtree_wrapper.py
cv_int
¶
Return a cvParam's value as an int, or None if absent or valueless (see :meth:cv_float).
Source code in src/mzmlpy/elems/dtree_wrapper.py
get_binary_array
¶
get_binary_array(id: str) -> BinaryDataArray | None
Get a BinaryDataConverter object for the binary data array with the specified id.
has_binary_array
¶
serialize
¶
Return the element as nested dicts: tag, attributes, text, children.
The result is a fresh copy; changing it does not change the wrapped element.
Source code in src/mzmlpy/elems/dtree_wrapper.py
get_attribute
¶
has_cv_param
¶
Check if a cvParam with the given accession or name exists.
has_user_param
¶
get_ref_param
¶
get_ref_param(
ref: str,
) -> ReferenceableParamGroupRef | None
Get a referenceable parameter by ref.