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

Fix gridpoints

Grid points were only visible in exported video files, but not during
live view.
parent b759f806
No related branches found
No related tags found
1 merge request!36Fix gridpoints in robofish-io-render
Pipeline #51658 failed
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
# email andi.gerken@gmail.com # email andi.gerken@gmail.com
# ----------------------------------------------------------- # -----------------------------------------------------------
from pytest import skip
import robofish.io import robofish.io
from robofish.io.entity import Entity from robofish.io.entity import Entity
import h5py import h5py
...@@ -259,7 +258,6 @@ class File(h5py.File): ...@@ -259,7 +258,6 @@ class File(h5py.File):
return self return self
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):
# Check if the context was left under normal circumstances # Check if the context was left under normal circumstances
if (hasattr(self, "closed") and not self.closed) and ( if (hasattr(self, "closed") and not self.closed) and (
type, type,
...@@ -933,15 +931,6 @@ class File(h5py.File): ...@@ -933,15 +931,6 @@ class File(h5py.File):
# Plotting outside of the figure to have the label # Plotting outside of the figure to have the label
ax.plot([550, 600], [550, 600], lw=5, c=this_c, label=fish_id) ax.plot([550, 600], [550, 600], lw=5, c=this_c, label=fish_id)
# ax.scatter(
# [poses[:, skip_timesteps, 0]],
# [poses[:, skip_timesteps, 1]],
# marker="h",
# c="black",
# s=ms,
# label="Start",
# zorder=5,
# )
ax.scatter( ax.scatter(
[poses[:, -1, 0]], [poses[:, -1, 0]],
[poses[:, -1, 1]], [poses[:, -1, 1]],
...@@ -1025,10 +1014,6 @@ class File(h5py.File): ...@@ -1025,10 +1014,6 @@ class File(h5py.File):
plt.plot([], [], lw=options["linewidth"], zorder=0)[0] plt.plot([], [], lw=options["linewidth"], zorder=0)[0]
for _ in range(n_entities) for _ in range(n_entities)
] ]
points = [
plt.scatter([], [], marker="x", color="k"),
plt.plot([], [], linestyle="dotted", alpha=0.5, color="k", zorder=0)[0],
]
categories = [entity.attrs.get("category", None) for entity in self.entities] categories = [entity.attrs.get("category", None) for entity in self.entities]
entity_polygons = [ entity_polygons = [
patches.Polygon(shape_vertices(options["entity_scale"]), facecolor=color) patches.Polygon(shape_vertices(options["entity_scale"]), facecolor=color)
...@@ -1053,9 +1038,12 @@ class File(h5py.File): ...@@ -1053,9 +1038,12 @@ class File(h5py.File):
) )
xv, yv = np.meshgrid(x, y) xv, yv = np.meshgrid(x, y)
grid_points = plt.scatter(xv, yv, c="gray", s=1.5) points = [
plt.scatter([], [], marker="x", color="k"),
plt.plot([], [], linestyle="dotted", alpha=0.5, color="k", zorder=0)[0],
plt.scatter(xv, yv, c="gray", s=1.5),
]
# border = plt.plot(border_vertices[0], border_vertices[1], "k")
border = patches.Polygon(border_vertices.T, facecolor="w", zorder=-1) border = patches.Polygon(border_vertices.T, facecolor="w", zorder=-1)
def title(file_frame: int) -> str: def title(file_frame: int) -> str:
...@@ -1146,7 +1134,7 @@ class File(h5py.File): ...@@ -1146,7 +1134,7 @@ class File(h5py.File):
[options["view_size"], min_view + options["margin"]] [options["view_size"], min_view + options["margin"]]
) )
if not np.isnan(min_view).any() and not new_view_size is np.nan: if not np.isnan(min_view).any() and new_view_size is not np.nan:
self.middle_of_swarm = options[ self.middle_of_swarm = options[
"slow_view" "slow_view"
] * self.middle_of_swarm + (1 - options["slow_view"]) * np.mean( ] * self.middle_of_swarm + (1 - options["slow_view"]) * np.mean(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment