@TanMath You are trying to estimate a periodic event and your jitter is worrying at times
@TanMath When you have jitter in the sampling frequency then everything is shifted up and down. Your bandpass filter cut off frequencies are going to be shifting etc
@TanMath And in addition to that you have a very challenging environment in terms of SNR
@TanMath So, what I would suggest to you is to start thinking about a real real-time solution which basically includes Multithreading
@TanMath You will need one thread devoted to data acquisition and then the main thread (or possibly another one) doing the processing
@TanMath The thread that is doing the acquisition will have to be programmed to be firing at set time intervals, which is something that you can specify in pyhton
@TanMath The ONLY thing that that thread will be doing is to capture a frame and note its timestamp. Nothing else
@TanMath Python has the `deque
@TanMath Python has the collections.deque
data structure which is a FIFO queue and it is thread safe. You can have the deque being populated from one end by the capture thread and read from the other end by the data processing thread. It will handle blocking on its own