viernes, 30 de octubre de 2015

Application Developed - eHealth


The first performance tests showed that python-based architectures and PyQtGraph were the most efficient to process the data sent through the serial port by the device. Therefore was developed an application based in RTGraph to process the captured data and plot them in real-time.

The developed application reads the data sent by the device in CVS format and process it. The data format includes the timestamp and two values for the signals. Currently the application can capture the ECG and GSR signals, and process them using the fast Fourier transform and a Low-Pass filter, provided by the library SciPy to remove the noise present. At the same time, the application show a real-time graph with both signals and allows to store the data processed in a CSV file in order to use them for a later analysis.

The application  allows input data in order to tag the datafiles to order them when the session finish. Also can be easily modified to add more signals in order to do a more complex benchmark to the e-Health platform.



This is a video that shows how the ECG signal is corrupted when the subject moves.

The eHealth application's source code  is available for download in the Bitbucket repository.



Data Capture and Real-Time Graphics


To capture data and show the corresponding graph in real time different software tools were used in order to test the performance and usability of each one of them. These tools will be presented in this section.

Matlab


Matlab is a complete mathematical and graphic processing software tool. Matlab have an IDE that uses his own programming language M. It is widely used in scientific and engineering environment. This tool can connect to the Arduino platform using an especially driver developed for this purpose. The main disadvantage is that it is a licensed software and at the same time implements an interface that confuses non-experts users.

Python


Python is a widely used general-purpose, high-level programming language (The RedMonk Programming Language Rankings, 2015) that supports multiple programming paradigm including object-oriented, imperative and functional programming or procedural styles. Its philosophy is maintain a readable code by using indentation and avoiding to use brackets to open and close blocks of code. The main advantages of python are that its interpreters are available for installation in many operating systems like Windows, Mac OS X and Linux; and a large set of standard open source libraries that you can add to improve the functionalities.

NumPy


NumPy is an open source Python library, basically is an extension to the Python programming language that add support for large multi-dimensional arrays and matrices, along with a library of high-level mathematical functions to operate on these arrays.

SciPy


SciPy is an open source Python library used by scientists, analysts, and engineers doing scientific computing and technical computing. SciPy contains modules for optimization, linear algebra, integration, interpolation, FFT, signal and image processing. SciPy adds Matlab-like functionalities to Python and is a fundamental library for scientific computing.

Matplotlib


Matplotlib is a Python 2D library which produce good quality graphs and figures in different formats useful for publications and presentations. Matplotlib use a Matlab-like interface and provide an object-oriented Application Programming Interface (API) for embedding plots into applications using general-purpose Graphic User Interface (GUI) toolkits like wxPython, Qt, or GTK+. Matplotlib tries to make easy things easy and hard things possible. Matplotlib is the Python library most widely used to plot, but unfortunately it does not have a good performance for real-time graphics.

PyQtGraph


It is a library that can be implemented for real-time processing. PyQtGraph creates quality graphics and it was developed for compatibility with Qt4 and, specifically with Qt Designer, simplifying the implementation of the chart. Its documentation is not complete, but now is extensively developed and there a lot of examples are available. This library can be exported to different operating systems.

Qt4, Qt Creator and Qt Designer


Qt4 or Qt version 4, is a cross-platform application framework that is widely used for developing application software. Qt can be run on various software and hardware platforms with little or no change in the underlying codebase. Qt Creator is the IDE for this framework and have an editor that supports syntax highlighting for various languages. Qt can connect with Python code through bindings.

RTGraph


Real Time Graph (RTGraph) a simple and lightweight Python application for plotting data from a serial port (Sepulveda, 2014). Its use all the Qt software mentioned above and was developed focused in real time processing and graph. The project is distributed under MIT license as a part of the Open Source Initiative.

Electrocardiogram (ECG) Sensor

The electrocardiogram sensor can detect the electrical and muscular functions of the heart. This sensor is composed by three connectors (positive, negative and neutral) that need to be attached to the body of the patient while lying on a flatbed.

This is one of the sensors that use the highest sample frequency due the level of accuracy needed to graph the heart activity waveform. At the same time this sensor present a high sensitivity to the movement of the subject, then if the patient moves while the sample is taken, then the values change drastically.

Like the GSR, the connectors of the sensor are attached directly to the skin of the patient but in this case the connector has a small piece of conductive gel that help to get a good conductivity.

Internally the sensor is connected to the analog pin 0 of the Arduino and can measure values between 0 and 1023. The software library does not have a minimal sample frequency because as mentioned before, this sensor needs a high value in order to get a good waveform.

The e-Health Sensor Platform is presented as a very good option for research and study of human emotions but early tests have shown that the platform sometimes is unstable and not very reliable.

The objective of this thesis is to test the platform, modify and develop the necessary software to make it more stable and reliable for future studies related to Affective Computing specially oriented in the field of learning but not restricted only to this area.

The work includes testing the e-Health Sensor Platform with different hardware and software architectures to define which presents the best performance and obtaining 2 or more biomedical signals simultaneously.

The first part of this work is to analyse the hardware. As an intrinsic condition of this work the platform must consider the Arduino board and e-Health Shield. The only hardware that can be changed is the electrical contact sensors and the computers responsible for capturing and processing data and graph.

The second part, is to analyse the software. In this specific point there are many options that was explored both in Arduino software and processing software.

This chapter details how the prototypes were designed and the benchmark tests used to compare them, and finally how the high performance prototype was selected and used for testing purpose and data capture. In order to obtain signals noise free useful to detect emotional changes, was necessary to test different software architectures to communicate the hardware devices, process the noise, graph and store the data.