Skip to content

The script parses the sensor data files and subsequently performs FFT to observe temporal trends in the respiratory rates.

Notifications You must be signed in to change notification settings

rchirravurivenkata/Short_Fourier_Transform

Repository files navigation

Short Fourier Transform

The script parses the sensor data and subsequently performs FFT to illustrate the temporal trends in the respiratory rates.

Introduction

Fourier analysis converts a signal from its time domain to a representation in the frequency domain and vice versa. Fast Fourier transforms are widely used for applications in engineering, science, and mathematics. The basic ideas were popularized in 1965, but some algorithms had been derived as early as 1805.

Description

To demonstrate the inner workings of our code, we will use a sample file (sample_sensor_data.txt).

In the above image, you could see that the entries within the variables are placed at regular intervals and their sampling frequency is ~50 samples/sec. The script will remove all the variables except respiratory ('rresp') and time ('timestamp') variables. Subsequently, it decodes the time variable to seconds with a starting entry at 0 seconds, to make it more meaningful. An arbitary plot illustrating time vs amplitude of the signal is saved (as Raw_signal_figure.pdf) in the working directory. The below is the plot generated by the script for our sample dataset.

Importantly, the sensor data is preprocessed to attenuate noise associated with the signals. A sliding window approach is used, where each window/batch comprises of 1500 samples (that corresponds to approx 30 seconds). The window is moved one sample at a time (i.e., the first sample of the previous window is discarded to include a new sample in the current window).

Each window of respiratory signals are rescaled using mean-centering. Therafter, Discrete Fourier Transform is applied on each window to identify the dominant frequency. The dominant frequencies across all windows are plotted against their corresponding times (in seconds). The resultant plot is again saved (as Dominant_Frequency_across_time_plot.pdf) in the working directory. The below plot represents the time in seconds vs frequencies (Hz) for our sample dataset.

Usage

1. Download the file using the below code in the terminal

$ git clone https://github.com/rcvenkata/Fast_Fourier_Transform.git

2. Change directory

$ cd Fast_Fourier_Transform/

3. Run the script on the accompanying sample dataset (sample_sensor_data.txt).

$ cat sample_sensor_data.txt | script.sh

References

https://en.wikipedia.org/wiki/Fast_Fourier_transform

About

The script parses the sensor data files and subsequently performs FFT to observe temporal trends in the respiratory rates.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published