Spectromeasurements#166
Conversation
There was a problem hiding this comment.
I don't have time right now for a full code review (and Jakub is better at that anyway), but I tested it on some different combinations of data I have lying around (did not test it for the dataset I sent you, @ScottSoren which is the only one I have with EC, MS and spectra in one set).
When trying to add two MSSpectroMeasurements, I get this (for me) unexpected error.

The measurements have a different number of spectra and (more likely the cause of the error) different settings for the spectra, i.e. a range of 0-50 amu for one and 0-100 for the other one.
Just to be sure you're aware.
| meas.spectrum_series[0].plot() | ||
|
|
||
| which plots the first MS spectrum. | ||
| To leave out the mass scan data, include the argument ``include_spectra=False`` |
There was a problem hiding this comment.
I'm confused, I just tested it and had to actively include it (i.e. pass include_spectra=True) in order for it to read the spectra and return a SpectroMSMeasurement.
Also, here you call it SpectroMSMeasurement but a few lines down MSSpectroMeasurement - which one is it now?
There was a problem hiding this comment.
It's now MSSpectroMeasurement , will fix!
I noticed that but thought I had fixed it so that it would automatically read spectra again! (It does now when there's also EC in the dataset.) Will fix.
|
@AnnaWiniwarter , in this case I must say the error is expected for me. If it should do something other than raise an error when appending measurements with spectra of different shapes, we have to decide what. What do you think it should do? |
|
I wonder if you could make the error message more explicit for this case? I.e. specify that it can't append to |
|
I am in middle of the review. Should be done with it tomorrow, Thursday latest. Regarding the appending error. I also think it could be more explicit, if it really is not possible to add them together, because of logical scientific reasons. Although, they are not clear to me right now. Why different amount of spectra couldn't be added together?
|
|
@matenestor ,
Let me know what you think. And I look forward to your review! If you can catch why available spectra are not always loaded by default, as Anna noticed, that's for sure something I hope to fix. |
matenestor
left a comment
There was a problem hiding this comment.
I have doubts whether combining multiple already specialized classes to create new ones like MSSpectroMeasurement and ECMSSpectroMeasurement etc. is a good idea. We are thinking with @KennethNielsen about an alternative way this codebase could go. We will make a proposal in the future.
Since this is a PR to fix stuff, let's keep it like this. It won't affect users anyway. But us developers, we will benefit.
Now I am thinking whether having a "technique" with -MS_spectra suffix is also relevant. Offering include_mass_scans only could make the interface more friendly. There is a comment about that.
Other than that, I have a few questions.
|
I am still getting an error when combining an EC measurement with spectra. I don't think I have found your suggestion, but what it should call would probably be |
|
Hi @matenestor , I have implemented your review! :) Can you give it a try? :) |
|
@ScottSoren I replied to your comments and I consider them mostly resolved. Some are left open for you to read, so know about it. And the rest is waiting for your answer (those are the left out comments from the first round). There is three of them. Once you comment, I will approve the PR. |
|
@matenestor , I've commented on the remaining issues! |
1f68eb2 to
a4dd36a
Compare
a4dd36a to
da2a735
Compare
da2a735 to
3d6ea33
Compare
This solves all of the open issues labeled "spectra", plus a few others, and gets all tests passing as intended.
Most of the code changes were associated with #158.
#165 is already incorporated (thanks @matenestor !)
@AnnaWiniwarter , if you have any other datasets to test this on, might catch a residual bug sooner rather than later :)