rustat-python-api 0.5.0__tar.gz → 0.5.2__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.
Files changed (18) hide show
  1. {rustat-python-api-0.5.0/rustat_python_api.egg-info → rustat-python-api-0.5.2}/PKG-INFO +16 -4
  2. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/README.md +15 -3
  3. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api/pitch_control.py +7 -6
  4. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2/rustat_python_api.egg-info}/PKG-INFO +16 -4
  5. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/setup.py +1 -1
  6. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/LICENSE +0 -0
  7. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/pyproject.toml +0 -0
  8. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api/__init__.py +0 -0
  9. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api/config.py +0 -0
  10. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api/models_api.py +0 -0
  11. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api/parser.py +0 -0
  12. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api/processing.py +0 -0
  13. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api/urls.py +0 -0
  14. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api.egg-info/SOURCES.txt +0 -0
  15. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api.egg-info/dependency_links.txt +0 -0
  16. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api.egg-info/requires.txt +0 -0
  17. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/rustat_python_api.egg-info/top_level.txt +0 -0
  18. {rustat-python-api-0.5.0 → rustat-python-api-0.5.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rustat-python-api
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: A Python wrapper for RuStat API
5
5
  Home-page: https://github.com/dailydaniel/rustat-python-api
6
6
  Author: Daniel Zholkovsky
@@ -23,7 +23,7 @@ pip install rustat-python-api
23
23
  ```
24
24
  1. Usage:
25
25
  ```python
26
- from rustat_python_api import RuStatParser
26
+ from rustat_python_api import RuStatParser, DynamoLab, PitchControl
27
27
 
28
28
  user = "your_login"
29
29
  password = "your_password"
@@ -39,8 +39,20 @@ keys = list(schedule.keys())
39
39
  match_id = keys[-1]
40
40
 
41
41
  events, subs = parser.get_events(match_id, process=True, return_subs=True)
42
-
43
42
  stats = parser.get_match_stats(match_id)
44
-
45
43
  tracking = parser.get_tracking(match_id)
44
+
45
+ host = "http://localhost:8001/"
46
+ client = DynamoLab(host)
47
+ client.run_model(
48
+ model="xT",
49
+ data=events,
50
+ inplace=True,
51
+ inplace_column=model
52
+ )
53
+
54
+ pc = PitchControl(tracking, events)
55
+ pc.draw_pitch_control(half=1, tp=100, save=True, filename="pitch_control")
56
+ # ffmpeg required for animation
57
+ pc.animate_pitch_control(half=1, tp=100, frames=30, filename="pitch_control")
46
58
  ```
@@ -8,7 +8,7 @@ pip install rustat-python-api
8
8
  ```
9
9
  1. Usage:
10
10
  ```python
11
- from rustat_python_api import RuStatParser
11
+ from rustat_python_api import RuStatParser, DynamoLab, PitchControl
12
12
 
13
13
  user = "your_login"
14
14
  password = "your_password"
@@ -24,8 +24,20 @@ keys = list(schedule.keys())
24
24
  match_id = keys[-1]
25
25
 
26
26
  events, subs = parser.get_events(match_id, process=True, return_subs=True)
27
-
28
27
  stats = parser.get_match_stats(match_id)
29
-
30
28
  tracking = parser.get_tracking(match_id)
29
+
30
+ host = "http://localhost:8001/"
31
+ client = DynamoLab(host)
32
+ client.run_model(
33
+ model="xT",
34
+ data=events,
35
+ inplace=True,
36
+ inplace_column=model
37
+ )
38
+
39
+ pc = PitchControl(tracking, events)
40
+ pc.draw_pitch_control(half=1, tp=100, save=True, filename="pitch_control")
41
+ # ffmpeg required for animation
42
+ pc.animate_pitch_control(half=1, tp=100, frames=30, filename="pitch_control")
31
43
  ```
@@ -45,7 +45,7 @@ class PitchControl:
45
45
 
46
46
  locs_home = {
47
47
  half: {
48
- player_id: self.get_player_data(player_id, half=half)
48
+ player_id: self.get_player_data(player_id, half, tracking)
49
49
  for player_id in tracking[tracking['side_1h'] == 'left']['player_id'].unique()
50
50
  }
51
51
  for half in tracking['half'].unique()
@@ -53,7 +53,7 @@ class PitchControl:
53
53
 
54
54
  locs_away = {
55
55
  half: {
56
- player_id: self.get_player_data(player_id, half=half)
56
+ player_id: self.get_player_data(player_id, half, tracking)
57
57
  for player_id in tracking[tracking['side_1h'] == 'right']['player_id'].unique()
58
58
  }
59
59
  for half in tracking['half'].unique()
@@ -213,7 +213,8 @@ class PitchControl:
213
213
  tp: int,
214
214
  pitch_control: tuple = None,
215
215
  save: bool = False,
216
- dt: int = 200
216
+ dt: int = 200,
217
+ filename: str = 'pitch_control'
217
218
  ):
218
219
  if pitch_control is None:
219
220
  pitch_control, xx, yy = self.fit(half, tp, dt)
@@ -245,7 +246,7 @@ class PitchControl:
245
246
  )
246
247
 
247
248
  if save:
248
- plt.savefig('pitch_control.png', dpi=300)
249
+ plt.savefig(f'{filename}.png', dpi=300)
249
250
  else:
250
251
  plt.show()
251
252
 
@@ -253,7 +254,7 @@ class PitchControl:
253
254
  self,
254
255
  half: int,
255
256
  tp: int,
256
- filename: str,
257
+ filename: str = "pitch_control_animation",
257
258
  dt: int = 200,
258
259
  frames: int = 30,
259
260
  interval: int = 1000
@@ -265,7 +266,7 @@ class PitchControl:
265
266
 
266
267
  def animate(i):
267
268
  fr = tp + i
268
- pitch_control, xx, yy = self.fit(half, tp, dt)
269
+ pitch_control, xx, yy = self.fit(half, fr, dt)
269
270
 
270
271
  mpl.field("white", show=False, ax=ax)
271
272
  ax.axis('off')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rustat-python-api
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: A Python wrapper for RuStat API
5
5
  Home-page: https://github.com/dailydaniel/rustat-python-api
6
6
  Author: Daniel Zholkovsky
@@ -23,7 +23,7 @@ pip install rustat-python-api
23
23
  ```
24
24
  1. Usage:
25
25
  ```python
26
- from rustat_python_api import RuStatParser
26
+ from rustat_python_api import RuStatParser, DynamoLab, PitchControl
27
27
 
28
28
  user = "your_login"
29
29
  password = "your_password"
@@ -39,8 +39,20 @@ keys = list(schedule.keys())
39
39
  match_id = keys[-1]
40
40
 
41
41
  events, subs = parser.get_events(match_id, process=True, return_subs=True)
42
-
43
42
  stats = parser.get_match_stats(match_id)
44
-
45
43
  tracking = parser.get_tracking(match_id)
44
+
45
+ host = "http://localhost:8001/"
46
+ client = DynamoLab(host)
47
+ client.run_model(
48
+ model="xT",
49
+ data=events,
50
+ inplace=True,
51
+ inplace_column=model
52
+ )
53
+
54
+ pc = PitchControl(tracking, events)
55
+ pc.draw_pitch_control(half=1, tp=100, save=True, filename="pitch_control")
56
+ # ffmpeg required for animation
57
+ pc.animate_pitch_control(half=1, tp=100, frames=30, filename="pitch_control")
46
58
  ```
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='rustat-python-api',
5
- version='0.5.0',
5
+ version='0.5.2',
6
6
  description='A Python wrapper for RuStat API',
7
7
  long_description=open('README.md').read(),
8
8
  long_description_content_type='text/markdown',