INNER CODE UNIT · Python
_init_iter
pymzml/pymzML · pymzml/run.py:362
def _init_iter(self):
"""
Initalize the iterator for the spectra and sets it to the start
of the spectrumList element.
Returns:
mzml_iter (xml.etree.ElementTree._IterParseIterator): Iterator over
all element in the file starting with the first spectrum
"""
mzml_iter = iter(
ElementTree.iterparse(self.info["file_object"], events=("end", "start"))
) # NOTE: end might be sufficient
_, self.root = next(mzml_iter)
self.info["chromatogram_count"] = None
self.info["spectrum_count"] = None
while True:
event, element = next(mzml_iter, ("END", "END"))
if element.tag.endswith("}mzML"):