Giter VIP home page Giter VIP logo

gt3x's Introduction

PLEASE SEE

Actigraph has released its pygt3x package at https://github.com/actigraph/pygt3x. This is likely going to be better maintained than this repo and will likely update with different changes to GT3X format.

Read Raw GT3X file

An implementation of extract raw acceleration data from .gt3x files.

This package was extracted and expanded upon from the work of Shaheen Syed and his repositories https://github.com/shaheen-syed/CNN-Non-Wear-Time-Algorithm and https://github.com/shaheen-syed/ActiGraph-ActiWave-Analysis. They are instrumental in this module creation.

The script gt3x_functions.py contains code to extract raw acceleration data from .gt3x files. Each .gt3x file is basically a zip file containing a log.bin and a info.txt file. The log.bin is a binary file which contains the actual acceleration values. The info.txt file contains the meta-data in text form. When the script is executed, it will create a numpy file that contains the raw data and a time vector.

Usage

The gt3x module needs to be first installed. The most up-to-date one is:

pip install --upgrade git+https://github.com/muschellij2/gt3x.git#egg=gt3x

But can also be installed via pip from PyPi:

pip install gt3x
import gt3x
actigraph_acc, actigraph_time, meta_data = gt3x.read_gt3x('AI9_NEO1F16120039_2017-06-27.gt3x')

Installation

pip3 install -r requirements.txt

gt3x's People

Contributors

muschellij2 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Forkers

aljo-jose

gt3x's Issues

ERROR:root:Unpacking GTX3 exception

I am unable to read some of my gt3x files. Here is one example case:

The gt3x file:
example_unpacking GTX3 exception.gt3x.zip

Console output of the exception while loading the above file:

i is outside payload bits = 126528
bitstring 0101
bitstring 010100000000
ERROR:root:Unpacking GTX3 exception: cannot reshape array of size 10544 into shape (30,3)
ERROR:root:Error rescaling log data: unsupported operand type(s) for *: 'NoneType' and 'float'

ValueError: cannot convert float NaN to integer

Hello,

When I try to read in gt3x files I get the error:

ValueError: cannot convert float NaN to integer

It's caused by line 184:

log_data[:] = np.NaN

I've tested on Python 3.10 and 3.8.8, for the later numpy version 1.20.3.

Code to snippet to reproduce:

import numpy as np
acc_data_type = np.int16
#acc_data_type = np.float #uncomment and this works

# create empty array for the acceleration data
log_data = np.empty((10, 3), dtype=acc_data_type)
log_data[:] = np.NaN

Hard coding to enabling scaling fixes the issue as it uses np.float which can be NaN. I'm guessing older versions of numpy allowed np.int16 to have NaN or silently converted to 0 but I haven't tested.

ERROR:root:Unpacking GTX3 exception

I am getting following exception for some of my gt3x files:

ERROR:root:Unpacking GTX3 exception: cannot reshape array of size 5120 into shape (40,3)
ERROR:root:Error rescaling log data: unsupported operand type(s) for *: 'NoneType' and 'float'

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.