Coder Social home page Coder Social logo

fit's Introduction

FIT file I/O for Python

The Flexible and Interoperable Data Transfer (FIT) protocol is a format designed specifically for the storing and sharing of data that originates from sport, fitness and health devices. It is specifically designed to be compact, interoperable and extensible. This document will describe the FIT file structure and interpretation.

The FIT protocol defines a set of data storage templates (FIT messages) that can be used to store information such as user profiles and activity data in files. Any FIT-compliant device can interpret a FIT file from any other FIT-compliant device.

How-To

from fit import FitFile
from fit.files.activity import ActivityFile
from fit.messages.common import FileCreator


fin = FitFile.open("path/to/filename.fit")
for msg in fin:
    print msg

with FitFile.open("path/to/copy.fit", mode="w") as fout:
    fout.copy(fin)

fnew = ActivityFile.create("path/to/new.fit")
fnew.append(FileCreator(software_version=666))
fnew.write()
fnew.close()

TODO

  • Component fields
  • Accumulated fields
  • Tests (you can submit me some cool examples)
  • Entry Points for external extensions
  • Convertible types
  • ...

fit's People

Contributors

rembish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fit's Issues

python 3 support

In [1]: from fit import FitFile
Traceback (most recent call last):

File "/mnt/c/Users/andre/Documents/FIT experiment/venv/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)

File "", line 1, in
from fit import FitFile

File "/mnt/c/Users/andre/Documents/FIT experiment/venv/lib/python3.6/site-packages/fit/init.py", line 53
raise exc_type, exc_val, exc_tb
^
SyntaxError: invalid syntax

FitFile.open

Hi,

When I try to open a file (fin = FitFile.open("input.fit")), I receive the following error message:
" File "", line 1, in
fin = FitFile.open("input.fit")

File "/usr/local/lib/python2.7/dist-packages/fit/init.py", line 27, in open
body = Reader(ffd).body
File "/usr/local/lib/python2.7/dist-packages/fit/io/reader.py", line 60, in body
self._fd.seek(self.header.size)

File "/usr/local/lib/python2.7/dist-packages/fit/io/reader.py", line 33, in header
header_size = ord(self._fd.read(1))

TypeError: ord() expected a character, but string of length 0 found"

Any idea?
Thanks!

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.