Skip to content

Commit b05f484

Browse files
Merge pull request #46 from UnravelSports/feat/unravel_graph
Feat/unravel graph
2 parents 60f934e + 1e23a6a commit b05f484

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,9 @@ These dependencies come pre-installed with the package. It is advised to create
152152

153153
This package is tested on the latest versions of Ubuntu, MacOS and Windows.
154154

155-
🌀 Contributing
155+
🌀 Licenses
156156
----
157-
All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
158-
159-
An overview on how to contribute can be found in the [**contributing guide**](CONTRIBUTING.md).
160-
161-
I try to keep an up-to-date list of [Open Issues](https://github.com/UnravelSports/unravelsports/issues). If you would like to work on any of these, or have ideas of your own that could be added, send me a message on [LinkedIn](https://www.linkedin.com/in/joris-bekkers-33138288/) or [BlueSky](https://bsky.app/profile/unravelsports.com)
157+
This project is licensed under the [Mozilla Public License Version 2.0 (MPL)](LICENSE), which requires that you include a copy of the license and provide attribution to the original authors. Any modifications you make to the MPL-licensed files must be documented, and the source code for those modifications must be made open-source under the same license.
162158

163159
🌀 Citation
164160
----
@@ -215,7 +211,5 @@ If you use this repository for any educational purposes, research, project etc.,
215211
[<img alt="alt_text" width="40px" src="https://upload.wikimedia.org/wikipedia/commons/c/ca/LinkedIn_logo_initials.png"/>](https://www.linkedin.com/in/joris-bekkers-33138288/)
216212
[<img alt="alt_text" width="40px" src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/7a/Bluesky_Logo.svg/2319px-Bluesky_Logo.svg.png"/>](https://bsky.app/profile/unravelsports.com)
217213

218-
🌀 Licenses
219-
----
220-
This project is licensed under the [Mozilla Public License Version 2.0 (MPL)](LICENSE), which requires that you include a copy of the license and provide attribution to the original authors. Any modifications you make to the MPL-licensed files must be documented, and the source code for those modifications must be made open-source under the same license.
214+
221215

unravel/soccer/graphs/graph_converter.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,18 @@ def player_and_ball(frame_data, ax):
982982
]
983983
)
984984
ax.set_xlabel(f"Label: {frame_data['label'][0]}", fontsize=22)
985+
ax.set_title(self._gameclock, fontsize=22)
985986

986987
def frame_plot(self, frame_data):
988+
def timestamp_to_gameclock(timestamp, period_id):
989+
total_seconds = timestamp.total_seconds()
990+
991+
minutes = int(total_seconds // 60)
992+
seconds = int(total_seconds % 60)
993+
milliseconds = int((total_seconds % 1) * 1000)
994+
995+
return f"[{period_id}] - {minutes}:{seconds:02d}:{milliseconds:03d}"
996+
987997
self._gs = GridSpec(
988998
2,
989999
3,
@@ -1023,6 +1033,10 @@ def frame_plot(self, frame_data):
10231033
frame_data[Column.IS_BALL_CARRIER] == True
10241034
)[0][0]
10251035
self._ball_owning_team_id = list(frame_data[Column.BALL_OWNING_TEAM_ID])[0]
1036+
self._gameclock = timestamp_to_gameclock(
1037+
timestamp=list(frame_data["timestamp"])[0],
1038+
period_id=list(frame_data["period_id"])[0],
1039+
)
10261040

10271041
plot_vertical_pitch(frame_data)
10281042
plot_graph()
@@ -1036,7 +1050,7 @@ def frame_plot(self, frame_data):
10361050
df = self._sort(df)
10371051

10381052
if generate_video:
1039-
writer = animation.FFMpegWriter(fps=fps, bitrate=1800)
1053+
writer = animation.FFMpegWriter(fps=fps, bitrate=1500)
10401054

10411055
with writer.saving(self._fig, file_path, dpi=300):
10421056
for group_id, frame_data in df.group_by(

unravel/utils/objects/custom_spektral_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __convert(self, data) -> List[Graph]:
9090
e=g["e"],
9191
y=g["y"],
9292
id=g["id"],
93-
frame_id=g["frame_id"],
93+
frame_id=g.get("frame_id", None),
9494
)
9595
for i, g in enumerate(data)
9696
if i % self.sample == 0

0 commit comments

Comments
 (0)