-
Notifications
You must be signed in to change notification settings - Fork 11
/
draw_map_with_identified_intervals.py
36 lines (33 loc) · 1.18 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
"""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()
(
activity_type,
positions,
altitudes,
distances,
total_distance,
timestamps,
heartrates,
speeds,
) = tcx_file.read_one_file('path_to_the_data').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.draw_intervals_in_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.draw_intervals_in_map(timestamps, distances, all_intervals)