PyPersonalTrainer – visualize running fitness data with python and excel

Polar Electro announced last year to shut down their Webpage PolarPersonalTrainer by 31.12.2019, as a result older Polar Fitness and GPS watches like the RC3 GPS will be obsolete. There are several options available to still use the watches, but I wanted to have a solution which keeps all training data local and have similar functionality as the Webpage. My software enables to further use these older devices and creates relevant running training information in form of Excel WorkSheets. The software imports the training data in form HRM and GPX Files, creates training session worksheet for each training, and adds the training to an overview sheet.

Export of Fitness Data from the Polar Watch

The data can be easily exported by the Polar Websync Software. Connect your watch, start Websync, and click on Trainingscomputer. Check for Trainingdata and export a selection or all stored files. You then can select the directory to store the trainingdata. In order to get proper yearly overviews, it is recommended to store the training of different years in seperate folders.


PyPersonalTrainer Introduction

This software aims to provide a similar (of course restricted) functionality as the website PolarPersonalTrainer by creating excel sheets with a similar look as the website. For each training session, an individual excel workbook is created as shown in the next figure. All headlines and info is in German, but this can be changed easily when cloning the github repository. Example: 19010601.xlsx


The filename of the individual excel sheet is derived from the filenames of the hrm and gpx files. The data heartrate, pace, speed, and altitude versus time is stored in the same workbook in worksheet ‘Data’ to be used for further analysis.

The software then adds the information on the overview table to a separate excel which should give an overview over the yearly training. It contains of a first sheet which gives overview over total duration, total distance, and number of training sessions for each month.


The workbook contains for each month a table with the detailed overview table, an example with only one training is depicted below.


The software als tries to detect if a training session was of type interval by analyzing variation in heart rate and speed and then adds this information to the worksheet ‘Intervalle’. An example of the yearly overview excel workbook can be found under “Overview_2019.xlsx”.


General example to scan a folder for updated training files, analyze the GPX and HRM data, create a dedicated training session workbook, and update the overview workbook:

python -m scan -o ../Ueberblick_2019.xlsx -tf ../Trainingsdaten_2019 -sf ../Trainingsheets_2019

More information on the usage and different options is available on github. It incldues a jupyter notebook with more detailed examples and a batch file which could be run when new training sessions are available.


Getting Started with Wireless Communication – Setting up a Flight Tracking Receiver

We recently had a 16 year old student in our labs, and tried to teach him something about LTE, RF transmitters, spectrum analysis, and so on. Most of the stuff however was far too complex for him to understand, as many of the mathematical basics were missing. After talking to him for a day and doing weird measurements, it popped to my mind that I still have this DVB-T Stick and a Raspberry Pi at home, which might make a really cool project. So I brought both devices the next day and told the student to do some research on and find a project he would like to do.

He wanted to track airplanes, as he found a flight tracking webserver could be easily implemented with the RTL-SDR stick and the Pi. What’s this flight tracking, anyhow? Airplanes are sending broadcast messages with information on their flight code, location, altitude, direction, speed, and many other information. The system is called ADS-B, Automatic Dependent Surveillance Broadcast, and the messages are modulated on a 1090 MHz carrier signal and sent once or twice every second.


We just need the RTL-SDR Stick, an 1GHz vertically polarized antenna, and some receiver software. So we went to the lab and were soldering a simple dipole antenna with a length of roughly 7.5cm. Other antenna examples can be found on the project webpageof Then we downloaded dump1090-mutability software, the compilation was easy with standard tools.

Plugging everything together, holding the antenna out of the window starting the software, and immediately we received some messages! We were of course immediately googling at the coordinates, to see where the airplanes were located and were heading to.


It took us a 1 hour effort to build an antenna and compile the software, and could receive some digital radio messages from far away. Pretty cool, isn’t it?

On Teaching Wireless Communication – with a Raspberry Pi

Smartphones, PCs, Televisions, internet, cellular networks, Wifi, Bluetooth; we have seen dramatic increase in complexity of devices, servies, and technologies while theay are easier and easier to use. A huge step forward to enable use of technology not only to nerds and geeks, this trend also results in the fact that nearly nobody understands and nobody can explain his kids how these devices and systems work. Teaching and explaining wireless communication gets more and more complicated, as we lack simple examples and devices. Some decades ago, it was easily possible to disassemble and debug your TV, Radio, or other electrical equipment, make some experiments or try to fix it.

The current PISA report in Germany revealed, that students are good in Math and Science, but are heavily lacking interest in these fields. One of the projects targeted at fueling interest in programming and computers is the Raspberry Pi as simple learning platform for anything related to computing. The success is amazing, now having sold 10 million devices of the Raspberry Pi and fueling huge interest in the making and creating things.

There are plenty of cool and fun projects on the webpages like With these ideas, plans, and descriptions, a rewarding project can be very easily built. Questions on the basic principles of the project can follow, which can be answered by a friend, relative, or teacher. On the second hand, it’s very easy to experiment and to explore. The combination of getting started easily, rewarding projects and room for experimentation makes the major success of the Pi.

In the next couple of posts I will write how to use the Raspberry Pi together with cheap Hardware and open source software to conduct projects and experiments to learn something about wireless communication.

Polar Modulation explained

“What do you actually do at work?” – ” Uh, well, this is hard to explain.  Today, I was doing optimization of DPD coefficients for 3G higher order modulation cases”. When people asking us highly specialzed engineers, scientists, or researchers about their work,  we are sometimes stuck and can’t explain what we are actually doing, but rather explaining very basic, undergraduate course topics, which leaves both us and them puzzled.

With this blog post I want to start a new series on my actual work, with a more educational vision: The desire to explain basic principles of my work to people with no background in electrical engineering, but with following articles including deeper explanation of advanced techniques. The first example seems to be randomly chosen, but this technique is actually used in data connections of the modern mobile phones (smartphones), so it’s definitely worth  explaining; I am talking about Polar Modulation.

So, what is Modulation?

The goal of wireless communication is transmission and reception of information  with the help of electromagnetic waves over the air, without wires. For example in audio broadcasting, the electrical signal representing the sound is transmitted over the air and can be receipt at a distant place with a radio receiver. As several stations want to be heard, the radio spectrum is organized in channels, and each station is only allowed to send a signal in it’s own channel. A channel is a range of frequencies, and Modulation is the term for the mechanism of bringing the desired information into frequencies of the desired channel. It includes a frequency translation, in the example of a radio the audio signal spans frequencies up to 20 kHz,  but the carrier frequency is around 100 MHz (in FM radio). The eletrical device which forms the carrier signal out of the underlying signal is called a Modulator.

Modulation as frequency conversion to a channel frequency of 100MHz

What does Modulation actually do?

Let’s explain with a simple example: music. While the term modulation means something different in the context of music, we can use music to explain polar modulation. The art of music lies in the artful combination of notes with different volume. A piano player can play louder high notes and lower bass notes; but he can also play louder bass notes and lower high notes, both volume and key are completely inedependent. As you probably know from the physics course, each note has a different base frequency.  The piano player is therefore altering both the amplitude and the frequency of the generated sound completely independently.

In wireless communication, equally to the example of a piano, the concept of altering the frequency (phase) and the amplitude of a signal indenpendently also exists. If the signal is thought of as a vector, it can be represented with  both phase and magnitude, meaning in polar coordinates. Therefore we are talking about polar modulation. Let’s have a closer look at the modulation itself. The transmission signal T(t) can be described by a cosine-wave:

T(t) = A(t) cos(ωt+φ(t)),

where A(t) is the modulated amplitude, φ(t) is the modulated phase, and w is the carrier frequency. But wait, we were talking here about frequency, not phase, so how are they related?  The phase of a sinewave is changing over one period from 0 to 2*pi, the shorter the period thefaster it changes; and the higher the frequency.  As we are talking on change versus time, the frequency is therefore derivative of the phase with respect to time, ω = dφ(t)/dt.


If we now find a device which can generate a signal with tunable frequency and tunable amplitude, we can build a Polar Modulator. Such a Transmitter has been built a Raspberry Pi, I will talk about that in my next posts. If the Pi is up and running, I will show measurements, and describe both the general and uniqe properties of the polar modulator based on a Raspberry Pi.

Source Code of Bibtex Graph Generator

Now I would like to release the source code of the software described in an earlier post. The package will be released under the GNU General Public License, any release of other software which includes the full source code or parts of it must also be released under the GPL.

The software is running with python 2.7.9 (Python 3 is not supported) and requires PyGraphViz 1.3rc2 and BibtexParser 0.6.2.

The program includes three main data structures: the list of all publications from the Bibtex file, a list of authors, and a list of relations. The latter two are implemented as python classes. As first step, the full bibtexfile is parsed into an array of dictionaries with the package BibtexParser. Second, the author list is created by iterating over all publications and authors in the bibtex database. Third, the relationsship array is created with entries for all combinations of two authors A and B by iterating over the publications list and checking if both A and B are author of a specific publication. The the graph is constructed by adding nodes for each author and edges for all relations. As a last step, the graph is compacted by constraints given as arguments. Two short examples follow to describe such kind of constraints. The parsed bibtexfile is included in the published package.

Starting it without any argument will show the license info and the help.

A Graph Display Software for bibtex databases
 Copyright (C) 2015 Benjamin Laemmle, jdmorise a t
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 GNU General Public License for more details.
 You should have received a copy of the GNU General Public License 
along with this program. If not, see <>. 

usage: "Examples:

optional arguments:
 -h, --help show this help message and exit
-if INPUT_FILENAME, --input_filename INPUT_FILENAME 
          Filename of publication database in bibtex format
-gf GRAPH_FILENAME, --graph_filename GRAPH_FILENAME    
          Filename of graph output stored as png
-ma MAIN_AUTHOR_NAME, --main_author_name MAIN_AUTHOR_NAME
          Only add edges with ERT or more number of relations
          Only add authors with ART or more number of relations
          Only add authors with APT number of publications
-lvl LEVEL, --level LEVEL
-b BEFORE, --before BEFORE     
          Only use Publications before YEAR for the graph
-a AFTER, --after AFTER
          Only use Publications after YEAR for the graph
          Graph Programm for rendering the graph. one of the
          following: fdp,dot,sfdp,circo,twopi.



The first example was created without any filter, just specifying the input database and the output picture:

python -if Darabi.bib -gf graph_plain.png


Now, in the second example the filters are explained in more detail. First, we would like to see only direct relations between an author and anybody else, so only direct collaboration. This is achieved by specifying the “main author” (-ma “A. Mirzaei” )  and the collaboration “level” (-lvl 1). Then, we would like to remove all authors with less than three publications (e.g. P. Suri) by adding an “author publication threshold” (-apt 3). To make it more readable, we also remove all edges with less than three relations by specyfing an “edge relation threshold” (-ert 3), which removes a couple of authors like K. Juan.

python -if Darabi.bib -gf graph_red.png 
-ma "A. Mirzaei" -lvl 1 -apt 3 -ert 3

The reduced graph is shown below with only a limited amount of authors remaining.


Additional arguments include an “author relation threshold”(-art) to remove all authors with only few relations, and you can filter by publication date by specifying a certain range. As a last argument, the graph generation programm can be selected (-gp) where fdp is chosen as default. The GraphViz documentation will give more details about the examples.

The python code can be found together with the example bibtexfile and the license file in my DropBox. Have fun!

Male and Female Coauthors of #TimHunt

After allegation of sexist , Nobel Prize Winner and Tim Hunt resigned as honorary professor from UCL. I wanted to look into his web of relations as described in the last posts, his coauthored publications, and display the names together with the information of the sex of the author.

Tim Hunt started his academic career 50 years ago in 1964 in Cambridge In this time, he authored a huge amount of publications, he has an h-factor of 74 and an i-10 factor of 157 according to Google Scholar. Hunt_100_2I want to show in the following pictures how many female scientists he worked with and how many female coauthors he had during his time. The bibliographic data of the 100 most important publications (most cited in general) was fetched from Google Scholar and processed with the Graph Analysis Tool presented in earlier posts.

The first graph on the left side shows all authors with more than 2 coauthored publications. We can clearly see, that Tim authored his publications with many different authors, which all have a low number of shared publications. The highest number of publications (10) he authored with Julian Gannon.

The figure with at least 2 publications shows 15 female out of 53 authors, which is roughly 28%. Looking at 3 or 4 coauthored publications, we also count 7 out of 24 (29%) and 5 out of 17 (29%) women, respectively. Stating that, it seems like important academic work of Tim Hunt was done by women, roughly 30% of the important authors are women.

Now, plotting all authors, we get a huge web ob people with a total number of 203 authors and 688 relationships. In this list, there are many international names, sometimes it’s hard to identify if the belongs to a man or women. Forgive me (and please correct me), when there are minor errors. Out of the 203 authors, 63 are women, which is a slightly higher percentage than before, 31%.


Now, according to the article “Research reveals a gender gap in the nation’s biology labs” from MIT, the actual precetange of post-docs, assistant professors, and full professors is 40%,  36%, and 18%, respectively. The report also states, that “between 1969 and 2009, the percentage of doctoral degrees awarded to women in the life sciences grew from 15 percent to 52 percent, but women still lag when it comes to faculty appointments.”

Assuming that the publications cover the full timeline from the beginning to Hunt’s career until now with a higher number of older publications (as they are probably cited more often), the number of 30% women matches the numbers reported from that time.