Skip to content

Commit

Permalink
Merge pull request #336 from pymzml/feature/zontal_add_ele_to_precurs…
Browse files Browse the repository at this point in the history
…or_black

Add element precursor as PR from Wolfgang Colsman
  • Loading branch information
StSchulze committed Sep 15, 2023
2 parents 782289b + 3ad4aae commit 8518e86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions pymzml/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ def _decode_to_numpy(self, data, d_array_length, data_type, comp):
or "MS-Numpress linear prediction compression" in comp
or "MS-Numpress short logged float compression" in comp
):

out_data = self._decodeNumpress_to_array(out_data, comp)
if data_type == "32-bit float":
# one character code may be sufficient too (f)
Expand Down Expand Up @@ -427,7 +426,6 @@ class Spectrum(MS_Spectrum):
"""

def __init__(self, element=ElementTree.Element(""), measured_precision=5e-6):

__slots__ = [
"_centroided_peaks",
"_centroided_peaks_sorted_by_i",
Expand Down Expand Up @@ -1003,6 +1001,7 @@ def selected_precursors(self):
("i", i_values),
("charge", charges),
("precursor id", ids),
("element", precursors),
]:
try:
dict_2_save[key] = list_of_values[pos]
Expand Down
7 changes: 3 additions & 4 deletions tests/ms2_spec_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ def test_select_precursors(self):
self.assertIsInstance(selected_precursor[0]["mz"], float)
self.assertIsInstance(selected_precursor[0]["i"], float)
self.assertIsInstance(selected_precursor[0]["charge"], int)
self.assertEqual(
selected_precursor,
[{"mz": 443.711242675781, "i": 0.0, "charge": 2, "precursor id": None}],
)
assert selected_precursor[0]["mz"] == 443.711242675781
assert selected_precursor[0]["i"] == 0.0
assert selected_precursor[0]["precursor id"] is None

def test_ion_mode(self):
assert self.spec["positive scan"] is True
Expand Down

0 comments on commit 8518e86

Please sign in to comment.