berlinguyinca / spectra-hash

The splash, this is the reference documentation
http://splash.fiehnlab.ucdavis.edu
BSD 3-Clause "New" or "Revised" License
23 stars 11 forks source link

Handling numpy arrays natively #33

Closed bjonnh closed 7 years ago

bjonnh commented 7 years ago

Would it be possible to get the module to handle (or even use?) numpy arrays?

ssmehta commented 7 years ago

Hi @bjonnh, are you just interested in creating a spectrum object from a 2d numpy array? If so, that should be pretty easy to add.

bjonnh commented 7 years ago

What I do for now is: [tuple(a) for a in molpeaks.peaks.tolist()] to generate in a format that it likes.

I have millions of spectrum to generate fingerprint for and was wondering if this whole library would benefit from being rewritten in numpy (this is likely).

ssmehta commented 7 years ago

Understood. I use numpy a lot, but it was actually more of a hassle to implement SPLASH algorithm with numpy arrays. I can certainly add support for numpy arrays as input, but I don't think we will rewrite the SPLASH implementation based on numpy.

The two-step procedure of creating a Spectrum object and then SPLASHing it, which was done to allow for additional spectral types, makes it difficult to add elegant, numpy-friendly support (or at least I can't think of a good way).