diff --git a/src/robofish/io/file.py b/src/robofish/io/file.py index 0afc5cdef44b33f972c6bc59e86b4c4f89c2f708..e734258dbe18b4b387417884533127b19b76f317 100644 --- a/src/robofish/io/file.py +++ b/src/robofish/io/file.py @@ -1437,16 +1437,17 @@ class File(h5py.File): ori_deg = np.rad2deg(self.fov_orientations[i_entity]) - for zone in zones[i_entity]: - zone.set_center( - ( - this_pose[i_entity, 0], - this_pose[i_entity, 1], + if len(zones) > i_entity: + for zone in zones[i_entity]: + zone.set_center( + ( + this_pose[i_entity, 0], + this_pose[i_entity, 1], + ) ) - ) - if fovs[i_entity] < 360: - zone.theta1 = ori_deg - fovs[i_entity] / 2 - zone.theta2 = ori_deg + fovs[i_entity] / 2 + if fovs[i_entity] < 360: + zone.theta1 = ori_deg - fovs[i_entity] / 2 + zone.theta2 = ori_deg + fovs[i_entity] / 2 if render_swarm_center: swarm_center[0].set_offsets(swarm_center_position[file_frame])