@@ 195,10 195,14 @@ def analyse(track: Track, athlete_data: Mapping[str, float], raw: bool = False):
for i in range(raw_hr.shape[0]):
hr[i][0] = (raw_hr[i][0] - start_date).item().total_seconds()
+ hr_zones = None
if hr.shape[0] > 1:
avg_hr = time_series_average(hr[:, 0], hr[:, 1])
max_hr = np.max(hr[:, 1])
min_hr = np.min(hr[:, 1])
+
+ potential_max_hr = opt_max(max_hr, athlete_data.get('max_hr'))
+ hr_zones = analyse_hr_zones(hr, potential_max_hr)
elif hr.shape[0] == 1:
avg_hr = hr[0][1]
max_hr = hr[0][1]
@@ 208,12 212,6 @@ def analyse(track: Track, athlete_data: Mapping[str, float], raw: bool = False):
max_hr = None
min_hr = None
- real_max_hr = opt_max(max_hr, athlete_data.get('max_hr'))
- if real_max_hr is not None:
- hr_zones = analyse_hr_zones(hr, real_max_hr)
- else:
- hr_zones = None
-
# elapsed_seconds = (pos[-1][0] - pos[0][0]).item().total_seconds()
elapsed_seconds = dist[-1][0]