Hello,
I am looking for significant signal peaks on top of a slowly variable background. An example of the data that I am analysing looks like that:
In principle to get the best SNR I would:
1. Subtract the background
2. Remove the point-to-point variability by thresholding high levels of the wavelet decomposition.
While (2) seems to work reasonably, I have troubles estimating the background. I thought that in principle when I do:
s_swt = pywt.swt(s, "sym3", level=6)
and then reconstruct the signal zeroing the first approximates s_swt[0][0] I should get the signal on a "flat" background. However, it

The background seems to be more "bent" towards the ends, not to mention a complete change of scale.
I guess this approach is somehow completely wrong. I would be grateful if someone could tell me why and what would be the proper approach.
I also tried to use non-reconstructed first approximates as background. The shape more or less fits, but not the scale, even though here I've used "norm=True" for the decomposition. Here I plot it as a line on top of the data:
On the other hand, signal reconstructed just from s_swt[0][0] (all other details/approximates zeroed) do not match the background at all, which is most puzzling for me:
I would appreciate any help.