Skip to content

Commit

Permalink
Merge pull request #200 from MihaMi27/main
Browse files Browse the repository at this point in the history
Add speed average and speed max to TCXFile's extract_integral_metrics()
  • Loading branch information
firefly-cpp authored Dec 3, 2024
2 parents e2657c9 + 953e6ae commit fdfe24a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion sport_activities_features/tcx_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def extract_integral_metrics(self, filename: str) -> dict:
'cadence_avg': cadence_avg,
'cadence_max': cadence_max,
'watts_avg': watts_avg,
'watts_max': watts_max
'watts_max': watts_max,
'speed_avg': speed_avg,
'speed_max': speed_max
}.
"""
tcx = TCXReader().read(filename)
Expand Down Expand Up @@ -235,6 +237,17 @@ def extract_integral_metrics(self, filename: str) -> dict:
except BaseException:
watts_max = None

try:
speed_avg = tcx.avg_speed
except BaseException:
speed_avg = None

try:
speed_max = tcx.max_speed
except BaseException:
speed_max = None



int_metrics = {
'activity_type': activity_type,
Expand All @@ -254,6 +267,8 @@ def extract_integral_metrics(self, filename: str) -> dict:
'cadence_max': cadence_max,
'watts_avg': watts_avg,
'watts_max': watts_max,
'speed_avg': speed_avg,
'speed_max': speed_max
}
return int_metrics

Expand Down

0 comments on commit fdfe24a

Please sign in to comment.