sstools 0.2.6__tar.gz → 0.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sstools-0.2.6 → sstools-0.2.8}/PKG-INFO +7 -2
- {sstools-0.2.6 → sstools-0.2.8}/README.md +6 -0
- {sstools-0.2.6 → sstools-0.2.8}/setup.py +1 -2
- sstools-0.2.8/sstools/rudolph_punkttabelle.pkl +0 -0
- {sstools-0.2.6 → sstools-0.2.8}/sstools/ssconv.py +239 -144
- {sstools-0.2.6 → sstools-0.2.8}/sstools.egg-info/PKG-INFO +7 -2
- {sstools-0.2.6 → sstools-0.2.8}/sstools.egg-info/SOURCES.txt +1 -2
- sstools-0.2.8/tests/test_ssconv.py +87 -0
- sstools-0.2.6/sstools/rudolph_points_table.xls +0 -0
- sstools-0.2.6/sstools.egg-info/requires.txt +0 -1
- sstools-0.2.6/tests/test_ssconv.py +0 -200
- {sstools-0.2.6 → sstools-0.2.8}/MANIFEST.in +0 -0
- {sstools-0.2.6 → sstools-0.2.8}/setup.cfg +0 -0
- {sstools-0.2.6 → sstools-0.2.8}/sstools/__init__.py +0 -0
- {sstools-0.2.6 → sstools-0.2.8}/sstools/fina_base_times.pkl +0 -0
- {sstools-0.2.6 → sstools-0.2.8}/sstools.egg-info/dependency_links.txt +0 -0
- {sstools-0.2.6 → sstools-0.2.8}/sstools.egg-info/top_level.txt +0 -0
- {sstools-0.2.6 → sstools-0.2.8}/tests/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sstools
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: swimstats tools
|
|
5
5
|
Home-page: https://swimstats.net
|
|
6
6
|
Author: Roman Arnet
|
|
@@ -10,9 +10,14 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Requires-Python: >=3.6
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: xlrd
|
|
14
13
|
|
|
15
14
|
# sstools - Swimstats Tools
|
|
15
|
+
0.2.8
|
|
16
|
+
- Add season 2025 FINA SCM
|
|
17
|
+
|
|
18
|
+
0.2.7
|
|
19
|
+
- Trunc FINA calculation
|
|
20
|
+
- Add Rudolph-Punkttabelle 2025
|
|
16
21
|
|
|
17
22
|
0.2.6
|
|
18
23
|
- Fix available styles
|
|
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
|
|
|
6
6
|
|
|
7
7
|
setuptools.setup(
|
|
8
8
|
name="sstools", # Replace with your own username
|
|
9
|
-
version="0.2.
|
|
9
|
+
version="0.2.8",
|
|
10
10
|
author="Roman Arnet",
|
|
11
11
|
author_email="arnet@dlab.ch",
|
|
12
12
|
description="swimstats tools",
|
|
@@ -22,6 +22,5 @@ setuptools.setup(
|
|
|
22
22
|
],
|
|
23
23
|
python_requires='>=3.6',
|
|
24
24
|
install_requires=[
|
|
25
|
-
'xlrd',
|
|
26
25
|
],
|
|
27
26
|
)
|
|
Binary file
|
|
@@ -2,9 +2,6 @@ from datetime import datetime
|
|
|
2
2
|
import logging
|
|
3
3
|
import os
|
|
4
4
|
import pickle
|
|
5
|
-
import sys
|
|
6
|
-
|
|
7
|
-
import xlrd
|
|
8
5
|
|
|
9
6
|
logger = logging.getLogger(__name__)
|
|
10
7
|
logger.setLevel(logging.INFO)
|
|
@@ -12,58 +9,131 @@ logger.setLevel(logging.INFO)
|
|
|
12
9
|
|
|
13
10
|
class SsConverter:
|
|
14
11
|
def __init__(self):
|
|
15
|
-
self._supported_rudolph_seasons = [
|
|
12
|
+
self._supported_rudolph_seasons = [
|
|
13
|
+
2004,
|
|
14
|
+
2005,
|
|
15
|
+
2006,
|
|
16
|
+
2007,
|
|
17
|
+
2008,
|
|
18
|
+
2009,
|
|
19
|
+
2010,
|
|
20
|
+
2011,
|
|
21
|
+
2012,
|
|
22
|
+
2013,
|
|
23
|
+
2014,
|
|
24
|
+
2015,
|
|
25
|
+
2016,
|
|
26
|
+
2017,
|
|
27
|
+
2018,
|
|
28
|
+
2019,
|
|
29
|
+
2020,
|
|
30
|
+
2021,
|
|
31
|
+
2022,
|
|
32
|
+
2023,
|
|
33
|
+
2024,
|
|
34
|
+
2025,
|
|
35
|
+
]
|
|
16
36
|
# There is no Rudolphtabelle for 2021. 2021 bases on times swam 2019 too.
|
|
17
|
-
self._rudolph_season_base =
|
|
18
|
-
|
|
19
|
-
self._supported_fina_seasons = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
self._rudolph_season_base = 2025 # rudolph_season_base bases on times swam the season before
|
|
38
|
+
|
|
39
|
+
self._supported_fina_seasons = {
|
|
40
|
+
"SCM": [
|
|
41
|
+
2008,
|
|
42
|
+
2009,
|
|
43
|
+
2010,
|
|
44
|
+
2011,
|
|
45
|
+
2012,
|
|
46
|
+
2013,
|
|
47
|
+
2014,
|
|
48
|
+
2015,
|
|
49
|
+
2016,
|
|
50
|
+
2017,
|
|
51
|
+
2018,
|
|
52
|
+
2019,
|
|
53
|
+
2020,
|
|
54
|
+
2021,
|
|
55
|
+
2022,
|
|
56
|
+
2023,
|
|
57
|
+
2025,
|
|
58
|
+
],
|
|
59
|
+
"LCM": [
|
|
60
|
+
2008,
|
|
61
|
+
2009,
|
|
62
|
+
2010,
|
|
63
|
+
2011,
|
|
64
|
+
2012,
|
|
65
|
+
2013,
|
|
66
|
+
2014,
|
|
67
|
+
2015,
|
|
68
|
+
2016,
|
|
69
|
+
2017,
|
|
70
|
+
2018,
|
|
71
|
+
2019,
|
|
72
|
+
2020,
|
|
73
|
+
2021,
|
|
74
|
+
2022,
|
|
75
|
+
2023,
|
|
76
|
+
2024,
|
|
77
|
+
2025,
|
|
78
|
+
],
|
|
79
|
+
}
|
|
80
|
+
self._fina_season_base = {
|
|
81
|
+
"SCM": 2025, # Validity Period: 1.9.YYYY-31.8.YYYY+1
|
|
82
|
+
"LCM": 2025,
|
|
83
|
+
} # Validity Period: 1.1.XXXX-31.12.XXXX
|
|
84
|
+
self._fina_base_table_path = os.path.join(os.path.dirname(__file__), "fina_base_times.pkl")
|
|
85
|
+
self._rudolph_punkttabelle_path = os.path.join(os.path.dirname(__file__), "rudolph_punkttabelle.pkl")
|
|
26
86
|
self._dict_style_styleid = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
87
|
+
"50m Freestyle": "Style-1",
|
|
88
|
+
"100m Freestyle": "Style-2",
|
|
89
|
+
"200m Freestyle": "Style-3",
|
|
90
|
+
"400m Freestyle": "Style-5",
|
|
91
|
+
"800m Freestyle": "Style-6",
|
|
92
|
+
"1500m Freestyle": "Style-8",
|
|
93
|
+
"50m Backstroke": "Style-9",
|
|
94
|
+
"100m Backstroke": "Style-10",
|
|
95
|
+
"200m Backstroke": "Style-11",
|
|
96
|
+
"50m Breaststroke": "Style-12",
|
|
97
|
+
"100m Breaststroke": "Style-13",
|
|
98
|
+
"200m Breaststroke": "Style-14",
|
|
99
|
+
"50m Butterfly": "Style-15",
|
|
100
|
+
"100m Butterfly": "Style-16",
|
|
101
|
+
"200m Butterfly": "Style-17",
|
|
102
|
+
"200m Medley": "Style-18",
|
|
103
|
+
"400m Medley": "Style-19",
|
|
104
|
+
"100m Medley": "Style-20",
|
|
105
|
+
}
|
|
45
106
|
|
|
46
107
|
# dictionary concerning the syle vs. styleid relation
|
|
47
108
|
self._dict_styleid_style = {v: k for k, v in self._dict_style_styleid.items()}
|
|
48
109
|
|
|
49
110
|
# Rudolph functionality
|
|
50
|
-
logger.debug(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
self.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
111
|
+
logger.debug("Initialize rudolph functionality")
|
|
112
|
+
with open(self._rudolph_punkttabelle_path, "rb") as handle:
|
|
113
|
+
self._rudolph_punkttablle = pickle.load(handle)
|
|
114
|
+
self._dict_style_rudolphcolumn = {
|
|
115
|
+
"50m Freestyle": 0,
|
|
116
|
+
"100m Freestyle": 1,
|
|
117
|
+
"200m Freestyle": 2,
|
|
118
|
+
"400m Freestyle": 3,
|
|
119
|
+
"800m Freestyle": 4,
|
|
120
|
+
"1500m Freestyle": 5,
|
|
121
|
+
"50m Breaststroke": 6,
|
|
122
|
+
"100m Breaststroke": 7,
|
|
123
|
+
"200m Breaststroke": 8,
|
|
124
|
+
"50m Butterfly": 9,
|
|
125
|
+
"100m Butterfly": 10,
|
|
126
|
+
"200m Butterfly": 11,
|
|
127
|
+
"50m Backstroke": 12,
|
|
128
|
+
"100m Backstroke": 13,
|
|
129
|
+
"200m Backstroke": 14,
|
|
130
|
+
"200m Medley": 15,
|
|
131
|
+
"400m Medley": 16,
|
|
132
|
+
}
|
|
65
133
|
|
|
66
|
-
|
|
134
|
+
# Fina functionality
|
|
135
|
+
logger.debug("Initialize fina functionality")
|
|
136
|
+
with open(self._fina_base_table_path, "rb") as handle:
|
|
67
137
|
self._finabasetimes = pickle.load(handle)
|
|
68
138
|
|
|
69
139
|
def get_rudolphpts_from_seconds(self, gender, style, agegroup, seconds, season_base=None):
|
|
@@ -92,23 +162,19 @@ class SsConverter:
|
|
|
92
162
|
seconds.append(tmp)
|
|
93
163
|
seconds_type_list = False
|
|
94
164
|
|
|
95
|
-
if gender ==
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
ageoffset = 20 * 12 + 1
|
|
165
|
+
if gender == "M":
|
|
166
|
+
ageoffset = 0
|
|
167
|
+
elif gender == "F":
|
|
168
|
+
ageoffset = 20 * 12
|
|
100
169
|
else:
|
|
101
|
-
raise ValueError(
|
|
170
|
+
raise ValueError("unsupported gender: %s" % gender)
|
|
102
171
|
|
|
103
172
|
if style not in self._dict_style_rudolphcolumn:
|
|
104
173
|
raise ValueError('unsupported style for rudolphpoints: "%s"' % style)
|
|
105
|
-
|
|
106
|
-
col = self._xl_sheet[season_base].col(self._dict_style_rudolphcolumn[style])
|
|
107
|
-
except KeyError as e:
|
|
108
|
-
raise type(e)(type(e)('"%s" - unknown style in rudolph_points_table.xls' % e)).with_traceback(sys.exc_info()[2])
|
|
174
|
+
style_idx = self._dict_style_rudolphcolumn[style]
|
|
109
175
|
|
|
110
176
|
if season_base not in self._supported_rudolph_seasons:
|
|
111
|
-
raise ValueError(
|
|
177
|
+
raise ValueError("unsupported season: %s" % season_base)
|
|
112
178
|
|
|
113
179
|
if agegroup < 8:
|
|
114
180
|
agegroup = 8
|
|
@@ -121,18 +187,19 @@ class SsConverter:
|
|
|
121
187
|
match = False
|
|
122
188
|
for ptsIdx in range(0, 20):
|
|
123
189
|
idx = ageoffset + (agegroup - 8) * 20 + ptsIdx
|
|
124
|
-
|
|
125
|
-
curtime =
|
|
190
|
+
|
|
191
|
+
curtime = self._rudolph_punkttablle[str(season_base)][idx][style_idx]
|
|
126
192
|
if curtime > sec:
|
|
127
193
|
if ptsIdx == 0:
|
|
128
194
|
return 20
|
|
129
195
|
y1 = (20 - ptsIdx) - 1
|
|
130
|
-
y2 =
|
|
196
|
+
y2 = 20 - ptsIdx
|
|
131
197
|
x1 = curtime
|
|
132
198
|
x2 = prevtime
|
|
133
199
|
x = sec
|
|
134
|
-
currudolphpts = round(
|
|
135
|
-
|
|
200
|
+
currudolphpts = round(
|
|
201
|
+
(y2 - y1) / (x2 - x1) * (x - x1) + y1 + 1, 1
|
|
202
|
+
) # linear interpolation between rudolph points
|
|
136
203
|
rudolphpts.append(currudolphpts)
|
|
137
204
|
match = True
|
|
138
205
|
break
|
|
@@ -172,25 +239,22 @@ class SsConverter:
|
|
|
172
239
|
rudolphpts_type_list = False
|
|
173
240
|
|
|
174
241
|
if max(rudolphpts) > 20 or min(rudolphpts) < 1:
|
|
175
|
-
raise ValueError(
|
|
242
|
+
raise ValueError("Rudolphpts must be between 1:20: %s" % rudolphpts)
|
|
176
243
|
|
|
177
|
-
if gender ==
|
|
244
|
+
if gender == "M":
|
|
178
245
|
# 1 because of header
|
|
179
|
-
ageoffset =
|
|
180
|
-
elif gender ==
|
|
181
|
-
ageoffset = 20 * 12
|
|
246
|
+
ageoffset = 0
|
|
247
|
+
elif gender == "F":
|
|
248
|
+
ageoffset = 20 * 12
|
|
182
249
|
else:
|
|
183
|
-
raise ValueError(
|
|
250
|
+
raise ValueError("unsupported gender: %s" % gender)
|
|
184
251
|
|
|
185
252
|
if style not in self._dict_style_rudolphcolumn:
|
|
186
253
|
raise ValueError('unsupported style: "%s"' % style)
|
|
187
|
-
|
|
188
|
-
col = self._xl_sheet[season_base].col(self._dict_style_rudolphcolumn[style])
|
|
189
|
-
except KeyError as e:
|
|
190
|
-
raise type(e)(type(e)('"%s" - unknown style in rudolph_points_table.xls' % e)).with_traceback(sys.exc_info()[2])
|
|
254
|
+
style_idx = self._dict_style_rudolphcolumn[style]
|
|
191
255
|
|
|
192
256
|
if season_base not in self._supported_rudolph_seasons:
|
|
193
|
-
raise ValueError(
|
|
257
|
+
raise ValueError("unsupported season: %s" % season_base)
|
|
194
258
|
|
|
195
259
|
if agegroup < 8:
|
|
196
260
|
agegroup = 8
|
|
@@ -201,11 +265,8 @@ class SsConverter:
|
|
|
201
265
|
|
|
202
266
|
for rudolphpt in rudolphpts:
|
|
203
267
|
idx = ageoffset + (agegroup - 8) * 20 + (20 - int(rudolphpt))
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
d = datetime.strptime(col[idx - 1].value, '%M:%S,%f')
|
|
207
|
-
t_top = d.minute * 60 + d.second + d.microsecond / 10 ** 6.
|
|
208
|
-
|
|
268
|
+
t_bottom = self._rudolph_punkttablle[str(season_base)][idx][style_idx]
|
|
269
|
+
t_top = self._rudolph_punkttablle[str(season_base)][idx - 1][style_idx]
|
|
209
270
|
seconds.append((t_top - t_bottom) * (rudolphpt - int(rudolphpt)) + t_bottom)
|
|
210
271
|
|
|
211
272
|
if not rudolphpts_type_list:
|
|
@@ -229,18 +290,18 @@ class SsConverter:
|
|
|
229
290
|
:type: int or List[int]
|
|
230
291
|
"""
|
|
231
292
|
|
|
232
|
-
if not ((gender ==
|
|
233
|
-
raise ValueError(
|
|
293
|
+
if not ((gender == "M") or (gender == "F")):
|
|
294
|
+
raise ValueError("unknown gender: %s" % gender)
|
|
234
295
|
|
|
235
|
-
if not ((course ==
|
|
236
|
-
raise ValueError(
|
|
296
|
+
if not ((course == "SCM") or (course == "LCM")):
|
|
297
|
+
raise ValueError("unknown course: %s" % course)
|
|
237
298
|
|
|
238
299
|
if not season_base:
|
|
239
300
|
season_base = self._fina_season_base[course]
|
|
240
301
|
season_base = int(season_base)
|
|
241
302
|
|
|
242
303
|
if season_base not in self._supported_fina_seasons[course]:
|
|
243
|
-
raise ValueError(
|
|
304
|
+
raise ValueError("unsupported season: %s" % season_base)
|
|
244
305
|
|
|
245
306
|
seconds_type_list = True
|
|
246
307
|
if not isinstance(seconds, list):
|
|
@@ -253,10 +314,12 @@ class SsConverter:
|
|
|
253
314
|
basetime = self._finabasetimes[season_base][style][gender][course]
|
|
254
315
|
|
|
255
316
|
if not basetime:
|
|
256
|
-
raise ValueError(
|
|
317
|
+
raise ValueError(
|
|
318
|
+
'BaseTime could not be found with arguments "%s, %s, %s, %s"' % (season_base, course, gender, style)
|
|
319
|
+
)
|
|
257
320
|
|
|
258
321
|
for sec in seconds:
|
|
259
|
-
finapts.append(
|
|
322
|
+
finapts.append(int(1000 * (basetime / sec) ** 3))
|
|
260
323
|
|
|
261
324
|
if not seconds_type_list:
|
|
262
325
|
return finapts[0]
|
|
@@ -278,15 +341,15 @@ class SsConverter:
|
|
|
278
341
|
:type: frac or List[frac]
|
|
279
342
|
"""
|
|
280
343
|
|
|
281
|
-
if not ((gender ==
|
|
282
|
-
raise ValueError(
|
|
283
|
-
if not ((course ==
|
|
284
|
-
raise ValueError(
|
|
344
|
+
if not ((gender == "M") or (gender == "F")):
|
|
345
|
+
raise ValueError("unknown gender: %s" % gender)
|
|
346
|
+
if not ((course == "SCM") or (course == "LCM")):
|
|
347
|
+
raise ValueError("unknown course: %s" % course)
|
|
285
348
|
if not season_base:
|
|
286
349
|
season_base = self._fina_season_base[course]
|
|
287
350
|
season_base = int(season_base)
|
|
288
351
|
if season_base not in self._supported_fina_seasons[course]:
|
|
289
|
-
raise ValueError(
|
|
352
|
+
raise ValueError("unsupported season: %s" % season_base)
|
|
290
353
|
|
|
291
354
|
finapts_type_list = True
|
|
292
355
|
if not isinstance(finapts, list):
|
|
@@ -299,7 +362,9 @@ class SsConverter:
|
|
|
299
362
|
basetime = self._finabasetimes[season_base][style][gender][course]
|
|
300
363
|
|
|
301
364
|
if not basetime:
|
|
302
|
-
raise ValueError(
|
|
365
|
+
raise ValueError(
|
|
366
|
+
'BaseTime could not be found with arguments "%s, %s, %s, %s"' % (course, gender, style, seconds)
|
|
367
|
+
)
|
|
303
368
|
|
|
304
369
|
for fina in finapts:
|
|
305
370
|
seconds.append(round(1.0 / ((fina / 1000.0) ** (1 / 3.0) / basetime), 2))
|
|
@@ -328,10 +393,10 @@ class SsConverter:
|
|
|
328
393
|
return list(self._dict_styleid_style.values())
|
|
329
394
|
|
|
330
395
|
def get_fina_validity_period(self, course):
|
|
331
|
-
if course ==
|
|
332
|
-
return
|
|
333
|
-
elif course ==
|
|
334
|
-
return
|
|
396
|
+
if course == "SCM":
|
|
397
|
+
return "1. Sept. %s - 31. Aug. %s" % (self._fina_season_base[course], self._fina_season_base[course] + 1)
|
|
398
|
+
elif course == "LCM":
|
|
399
|
+
return "1. Jan. %s - 31. Dec. %s" % (self._fina_season_base[course], self._fina_season_base[course])
|
|
335
400
|
return None
|
|
336
401
|
|
|
337
402
|
def get_fina_season_base(self, course):
|
|
@@ -342,51 +407,51 @@ class SsConverter:
|
|
|
342
407
|
|
|
343
408
|
def set_fina_season_base(self, course, season):
|
|
344
409
|
if season not in self._supported_fina_seasons[course]:
|
|
345
|
-
raise ValueError(
|
|
410
|
+
raise ValueError("unsupported season: %s" % season)
|
|
346
411
|
self._fina_season_base[course] = season
|
|
347
412
|
|
|
348
413
|
def set_rudolph_season_base(self, season):
|
|
349
414
|
if season not in self._supported_rudolph_seasons:
|
|
350
|
-
raise ValueError(
|
|
415
|
+
raise ValueError("unsupported season: %s" % season)
|
|
351
416
|
self._rudolph_season_base = season
|
|
352
417
|
|
|
353
418
|
@staticmethod
|
|
354
419
|
def get_agegroup_json_from_agegroup_url(agegroup_url):
|
|
355
|
-
strlist = agegroup_url.split(
|
|
356
|
-
if strlist[0] ==
|
|
357
|
-
return
|
|
420
|
+
strlist = agegroup_url.split("_")
|
|
421
|
+
if strlist[0] == "x" and strlist[0] == "x":
|
|
422
|
+
return "Open"
|
|
358
423
|
if strlist[0] == strlist[1]:
|
|
359
424
|
return strlist[0]
|
|
360
|
-
raise ValueError(
|
|
425
|
+
raise ValueError("not convertable %s" % agegroup_url)
|
|
361
426
|
|
|
362
427
|
@staticmethod
|
|
363
428
|
def get_agegroup_str_from_agegroup_url(agegroup_url):
|
|
364
|
-
selected_athletes_places = agegroup_url.split(
|
|
365
|
-
agegroup_str = agegroup_url.replace(
|
|
429
|
+
selected_athletes_places = agegroup_url.split("_")
|
|
430
|
+
agegroup_str = agegroup_url.replace("_", "-") + "y"
|
|
366
431
|
if len(selected_athletes_places) == 2:
|
|
367
432
|
if selected_athletes_places[0] == selected_athletes_places[1]:
|
|
368
|
-
if selected_athletes_places[0] ==
|
|
369
|
-
agegroup_str =
|
|
433
|
+
if selected_athletes_places[0] == "x":
|
|
434
|
+
agegroup_str = "open"
|
|
370
435
|
else:
|
|
371
|
-
agegroup_str = selected_athletes_places[0] +
|
|
372
|
-
if selected_athletes_places[1] !=
|
|
373
|
-
agegroup_str +=
|
|
374
|
-
return agegroup_str.replace(
|
|
436
|
+
agegroup_str = selected_athletes_places[0] + "y"
|
|
437
|
+
if selected_athletes_places[1] != "x" and int(selected_athletes_places[1]) > 20:
|
|
438
|
+
agegroup_str += " Masters"
|
|
439
|
+
return agegroup_str.replace("x", "")
|
|
375
440
|
|
|
376
441
|
@staticmethod
|
|
377
442
|
def get_agegroup_url_from_agegroup_json(agegroup_json):
|
|
378
|
-
strlist = agegroup_json.split(
|
|
443
|
+
strlist = agegroup_json.split("-")
|
|
379
444
|
for idx in list(range(len(strlist))):
|
|
380
445
|
strlist[idx] = strlist[idx].strip()
|
|
381
|
-
if strlist[idx] ==
|
|
382
|
-
strlist[idx] =
|
|
446
|
+
if strlist[idx] == "":
|
|
447
|
+
strlist[idx] = "x"
|
|
383
448
|
|
|
384
449
|
if len(strlist) > 1:
|
|
385
|
-
return
|
|
386
|
-
if strlist[0] ==
|
|
387
|
-
return
|
|
450
|
+
return "%s_%s" % (strlist[0], strlist[1])
|
|
451
|
+
if strlist[0] == "Open":
|
|
452
|
+
return "x_x"
|
|
388
453
|
|
|
389
|
-
return
|
|
454
|
+
return "%s_%s" % (strlist[0], strlist[0])
|
|
390
455
|
|
|
391
456
|
@staticmethod
|
|
392
457
|
def get_year_fraction_from_datetime(date_in):
|
|
@@ -413,40 +478,70 @@ class SsConverter:
|
|
|
413
478
|
:return: seconds
|
|
414
479
|
"""
|
|
415
480
|
if not isinstance(swimtime, list):
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
481
|
+
parts = swimtime.split(":") # Split by colon to check the format
|
|
482
|
+
if len(parts) == 1: # Format: %S.%f
|
|
483
|
+
seconds = float(parts[0])
|
|
484
|
+
elif len(parts) == 2: # Format: %M:%S.%f
|
|
485
|
+
minutes, seconds = map(float, parts)
|
|
486
|
+
seconds += minutes * 60
|
|
487
|
+
elif len(parts) == 3: # Format: %H:%M:%S.%f
|
|
488
|
+
hours, minutes, seconds = map(float, parts)
|
|
489
|
+
seconds += minutes * 60 + hours * 3600
|
|
490
|
+
else:
|
|
491
|
+
raise ValueError("Invalid time format")
|
|
492
|
+
return seconds
|
|
424
493
|
else:
|
|
425
494
|
swimtimes_sec = list()
|
|
426
495
|
for entry in swimtime:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
496
|
+
parts = entry.split(":") # Split by colon to check the format
|
|
497
|
+
if len(parts) == 1: # Format: %S.%f
|
|
498
|
+
seconds = float(parts[0])
|
|
499
|
+
elif len(parts) == 2: # Format: %M:%S.%f
|
|
500
|
+
minutes, seconds = map(float, parts)
|
|
501
|
+
seconds += minutes * 60
|
|
502
|
+
elif len(parts) == 3: # Format: %H:%M:%S.%f
|
|
503
|
+
hours, minutes, seconds = map(float, parts)
|
|
504
|
+
seconds += minutes * 60 + hours * 3600
|
|
505
|
+
else:
|
|
506
|
+
raise ValueError("Invalid time format")
|
|
507
|
+
swimtimes_sec.append(seconds)
|
|
435
508
|
return swimtimes_sec
|
|
436
509
|
|
|
437
510
|
|
|
438
511
|
ssconv = SsConverter()
|
|
439
512
|
|
|
440
|
-
if __name__ ==
|
|
441
|
-
|
|
442
|
-
print(ssconv.
|
|
443
|
-
|
|
444
|
-
print(ssconv.get_rudolphpts_from_seconds(
|
|
445
|
-
print(ssconv.
|
|
446
|
-
|
|
513
|
+
if __name__ == "__main__":
|
|
514
|
+
ssconv = SsConverter()
|
|
515
|
+
print(ssconv.get_seconds_from_swimtime("1:23.45"))
|
|
516
|
+
|
|
517
|
+
# print(ssconv.get_rudolphpts_from_seconds("F", "50m Butterfly", 5, 26.15, 2016))
|
|
518
|
+
# print(ssconv.get_seconds_from_rudolphpts("F", "50m Butterfly", 5, 20, 2016))
|
|
519
|
+
|
|
520
|
+
print(ssconv.get_rudolphpts_from_seconds("M", "50m Freestyle", 16, 24.73, 2024))
|
|
521
|
+
print(ssconv.get_seconds_from_rudolphpts("M", "50m Freestyle", 16, 13.9, 2024))
|
|
522
|
+
|
|
523
|
+
# print(ssconv.get_rudolphpts_from_seconds("M", "200m Freestyle", 13, 134.41, 2024))
|
|
524
|
+
# print(ssconv.get_seconds_from_rudolphpts("M", "200m Freestyle", 13, 10, 2024))
|
|
525
|
+
|
|
526
|
+
print(ssconv.get_finapts_from_seconds("LCM", "M", "1500m Freestyle", 16 * 60 + 45.63, 2024))
|
|
527
|
+
print(ssconv.get_seconds_from_finapts("LCM", "M", "1500m Freestyle", 649, 2024))
|
|
528
|
+
|
|
529
|
+
print(ssconv.get_finapts_from_seconds("LCM", "M", "1500m Freestyle", 14 * 60 + 30.67, 2025))
|
|
530
|
+
print(ssconv.get_seconds_from_finapts("LCM", "M", "1500m Freestyle", 1000, 2025))
|
|
531
|
+
|
|
532
|
+
print(ssconv.get_finapts_from_seconds("LCM", "M", "1500m Freestyle", 21 * 60 + 40.60, 2025))
|
|
533
|
+
print(ssconv.get_seconds_from_finapts("LCM", "M", "1500m Freestyle", 300, 2025))
|
|
534
|
+
|
|
535
|
+
print(ssconv.get_rudolphpts_from_seconds("M", "50m Backstroke", 16, 26.54, 2025))
|
|
536
|
+
|
|
537
|
+
# print(ssconv.get_finapts_from_seconds("LCM", "M", "50m Freestyle", [23.96], 2009))
|
|
538
|
+
# print(ssconv.get_finapts_from_seconds("LCM", "M", "100m Breaststroke", [56.88]))
|
|
539
|
+
# print(ssconv.get_rudolphpts_from_seconds("F", "200m Backstroke", 9, [203.87], 2024))
|
|
540
|
+
# print(ssconv.get_seconds_from_finapts("LCM", "M", "100m Freestyle", 900))
|
|
541
|
+
# print(ssconv.get_finapts_from_seconds("SCM", "M", "50m Freestyle", [20.24], 2020))
|
|
447
542
|
|
|
448
|
-
print(ssconv.get_finapts_from_seconds(
|
|
543
|
+
# print(ssconv.get_finapts_from_seconds("LCM", "F", "200m Freestyle", 112.98))
|
|
449
544
|
|
|
450
|
-
ssconv.set_fina_season_base(
|
|
451
|
-
ssconv.set_fina_season_base(
|
|
452
|
-
ssconv.set_rudolph_season_base(2024)
|
|
545
|
+
# ssconv.set_fina_season_base("SCM", 2024)
|
|
546
|
+
# ssconv.set_fina_season_base("LCM", 2024)
|
|
547
|
+
# ssconv.set_rudolph_season_base(2024)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sstools
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.8
|
|
4
4
|
Summary: swimstats tools
|
|
5
5
|
Home-page: https://swimstats.net
|
|
6
6
|
Author: Roman Arnet
|
|
@@ -10,9 +10,14 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Requires-Python: >=3.6
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: xlrd
|
|
14
13
|
|
|
15
14
|
# sstools - Swimstats Tools
|
|
15
|
+
0.2.8
|
|
16
|
+
- Add season 2025 FINA SCM
|
|
17
|
+
|
|
18
|
+
0.2.7
|
|
19
|
+
- Trunc FINA calculation
|
|
20
|
+
- Add Rudolph-Punkttabelle 2025
|
|
16
21
|
|
|
17
22
|
0.2.6
|
|
18
23
|
- Fix available styles
|
|
@@ -3,12 +3,11 @@ README.md
|
|
|
3
3
|
setup.py
|
|
4
4
|
sstools/__init__.py
|
|
5
5
|
sstools/fina_base_times.pkl
|
|
6
|
-
sstools/
|
|
6
|
+
sstools/rudolph_punkttabelle.pkl
|
|
7
7
|
sstools/ssconv.py
|
|
8
8
|
sstools.egg-info/PKG-INFO
|
|
9
9
|
sstools.egg-info/SOURCES.txt
|
|
10
10
|
sstools.egg-info/dependency_links.txt
|
|
11
|
-
sstools.egg-info/requires.txt
|
|
12
11
|
sstools.egg-info/top_level.txt
|
|
13
12
|
tests/__init__.py
|
|
14
13
|
tests/test_ssconv.py
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import logging.config
|
|
2
|
+
import unittest
|
|
3
|
+
|
|
4
|
+
from sstools.ssconv import ssconv
|
|
5
|
+
|
|
6
|
+
logging.config.dictConfig({
|
|
7
|
+
'version': 1,
|
|
8
|
+
'disable_existing_loggers': False,
|
|
9
|
+
'formatters': {
|
|
10
|
+
'default': {
|
|
11
|
+
'format': '%(asctime)s %(name)-30s %(levelname)-8s %(message)s',
|
|
12
|
+
'()': 'multiline_formatter.formatter.MultilineMessagesFormatter',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
'handlers': {
|
|
16
|
+
'console': {
|
|
17
|
+
'level': 'INFO',
|
|
18
|
+
'class': 'logging.StreamHandler',
|
|
19
|
+
'formatter': 'default',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
'loggers': {
|
|
23
|
+
# '' root logger
|
|
24
|
+
'': {
|
|
25
|
+
'level': 'DEBUG',
|
|
26
|
+
'handlers': ['console'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
logger = logging.getLogger()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class ConverterTest(unittest.TestCase):
|
|
37
|
+
# Conversion is verified with the FINA Points Calculator 6.47605
|
|
38
|
+
@classmethod
|
|
39
|
+
def setUpClass(cls):
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
# preparing to test
|
|
43
|
+
def setUp(self):
|
|
44
|
+
""" Setting up for the test """
|
|
45
|
+
|
|
46
|
+
def tearDown(self):
|
|
47
|
+
"""Cleaning up after the test"""
|
|
48
|
+
|
|
49
|
+
def test_finapts(self):
|
|
50
|
+
finapts_refs = [1, 999, 1000, 1001]
|
|
51
|
+
available_styles = ssconv.get_available_styles()
|
|
52
|
+
genders = ['M', 'F']
|
|
53
|
+
courses = ['SCM', 'LCM']
|
|
54
|
+
for finapts_ref in finapts_refs:
|
|
55
|
+
for style in available_styles:
|
|
56
|
+
for gender in genders:
|
|
57
|
+
for course in courses:
|
|
58
|
+
if style != '100m Medley' and course != 'LCM':
|
|
59
|
+
swimtime = ssconv.get_seconds_from_finapts(course, gender, style, finapts_ref)
|
|
60
|
+
finapts = ssconv.get_finapts_from_seconds(course, gender, style, swimtime)
|
|
61
|
+
self.assertAlmostEqual(finapts_ref, finapts, delta=1)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_get_rudolphpts_from_seconds(self):
|
|
65
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 9, 20), 20)
|
|
66
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 9, [76.07, 75, 74], 2024), [14.9, 15.9, 16.8])
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# # https://www.swimrankings.net/index.php?page=athleteDetail&athleteId=4605725&pbest=2013
|
|
70
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 8, 106.65, 2024), 0)
|
|
71
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 9, 76.07, 2024), 14.9)
|
|
72
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 10, 66.99, 2024), 18.7)
|
|
73
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 11, 61.2, 2024), 18.9)
|
|
74
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 12, 57.16, 2024), 18.9)
|
|
75
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 13, 55.56, 2024), 17.4)
|
|
76
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 14, 52.67, 2024), 18.6)
|
|
77
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 15, 50.9, 2024), 19.1)
|
|
78
|
+
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 16, 50.68, 2024), 18.5)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_get_seconds_from_rudolphpts(self):
|
|
82
|
+
self.assertEqual(ssconv.get_seconds_from_rudolphpts('M', '100m Freestyle', 9, [15.3, 16.2, 17.2], 2024), [75.633, 74.652, 73.562])
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if __name__ == '__main__':
|
|
86
|
+
suite = unittest.TestLoader().loadTestsFromTestCase(ConverterTest)
|
|
87
|
+
unittest.TextTestRunner(verbosity=2).run(suite)
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
xlrd
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import logging.config
|
|
2
|
-
import unittest
|
|
3
|
-
|
|
4
|
-
from sstools.ssconv import ssconv
|
|
5
|
-
|
|
6
|
-
logging.config.dictConfig({
|
|
7
|
-
'version': 1,
|
|
8
|
-
'disable_existing_loggers': False,
|
|
9
|
-
'formatters': {
|
|
10
|
-
'default': {
|
|
11
|
-
'format': '%(asctime)s %(name)-30s %(levelname)-8s %(message)s',
|
|
12
|
-
'()': 'multiline_formatter.formatter.MultilineMessagesFormatter',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
'handlers': {
|
|
16
|
-
'console': {
|
|
17
|
-
'level': 'INFO',
|
|
18
|
-
'class': 'logging.StreamHandler',
|
|
19
|
-
'formatter': 'default',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
'loggers': {
|
|
23
|
-
# '' root logger
|
|
24
|
-
'': {
|
|
25
|
-
'level': 'DEBUG',
|
|
26
|
-
'handlers': ['console'],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
logger = logging.getLogger()
|
|
32
|
-
# Freestyle Backstroke Breaststroke Butterfly Medley
|
|
33
|
-
# 50 100 200 400 800 1500 50 100 200 50 100 200 50 100 200 100 200 400
|
|
34
|
-
m_lcm_fina_1000_2023 = ['20.91', '46.86', '01:42.00', '03:40.07', '07:32.12', '14:31.02', '23.71', '51.60', '01:51.92', '25.95', '56.88', '02:05.95', '22.27', '49.45', '01:50.34', '01:54.0', '04:03.84']
|
|
35
|
-
f_lcm_fina_1000_2023 = ['23.67', '51.71', '01:52.98', '03:56.40', '08:04.79', '15:20.48', '26.98', '57.45', '02:03.35', '29.30', '01:04.13', '02:18.95', '24.43', '55.48', '02:01.81', '02:06.12', '04:26.36']
|
|
36
|
-
m_scm_fina_1000_2023 = ['20.16', '44.84', '01:39.37', '03:32.25', '07:23.42', '14:06.88', '22.11', '48.33', '01:45.63', '24.95', '55.28', '02:00.16', '21.75', '47.78', '01:46.85', '49.28', '01:49.63', '03:54.81']
|
|
37
|
-
f_scm_fina_1000_2023 = ['22.93', '50.25', '01:50.31', '03:51.30', '07:57.42', '15:08.24', '25.25', '54.89', '01:58.94', '28.37', '01:02.36', '02:14.57', '24.38', '54.05', '01:59.61', '56.51', '02:01.86', '04:18.94']
|
|
38
|
-
|
|
39
|
-
m_lcm_fina_1000_2022 = ['20.91', '46.91', '01:42.00', '03:40.07', '07:32.12', '14:31.02', '23.8', '51.85', '01:51.92', '25.95', '56.88', '02:06.12', '22.27', '49.45', '01:50.73', '01:54.0', '04:03.84']
|
|
40
|
-
f_lcm_fina_1000_2022 = ['23.67', '51.71', '01:52.98', '03:56.46', '08:04.79', '15:20.48', '26.98', '57.45', '02:03.35', '29.30', '01:04.13', '02:18.95', '24.43', '55.48', '02:01.81', '02:06.12', '04:26.36']
|
|
41
|
-
m_scm_fina_1000_2022 = ['20.16', '44.84', '01:39.37', '03:32.25', '07:23.42', '14:06.88', '22.22', '48.33', '01:45.63', '24.95', '55.28', '02:00.16', '21.75', '47.78', '01:48.24', '49.28', '01:49.63', '03:54.81']
|
|
42
|
-
f_scm_fina_1000_2022 = ['22.93', '50.25', '01:50.31', '03:53.92', '07:59.34', '15:18.01', '25.27', '54.89', '01:58.94', '28.56', '01:02.36', '02:14.57', '24.38', '54.59', '01:59.61', '56.51', '02:01.86', '04:18.94']
|
|
43
|
-
|
|
44
|
-
m_lcm_fina_1000_2021 = ['20.91', '46.91', '01:42.00', '03:40.07', '07:32.12', '14:31.02', '24.0', '51.85', '01:51.92', '25.95', '56.88', '02:06.12', '22.27', '49.5', '01:50.73', '01:54.0', '04:03.84']
|
|
45
|
-
m_scm_fina_1000_2021 = ['20.16', '44.94', '01:39.37', '03:32.25', '07:23.42', '14:08.06', '22.22', '48.33', '01:45.63', '25.25', '55.34', '02:00.16', '21.75', '47.78', '01:48.24', '49.28', '01:49.63', '03:54.81']
|
|
46
|
-
f_lcm_fina_1000_2021 = ['23.67', '51.71', '01:52.98', '03:56.46', '08:04.79', '15:20.48', '26.98', '57.57', '02:03.35', '29.40', '01:04.13', '02:19.11', '24.43', '55.48', '02:01.81', '02:06.12', '04:26.36']
|
|
47
|
-
f_scm_fina_1000_2021 = ['22.93', '50.25', '01:50.43', '03:53.92', '07:59.34', '15:18.01', '25.60', '54.89', '01:58.94', '28.56', '01:02.36', '02:14.57', '24.38', '54.61', '01:59.61', '56.51', '02:01.86', '04:18.94']
|
|
48
|
-
|
|
49
|
-
m_lcm_fina_1000_2020 = ['20.91', '46.91', '01:42.0', '03:40.07', '07:32.12', '14:31.02', '24.0', '51.85', '01:51.92', '25.95', '56.88', '02:06.12', '22.27', '49.5', '01:50.73', '01:54.0', '04:03.84']
|
|
50
|
-
m_scm_fina_1000_2020 = ['20.24', '44.94', '01:39.37', '03:32.25', '07:23.42', '14:08.06', '22.22', '48.88', '01:45.63', '25.25', '55.61', '02:00.16', '21.75', '48.08', '01:48.24', '50.26', '01:49.63', '03:54.81']
|
|
51
|
-
f_lcm_fina_1000_2020 = ['23.67', '51.71', '01:52.98', '03:56.46', '08:04.79', '15:20.48', '26.98', '57.57', '02:03.35', '29.40', '01:04.13', '02:19.11', '24.43', '55.48', '02:01.81', '02:06.12', '04:26.36']
|
|
52
|
-
f_scm_fina_1000_2020 = ['22.93', '50.25', '01:50.43', '03:53.92', '07:59.34', '15:18.01', '25.67', '54.89', '01:59.23', '28.56', '01:02.36', '02:14.57', '24.38', '54.61', '01:59.61', '56.51', '02:01.86', '04:18.94']
|
|
53
|
-
|
|
54
|
-
m_lcm_fina = ssconv.get_seconds_from_swimtime(m_lcm_fina_1000_2023)
|
|
55
|
-
f_lcm_fina = ssconv.get_seconds_from_swimtime(f_lcm_fina_1000_2023)
|
|
56
|
-
|
|
57
|
-
m_scm_fina = ssconv.get_seconds_from_swimtime(m_scm_fina_1000_2023)
|
|
58
|
-
f_scm_fina = ssconv.get_seconds_from_swimtime(f_scm_fina_1000_2023)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class ConverterTest(unittest.TestCase):
|
|
62
|
-
# Conversion is verified with the FINA Points Calculator 6.47605
|
|
63
|
-
@classmethod
|
|
64
|
-
def setUpClass(cls):
|
|
65
|
-
pass
|
|
66
|
-
|
|
67
|
-
# preparing to test
|
|
68
|
-
def setUp(self):
|
|
69
|
-
""" Setting up for the test """
|
|
70
|
-
|
|
71
|
-
def tearDown(self):
|
|
72
|
-
"""Cleaning up after the test"""
|
|
73
|
-
|
|
74
|
-
def test_get_finapts_from_seconds(self):
|
|
75
|
-
# Male
|
|
76
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '50m Freestyle', [m_lcm_fina[0]]), [1000])
|
|
77
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '50m Freestyle', [m_scm_fina[0]]), [1000])
|
|
78
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '100m Freestyle', [m_lcm_fina[1]]), [1000])
|
|
79
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '100m Freestyle', [m_scm_fina[1]]), [1000])
|
|
80
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '200m Freestyle', [m_lcm_fina[2]]), [1000])
|
|
81
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '200m Freestyle', [m_scm_fina[2]]), [1000])
|
|
82
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '400m Freestyle', [m_lcm_fina[3]]), [1000])
|
|
83
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '400m Freestyle', [m_scm_fina[3]]), [1000])
|
|
84
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '800m Freestyle', [m_lcm_fina[4]]), [1000])
|
|
85
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '800m Freestyle', [m_scm_fina[4]]), [1000])
|
|
86
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '1500m Freestyle', [m_lcm_fina[5]]), [1000])
|
|
87
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '1500m Freestyle', [m_scm_fina[5]]), [1000])
|
|
88
|
-
|
|
89
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '50m Backstroke', [m_lcm_fina[6]]), [1000])
|
|
90
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '50m Backstroke', [m_scm_fina[6]]), [1000])
|
|
91
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '100m Backstroke', [m_lcm_fina[7]]), [1000])
|
|
92
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '100m Backstroke', [m_scm_fina[7]]), [1000])
|
|
93
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '200m Backstroke', [m_lcm_fina[8]]), [1000])
|
|
94
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '200m Backstroke', [m_scm_fina[8]]), [1000])
|
|
95
|
-
|
|
96
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '50m Breaststroke', [m_lcm_fina[9]]), [1000])
|
|
97
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '50m Breaststroke', [m_scm_fina[9]]), [1000])
|
|
98
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '100m Breaststroke', [m_lcm_fina[10]]), [1000])
|
|
99
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '100m Breaststroke', [m_scm_fina[10]]), [1000])
|
|
100
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '200m Breaststroke', [m_lcm_fina[11]]), [1000])
|
|
101
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '200m Breaststroke', [m_scm_fina[11]]), [1000])
|
|
102
|
-
|
|
103
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '50m Butterfly', [m_lcm_fina[12]]), [1000])
|
|
104
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '50m Butterfly', [m_scm_fina[12]]), [1000])
|
|
105
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '100m Butterfly', [m_lcm_fina[13]]), [1000])
|
|
106
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '100m Butterfly', [m_scm_fina[13]]), [1000])
|
|
107
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '200m Butterfly', [m_lcm_fina[14]]), [1000])
|
|
108
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '200m Butterfly', [m_scm_fina[14]]), [1000])
|
|
109
|
-
|
|
110
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '100m Medley', [m_scm_fina[15]]), [1000])
|
|
111
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '200m Medley', [m_lcm_fina[15]]), [1000])
|
|
112
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '200m Medley', [m_scm_fina[16]]), [1000])
|
|
113
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'M', '400m Medley', [m_lcm_fina[16]]), [1000])
|
|
114
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'M', '400m Medley', [m_scm_fina[17]]), [1000])
|
|
115
|
-
|
|
116
|
-
# Female
|
|
117
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '50m Freestyle', [f_lcm_fina[0]]), [1000])
|
|
118
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '50m Freestyle', [f_scm_fina[0]]), [1000])
|
|
119
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '100m Freestyle', [f_lcm_fina[1]]), [1000])
|
|
120
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '100m Freestyle', [f_scm_fina[1]]), [1000])
|
|
121
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '200m Freestyle', [f_lcm_fina[2]]), [1000])
|
|
122
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '200m Freestyle', [f_scm_fina[2]]), [1000])
|
|
123
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '400m Freestyle', [f_lcm_fina[3]]), [1000])
|
|
124
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '400m Freestyle', [f_scm_fina[3]]), [1000])
|
|
125
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '800m Freestyle', [f_lcm_fina[4]]), [1000])
|
|
126
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '800m Freestyle', [f_scm_fina[4]]), [1000])
|
|
127
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '1500m Freestyle', [f_lcm_fina[5]]), [1000])
|
|
128
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '1500m Freestyle', [f_scm_fina[5]]), [1000])
|
|
129
|
-
|
|
130
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '50m Backstroke', [f_lcm_fina[6]]), [1000])
|
|
131
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '50m Backstroke', [f_scm_fina[6]]), [1000])
|
|
132
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '100m Backstroke', [f_lcm_fina[7]]), [1000])
|
|
133
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '100m Backstroke', [f_scm_fina[7]]), [1000])
|
|
134
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '200m Backstroke', [f_lcm_fina[8]]), [1000])
|
|
135
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '200m Backstroke', [f_scm_fina[8]]), [1000])
|
|
136
|
-
|
|
137
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '50m Breaststroke', [f_lcm_fina[9]]), [1000])
|
|
138
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '50m Breaststroke', [f_scm_fina[9]]), [1000])
|
|
139
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '100m Breaststroke', [f_lcm_fina[10]]), [1000])
|
|
140
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '100m Breaststroke', [f_scm_fina[10]]), [1000])
|
|
141
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '200m Breaststroke', [f_lcm_fina[11]]), [1000])
|
|
142
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '200m Breaststroke', [f_scm_fina[11]]), [1000])
|
|
143
|
-
|
|
144
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '50m Butterfly', [f_lcm_fina[12]]), [1000])
|
|
145
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '50m Butterfly', [f_scm_fina[12]]), [1000])
|
|
146
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '100m Butterfly', [f_lcm_fina[13]]), [1000])
|
|
147
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '100m Butterfly', [f_scm_fina[13]]), [1000])
|
|
148
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '200m Butterfly', [f_lcm_fina[14]]), [1000])
|
|
149
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '200m Butterfly', [f_scm_fina[14]]), [1000])
|
|
150
|
-
|
|
151
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '100m Medley', [f_scm_fina[15]]), [1000])
|
|
152
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '200m Medley', [f_lcm_fina[15]]), [1000])
|
|
153
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '200m Medley', [f_scm_fina[16]]), [1000])
|
|
154
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('LCM', 'F', '400m Medley', [f_lcm_fina[16]]), [1000])
|
|
155
|
-
self.assertEqual(ssconv.get_finapts_from_seconds('SCM', 'F', '400m Medley', [f_scm_fina[17]]), [1000])
|
|
156
|
-
|
|
157
|
-
# @unittest.skip
|
|
158
|
-
def test_get_seconds_from_finapts(self):
|
|
159
|
-
self.assertEqual(ssconv.get_seconds_from_finapts('SCM', 'M', '100m Freestyle', 1000), 44.84)
|
|
160
|
-
self.assertEqual(ssconv.get_seconds_from_finapts('LCM', 'M', '100m Freestyle', 1000), 46.86)
|
|
161
|
-
self.assertEqual(ssconv.get_seconds_from_finapts('SCM', 'F', '100m Freestyle', 1000), 50.25)
|
|
162
|
-
self.assertEqual(ssconv.get_seconds_from_finapts('LCM', 'F', '100m Freestyle', 1000), 51.71)
|
|
163
|
-
|
|
164
|
-
self.assertEqual(ssconv.get_seconds_from_finapts('SCM', 'M', '100m Butterfly', 1000), 47.78)
|
|
165
|
-
self.assertEqual(ssconv.get_seconds_from_finapts('LCM', 'M', '100m Butterfly', 1000), 49.45)
|
|
166
|
-
self.assertEqual(ssconv.get_seconds_from_finapts('SCM', 'F', '100m Butterfly', 1000), 54.05)
|
|
167
|
-
self.assertEqual(ssconv.get_seconds_from_finapts('LCM', 'F', '100m Butterfly', 1000), 55.48)
|
|
168
|
-
|
|
169
|
-
@unittest.skip
|
|
170
|
-
def test_get_rudolphpts_from_seconds(self):
|
|
171
|
-
print(ssconv.get_rudolphpts_from_seconds('F', '100m Breaststroke', 20, 122.83))
|
|
172
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 9, 20), 20)
|
|
173
|
-
|
|
174
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 9, [76.07, 75, 74]), [14.9, 15.9, 16.8])
|
|
175
|
-
|
|
176
|
-
# https://www.swimrankings.net/index.php?page=athleteDetail&athleteId=4605725&pbest=2013
|
|
177
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 8, 106.65), 0)
|
|
178
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 9, 76.07), 14.9)
|
|
179
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 10, 66.99), 18.9)
|
|
180
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 11, 61.2), 19.4)
|
|
181
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 12, 57.16), 19.4)
|
|
182
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 13, 55.56), 17.9)
|
|
183
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 14, 52.8), 18.9)
|
|
184
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 15, 50.9), 19.4)
|
|
185
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('M', '100m Freestyle', 16, 50.68), 18.8)
|
|
186
|
-
|
|
187
|
-
# https://www.swimrankings.net/index.php?page=athleteDetail&athleteId=4043784&pbest=2009
|
|
188
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('F', '200m Freestyle', 17, 131.62), 11.2)
|
|
189
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('F', '200m Freestyle', 18, 126.16), 14.2)
|
|
190
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('F', '200m Freestyle', 19, 125.46), 13.3)
|
|
191
|
-
self.assertEqual(ssconv.get_rudolphpts_from_seconds('F', '200m Freestyle', 20, 122.83), 14.8)
|
|
192
|
-
|
|
193
|
-
@unittest.skip
|
|
194
|
-
def test_get_seconds_from_rudolphpts(self):
|
|
195
|
-
self.assertEqual(ssconv.get_seconds_from_rudolphpts('M', '100m Freestyle', 9, [15.3, 16.2, 17.2]), [75.633, 74.652, 73.562])
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if __name__ == '__main__':
|
|
199
|
-
suite = unittest.TestLoader().loadTestsFromTestCase(ConverterTest)
|
|
200
|
-
unittest.TextTestRunner(verbosity=2).run(suite)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|