Example #1
0
 def samples(self, s=ActSample.empty()):
     # TODO: Detect timer start event and use that to reset timestamps.
     for event, elm in ET.iterparse(self.path):
         if elm.tag == self.TagPrefix + "Trackpoint": # end TrackPoint
             s = self.parseTrackpoint(elm, s)
             yield s
         elif elm.tag == self.TagPrefix + "Activity": # end first Activity
             break # Skip any subsequent Activity
Example #2
0
def main(path1, path2):
    print "Reading activity data from %s..." % (path1),
    p1 = ActParser(path1)
    print "done"
    print "Reading activity data from %s..." % (path2),
    p2 = ActParser(path2)
    print "done"

    compfunc = ActSample.comparator(alt=0.25, d=0.1, v=0.1, hr=0.1, cad=0.1)
    for s1, s2 in zip(p1.samples(), p2.samples()):
        if compfunc(s1, s2):
            print "-%s" % (s1)
            print "+%s" % (s2)
    return 0
Example #3
0
 def samples(self, s=ActSample.empty()):
     """Yield all trackpoints as ActSample objects."""
     for r in self.act.get_records_by_type('record'):
         s = self.parseFitRecord(r, s)
         yield s