pymzml / pymzML

pymzML - an interface between Python and mzML Mass spectrometry Files
https://pymzml.readthedocs.io/en/latest/
MIT License
163 stars 92 forks source link

fix for issue #7, Cannot store spectra in a list #8

Closed mberth closed 12 years ago

mberth commented 12 years ago

The problem was that the same self.spectrum object was reused over and over when new spectra are read. The fix is to have __getitem__ and __next__ return fresh Spectrum objects.

Added unit tests for this, run them with nosetests test/

fu commented 12 years ago

This "feature" in reusing the spectrum object was implemented on purpose since not initiating a new spectra every time will yield much faster parsing speeds! One can however obtain a spectrum object for later usage by calling deRef, please see http://pymzml.github.com/spec.html#spec.Spectrum.deRef

Thus to keep the speed I would like to keep the "re-use" model as it is.

Cheers