-
Notifications
You must be signed in to change notification settings - Fork 12
/
draw_map_with_identified_intervals.py
37 lines (34 loc) · 1.24 KB
/
draw_map_with_identified_intervals.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""This example presents how to draw a map with identified intervals."""
from sport_activities_features.interval_identification import (
IntervalIdentificationByHeartRate,
IntervalIdentificationByPower,
)
from sport_activities_features.plot_data import PlotData
from sport_activities_features.tcx_manipulation import TCXFile
# Reading the TCX file
tcx_file = TCXFile()
tcx_exercise = tcx_file.read_one_file('path_to_the_data')
(
activity_type,
positions,
altitudes,
distances,
total_distance,
timestamps,
heartrates,
speeds,
) = tcx_file.extract_activity_data(tcx_exercise).values()
# Identifying the intervals in the activity by power and drawing the map
Intervals = IntervalIdentificationByPower(distances, timestamps, altitudes, 70)
Intervals.identify_intervals()
all_intervals = Intervals.return_intervals()
Map = PlotData()
Map.show_intervals_on_map(timestamps, distances, all_intervals)
# Identifying the intervals in the activity by heart rate and drawing the map
Intervals = IntervalIdentificationByHeartRate(
distances, timestamps, altitudes, heartrates,
)
Intervals.identify_intervals()
all_intervals = Intervals.return_intervals()
Map = PlotData()
Map.show_intervals_on_map(timestamps, distances, all_intervals)