Skip to content

Commit

Permalink
fixed some tests, not everything is clear - how the test_new_particle…
Browse files Browse the repository at this point in the history
… works
  • Loading branch information
alexlib committed Nov 19, 2023
1 parent c6c767d commit b40ebb0
Show file tree
Hide file tree
Showing 2 changed files with 280 additions and 246 deletions.
21 changes: 15 additions & 6 deletions openptv_python/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .imgcoord import img_coord
from .orientation import point_position
from .parameters import ControlPar, TrackPar
from .tracking_frame_buf import Frame, Target
from .tracking_frame_buf import Corres, Frame, Pathinfo, Target
from .tracking_run import TrackingRun
from .trafo import dist_to_flat, metric_to_pixel, pixel_to_metric
from .vec_utils import vec_copy, vec_diff_norm, vec_subt
Expand Down Expand Up @@ -628,7 +628,7 @@ def sorted_candidates_in_volume(
if num_cands > 0:
points = points[:num_cands] + [Foundpix(ftnr=TR_UNUSED)]
else:
points = []
points = [Foundpix(ftnr=TR_UNUSED)]

return points

Expand Down Expand Up @@ -743,11 +743,20 @@ def add_particle(frm: Frame, pos: np.ndarray, cand_inds: np.ndarray) -> None:
- cand_inds (list[list[int]]): Indices of candidate targets for association with this particle.
"""
num_parts = frm.num_parts
ref_path_inf = frm.path_info[num_parts]
if num_parts > 0:
ref_path_inf = frm.path_info[num_parts]
ref_corres = frm.correspond[num_parts]
else:
ref_path_inf = Pathinfo()
frm.path_info.append(ref_path_inf)

ref_corres = Corres()
frm.correspond.append(ref_corres)

ref_path_inf.x = vec_copy(pos)
ref_path_inf.reset_links()

ref_corres = frm.correspond[num_parts]

ref_targets = frm.targets

for cam in range(frm.num_cams):
Expand Down Expand Up @@ -852,7 +861,7 @@ def trackcorr_c_loop(run_info, step):
# Continue to find candidates for the candidates.
count2 += 1
mm = 0
while w[mm].ftnr != TR_UNUSED: # counter1-loop
while w[mm].ftnr != TR_UNUSED and len(fb.buf[2].path_info) > w[mm].ftnr: # counter1-loop
# search for found corr of current the corr in next_frame with predicted location

# found 3D-position
Expand All @@ -878,7 +887,7 @@ def trackcorr_c_loop(run_info, step):
if len(wn) > 0: # not empty
count3 += 1
kk = 0
while wn[kk].ftnr != TR_UNUSED:
while wn[kk].ftnr != TR_UNUSED and len(fb.buf[3].path_info) > wn[kk].ftnr:
# print(f" inside wn[{kk}].ftnr {wn[kk].ftnr}")
ref_path_inf = fb.buf[3].path_info[wn[kk].ftnr]
X[4] = vec_copy(ref_path_inf.x)
Expand Down
Loading

0 comments on commit b40ebb0

Please sign in to comment.