Skip to content

Commit

Permalink
✅ : Fix failing position test
Browse files Browse the repository at this point in the history
  • Loading branch information
CBroz1 committed Feb 13, 2025
1 parent a36585e commit 42f5f44
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/spyglass/position/v1/dlc_utils_makevid.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ def _generate_single_frame(self, frame_ind):
self.centroid_position_dot.set_offsets((np.NaN, np.NaN))
for bodypart in self.centroid_plot_objs.keys():
self.centroid_plot_objs[bodypart].set_offsets((np.NaN, np.NaN))
self.orientation_line.set_data((np.NaN, np.NaN))
empty_array = np.array([], dtype=float)
self.orientation_line.set_data(empty_array, empty_array)
self.title.set_text(f"time = {0:3.4f}s\n frame = {frame_ind}")

self.fig.savefig(frame_out_path, dpi=400)
Expand Down Expand Up @@ -421,8 +422,17 @@ def _debug_print(self, msg=" ", end=""):
if self.debug:
print(f"\r{msg}", end=end)

def plot_frames(self, start_frame, end_frame, progress_bar=None):
def plot_frames(
self, start_frame, end_frame, progress_bar=None, process_pool=True
):
logger.debug(f"Plotting frames: {start_frame} - {end_frame}")

if not process_pool: # Single-threaded processing for debugging
for frame_ind in range(start_frame, end_frame):
self._generate_single_frame(frame_ind)
progress_bar.update()
return

with ProcessPoolExecutor(max_workers=self.max_workers) as executor:
jobs = {} # dict of jobs

Expand Down

0 comments on commit 42f5f44

Please sign in to comment.