rustat-python-api 0.5.2__tar.gz → 0.5.3__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.
- {rustat-python-api-0.5.2/rustat_python_api.egg-info → rustat-python-api-0.5.3}/PKG-INFO +1 -1
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api/pitch_control.py +25 -10
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3/rustat_python_api.egg-info}/PKG-INFO +1 -1
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/setup.py +1 -1
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/LICENSE +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/README.md +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/pyproject.toml +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api/__init__.py +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api/config.py +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api/models_api.py +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api/parser.py +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api/processing.py +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api/urls.py +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api.egg-info/SOURCES.txt +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api.egg-info/dependency_links.txt +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api.egg-info/requires.txt +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api.egg-info/top_level.txt +0 -0
- {rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/setup.cfg +0 -0
|
@@ -124,10 +124,21 @@ class PitchControl:
|
|
|
124
124
|
|
|
125
125
|
@staticmethod
|
|
126
126
|
def get_player_data(player_id, half, tracking):
|
|
127
|
-
|
|
127
|
+
timestamps = tracking[tracking['half'] == half]['second'].unique()
|
|
128
|
+
player_data = tracking[
|
|
128
129
|
(tracking['player_id'] == player_id)
|
|
129
130
|
& (tracking['half'] == half)
|
|
130
|
-
|
|
131
|
+
][['second', 'pos_x', 'pos_y']]
|
|
132
|
+
|
|
133
|
+
player_data_full = pd.DataFrame({'second': timestamps})
|
|
134
|
+
player_data_full = player_data_full.merge(player_data, on='second', how='left')
|
|
135
|
+
|
|
136
|
+
return player_data_full[['pos_x', 'pos_y']].values
|
|
137
|
+
|
|
138
|
+
# return tracking[
|
|
139
|
+
# (tracking['player_id'] == player_id)
|
|
140
|
+
# & (tracking['half'] == half)
|
|
141
|
+
# ][['pos_x', 'pos_y']].values
|
|
131
142
|
|
|
132
143
|
def influence_function(
|
|
133
144
|
self,
|
|
@@ -195,11 +206,11 @@ class PitchControl:
|
|
|
195
206
|
locations = np.c_[xx.flatten(),yy.flatten()]
|
|
196
207
|
|
|
197
208
|
for k in self.locs_home[half].keys():
|
|
198
|
-
if len(self.locs_home[half][k]) >= tp:
|
|
199
|
-
|
|
209
|
+
# if len(self.locs_home[half][k]) >= tp:
|
|
210
|
+
Zh += self.influence_function(k, locations, tp, 'h', half)
|
|
200
211
|
for k in self.locs_away[half].keys():
|
|
201
|
-
if len(self.locs_away[half][k]) >= tp:
|
|
202
|
-
|
|
212
|
+
# if len(self.locs_away[half][k]) >= tp:
|
|
213
|
+
Za += self.influence_function(k, locations, tp, 'a', half)
|
|
203
214
|
|
|
204
215
|
Zh = Zh.reshape((dt, dt))
|
|
205
216
|
Za = Za.reshape((dt, dt))
|
|
@@ -225,7 +236,8 @@ class PitchControl:
|
|
|
225
236
|
plt.contourf(xx, yy, pitch_control)
|
|
226
237
|
|
|
227
238
|
for k in self.locs_home[half].keys():
|
|
228
|
-
if len(self.locs_home[half][k]) >= tp:
|
|
239
|
+
# if len(self.locs_home[half][k]) >= tp:
|
|
240
|
+
if np.isfinite(self.locs_home[half][k][tp, :]).all():
|
|
229
241
|
plt.scatter(
|
|
230
242
|
self.locs_home[half][k][tp, 0],
|
|
231
243
|
self.locs_home[half][k][tp, 1],
|
|
@@ -233,7 +245,8 @@ class PitchControl:
|
|
|
233
245
|
)
|
|
234
246
|
|
|
235
247
|
for k in self.locs_away[half].keys():
|
|
236
|
-
if len(self.locs_away[half][k]) >= tp:
|
|
248
|
+
# if len(self.locs_away[half][k]) >= tp:
|
|
249
|
+
if np.isfinite(self.locs_away[half][k][tp, :]).all():
|
|
237
250
|
plt.scatter(
|
|
238
251
|
self.locs_away[half][k][tp, 0],
|
|
239
252
|
self.locs_away[half][k][tp, 1], color='black'
|
|
@@ -274,14 +287,16 @@ class PitchControl:
|
|
|
274
287
|
plt.contourf(xx, yy, pitch_control)
|
|
275
288
|
|
|
276
289
|
for k in self.locs_home[half].keys():
|
|
277
|
-
if len(self.locs_home[half][k]) >= fr:
|
|
290
|
+
# if len(self.locs_home[half][k]) >= fr:
|
|
291
|
+
if np.isfinite(self.locs_home[half][k][fr, :]).all():
|
|
278
292
|
plt.scatter(
|
|
279
293
|
self.locs_home[half][k][fr, 0],
|
|
280
294
|
self.locs_home[half][k][fr, 1],
|
|
281
295
|
color='darkgrey'
|
|
282
296
|
)
|
|
283
297
|
for k in self.locs_away[half].keys():
|
|
284
|
-
if len(self.locs_away[half][k]) >= fr:
|
|
298
|
+
# if len(self.locs_away[half][k]) >= fr:
|
|
299
|
+
if np.isfinite(self.locs_away[half][k][fr, :]).all():
|
|
285
300
|
plt.scatter(
|
|
286
301
|
self.locs_away[half][k][fr, 0],
|
|
287
302
|
self.locs_away[half][k][fr, 1],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{rustat-python-api-0.5.2 → rustat-python-api-0.5.3}/rustat_python_api.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|