Skip to content

Commit

Permalink
fixed bug related to computing uniqueIds of spectra having peaks bein…
Browse files Browse the repository at this point in the history
…g numpy views
  • Loading branch information
uweschmitt committed Mar 14, 2016
1 parent d676f72 commit f431d19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion emzed/core/data_types/ms_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def uniqueId(self):
h.update("%.6e" % self.rt)
h.update(str(self.msLevel))
# peaks.data is binary representation of numpy array peaks:
h.update(str(self.peaks.data))
h.update(str(self.peaks.tostring()))
h.update(str(self.polarity))
for mz, ii in self.precursors:
h.update("%.6e" % mz)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_data_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ def check(fun, spec=spec):
pm.meta.pop("unique_id", None)
assert back.uniqueId() == pm.uniqueId()

# this was broken after pickling, the callback was not pickled and calling
# it whein operatin on peaks rose an excepion
for s in back:
s.peaks += 1

# this was broken because it creates a view which is not continous:
s.peaks = s.peaks[1:-1:2]
assert s.uniqueId()

0 comments on commit f431d19

Please sign in to comment.