Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PyPersonalTrainer.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python PyPersonalTrainer.py -m scan -o ../Ueberblick_2019.xlsx -tf ../Trainingsdaten_2019 -sf ../Trainingsheets_2019
python PyPersonalTrainer.py -m scan -o ../resumen_2021.xlsx -tf ../datos_2021 -sf ../excels_2021
1 change: 1 addition & 0 deletions PyPersonalTrainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def print_license():
# print(' ')
# print(' (C) 2019, jdmorise@yahoo.com')
print(' ')
print(' Traducción realizada al español por Luis Zurita Herrera')
print(' This program is free software: you can redistribute it and/or modify')
print(' it under the terms of the GNU General Public License as published by')
print(' the Free Software Foundation, either version 3 of the License, or')
Expand Down
Binary file added __pycache__/gpx_d.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/hrm_d.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/training_d.cpython-39.pyc
Binary file not shown.
10 changes: 6 additions & 4 deletions training_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,13 @@ def get_type(self):
#if((np_hr_hist[4]>0.1) & (0.68*MaxHR < AvgHR < 0.90*MaxHR)):
# self.trtype = 'Intervalle'
if (AvgHR > (0.90*MaxHR)):
self.trtype = 'Wettkampf'
self.trtype = 'Competición'
elif (AvgHR > (0.84*MaxHR)):
self.trtype = 'TDL'
self.trtype = 'Entrenamiento'
elif (AvgHR > (0.75*MaxHR)):
self.trtype = 'GA2'
self.trtype = 'Recuperación'
elif (AvgHR > (0.50*MaxHR)):
self.trtype = 'Ruta del colesterol'
# elif (AvgHR > (0.85*MaxHR)):
# self.trtype = 'GA1'

Expand Down Expand Up @@ -145,7 +147,7 @@ def get_intervals(self):
sum_hrmin = sum(hr_avg < 0.79*MaxHR for hr_avg in self.userlaps.hr_avg)

if ((sum_hrmax > 2) & (sum_hrmin >= sum_hrmax)):
self.trtype = 'Intervalle'
self.trtype = 'Intervalos'
intlaps_idx = []
for userlap_idx_s in self.userlaps_idx:
idx_s = self.userlaps_idx.index(userlap_idx_s)
Expand Down
60 changes: 30 additions & 30 deletions trd_oview_xlswriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def __init__(self, filename_dict_s, my_training):
super(trd_oview_xlswriter,self).__init__(self.xlsx_filename)

self.my_tr = my_training
self.months = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
self.weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So' ]
self.months = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre']
self.weekdays = ['Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa', 'Do' ]

if(os.path.exists(self.xlsx_filename)):

Expand All @@ -63,11 +63,11 @@ def create_oview_sheet(self):
# Überblickssheet

self.ws = self.wb.active
self.ws.title = "Überblick"
self.ws['A1'] = 'Monat'
self.ws['B1'] = 'Strecke'
self.ws['C1'] = 'Dauer'
self.ws['D1'] = 'Trainingseinheiten'
self.ws.title = "General"
self.ws['A1'] = 'Mess'
self.ws['B1'] = 'Trayecto'
self.ws['C1'] = 'Duración'
self.ws['D1'] = 'Sesión de entrenamiento'

for i in range(12):
month_s = self.months[i]
Expand All @@ -89,18 +89,18 @@ def create_oview_sheet(self):
# Intervalle
def create_interval_sheet(self):
self.ws = self.wb.create_sheet('Intervalle')
self.ws['A1'] = 'Datum'
self.ws['B1'] = 'Uhrzeit'
self.ws['C1'] = 'Tag'
self.ws['D1'] = 'Intervalle'
self.ws['E1'] = 'Dist Avg'
self.ws['F1'] = 'Zeit Avg'
self.ws['G1'] = 'Pace Avg'
self.ws['A1'] = 'Datos'
self.ws['B1'] = 'Tiempo'
self.ws['C1'] = 'Etiqueta'
self.ws['D1'] = 'Intervalos'
self.ws['E1'] = 'Distancia media'
self.ws['F1'] = 'Duración media'
self.ws['G1'] = 'Velocidad media'

for i in range(10):
self.ws.cell(row=1, column=8+3*i).value = ('Dist #' + str(i))
self.ws.cell(row=1, column=8+3*i+1).value = ('Zeit #' + str(i))
self.ws.cell(row=1, column=8+3*i+2).value = ('Pace #' + str(i))
self.ws.cell(row=1, column=8+3*i).value = ('Distancia #' + str(i))
self.ws.cell(row=1, column=8+3*i+1).value = ('Duración #' + str(i))
self.ws.cell(row=1, column=8+3*i+2).value = ('Velocidad #' + str(i))

# Header of Laps
self.ws.column_dimensions["A"].width = 13.0
Expand All @@ -120,16 +120,16 @@ def create_months_sheet(self):
for i in range(12):
self.ws = self.wb.create_sheet(self.months[i])

self.ws['A1'] = 'Datum'
self.ws['B1'] = 'Uhrzeit'
self.ws['C1'] = 'Tag'
self.ws['D1'] = 'Dauer'
self.ws['E1'] = 'Puls Avg'
self.ws['F1'] = 'Puls Max'
self.ws['G1'] = 'Distanz'
self.ws['H1'] = 'Pace'
self.ws['I1'] = 'Running Index'
self.ws['J1'] = 'Training'
self.ws['A1'] = 'Datos'
self.ws['B1'] = 'Tiempo'
self.ws['C1'] = 'Etiqueta'
self.ws['D1'] = 'Duración'
self.ws['E1'] = 'Pulsaciones Medias'
self.ws['F1'] = 'Pulsaciones Máximas'
self.ws['G1'] = 'Distancia'
self.ws['H1'] = 'Velocidad'
self.ws['I1'] = 'Índice de carrera'
self.ws['J1'] = 'Entrenamiento'

self.format_header(1, 1, 10, 1)

Expand Down Expand Up @@ -170,7 +170,7 @@ def update_oview_sheet(self):
t = dt1 - dt0
sum_dur += t.total_seconds()

self.ws = self.wb['Überblick']
self.ws = self.wb['General']
self.ws.cell(column=2, row = dt_t.month+1).value = sum_len
self.ws.cell(column=4, row = dt_t.month+1).value = training_no
sum_dur_dt = datetime.datetime.fromtimestamp(sum_dur+ts1)
Expand Down Expand Up @@ -266,7 +266,7 @@ def update_intervals_sheet(self):
data_row.append('{0:02d}'.format(floor(int_dur_s/60)) + ':' + '{0:02d}'.format(int_dur_s%60))
data_row.append('{0:02d}'.format(floor(int_pace_s)) + ':' + '{0:02d}'.format(floor(int_pace_s%1*60)))

self.ws = self.wb['Intervalle']
self.ws = self.wb['Intervalos']

if(self.ws.max_row == 1):
style_row = self.append_row(data_row)
Expand Down Expand Up @@ -317,7 +317,7 @@ def update_workbook(self):
self.update_months_row()
self.update_oview_sheet()
#print(self.my_tr.trtype)
if(self.my_tr.trtype == 'Intervalle'):
if(self.my_tr.trtype == 'Intervalos'):
self.update_intervals_sheet()


Expand Down
68 changes: 34 additions & 34 deletions trd_session_xlswriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, training_filename_dict, my_training):

self.wb = Workbook()
self.ws = self.wb.active
self.ws.title = "Überblick"
self.ws.title = "General"

# Location of HRZones
self.hrzones_col = 14
Expand All @@ -66,12 +66,12 @@ def write_hrmdata(self):

my_row = 2
ts1 = 82800
self.ws1 = self.wb.create_sheet("Data")
self.ws1['A1'] = 'sec'
self.ws1 = self.wb.create_sheet("Datos")
self.ws1['A1'] = 'Segundos'
#self.ws1['B1'] = 'Time'
self.ws1['C1'] = 'HR'
self.ws1['D1'] = 'Speed'
self.ws1['E1'] = 'Pace'
self.ws1['C1'] = 'Pulsaciones'
self.ws1['D1'] = 'Velocidad'
self.ws1['E1'] = 'Paso'
self.ws1['F1'] = 'Alt'
hrm_length = len(self.mytr.hrm_d.pace_u)
for i in range(hrm_length):
Expand All @@ -88,36 +88,36 @@ def write_hrmdata(self):
## Insert Overview

def write_overview(self):
self.ws['A1'] = 'Datum'
self.ws['A1'] = 'Datos'
self.ws['A2'] = self.mytr.hrm_d.Start_Date.strftime('%d.%m.%Y')

self.ws['C1'] = 'Dauer'
self.ws['C1'] = 'Duración'

dur_h = self.mytr.hrm_d.Length_dt.tm_hour
dur_m = self.mytr.hrm_d.Length_dt.tm_min
dur_s = self.mytr.hrm_d.Length_dt.tm_sec

self.ws['C2'] = '{0:02d}'.format(dur_h) + ':' + '{0:02d}'.format(dur_m) + ':' + '{0:02d}'.format(dur_s)

self.ws['B1'] = 'Uhrzeit'
self.ws['B1'] = 'Hora'
self.ws['B2'] = self.mytr.hrm_d.Start_Date.strftime("%H:%M:%S")

self.ws['F1'] = 'Puls Avg'
self.ws['F1'] = 'Pulsaciones medias'
self.ws['F2'] = int(round(mean(self.mytr.hrm_d.hr),0))

self.ws['G1'] = 'Puls Max'
self.ws['G1'] = 'Pulsaciones máximas'
self.ws['G2'] = max(self.mytr.hrm_d.hr)

self.ws['D1'] = 'Distanz'
self.ws['D1'] = 'Distancia'
self.ws['D2'] = int(self.mytr.gpx_d.dist_geod_no_alt[-1])/1000

self.ws['E1'] = 'Pace'
self.ws['E1'] = 'Paso'
self.ws['E2'] = '{0:02d}'.format(int(floor(self.mytr.gpx_d.pace))) + ':' + '{0:02d}'.format(int((self.mytr.gpx_d.pace*60)%60))

self.ws['H1'] = 'Running Index'
self.ws['H1'] = 'Índice de carrera'
self.ws['H2'] = self.mytr.hrm_d.RunningIndex

self.ws['I1'] = 'Training'
self.ws['I1'] = 'Entrenamiento'
self.ws['I2'] = self.mytr.trtype

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand All @@ -130,12 +130,12 @@ def write_autolaps(self):
#self.no_autolaps = len(self.mytr.autolaps.idx)
self.ws.merge_cells(start_row=my_row-2, start_column=my_col, end_row=my_row-2, end_column=my_col+5)
self.ws.cell(row=my_row-2, column = my_col, value='Autolaps')
self.ws.cell(row=my_row-1, column = my_col, value='Runde')
self.ws.cell(row=my_row-1, column = my_col+1, value='Distanz')
self.ws.cell(row=my_row-1, column = my_col+2, value='Dauer')
self.ws.cell(row=my_row-1, column = my_col+3, value='Pace')
self.ws.cell(row=my_row-1, column = my_col+4, value='Puls Avg')
self.ws.cell(row=my_row-1, column = my_col+5, value='Puls Max')
self.ws.cell(row=my_row-1, column = my_col, value='Carrera')
self.ws.cell(row=my_row-1, column = my_col+1, value='Distancia')
self.ws.cell(row=my_row-1, column = my_col+2, value='Duración')
self.ws.cell(row=my_row-1, column = my_col+3, value='Paso')
self.ws.cell(row=my_row-1, column = my_col+4, value='Pulsaciones medias')
self.ws.cell(row=my_row-1, column = my_col+5, value='Pulsaciones máximas')

for i in range(self.no_autolaps):
self.ws.cell(row=my_row+i, column=my_col, value = i+1)
Expand All @@ -158,13 +158,13 @@ def write_userlaps(self):

#Runden Einfügen
self.ws.merge_cells(start_row=my_row-2, start_column=my_col, end_row=my_row-2, end_column=my_col+5)
self.ws.cell(row=my_row-2, column = my_col, value='Userlaps')
self.ws.cell(row=my_row-1, column = my_col, value='Runde')
self.ws.cell(row=my_row-1, column = my_col+1, value='Distanz')
self.ws.cell(row=my_row-1, column = my_col+2, value='Dauer')
self.ws.cell(row=my_row-1, column = my_col+3, value='Pace')
self.ws.cell(row=my_row-1, column = my_col+4, value='Puls Avg')
self.ws.cell(row=my_row-1, column = my_col+5, value='Puls Max')
self.ws.cell(row=my_row-2, column = my_col, value='Vueltas')
self.ws.cell(row=my_row-1, column = my_col, value='Ronda')
self.ws.cell(row=my_row-1, column = my_col+1, value='Distancia')
self.ws.cell(row=my_row-1, column = my_col+2, value='Duración')
self.ws.cell(row=my_row-1, column = my_col+3, value='Paso')
self.ws.cell(row=my_row-1, column = my_col+4, value='Pulsaciones medias')
self.ws.cell(row=my_row-1, column = my_col+5, value='Pulsaciones máximas')
for i in range(self.no_userlaps):
self.ws.cell(row=my_row+i, column=my_col, value = i+1)
self.ws.cell(row=my_row+i, column=my_col+2, value = '{0:02d}'.format(floor(self.mytr.userlaps.dur[i]/60)) + ':' + '{0:02d}'.format(int(self.mytr.userlaps.dur[i]%60)))
Expand Down Expand Up @@ -197,10 +197,10 @@ def write_hrzones(self):
# Write Header
# self.ws.merge_cells(start_row=my_row-2, start_column=my_col, end_row=my_row-2, end_column=my_col+1)
self.ws.merge_cells(start_row=my_row-1, start_column=my_col, end_row=my_row-1, end_column=my_col+3)
self.ws.cell(column=my_col, row=my_row-1).value = 'Pulszonen'
self.ws.cell(column=my_col, row=my_row).value = 'Zone'
self.ws.cell(column=my_col, row=my_row-1).value = 'Zonas de esfuero'
self.ws.cell(column=my_col, row=my_row).value = 'Zona'
self.ws.cell(column=my_col+2, row=my_row).value = '%'
self.ws.cell(column=my_col+3, row=my_row).value = 'Zeit'
self.ws.cell(column=my_col+3, row=my_row).value = 'Duración'

# Write HRzones Data
for i in range(6):
Expand Down Expand Up @@ -288,8 +288,8 @@ def create_hrmgraph(self):
c1 = ScatterChart()
#c1.title = ""
c1.style = 13
c1.y_axis.title = 'Puls (bpm)'
c1.x_axis.title = 'Zeit'
c1.y_axis.title = 'Pulsaciones (bpm)'
c1.x_axis.title = 'Duración'
c1.y_axis.title.tx.rich.p[0].r[0].rPr = CharacterProperties(sz=1200)
c1.x_axis.title.tx.rich.p[0].r[0].rPr = CharacterProperties(sz=1200)

Expand All @@ -305,7 +305,7 @@ def create_hrmgraph(self):
# Second Chart: Speed
c2 = ScatterChart()

c2.y_axis.title = 'Speed (km/h)'
c2.y_axis.title = 'Velocidad (km/h)'
c2.y_axis.title.tx.rich.p[0].r[0].rPr = CharacterProperties(sz=1200)


Expand Down