From bf18eff27012cd4ae14d40dbec17db5872923df3 Mon Sep 17 00:00:00 2001 From: Alex Liberzon Date: Mon, 13 Nov 2023 23:15:56 +0200 Subject: [PATCH] ready to slowly debug tracking --- openptv_python/track.py | 12 +++++++----- tests/test_tracking_run.py | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/openptv_python/track.py b/openptv_python/track.py index 952ba8c..9940bde 100644 --- a/openptv_python/track.py +++ b/openptv_python/track.py @@ -686,7 +686,7 @@ def track_forward_start(tr: TrackingRun): def trackcorr_c_loop(run_info, step): - # sequence loop + """Sequence loop.""" j, h, mm, kk, in_volume = 0, 0, 0, 0, 0 philf = [[0 for _ in range(MAX_CANDS)] for _ in range(4)] count1, count2, count3, num_added = 0, 0, 0, 0 @@ -971,7 +971,7 @@ def trackcorr_c_loop(run_info, step): run_info.npart = run_info.npart + fb.buf[1].num_parts run_info.nlinks = run_info.nlinks + count1 - fb.next_frame() + fb.fb_next() fb.write_frame_from_start(step) if step < run_info.seq_par.last - 2: @@ -979,13 +979,15 @@ def trackcorr_c_loop(run_info, step): # end of sequence loop -def trackcorr_c_finish(run_info, step): - npart, nlinks = run_info.npart / range, run_info.nlinks / range +def trackcorr_c_finish(run_info, step: int): + """Close the links and write the last frame.""" + track_range = run_info.seq_par.last - run_info.seq_par.first + npart, nlinks = run_info.npart / track_range, run_info.nlinks / track_range print( f"Average over sequence, particles: {npart:.1f}, links: {nlinks:.1f}, lost: {npart - nlinks:.1f}" ) - run_info.fb.next_frame() + run_info.fb.fb_next() run_info.fb.write_frame_from_start(step) diff --git a/tests/test_tracking_run.py b/tests/test_tracking_run.py index 756a186..6825153 100644 --- a/tests/test_tracking_run.py +++ b/tests/test_tracking_run.py @@ -29,6 +29,7 @@ def remove_directory(directory_path): + """Remove a directory and its contents.""" # Convert the input to a Path object path = Path(directory_path)