The problem:
I have a signal that contains multiple, relatively stable frequency components and I want to extract only one of them. I attached a plot that illustrates the situation with a simple example. The top plot shows the raw signal and the lower one the spectrogram for the signal.
The emphasis here is on "relatively", since individual frequency bands are sometimes modulated upwards, crossing other frequency bands. By tracking the frequency bands on a spectrogram, I can approximate this frequency change. But this leaves me with a signal with a much lower sampling rate constrained by the nfft of the spectrogram. However what I want is the raw signal for just the frequency component of interest. Ideally, I would be able to compute the instantaneous frequencies for every frequency band. I am aware that this will be very noisy in situations where the frequency bands cross, but the majority of the signal would be useful at least. Hence, I need a filter, that can filter in boundaries (illustrated by the black dashed lines) that change over time.
What I've tried
I've naively tried implementing a rolling bandpass filter using scipy.signal, which obviously didn't work. I have also found another question that asked something similar but my research in that direction, particularly into Kalman filters, was not all that successful.
I am not looking for a finished solution but maybe a hint or resources to learn more from that might lead me into the right direction.
PS: I am a biologist by training and have very limited background in signal processing so please be nice to me :)

practical) – OverLordGoldDragon Mar 07 '23 at 15:47cwtwith a few differences that can be seen inicwtvsissq_cwt. In the second link I provide a tool that allows manually drawing curves on a saved image, and converting that to an array as coordinates, though it's unfinished. – OverLordGoldDragon Mar 09 '23 at 12:04int_fn'. I've played with a bunch of different parameters and I do not seem to get past that point. Do you have any hints on how to deal with this? The code can be found here. – weygoldt Mar 09 '23 at 16:05