Collision probability computation for conjunction assessment
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

claude: complete Err -> Error module rename across call sites

Follow up to the module rename: update the remaining callers that
still referenced [Err] (library [claude.ml{,i}], [client.ml], the test
driver [test.ml]), and fix one stray [^ e] string concatenation in
hermest's CLI that needed [Json.Error.to_string e] now that
[Json.of_string] yields a structured error.

+4 -10
-1
fuzz/dune
··· 8 8 9 9 (executable 10 10 (name fuzz) 11 - (modules fuzz fuzz_collision) 12 11 (libraries collision alcobar)) 13 12 14 13 (rule
+4 -9
lib/collision.ml
··· 8 8 (* {1 Types} *) 9 9 10 10 type vec3 = Vec3.t = { x : float; y : float; z : float } 11 - type sym2 = { a11 : float; a12 : float; a22 : float } 12 11 13 12 type encounter = { 14 13 miss_x : float; ··· 395 394 396 395 type tca = { time : float; miss_distance : float; relative_velocity : float } 397 396 398 - let tca_at_index times pos1 pos2 vel1 vel2 i d2 = 397 + let tca_at_index times vel1 vel2 i d2 = 399 398 let d = sqrt d2 in 400 399 let dv = Vec3.length (Vec3.sub vel1.(i) vel2.(i)) in 401 400 { time = times.(i); miss_distance = d; relative_velocity = dv } ··· 421 420 min_i := i) 422 421 done; 423 422 let i = !min_i in 424 - if i = 0 || i = n - 1 then 425 - Some (tca_at_index times pos1 pos2 vel1 vel2 i !min_d2) 423 + if i = 0 || i = n - 1 then Some (tca_at_index times vel1 vel2 i !min_d2) 426 424 else 427 425 (* Step 2: quadratic refinement around minimum *) 428 426 let t0 = times.(i - 1) and t1 = times.(i) and t2 = times.(i + 1) in ··· 432 430 let h0 = t0 -. t1 and h2 = t2 -. t1 in 433 431 let denom = h0 *. h2 *. (h2 -. h0) in 434 432 if Float.abs denom < 1e-30 || denom = 0.0 then 435 - Some (tca_at_index times pos1 pos2 vel1 vel2 i !min_d2) 433 + Some (tca_at_index times vel1 vel2 i !min_d2) 436 434 else 437 435 let a = ((h2 *. (y0 -. y1)) -. (h0 *. (y2 -. y1))) /. denom in 438 436 let b = 439 437 ((h0 *. h0 *. (y2 -. y1)) -. (h2 *. h2 *. (y0 -. y1))) /. denom 440 438 in 441 - if a <= 0.0 then Some (tca_at_index times pos1 pos2 vel1 vel2 i !min_d2) 439 + if a <= 0.0 then Some (tca_at_index times vel1 vel2 i !min_d2) 442 440 else 443 441 let dt = -.b /. (2.0 *. a) in 444 442 let t_star = Float.max t0 (Float.min t2 (t1 +. dt)) in ··· 505 503 a.pc pp_risk (risk_level a) a.pc_max a.miss_distance a.relative_velocity 506 504 507 505 (* {1 Pretty-printing} *) 508 - 509 - let pp_sym2 ppf s = 510 - Fmt.pf ppf "| %.6e %.6e |@,| %.6e %.6e |" s.a11 s.a12 s.a12 s.a22 511 506 512 507 let pp_encounter ppf e = 513 508 Fmt.pf ppf