Giter VIP home page Giter VIP logo

tcxreader's People

Contributors

alenrajsp avatar allcontributors[bot] avatar firefly-cpp avatar fortysix2ahead avatar hlistilen avatar martin-ueding avatar toonelewaut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tcxreader's Issues

AssertionErrors

@alenrajsp, pytest is failing due to the assertion errors. Please check it out!

def test_hr_max(self):
self.assertEqual(self.tcx.hr_max, None) -> it should be 200

There is another None:

def altitude_avg(self):
    self.assertEqual(self.tcx.altitude_avg, None)  

Value Conversion Error - Cadence

Similar issue to #19 - if the TCX file contains Cadence as a float value, e.g. '86.0' it will cause "ValueError: invalid literal for int() with base 10: '0.0'". If helpful, I've attached a truncated TCX file exported from a Peloton bike which has the issue, saved as .txt to allow Github import.

Example_Issue.txt

Code on line

tcx_point.cadence = int(trackpoint_data.text)
appears to cause the issue. You previously fixed a similar problem for heart rate on ddcd825.

No trackpoints read out when position data is missing

Hi,
I'm using the tcxreader in a personal project, and it works nicely with most of my tcx-files exported from Garmin. However for this one file where positional data of the trackpoints is missing (but timestamps, heartrate data etc. still available) it only reads out very little general information (author, activity_type), but tcx.trackpoints is a completely empty list. I am assuming there's an exception built in during the parsing of the file if no positional data is available? Would it be feasible/desirable to change that, so that all available data is read in and stored, even if some parameters are missing?
I have attached the relevant tcx-file for reference:
activity_12702654569.tcx.txt

Cheers, Paul

Current TCXReader does not appear to support daylight savings formats

Using a file that was recorded during UK daylight savings time, the datetime for the trackpoints includes +01:00, and trying to use such a file in the TCXReader produces the following ValueError:

ValueError: time data '2022-10-25T19:33:35.000+01:00' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'

This does not appear fixable on my end just by removing characters from each datetime in Python, as the error is related to the tcxReader.read() function

Read error with missing HR data values

If there is missing HR data in a TCX file, the read code is crashing for me with the following error:

...\lib\site-packages\tcxreader\tcxreader.py", line 144, in trackpoint_parser
tcx_point.hr_value = int(float(heart_rate.text))
TypeError: float() argument must be a string or a number, not 'NoneType'

Looking inside the TCX there are some missing values:
...

<HeartRateBpm>
  <Value></Value>
</HeartRateBpm>

...

I guess this may also apply to other datafields too if the sensor falls out during a ride.

I'm using Python 3.9 (I know, a bit behind the times, but embedded platform) and tcxreader-0.4.6 via pip3.

Fix linter issues

./tests/test_tcxreader.py:4:1: W391 blank line at end of file
./examples/reader_demo.py:4:1: F401 'tcxreader.tcxreader.TCXTrackPoint' imported but unused
./examples/reader_demo.py:18:1: W191 indentation contains tabs
./examples/reader_demo.py:18:2: E101 indentation contains mixed spaces and tabs
./examples/reader_demo.py:19:1: W191 indentation contains tabs
./examples/reader_demo.py:19:2: E101 indentation contains mixed spaces and tabs
./examples/reader_demo.py:20:1: W191 indentation contains tabs
./examples/reader_demo.py:20:2: E101 indentation contains mixed spaces and tabs
./examples/reader_demo.py:21:1: W191 indentation contains tabs
./examples/reader_demo.py:21:2: E101 indentation contains mixed spaces and tabs
./examples/reader_demo.py:22:1: W191 indentation contains tabs
./examples/reader_demo.py:22:2: E101 indentation contains mixed spaces and tabs
./examples/reader_demo.py:23:1: W191 indentation contains tabs
./examples/reader_demo.py:23:2: E101 indentation contains mixed spaces and tabs
./examples/reader_demo.py:24:1: W191 indentation contains tabs
./examples/reader_demo.py:24:2: E101 indentation contains mixed spaces and tabs
./examples/reader_demo.py:25:1: W191 indentation contains tabs
./examples/reader_demo.py:25:2: E101 indentation contains mixed spaces and tabs
./examples/reader_demo.py:26:1: W191 indentation contains tabs
./examples/reader_demo.py:26:2: E101 indentation contains mixed spaces and tabs
./tcxreader/tcxreader.py:1:1: F401 'os' imported but unused
./tcxreader/tcxreader.py:6:1: F401 'pathlib.Path' imported but unused
./tcxreader/tcxreader.py:16:5: C901 'TCXReader.read' is too complex (34)
./tcxreader/tcxreader.py:73:21: E712 comparison to True should be 'if cond is True:' or 'if cond:'
./tcxreader/tcxreader.py:87:5: C901 'TCXReader.__find_hi_lo_avg' is too complex (14)
./tcxreader/tcxreader.py:93:36: E711 comparison to None should be 'if cond is not None:'
./tcxreader/tcxreader.py:95:37: E711 comparison to None should be 'if cond is not None:'
./tcxreader/tcxreader.py:97:35: E711 comparison to None should be 'if cond is not None:'
./tcxreader/tests/test_reader.py:3:1: F401 'tcxreader.tcxreader.TCXTrackPoint' imported but unused
./tcxreader/tests/test_reader.py:3:1: F401 'tcxreader.tcxreader.TCXExercise' imported but unused
./tcxreader/tests/conftest.py:3:1: E302 expected 2 blank lines, found 1
2 C901 'TCXReader.read' is too complex (34)
9 E101 indentation contains mixed spaces and tabs
1 E302 expected 2 blank lines, found 1
3 E711 comparison to None should be 'if cond is not None:'
1 E712 comparison to True should be 'if cond is True:' or 'if cond:'
5 F401 'tcxreader.tcxreader.TCXTrackPoint' imported but unused
9 W191 indentation contains tabs
1 W391 blank line at end of file

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.