Integration of python's time.time() and work() calls

Hi

I’m writing a custom block in python. The application goes like this:

I specify the minimum number of samples I need by using the forecast
function. This ensures that I have that many samples available in the
in-buffer of the block every time work is called. Once I have as many
samples as I need, I slide a window over the samples. In each window
slide
I measure signal power. If power less than a pre-set threshold (I assume
only noise is being received), do nothing. Keep sliding.

The moment power exceeds the threshold for the first time, I have to
start
measuring time. I need to see how many windows I’m able to slide in the
next let’s say, 10 milliseconds (because I expect that the actual signal
transmission is to last for that long). As a hypothetical example, let’s
say by 7 milliseconds I’ve reached the end of the buffer. If my
understanding is correct, once I reach the end, the next set of samples
come in (as per forecast) and work is called again. My question is how
do I
make this next work call aware of this concept of time and that 3
milliseconds were unaccounted for in the last call?

Or is there a way to make sure that the in-buffer gets updated multiple
times within the same work call?

Thanks
Anil

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs