• No results found

Data analysis and radar parameter tuning for rats

N/A
N/A
Protected

Academic year: 2021

Share "Data analysis and radar parameter tuning for rats "

Copied!
52
0
0

Loading.... (view fulltext now)

Full text

(1)

Feil! Fant ikke referansekilden. - Feil! Fant ikke referansekilden.

Feil! Fant ikke referansekilden.

Feil! Det er ingen tekst med den angitte stilen i dokumentet.

2019-07-15

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning for rats

Electronic Systems and Instrumentation

Master Thesis

Jørgen Sørgård Svenning

(2)

MID SWEDEN UNIVERSITY Department of Electronics Design

Examiner: G¨oran Thungstr¨om, goran.thungstrom@miun.se Supervisor: Dag Roar Hjelme, dag.hjelme@ntnu.no

Author: Jørgen Sørg˚ard Svenning, jssvenni@hotmail.com Degree program: Master of science, 120 credits

Main field of study: Electronic Systems and Instrumentation Semester, year: 04, 2019

(3)

Abstract

I April 2018 an experiment was conducted at the university of Bergen in collaboration with Novelda using the XeThru range-doppler radar. The goal of the experiment was to record data on rats using XeThru radar and by using traditional medical sensors, to see if a XeThru radar can be used instead of the traditional sensors. The data from the experiment consisted of data saved as EDF (European Data Format) from the traditional sensors, radar data and video. The first goal of this thesis was to analyze the different data types. Then to look at the radar data with the goal of seeing if respiration detection on rats was possible and try to create a radar profile for use on rats. This report focuses on only one of the rats from the experiment, because this rat was recorded using a video camera.

In a preliminary project a python program had been written to use on the EDF data.

The program was expanded upon in this thesis to optimize the performance. The python program took the EDF data and extracted the desired signal, data from a muscle sensor, and plotted it, making it possible to analyze. For the radar data Matlab was used, since Novelda already had the tools to process the data using that program.

This worked using parameter files to set all the necessary settings to do a playback and change the radar and processing settings. The work then consisted of changing the parameters to get the best results on the data from the rats. A parameter file was created for use on rats that was based on the parameter file for respiration detection on adult humans.

The conclusion on the EDF data was that it was not possible to find a pattern for respiration using the muscle sensor. The radar data fortunately yielded better results.

After much testing and optimization it was possible to get good respiration detection on rat 7. Some of the findings was possible noise problems and sources. The radar was mounted to the rack holding the cages. This meant it was susceptible to vibration noise form the other rats in the same rack and to the construction work being done at the university. Another problem with mounting of the radar was that is was to close to the cage, because the rat slept close to the wall of the cage closest to the radar.

Then the problem of directly coupled energy interfered with the actual signal form the radar. It is still unclear if a radar sensor can replace the traditional sensors, but it is very possible to detect respiration on rats. With some more work, and possible a new experiment fixing the noise sources, can make it possible.

(4)
(5)

Acknowledgements

I would like to give a big thank you to Novelda for giving me the opportunity to do my master thesis for them. For letting me have a desk of my own at their office in Trondheim. And I am grateful for the sponsored lunches. Special thanks to the people at Novelda for being helpful with questions.

A special thanks to Ingar Hanssen for letting me have this project. Also for valuable guidance throughout the project.

Thanks to Harald Blehr for helpful inputs and for showing me through the Matlab code and graphs.

(6)
(7)

Contents

Abstract iii

Acknowledgements v

Figures x

Notation xi

1 Introduction 1

1.1 Novelda . . . . 1

1.2 XeThru . . . . 1

1.3 Background and problem motivation . . . . 1

1.4 The experiment . . . . 2

1.5 Scope of the report (rat 7) . . . . 3

1.6 The goal of the report . . . . 4

1.7 Outline . . . . 4

2 Theory 5 2.1 Impulse radar . . . . 5

2.2 Radar signal processing . . . . 5

2.3 Rats . . . . 8

3 Methodology 9 3.1 Python . . . . 9

3.1.1 Using the python programs . . . . 10

3.2 Video files . . . . 12

3.3 Matlab . . . . 12

3.3.1 Rat delta . . . . 13

3.3.2 Rat plot . . . . 14

3.3.3 Plotting Vital signs with Matlab . . . . 15

3.4 Work methodology . . . . 16

4 Results 17 4.1 General findings . . . . 17

4.2 The Video . . . . 17

(8)

4.3 Python programs . . . . 18

4.3.1 Optimization . . . . 18

4.3.2 Breathing pattern . . . . 18

4.4 Matlab . . . . 21

5 Discussion 25 5.1 The Video . . . . 25

5.2 Python Programs . . . . 25

5.3 Matlab . . . . 26

5.4 The experiment . . . . 27

5.5 Social aspects . . . . 29

5.6 Ethical aspect . . . . 29

6 Conclusion 30 6.1 Improvements and further work . . . . 30

Bibliography 32 A Python Code 34 A.1 Read EDF to CSV . . . . 34

A.2 Read CSV and plot . . . . 35

A.3 Read EKG CSV and plot . . . . 36

B Matlab code 38 B.1 DSP playback rat . . . . 38

B.2 Rat.lst . . . . 38

B.3 Rat delta.par . . . . 39

B.4 Rat plots.par . . . . 40

(9)

List of Figures

1.1 Frame from the video of the experiment showing the set up of the cage with the rat. The green LED was the radar. . . . 3 2.1 I/Q mixer for received signal. IF and QF: final baseband I/Q signals.

ADC: Analog-to-Digital converter. DSP: Digital signal processor.[7] . 6 2.2 Range-Doppler matrix of breathing person at 1 meter. Source: xethru.com 7 2.3 Block diagram of the signal processing algorithm used by Novelda. [9] 7 3.1 Shows the result of the ”Read CSV and plot” program for hour 1 on

rat 7. The data is from the muscle sensor. X-axis is time in seconds. 11 3.2 Shows the same data set as figure 3.1 but zoomed in to show 130 sec.

The data is from the muscle sensor. X-axis is time in seconds. . . . . 11 3.3 Range-Doppler graph of one frame of the radar data plotted during a

playback of hour 2. . . . 14 3.4 Breathing mask showing what the algorithm was tracking. . . . 15 4.1 Shows the rat sleeping from hour 2 and the position of the rat in the

cage, to the right. . . . 18 4.2 Graph for hour 2 of the data from the muscle sensor. X-axis is time in

seconds. . . . 19 4.3 Graph for hour 3 of the data from the muscle sensor. X-axis is time in

seconds. . . . 20 4.4 Shows the heart beat can be found as noise in the muscle sensor data. 20 4.5 Graph of the plotted vital signs from hour 2 using unchanged parameters.

X-axis is the frame counter [x ∗ 105]. The first graph is the respiration rate. The second graph is the state the radar is in (0 being breathing detected and 1 being other motion). The third graph is the distance, in meter, to the rat. The last two are a measurement of the magnitude of the movement when no breath is detected. . . . 23 4.6 Graph of the plotted vital signs from hour 2 using the final parameters.

X-axis is the frame counter [x ∗ 105]. The first graph is the respiration rate. The second graph is the state the radar is in (0 being breathing detected and 1 being other motion). The third graph is the distance, in meter, to the rat. The last two are a measurement of the magnitude of the movement when no breath is detected. . . . 24

(10)

5.1 Graph taken from the datasheet of the X4M200 [9, p. 19] showing an example of baseband data output. . . . 26 5.2 Examples of noise seen in the range-Doppler plot during the playback. 28 5.3 Normal range-Doppler plot during the playback with breathing of

76RP M at 1.5dB power level. . . . 28

(11)

Notation

Acronyms

DSP Digital Signal Processing

EDF European Data Format

EMG Electromyography

FFT Fast Fourier transform

FPS Frames per second

LO Local oscillator

RPM Respiration per minute SNR Signal-to-noise ratio

Mathematical notation

A Amplitude

θ Phase

(12)

Chapter 1 Introduction

1.1 Novelda

”Novelda AS is a privately held, R&D driven, sensor company based in Norway and specializing in nanoscale wireless low-power technology for ultra-high resolution impulse radar.” (xethru.com). These sensors have different kinds of usage, for example respiration monitoring on humans and presence detection. Up until now the main focus for Novelda have been on monitoring of humans.

1.2 XeThru

Novelda’s XeThru technology is a single chip complete CMOS impulse radar system.

It can detect both breath and pulse on a human. The radar data is saved as baseband IQ data that make it possible to do processing on the data later using for example Matlab. The radar detects movements, so for it to be able to detect respiration the target object needs to be stationary/motionless.

1.3 Background and problem motivation

An experiment were conducted at the University of Bergen, led by Dr. Janne Grønli, in April 2018 on behalf of Novelda. The goal of the experiment was to record data on rats using XeThru radar and by using traditional medical sensors. Then to see if a XeThru radar can be used instead of the traditional sensors.

The traditional sensors need to be surgically operated into the rats. This cost a lot of money and cause distress on the animals. If a radar sensor can do some of the job, and there by replace some of the traditional sensors it would be more cost effective and more humane against the animals.

(13)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 1. INTRODUCTION September 29, 2019 Novelda was busy with new developments and had no one to analyze the data from the experiment. Since this type of project is perfect for a thesis, they wanted a student to do it. This way the data from the experiment could get analyzed for them and they got good use of the data.

So far most of the research using this radar technology to monitor vital signs have been on humans. Examples of this are the articles; ”A Pilot Study of Impulse Radio Ultra Wideband Radar Technology as a New Tool for Sleep Assessment” [4] and

”Noncontact Respiration Monitoring During Sleep With Microwave Doppler Radar”

[2]. There is however a company using the XeThru technology to monitor on horses called ”NIGHTWATCH” [3]. They monitors the horses vital signs 24/7 to keep a close eye on the health of the horse.

1.4 The experiment

The experiment was conducted at the animal lab at the University of Bergen. The rats were implanted with a sensor that recorded heart rate, 2 sensors to record the brain activity, one for muscle activity and one for the temperature. Each rat was also monitored using a X4M200 radar from Novelda. For this report the muscle sensor and the heart rate sensor was the ones that was analyzed. This because the XeThru radar looks at movement so the brain activity and temperature data would not give any useful information to compare with the radar data.

The cages that the rats was kept in was separated using aluminum foil on the sides.

This was done to separate the different column of cages so that the radar signals did not interfere with each other and therefore reduce possible noise.

(14)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 1. INTRODUCTION September 29, 2019

Figure 1.1: Frame from the video of the experiment showing the set up of the cage with the rat.

The green LED was the radar.

A Raspberry Pi 2 was used as a data gathering unit with the X4M200 radar and each rat had its own box. A USB connected the radar to the Pi. The Raspberry Pi had a script running to receive the data and save it as DAT files. The script made a new DAT file each hour.

The radar was mounted to the rack of the cages using strips. The distance to the cage was 10 cm. Inside the cage there was a feeding station, as can be seen to the left in figure 1.1. The feeder has a slight angle down towards the rat from the radar. On the back side of the cage, from the cameras point of view, you can see the aluminum foil.

The recording box was kept on top of each cage. On the floor of the cage there was shavings of wood often used in the keep of rodents.

At the time of the experiment there was construction work conducted close by and at the university. This included drilling in the ground and explosions. This may have impacted the experiment since the radar is super sensitive to movement.

1.5 Scope of the report (rat 7)

Rat 7 was as the other rats implanted with sensors and monitored using a X4M200 radar sensor. What made it special was that it was also filmed using a camera. This would make it possible to compare the findings from the analysis with what the rat was actually doing. The focus of this project was therefore on the data from rat 7.

(15)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 1. INTRODUCTION September 29, 2019

1.6 The goal of the report

The goal of this project was to analyze the data from the experiment, with the main focus on the radar data, for Novelda. Then do tuning to their parameters to try and make a profile for their radar to use on small animals, in this case rats. A profile being a set of parameters for the radar to be used in processing of the radar data. After this to present the findings of the analysis and the parameter tuning in a clear way.

1.7 Outline

Chapter 1 has given an introduction and background to the project. Chapter 2 gives a brief introduction to how the radar signal processing and gives some vital signs values for rats. In chapter 3 the methodology of the work done gets explained. This includes the work done in python, Matlab and with the video. Chapter 4 presents the results of the work. Some general findings then some more specific results from each of the data types. First the findings in the video, then the work on and with python, then some details of the parameters, followed by the result of the parameter tuning. Chapter 5 is the discussion of each of the results, then some discussion about the experiment itself. Lastly chapter 6 has the conclusions of the report and finishes with what could have been improved and suggestions for future work. The appendix shows the code and the parameter files for the project.

(16)

Chapter 2 Theory

2.1 Impulse radar

The XeThru technology developed by Novelda is CMOS Impulse Radio Ultra Wideband (IR-UWB) sensors. The data processing makes use of pulse-Doppler processing. The ultra wideband impulse radio uses a wideband antenna to transmit short energy pulses with low power density [1]. This to comply with FCC and ECC regulations, which is covered in detail in chapter 2.1 of [5, p. 5].

2.2 Radar signal processing

The radar system has a local oscillator (LO) that generates the radar pulses that are transmitted to the environment. They will go through the environment until they hit an object and is reflected in multiple directions. The radar then receives some of these reflections and samples them. The sampling is done between each transmitted pulse. For more details on how this is done in the radar see [8].

During the sampling the local oscillator signal is duplicated in to two signals with an offset of 90 degrees to each other. Then both those two signals are mixed with the received signal. This results in making of the I(t) and Q(t) signals and used in IQ demodulation. The received signal is brought down to baseband by the local oscillator.

A filter is then used to suppress the remaining high frequencies. This process is shown in figure 2.1.

(17)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 2. THEORY September 29, 2019

Figure 2.1: I/Q mixer for received signal. IF and QF: final baseband I/Q signals. ADC: Analog- to-Digital converter. DSP: Digital signal processor.[7]

The reason for doing a down conversion to baseband IQ is because it is much easier to process. There is also the advantage that due to the 90 degree offset one avoids null points of the A/P (amplitude, phase) signal. To convert the IQ signals to A/P signals it is just to use;

I = A cos θ, (2.1)

Q = A sin θ (2.2)

where A is the amplitude of the signal and θ is the phase.

A radar frame is a set of samples for a specific time window. These frames can be stored in samples-frames matrices. The matrix is then a collection of frames in each row with the samples in the columns, as shown in table 2.1.

Sample 1 Sample 2 ... Sample N Frame 1 (t1) R (1, 1) R (1, 2) ... R (1,N) Frame 2 (t2) R (2, 1) R (2, 2) ... R (2,N)

... ... ... ... ...

Frame M (tM) R (M, 1) R (M, 2) ... R (M,N)

Table 2.1: Schematics of radar sampling of N samples during a time window of M frames.

The samples that are stored in the matrix are in the time domain. Then by doing a fast Fourier transform (FFT) they are converted into the frequency domain and is then called a range-Doppler matrix, which is illustrated in figure 2.2. The figure shows the peaks of the power specter at one meter away. The stationary body is in the middle, as shown in the figure, with the symmetrical peaks on each side which is the breathing and the harmonics. They are on both sides due to the expansion and compression of the chest.

(18)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 2. THEORY September 29, 2019

Figure 2.2: Range-Doppler matrix of breathing person at 1 meter. Source: xethru.com

The block diagram for the signal processing is shown in figure 2.3. The noise map for a recording is mapped during the initialization phase of the radar or a default noise map can be used. As stated in the data sheet for X4M200 sensor; ”The Default Noise Map represents a typical Noise Map for the sensor placed in an environment without reflections” [9, p. 19].

Figure 2.3: Block diagram of the signal processing algorithm used by Novelda. [9]

(19)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 2. THEORY September 29, 2019

2.3 Rats

Some vital signs for rats are shown in table 2.2. These values are used in this project when looking at the data from the sensors.

Lifespan 2,5-3.5 years Heart rate 330-480 beats per minute Respiratory rate 85 breaths per minute

Table 2.2: Normative values for rats that were relevant for this project. [6]

(20)

Chapter 3

Methodology

3.1 Python

In a preliminary project a python program was written to read and visualize the EDF data. European data format (EDF) is the standardized file format for saving vital signs as medical time series. The types of data for this project is listed in chapter 1.4.

This program was extended in to two separate programs for this project to make the program performance better. The first program would read the whole EDF file and then plot the desired data. This made the program take some time to complete its task. By dividing it in to two programs efficiency would be improved. One that reads the EDF file and just saving the data as CSV files, see appendix A.1 for the code.

And one that reads the CSV file, filters the signal and plots it all, see appendix A.2 for the code.

The ”Read EDF to CSV” program from appendix A.1 takes the EDF file and reads it. Then makes an array the same size as the desired signal. It writes the signal samples into the array and split the array into subarrays. The number of subarrays was decided to make each of them contain one hour of data. The data set for Rat 7 was 13 hours long, so the array was divided in to 13 subarrays. Then it goes through the subarrays, creates a CSV file for it and then writes the samples to the CSV file.

When it has gone through all the data it closes the files and prints ”Finished” to the console.

The other program in appendix A.2 asks for an input on which part, meaning which hour to plot. After it is given the input it reads the CSV file for that part/hour.

Then it filters the signal using a rolling mean filter with a window of 50 samples.

This number was found by changing the number until the filtered signal matched the original signal, but with the noise filtered out. The rolling mean filtered signal needs to be corrected by the half of the rolling mean window to match it up to the original signal. The last graph that was made was an absolute value of the filtered signal to be compared with the movement data from the radar. It needed to be the absolute value

(21)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 3. METHODOLOGY September 29, 2019 to show the magnitude of the movement. After this an x-axis is made to be shared by all the graphs, because the signal had 250 Hz samplings rate. Lastly it plots all the graphs with a shared X-axis so when it’s zoomed on one of the graphs it zooms them all. To see the end result, see figure 3.1 and figure 3.2. The first graph shows the original signal in blue and the filtered and time corrected signal in orange. The second graph shows the filtered signal alone, and the last graph shows the absolute value of the filtered signal.

3.1.1 Using the python programs

The python programs were used to analyze the EDF data from the experiment. The first program was run to get out the desired signal. This was by default signal 4, which was the EMG signal. To change which signal to retrieve a small change needed to be done to line 20 in the first program and change if line 16 or 17 was commented out depending if on the signal to be retrieved was 250 Hz or 1000 Hz. Which EDF file to read could be changed in line 13.

After the program had ran it would have made, in the case of rat 7, 13 CSV files since the EDF file contained 13 hours of data. These files could also be opened in other programs, for example Excel, to be analyzed. A downside with Excel was that it took some time to make graphs with so many data points. It was also hard to compare an hour of data without the possibility to zoom in and have it happen on all three graphs simultaneously. This was some of the reasons for using a python program for this task. See figure 3.1 and figure 3.2.

The ”Read CSV and plot” program did not require the code to be altered to change which file to read and plot. It asks in the console which part to plot and to plot a new figure simply close the current figure and run the program again. If the number entered is higher than the number of files it will give an error message saying: ”No such file or directory”.

(22)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 3. METHODOLOGY September 29, 2019

Figure 3.1: Shows the result of the ”Read CSV and plot” program for hour 1 on rat 7. The data is from the muscle sensor. X-axis is time in seconds.

Figure 3.2: Shows the same data set as figure 3.1 but zoomed in to show 130 sec. The data is from the muscle sensor. X-axis is time in seconds.

(23)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 3. METHODOLOGY September 29, 2019 With small changes to the ”Read EDF to CSV” program it could get out the EKG data instead of the EMG data. As mentioned before, line 16 needed to be commented out and make line 17 not commented out since the EKG data had a sampling rate of 1000 Hz. To plot the EKG data a simplified version of the ”Read CSV and plot”

program was made named ”Read EKG CSV and plot”, see appendix A.3. This because the EKG signal did not need to be filtered and therefore it did not need more than one graph.

The procedure was then to go through all the data and look for movement that could be breathing movement. As stated earlier, rats’ respiratory rate is around 85 breaths per minute. The task was then to find a pattern matching this rate. It was done by plotting each hour and then zooming in on different parts looking for the pattern.

3.2 Video files

As mentioned before there was recorded video of rat 7 to have a way of confirming what it was doing. The way of analyzing the video files was to look through the videos and take notes. The notes consisted of the time of an event and what the event was.

An example of an event could be that the rat woke up or just turned over a little.

The severity of the movement made was also noted so it could be compared with the other data in this project.

3.3 Matlab

Novelda have made several scripts for analyzing recorded radar data using Matlab.

Using these scrips gave the possibility to visualize the data as it goes through it and is called doing a playback. The script also processes the data and have the possibility to save the results as CSV files.

First in the script it adds the paths to the different files it needs. These were stored locally on the working computer. Next it reads in the address of either the folder of data it is going to work on or the single DAT file. After that it gets where to find the list file with the desired parameter files and output files. Lastly it gets where to store the output files with the result of the processing.

The DAT files were stored locally on the computer. This made the readings of the data faster and therefore Matlab would process the data faster. Which were good since it needed to process the data many times with different parameters.

First in the list file, see appendix B.2, the parameter file ”Respiration 2” was set. This was the parameters for an adult humans’ respiration. It contains a lot of different parameters for detecting respiration, DSP playback settings, setting noise map, range

(24)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 3. METHODOLOGY September 29, 2019 and change for this project. This parameter file was therefore loaded in as a default parameter file.

The two next lines in the list file activated two output files; ”Vital signs” and ”Sleep output”. The ”vital signs” output were a CSV file containing:

Frame Counter The frames from the radar

State The state of radar detection: 0 = breathing, 1 = movement, 2

= breathing tracking, 3 = No movement and 4 = initialisation

RPM Respiration per minute

Distance The distance to the object that the breathing algorithm have locked on to

Normalized Movement Slow

Normalized means compensated for the range in such a way that the value is the same regardless of the distance to the target.

Normalized Movement Fast

Normalized means compensated for the range in such a way that the value is the same regardless of the distance to the target.

Table 3.1: The data saved in the Vital signs file which was interesting to look at in this project

There was more data saved in the vital signs file, but they were not of importance to this project. The Sleep output file contained data about the sleep stages of the rat but since this project did not aim to work with this, this file was almost not used.

In line 4 of the list file, appendix B.2, the ”Rat Delta.par” B.3 parameter file was set.

This was the file with the parameters from the ”Respiration 2” that could be useful to have a look at and change, for example the DSP playback settings for filters and sampling rate. This will be discussed in more detail later in chapter 3.3.1. The last parameter file to be set in the list file was for the plots to be activated while running the DSP playback, see chapter 3.3.2.

It was important that the Respiration 2 file was set first in the list file. This set the default parameter settings for the playback. Then the Rat delta file needed to be set after this because of the way the program worked. It was the last parameter settings to be set that applied. So by setting the Respiration 2 first it set the default settings and then the Rat delta changed the parameters that needed to be changed.

3.3.1 Rat delta

As stated previously, the Rat delta file contained the parameters that was changed from the original respiration 2 file for this project. When starting the work on this Novelda was consulted on what parameters could be smart to add to this file and thus make changes to. The reason for consulting Novelda was to save some time and using their expertise as help to get the best results possible in the end. They came with some suggestions for the parameters in the rat delta.par, some of the parameters

(25)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 3. METHODOLOGY September 29, 2019 was found when going through the respiration 2 file and some was found during the analytical work.

A rat delta0.par was also made which had the necessary parameter changes to be used for this project, but also had the original values for the parameters that was changed in rat delta.par. This file was used to compare the new results with, which is detailed more in chapter 3.4.

3.3.2 Rat plot

There were several plots available to turn on during a playback. The figures in this chapter are the ones used in this project. Figure 3.3 is the range-Doppler plot which is a 3D plot. It shows one frame of the radar data. On one axis is the range, in meters, from the radar. The second axis is the Doppler, which shows the frequencies. The last axis is the power, in dB, of the signals. In this frame a frequency of 76RP M , which was the breathing of the rat, can be seen.

Figure 3.3: Range-Doppler graph of one frame of the radar data plotted during a playback of hour

(26)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 3. METHODOLOGY September 29, 2019 Figure 3.4 is from the same frame of the data set as figure 3.3. It made it possible to see if the algorithm locked on to the right spike. Sometimes it would track the wrong spike and some tuning needed to be done to the parameters to make it track the right one.

Figure 3.4: Breathing mask showing what the algorithm was tracking.

3.3.3 Plotting Vital signs with Matlab

As mentioned before, plotting a lot of data points in Excel was not the best solution.

For analyzing the data, Novelda had a Matlab script for reading in data from a CSV file and plotting it. The script was made especially for the files from a recording or a simulation with regards to the setup of the files. This read out the columns by the names and plotted them. The data used was the same as shown in table 3.1.

The frame counter was used as a x-axis, since the time stamp would not be correct.

This due to the fact that the time stamp being the time of the simulation and not the time of the recording. Since the focus of this project was movement detection with focus on breath detection, the respiration graph was made bigger than the rest of the graphs. It was also this graph in which the details were most important.

Figure 4.5 shows one of these plots. The rest of the figures is also explained in more detail in chapter 4.4.

(27)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 3. METHODOLOGY September 29, 2019

3.4 Work methodology

The methodology for working with Matlab and the parameter files was the try a set of parameters and see if the result moved in the right direction. After looking at the video of rat 7 it was clear that the second hour of the data set would be the best to do a lot of work on. This because it had long periods where the rat lay still while sleeping. The work consisted therefore of analyzing the second hour of the data set over and over, using different parameters. Then comparing these with the previous results. Both looking at the range-Doppler matrix as Matlab were working through the data and by looking at the Vital signs file after Matlab had finished the playback.

A second computer became available during the course of the project that Novelda used for big processing jobs. This computer had a playback factor of 3 according to Matlab. This meant that it used a 3rd of the time to run through the data as a normal playback would use. An hour of data would therefore take 20 minutes to process with the plots on.

A screen recording program was used on the second computer sometimes to be able to go back and look at the plots made during the processing. This way it was also possible to go back and look at older recordings and compare with the newer recording.

Then use this too to deciding if the changes to the parameter files were in the right direction. It also made it possible to start a recording and then work on something else until it was done. Then go back and look at specific frame segments of interest.

Working through the data and changing the parameters was done methodically. There was never done changes to two parameters at the same time. This was important so there would not be any confusion in which parameter gave the result of the specific playback. The changes were done on one parameter at a time. After a change was made a new playback was done. If the change made improvements on the result a new change was made in the same direction.

After each playback the result was compared with the previous playback and a standard playback. The standard playback used the rat delta0.par file that was based on the profile for human respiration detection, called respiration 2. The only parameters changed in rat delta0.par was to adapt to the settings from the recording and set up the buffers with suitable settings. The settings from the recordings was saved in a JSON file. This meaning that none of the other parameters had been altered. To compare with the original parameters was a way of looking at the overall progress and see the improvements.

(28)

Chapter 4 Results

4.1 General findings

The recording of the EDF data started at 08.00 April 4, while the video was started at 08.41 and the radar data started at 08.45. The EDF time was saved in the file and the two others was found in the file information. In the video it only takes 52 seconds before the radar is started. All three recordings devices had their own clock for time.

4.2 The Video

From the video it was found that hour 2 for rat 7 had some good periods where the rat was sleeping. Therefore have this hour been chosen to be presented here in the results chapter. It also had some movement, so it is a good representation of the data set.

Another finding in the video was that the rat slept close to the wall of the cage that was closest to the radar. The distance from the rat to the radar, while the rat was sleeping or sitting still, was short. See figure 4.1 for position of the rat and see figure 1.1 to see position of the radar. Also in the cage there was a water and feeding station on the left side. This had a small angle down towards where the rat slept, seen from the radar.

(29)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 4. RESULTS September 29, 2019

Figure 4.1: Shows the rat sleeping from hour 2 and the position of the rat in the cage, to the right.

4.3 Python programs

Different kinds of work were done using python. The first was to optimize the performance of the program. Then use the programs to visualize the muscle sensor data in plots. Making it possible to analyze it and look for breathing pattern.

4.3.1 Optimization

The python programs were based on a previous project and expanded upon in this project. The code was divided up into different programs to boost performance. The result of this was a considerable better performance. The program to read the EDF data and save it into CSV files, containing one hour of data each, still took some time to run through it all. Now though it only needed to go through the EDF data one time. This meant that to plot the desired hour took a lot less time than before.

4.3.2 Breathing pattern

It was easy to work with the python programs. The plotting functions of python proved to be a good tool for plotting and visualizing data. It made it possible so that all three plots in the same figure had the same x-axis. Zooming in on one made it so it zoomed in on all three. This made it easy to go in depth and look for patterns.

As stated in table 2.2, the normal breathing pattern for rats is around 85 breaths per

(30)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 4. RESULTS September 29, 2019 pattern repeating itself with a frequency around 1.5 Hz and this could naturally vary a bit.

Because of the time difference between the start of EDF recording and the rest, the first 40-45 minutes of the EDF data was not analyzed. This because only one of the three measuring systems was recording. Therefore hour 2 and 3 of the EDF data is included in figure 4.2 and figure 4.3 to compare with hour two of the radar data.

These two hours was also chosen after looking at the video as mentioned before.

Figure 4.2: Graph for hour 2 of the data from the muscle sensor. X-axis is time in seconds.

(31)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 4. RESULTS September 29, 2019

Figure 4.3: Graph for hour 3 of the data from the muscle sensor. X-axis is time in seconds.

After going through all 13 hours of the muscle sensor data, no breathing pattern could be found. There were however some parts of the data with some interesting features.

Figure 4.4 shows a section from hour 2 from 3480 sec to 3500 sec. It shows some kind of event, seen at 3485 and 3495, that repeats itself with different time intervals. All the spikes down that can be seen throughout figure 4.4 is the heart rate. From 3487.5 to 3492.5 there are 26 spikes that give:

26

5sec = 5.2beats

sec ⇒ 5.2 ∗ 60 = 312beats

min (4.1)

This correlates with the information about rats given in table 2.2, as this is taken from a period with little activity. It was seen in the video that the rat was sleeping during this period.

Figure 4.4: Shows the heart beat can be found as noise in the muscle sensor data.

(32)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 4. RESULTS September 29, 2019

4.4 Matlab

No new code was written for this project in Matlab. This due to the fact that Novelda had all the scripts for doing post processing on the radar data. A few parameter files was created, as described in chapter 3.4, for this project and also a list file. This being the rat delta.par, appendix B.3, and rat delta0.par parameter files and the rat.lst list file. Some files and scripts was duplicated with new names to keep track of the scripts and files and to associate them with the project.

The final version of the parameter file rat delta.par for this project can be seen in appendix B.3. Some of the parameters did not end up getting changed, but most of them did. The important ones will be presented here.

The following parameters was to set the number of frames to be buffered up in the fast and slow pulse-Doppler buffers. To buffer up 10 seconds, and 2 seconds, of data the parameter needed to be;

10 ∗ 255f ps

8 = 319 (4.2)

and

2 ∗ 255f ps

8 = 64 (4.3)

where the 8 is the decimation factor. Using these values made it possible to measure a respiration frequency of up to 956 given by;

(255f ps8 )

N yquist 2∗ 60RP M

Hz = 956RP M (4.4)

which was more than enough.

1 [PulseDoppler]

2 NumFramesInPD = { 319 , 64 , 1 }; # In (1x3) #frames in each PD

3 NumFramesDCEstim = { 319 , 64 , 1 }; # In (1x3) #frames backward to estimate slowtime DC-value

,→

4 FPSDecimVec = { 8 , 8 , 1 }; # In (1x3) fps decim ratio for each PD compared to input fps

,→

The RPMVec was, as the comment says, the minimum and maximum respiration for the respiration detector. Since the normal respiration for a rat is considerable higher than a humans, see table 2.2, the maximum value was raised to almost the double. The minimum value was also raised resulting in the reduction of false positive detections.

(33)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 4. RESULTS September 29, 2019

1 [RespDet]

2 RPMVec = { 40.0 , 150.00 }; # In (1x2) Min/Max respiration [rpm] for respiration detector

,→

The RangeVec BigMotion and ThSNR dB BigMotion parameters in MotionDet0 are codependent. The RangeVec sets the distance for the threshold while the ThSNR dB sets the threshold SNR. These settings were chosen for this project to creates a

”window” in which the algorithm operates. From 0 to 0.30m the threshold for the SNR was set to 100dB, meaning that signals in that distance will be filtered out.

Then from 0.31m to 0.50m the threshold is lowered to allow detection on the signals.

Lastly the threshold was brought back to 100dB for the remaining distance. The same was done for more parameters like this but there was no need to include all of them here, see appendix B.3.

1 [MotionDet0]

2 RangeVec_BigMotion = { 0.0, 0.30, 0.31, 0.50, 0.51, 0.0, 0.0, 0.0, 0.0, 0.0 }; # In (1x10) BigMotion: Abs Range vector for threshold [m]

,→

3 ThSNR_dB_BigMotion = { 100.0, 100.0, 45.0, 45.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; # In (1x10) BigMotion: Threshold SNR vec[dB]

,→

The MaxNumBreathingTracks and the MaxNumFreqPairs needed to be doubled.

There was and warning being printed in the command window of Matlab during the playback. It would be printed quite often warning that the max number of breathing tracks had been reached. The solution was to raise these two parameters.

1 [RespDet]

2 MaxNumBreathingTracks = 40; # Max breathing tracks

3 MaxNumFreqPairs = 40; # Max num freq pairs in local max respiration detector

The next two parameters had to do with the plot in figure 3.4. By changing the parameters in position (1, 2), one changed how long it takes to switch from one state to the next. In this project this was going from movement to breathing. It was changed so from that 21 of 22 consecutive samples must be breathing, to 11 out of 12 must be.

Then you have 4 of 4 ”No Breathing” to quit ”Breathing state”. These have to do with what state the algorithm is in, and what is was needed to change state.

1 BreathingStateM = # In (3x3) From row to column { Init, Breathing, End }.

2 { 0, 11, 4 } ,

3 { 0, 0, 4 } ,

(34)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 4. RESULTS September 29, 2019

5 BreathingStateN = # In (3x3) From row to column { Init, Breathing, End }.

6 { 0, 12, 4 } ,

7 { 0, 0, 4 } ,

8 { 0, 0, 0 };

Figure 4.5 was the reference figure that all the other results was compared to while working on the parameter tuning, as mentioned in chapter 3.4. This shows little to none results in the first half of the respiration graph. Only just after 2 it shows a little respiration in the correct frequency range. The second half has some more respiration.

From 5 to 6 there is respiration in the same frequency as just after 2.

The second graph is the state of the algorithm, or the radar, 0 is breathing, 1 is movement and 4 is initialization. The third graph is the distance to the object that the algorithm had locked on to. Notice that the distance when detecting breathing varies from 0.20m and 0.45m. The last two are big movement in the two different buffers.

Figure 4.5: Graph of the plotted vital signs from hour 2 using unchanged parameters. X-axis is the frame counter [x ∗ 105]. The first graph is the respiration rate. The second graph is the state the radar is in (0 being breathing detected and 1 being other motion). The third graph is the distance, in meter, to the rat. The last two are a measurement of the magnitude of the movement when no breath is detected.

There is much more breathing in figure 4.6. The first half is considerably better than the first figure. From 5 to 6 there is the same breathing but at a different distance.

(35)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 4. RESULTS September 29, 2019 The respiration graph also has less spikes, more stable, results too. The distance graph has more consistently, and stable, periods too.

Figure 4.6: Graph of the plotted vital signs from hour 2 using the final parameters. X-axis is the frame counter [x ∗ 105]. The first graph is the respiration rate. The second graph is the state the radar is in (0 being breathing detected and 1 being other motion). The third graph is the distance, in meter, to the rat. The last two are a measurement of the magnitude of the movement when no breath is detected.

(36)

Chapter 5 Discussion

The fact that all three systems for recording data had separate clocks, or not syn- chronized clocks, made the work a little harder and it took some work to get things synchronized.

5.1 The Video

Having the video was a valuable asset for this project. Having the opportunity to visually see what the rat was doing and the placement of it was priceless. This was the reason that rat 7 was the main focus of this project. The distance between the rat and the radar turned out to be a problem and will be discussed in more details later in chapter 5.3.

5.2 Python Programs

This was a continued work from a previous project done as a preliminary work to this thesis. The optimization of the python program helped improve the performance.

It made it much faster when plotting the desired hour. The ”Read EDF to CSV”

program still used some time to complete, but this only needed to be run once. It was also a good way of extracting one set of data from a file containing five signals. And also, to split up the thirteen hours of data in to one hour long segments instead.

It was not possible to find a respiration pattern in the data from the muscle sensor.

This may be because breathing involves many muscles and not just one. Therefore it may not be that simple to detect respiration using a single muscle sensor.

(37)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 5. DISCUSSION September 29, 2019

5.3 Matlab

The only way to work in Matlab with the scripts and the parameter files was to experiment with the values, do a new processing run with the new values and the see if the results got better. With no way of knowing the correct parameters this was the only method of working with the data set. Also to know which parameters that needed some change. Of course, some parameters were obvious needed some change, like the RPMVec which was the Min/Max respiration limit, but some was not that obvious. The only way was to try and try until the results looked better and better.

The fact that the rat slept so close to the radar turned out to be a problem. Looking at the radar data in figure 4.5 and figure 4.6, the best results was when the window of analysis was set from 0.30m to 0.50m. But looking at the video the rat was sleeping close to the radar at a distance of 0.19m, as seen from 5 to 6 in figure 4.5.

On page 19 in the datasheet for the X4M200 [9, p. 19], is figure 5.1. This show an

”example of baseband data output” and at 0.10m there is a reflection. This reflection comes from the directly coupled energy from the TX antenna to the RX antenna. This meaning that there is no reflection at 0.10m, it is just directly coupled energy. This may be some of the reason for not getting as good results with the direct reflections from the rat. Some interference from this directly coupled energy could have interfered with the reflections at this short distance. So, by changing the distance that the post processing would work in, the directly coupled energy did not interfere.

Figure 5.1: Graph taken from the datasheet of the X4M200 [9, p. 19] showing an example of baseband data output.

The window was set from 0.30m to 0.50m and gave better results. As seen in figure 4.6 the algorithm then got object lock at a distance of 0.43m − 0.48m. It is assumed that the reflections then were an indirect path. Probably reflecting of from the feeding station to the rat and back again. The angle of the feeding station is just perfect to get good reflections to and from the rat, as seen in figure 4.1 and presented in chapter 4.2. The top range was set to 0.50m to eliminate other reflections from the cage, like the back wall.

(38)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 5. DISCUSSION September 29, 2019

5.4 The experiment

The experiment yielded a lot of data and some good results. There were more rats in the experiment, but a part of a thesis is to limit the work. This with the fact that rat 7 had video recordings was the deciding factors for focusing on rat 7. As this report shows there was good results found. What follows are some comments about the experiment.

To get the best results using the radar sensor it should have a proper initialization period at boot up with an empty cage. This is described in chapter 4.2.5 of the X4M200 datasheet [9, p. 11]. It is recommended there that the area intended for recording be empty during the initialization period to create a new noise map. This was not done in this experiment as can be seen in figure 1.1, where the LED flashes during the initialization process. To get even better results it would be good to have a noise map from the cage. Considering that there was a lot of surfaces that could reflect the radar pulses.

It was thought in the beginning of the project work that the feeding station would cause problems and bad reflections, but it ended up doing the exact opposite. Was it not for the feeding station the result of the whole project may not have been this positive.

The mounting of the X4M200 radar sensor may not have been optimal. It was mounted to the rack that held the cages. A white zip tie can be seen to the right in figure 4.1.

This may not have given enough stability, since the radar sensor is super sensitive to movement. So, the fact that zip ties was used to mount it to the rack may have caused some noise. Examples of this noise is shown in figure 5.2. As the figure shows the the power levels are high up over 15dB and the normal level would rarely go over 5dB as shown in figure 5.3. They also have an almost triangular form from 0RP M and out. While the normal range-Doppler figure is flatter with spikes. Due to the buffering of data the spike of noise lasts for several plots. It builds up to the peak and then ”calms down” again during the playback.

(39)

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 5. DISCUSSION September 29, 2019

(a) Example of noise with peak over 30dB (b) Example of noise with peak over 15dB Figure 5.2: Examples of noise seen in the range-Doppler plot during the playback.

Figure 5.3: Normal range-Doppler plot during the playback with breathing of 76RP M at 1.5dB power level.

The reasons for these spikes of noise can be several things. One is that a door gets slammed close by where the experiment was conducted and this made the rack vibrate, which in turn transplanted to the radar. Another rat in the same rack could have moved, making vibrations and motion in the radar. As mentioned late in chapter 1.4, there was construction work being done at the University of Bergen at the same time the experiment was conducted. This may also be some of the cause for the noise seen during the playback.

(40)

Using radar for monitoring lab rats:

Data analysis and radar parameter tuning Jørgen Sørg˚ard Svenning

CHAPTER 5. DISCUSSION September 29, 2019 As discussed in chapter 5.3 there was a problem of directly coupled energy from the TX to the RX, affecting the direct reflections from the rat. This due to the fact that the rat slept close to the wall that the radar was mounted outside of. Had the radar been mounted further away from the cage this problem could have been avoided.

5.5 Social aspects

The XeThru technology is already being used in care for elderly. It is also being used in monitoring of babies. It can also be used to do sleep analysis and maybe help some people improve their sleep quality. More on the animal side it could be used to monitor the well-being of animals. For example NIGHTWATCH is using a XeThru radar to monitor horses health status. This could also be used by farmers to monitor the well-being of other animals too.

5.6 Ethical aspect

The XeThru technology could be used in surveillance of humans. The advantage is that the radar data is anonymous in the sense that it does not show who it has monitored. Since the radar can ”see” through walls it could be possible to monitor on your neighbor. On a more positive side if a radar could be used instead of surgically implanted sensors it would be much more humane on the animals. It would also be more cost effective since the equipment and surgery is expensive.

References

Related documents

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in

Av tabellen framgår att det behövs utförlig information om de projekt som genomförs vid instituten. Då Tillväxtanalys ska föreslå en metod som kan visa hur institutens verksamhet

Närmare 90 procent av de statliga medlen (intäkter och utgifter) för näringslivets klimatomställning går till generella styrmedel, det vill säga styrmedel som påverkar

Den förbättrade tillgängligheten berör framför allt boende i områden med en mycket hög eller hög tillgänglighet till tätorter, men även antalet personer med längre än

På många små orter i gles- och landsbygder, där varken några nya apotek eller försälj- ningsställen för receptfria läkemedel har tillkommit, är nätet av

While firms that receive Almi loans often are extremely small, they have borrowed money with the intent to grow the firm, which should ensure that these firm have growth ambitions even

The EU exports of waste abroad have negative environmental and public health consequences in the countries of destination, while resources for the circular economy.. domestically