I have some data, the blue curve which I want to filter out the background to get a flat signal with dips(Idea is to divide signal (except the dips) by the background). The orange curve is my best fit so far. You can see that it agrees for most of the points, apart from the deviation at around 1000. Otherwise, the fitting was very good. and It almost returned a noiseless result by dividing the blue curve (raw data) by the fitting.
I expect something like below However, the problem was that my fitting also has dips (which i don't want to divide out my dip!),also since the background was changing constantly, using a higher order fitting function returns wiggles, so it makes it really hard to have no wiggles between the dips. Here is the bad example,again, the blue = raw data, orange = fitting, green = processed data.
And I want something like this, where the blue curve sorts of fill the gap]4 Any ideas how to do this? I tried using lowpass filter, doesn't work. What i'm using now is Peak detect/ find peak method. I also tried Fourier transform and remove higher k components, but it doesn't work! I appreciate for any idea ! And I can write the code myself.