Skip to content
Snippets Groups Projects
Commit fc590051 authored by mhocke's avatar mhocke
Browse files

Show optional debug info in terminal

parent c95c84ed
No related merge requests found
Pipeline #51653 failed
......@@ -1046,12 +1046,18 @@ class File(h5py.File):
border = patches.Polygon(border_vertices.T, facecolor="w", zorder=-1)
def title(file_frame: int) -> str:
"""Search for datasets containing text for displaying it in the video"""
if options["show_text"] and not video_path:
print(self)
def get_text(file_frame: int) -> str:
"""Search for datasets containing text for displaying it in the terminal"""
output = []
keys = ["target_fish_ids"]
for e in self.entities:
for key, val in e.items():
if val.dtype == object and type(val[0]) == bytes:
if key in keys:
output.append(f"{e.name}.{key}='{val[file_frame]}'")
elif val.dtype == object and type(val[0]) == bytes:
output.append(f"{e.name}.{key}='{val[file_frame].decode()}'")
return ", ".join(output)
......@@ -1154,8 +1160,12 @@ class File(h5py.File):
self.middle_of_swarm[1] - self.view_size / 2,
self.middle_of_swarm[1] + self.view_size / 2,
)
if options["show_text"]:
ax.set_title(title(file_frame))
if options["show_text"] and not video_path:
terminal_width = shutil.get_terminal_size((80, 20)).columns
print(
f"{get_text(file_frame)[:terminal_width]:<{terminal_width}}",
end="\r",
)
if options["render_goals"]:
goal = get_goal(file_frame)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment