Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Real-time processing
#1
Hi, I've just started programming with Python.
I have to write a code trough which I have to process two different signals: ECG and respiration. I need to process them real-time but I have no idea how to do that. The code should analyze respiratory's signal first, find the expiration phase and then analyze ECG and find R-peak. Any suggestion? Thank you
Reply
#2
Quote:I have to write a code ... but I have no idea how to do that
was this not covered in your course?
what you are talking about can be easy if the interfaces to the devices are simple data reads, or quite difficult if you need to issue commands to control the instrumentation.
You do not provide enough details here to know.
Device models, how the data is obtained, etc.
Reply
#3
Let me explain: at first I do not have possibility to acquire signals (but the code should work online) so I have to use pre-recorded signals. The question is: how can I simulate a real-time recording basing on these pre-recorded data? How can I treat these data on Python as if they were acquired x samples by second?
Reply
#4
Usually recorded data have time stamps.

Which information do you have? Is there a sleep time between measurements of recorded data?
If yes, is this always the same. If yes, then you have your time delta.
If not, then it's a guessing game.

Without any sample of your data, for us it's also a guessing game too.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#5
please show your code.
Reply
#6
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Non-blocking real-time plotting slow_rider 5 3,451 Jan-07-2023, 09:47 PM
Last Post: woooee
  Real time database satyanarayana 3 1,623 Feb-16-2022, 01:37 PM
Last Post: buran
  Real time data satyanarayana 3 20,120 Feb-16-2022, 07:46 AM
Last Post: satyanarayana
  Real time Detection and Display Gilush 0 1,762 Feb-05-2022, 08:28 PM
Last Post: Gilush
  Real-Time output of server script on a client script. throwaway34 2 2,010 Oct-03-2021, 09:37 AM
Last Post: ibreeden
  Why recursive function consumes more of processing time than loops? M83Linux 9 4,128 May-20-2021, 01:52 PM
Last Post: DeaD_EyE
  Real Time Audio Processing with Python Sound-Device not working Slartybartfast 2 3,879 Mar-14-2021, 07:20 PM
Last Post: Slartybartfast
Question I can't get my real-time chart with Python (Help!) Bastian_ElProfe 1 2,188 Jan-20-2021, 01:34 PM
Last Post: wostan
  Real Time signal processing tagalog 2 2,600 Dec-12-2020, 05:23 AM
Last Post: tagalog
  Real time MIDI with python eythoralex 1 3,396 May-19-2020, 07:17 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020