My signal is a breath's signal (cycles of a sort of sinusoid) sampled at 100Hz. I've got a signal 22296 samples long. My task is to evaluate it as if it was real-time as a continuous stream of data sensed by a sensor but in this case I've got it already recorded, how can I simulate a real-time acquisition starting from this pre-recorded signal?. I thougth about using a while True cycle to get 1 sample at time and getting data I already have from a csv file (this file in each row the value measured by the sensor according to the sample frequency chosen). Does it make sense?
The objective is then set a treshold, calculated as the mean value of the signal above a window of 20s, and then use this value to make a choice: if sample>treshold -> inspiration phase, if sample<treshold ->expiration phase. If the last condition is met I have to find a way to detect the end of expiration phase which corresponds to the minimum of the curve. In order to find it I need to make a comparison between one sample and the successive sample (using diff), but I also need to take into account unavoided artifacts that can induce me to consider one sample as the minimum because the difference is negative while next one difference is positive. The treshold needs to be refreshed too after a set time.
The objective is then set a treshold, calculated as the mean value of the signal above a window of 20s, and then use this value to make a choice: if sample>treshold -> inspiration phase, if sample<treshold ->expiration phase. If the last condition is met I have to find a way to detect the end of expiration phase which corresponds to the minimum of the curve. In order to find it I need to make a comparison between one sample and the successive sample (using diff), but I also need to take into account unavoided artifacts that can induce me to consider one sample as the minimum because the difference is negative while next one difference is positive. The treshold needs to be refreshed too after a set time.