GithubHelp home page GithubHelp logo

jlc-christie / axivity-ax3-tool Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 4.0 2.85 MB

Command line tool written in c++ for easily extracting light and temperature data from Axivity AX3 accelerometers used in the UKBiobank

License: GNU General Public License v3.0

C++ 100.00%
cplusplus-11 axivity ax3 ukbiobank biobank

axivity-ax3-tool's Introduction

Axivity AX3 Light and Temperature Extractor

A tool created to extract the raw light and temperature data from Axivity AX3 wrist-worn accelerometers (as used in the UK Biobank). This was created whilst working at the Complex Trait Genomics team at the University of Exeter Medical School (http://www.t2diabetesgenes.org/who-we-are/). Please contact James Christie ([email protected]) or Andy Wood ([email protected]) for more information.

Features:

  • convert large .cwa binary files to .csv
  • light data extraction
  • temperature data extraction
  • central moving average of data (variable window size)
  • summarise individuals light or temperature data (useful for summarising many individuals in to one file)
  • framework exists to extract other data such as raw accelerometer readings

Install

  1. clone this repo
    git clone https://github.com/jlc-christie/axivity-ax3-tool.git
  2. compile with prefered c++11 compatible compiler
    e.g. g++ ax3.cpp -o ax3 -O3, if using g++

Usage

./ax3 (-l|-t)  -i <input file> -o <output file> [-a <window size>] [-s <summary file>]
    -l -- Light mode
    -t -- Temperature mode
    -i -- Path to .cwa input file
    -o -- path to .csv output file to be generated
    -a -- Use Central Moving Average on data read
    -s -- Calculate summary statistics

Example:

Extract the light (-l) data from the input file my_raw_data_file.cwa, use a central moving average (-a) of 5 minutes (300 seconds) and save the output to light_data.csv. Also, append summary statistics about the light data to the file summary_statistics.csv.

./ax3 -l -i my_raw_data_file.cwa -o light_data.csv -a 300 -s summary_statistics.csv

Plotting

This repo also contains a small gnuplot script to either interactively plot the results or save the plots to files. Use -e "filename='out.csv'" to pass in the data file, making sure that the -e flag comes before the script file. Append -p to display the interactive plot and finally pass another argument outfile if you want the plots to be saved to a file (recommended, as interactive plot is relatively slow). Examples:

  1. Display interactive plot, don't save plot images
    gnuplot -e "filename='out.csv'" plot.gpl -p
  2. Display interactive plot and save plot images
    gnuplot -e "filename='out.csv';outfile='my_plot'" plot.gpl -p
    creates 2 files, my_plot.png and my_plot.ps, ps can be converted easily to pdf if required (e.g. ps2pdf my_plot.ps my_plot.pdf)
  3. Don't display interactive plot, just save images to files
    gnuplot -e "filename='out.csv';outfile='my_plot'" plot.gpl

Example output from plot:

alt text

Summary Statistics

As mentioned above, the -s flag followed by a summary file filename, will calculate the mean and standard deviation of light or temperature (depending on which mode it is in) for the whole day as well as hourly. Because this functionality is meant to be used as part of a batch script which appends to the same file, there is no header. The data is comma seperated and the format is as follows:

filename mean iqr std_dev hour_0_mean hour_0_std_dev hour_1_mean hour_1_std_dev ... hour_23_mean hour_23_std_dev
27492749 20.558 120.000 1.381 21.550 1.656 21.229 1.524 ... 20.972 1.120

axivity-ax3-tool's People

Contributors

drarwood avatar jlc-christie avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.