2121)
2222from .imgcoord import img_coord
2323from .orientation import point_position
24- from .parameters import ControlPar , TrackPar
24+ from .parameters import ControlPar , TrackParTuple , convert_track_par_to_tuple
2525from .tracking_frame_buf import Frame , Pathinfo , Target
2626from .tracking_run import TrackingRun
2727from .trafo import dist_to_flat , metric_to_pixel , pixel_to_metric
@@ -188,8 +188,8 @@ def predict(prev_pos, curr_pos, output):
188188 output [0 ] = 2 * curr_pos [0 ] - prev_pos [0 ]
189189 output [1 ] = 2 * curr_pos [1 ] - prev_pos [1 ]
190190
191-
192- def pos3d_in_bounds (pos : np .ndarray , bounds : TrackPar ) -> bool :
191+ @ njit ( cache = True , fastmath = True , nogil = True )
192+ def pos3d_in_bounds (pos : np .ndarray , bounds : TrackParTuple ) -> bool :
193193 """Check that all components of a pos3d are in their respective bounds.
194194
195195 taken from a track_par object.
@@ -211,44 +211,6 @@ def pos3d_in_bounds(pos: np.ndarray, bounds: TrackPar) -> bool:
211211 )
212212
213213
214- # def angle_acc(
215- # start: np.ndarray, pred: np.ndarray, cand: np.ndarray
216- # ) -> Tuple[float, float]:
217- # """Calculate the angle between the (1st order) numerical velocity vectors.
218-
219- # to the predicted next_frame position and to the candidate actual position. The
220- # angle is calculated in [gon], see [1]. The predicted position is the
221- # position if the particle continued at current velocity.
222-
223- # Arguments:
224- # ---------
225- # start -- vec3d, the particle start position
226- # pred -- vec3d, predicted position
227- # cand -- vec3d, possible actual position
228-
229- # Returns:
230- # -------
231- # angle -- float, the angle between the two velocity vectors, [gon]
232- # acc -- float, the 1st-order numerical acceleration embodied in the deviation from prediction.
233- # """
234- # v0 = pred - start
235- # v1 = cand - start
236-
237- # acc = math.dist(v0, v1)
238- # # acc = np.linalg.norm(v0 - v1)
239-
240- # if np.all(v0 == -v1):
241- # angle = 200
242- # elif np.all(v0 == v1):
243- # angle = 0
244- # else:
245- # angle = float((200.0 / math.pi) * math.acos(
246- # math.fsum([v0[i] * v1[i] for i in range(3)])
247- # / (math.dist(start, pred) * math.dist(start, cand)))
248- # )
249-
250- # return angle, acc
251-
252214@njit (float64 [:](float64 [:], float64 [:], float64 [:]), cache = True , fastmath = True , nogil = True , parallel = True )
253215def angle_acc (
254216 start : np .ndarray , pred : np .ndarray , cand : np .ndarray
@@ -441,7 +403,7 @@ def candsearch_in_pix_rest(
441403
442404
443405def searchquader (
444- point : np .ndarray , tpar : TrackPar , cpar : ControlPar , cal : List [Calibration ]
406+ point : np .ndarray , tpar : TrackParTuple , cpar : ControlPar , cal : List [Calibration ]
445407) -> Tuple [np .ndarray , np .ndarray , np .ndarray , np .ndarray ]:
446408 """Calculate the search volume in image space."""
447409 mins = np .array ([tpar .dvxmin , tpar .dvymin , tpar .dvzmin ])
@@ -819,7 +781,7 @@ def trackcorr_c_loop(run_info, step):
819781
820782 fb = run_info .fb
821783 cal = run_info .cal
822- tpar = run_info .tpar
784+ tpar = convert_track_par_to_tuple ( run_info .tpar )
823785 vpar = run_info .vpar
824786 cpar = run_info .cpar
825787 curr_targets = fb .buf [1 ].targets
0 commit comments