[Numpy-discussion] Strange problem
Uwe Schmitt
uschmitt@mineway...
Fri Jun 29 04:09:17 CDT 2012
Am 29.06.2012 10:57, schrieb David Cournapeau:
>
> Is this on 32 or 64 bits windows ? Do you know if your customer uses
> only numpy, or other packages that depend on numpy C extension ?
It is 64 bit Windows.
I forgot to say that a part of my numpy arrays are generated by a short
Cython method wrapping open-ms library.
As the code fragment is short, I post it here:
def get_peaks(self):
cdef _MSSpectrum[_Peak1D] * spec_ = self.inst
cdef unsigned int n = spec_.size()
cdef np.ndarray[np.float32_t, ndim=2] peaks
peaks = np.zeros( [n,2], dtype=np.float32)
cdef _Peak1D p
cdef vector[_Peak1D].iterator it = spec_.begin()
cdef int i = 0
while it != spec_.end():
peaks[i,0] = deref(it).getMZ()
peaks[i,1] = deref(it).getIntensity()
preincrement(it)
i += 1
return peaks
I am sure that this functions does not crash during execution.
As spec_ 's class is derived from C++ STL std::vector<..> there should
be no conflict between counting 'i' up to 'n' and testing 'it'
against 'spec_.end()'.
Regards, Uwe
--
Dr. rer. nat. Uwe Schmitt
Leitung F/E Mathematik
mineway GmbH
Gebäude 4
Im Helmerswald 2
66121 Saarbrücken
Telefon: +49 (0)681 8390 5334
Telefax: +49 (0)681 830 4376
uschmitt@mineway.de
www.mineway.de
Geschäftsführung: Dr.-Ing. Mathias Bauer
Amtsgericht Saarbrücken HRB 12339
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120629/d9630358/attachment-0001.html
More information about the NumPy-Discussion
mailing list