Update splitter for merged s2s data kind #514
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the problem / what does the code in this PR do
The gap-size-based merging algorithm we are using now is not able to / optimized for splitting merged multiple scatter S2s, and thus motivates potentially adding the natural break after the merging. This pr is going to update the splitter so that it can also process merged s2s, particularly to circumvent calling sum waveform.
Can you briefly describe how it works?
The first change is to the peak building part that for merged s2s, instead of resetting
dt
anddata
with the records, we simply copy the part ofdata
from the pre-split peak and keep the samedt
. (One thing to note is that those two fields are only kept within the splitting process, so the split iteration can work. Once outside, those split peaks will be rebuilt from peaklets, so that they have the correct area_per_channel, saturation info, and so on)The second change is to make it possible to return the peaks in two arrays, one without any splitting and the new peaks from the splitting. This return option is needed, as mentioned above, we need to rebuild the peaks from peaklets but just for those split peaks.