Debian Codegraph @

docs/source/code_inc/has_peak.inc

raw
1 .. code-block:: python
2
3 #!/usr/bin/env python
4
5 import pymzml
6 import os
7
8
9 def main():
10 """
11 Testscript to demonstrate functionality of function :py:func:`pymzml.spec.Spectrum.has_peak`
12
13 usage:
14
15 ./has_peak.py
16
17 """
18
19 example_file = os.path.join(
20 os.path.dirname(__file__), os.pardir, "tests", "data", "example.mzML"
21 )
22 mz_to_find = 820.7711792
23 run = pymzml.run.Reader(example_file)
24 for spectrum in run:
25 found_peaks = spectrum.has_peak(mz_to_find)
26 if found_peaks != []:
27 print("Found peaks: {0} in spectrum {1}".format(found_peaks, spectrum.ID))
28
29
30 if __name__ == "__main__":
31 main()