[SciPy-user] [half OT?] best way to store a spectrum

Bruce Southey bsouthey@gmail....
Wed May 27 12:02:07 CDT 2009

Davide Cittaro wrote:
> Hi all,
> I have a bunch of spectra listed within a file (mass/intensity 
> values). I'm planning to analyze them and match with theoretical 
> spectra... In you opinion, which is the best way to store them for an 
> efficient analysis?
> In the past this has been done with python arrays (i.e. a spectrum was 
> an array of arrays, each peak was a mass/intensity array)...
> Thanks
> d
> /*
> Davide Cittaro
> Cogentech - Consortium for Genomic Technologies
> via adamello, 16
> 20139 Milano
> Italy
> tel.: +39(02)574303007
> e-mail: davide.cittaro@ifom-ieo-campus.it 
> <mailto:davide.cittaro@ifom-ieo-campus.it>
> */
Can you please be more specific?

Exactly what do you mean by 'analysis'?
Do you actually use the intensity values or only those values above a 
set threshold?
What do you really mean by a 'bunch of spectra'?
Does each experimental spectrum have a unique corresponding theoretical 
Do you compare  the 'bunch of spectra' to a single theoretical spectrum?
Do you compare  the 'bunch of spectra' to a bunch of theoretical spectrum?
What exactly do you mean by 'match'?

To be efficient, you probably want to:
1) Vectorize the operations so you want to avoid looping over each 
spectrum. So a single large array may help.
2) Find a suitable approach for your analysis as there may be more than 
one approach. Especially getting as many of the calculations as possible 
into lapack functions rather than Python should be faster.
3) Try to factoring out constants.


More information about the SciPy-user mailing list