1+ # This file is part of the NEOs.jl package; MIT licensed
2+
3+ using NEOs
4+ using PlanetaryEphemeris
5+ using LinearAlgebra
6+ using Roots
7+ using Test
8+
9+ using NEOs: propres
10+
11+ @testset " 2018 LA" begin
12+
13+ # Fetch optical astrometry
14+ radec = fetch_radec_mpc (" designation" => " 2018 LA" )
15+ # Parameters
16+ params = NEOParameters (coeffstol = Inf , bwdoffset = 0.007 , fwdoffset = 0.007 )
17+
18+ # Orbit Determination
19+ sol = orbitdetermination (radec[1 : 8 ], params)
20+ params = NEOParameters (params; jtlsorder = 6 )
21+ sol = orbitdetermination (radec, sol, params)
22+
23+ # Radial velocity with respect to the Earth.
24+ function rvelea (t, fwd, params)
25+ # Geocentric state vector
26+ rv = fwd (t) - params. eph_ea (t)
27+ # Derivative of geocentric distance
28+ return dot (rv[1 : 3 ], rv[4 : 6 ])
29+ end
30+
31+ # Values by June 23, 2024
32+
33+ # Time of close approach
34+ params = NEOParameters (params; fwdoffset = 0.3 )
35+ bwd, fwd, res = propres (radec, epoch (sol) + J2000, sol (), params)
36+ t_CA = find_zeros (t -> rvelea (t, fwd, params), fwd. t0, fwd. t0 + fwd. t[end - 1 ])[1 ]
37+ # Asteroid's geocentric state vector
38+ xae = fwd (t_CA) - params. eph_ea (t_CA)
39+ # Earth's heliocentric state vector
40+ xes = params. eph_ea (t_CA) - params. eph_su (t_CA)
41+
42+ # Öpik's coordinates
43+ B = bopik (xae, xes)
44+ # Modified Target Plane
45+ X, Y = mtp (xae)
46+
47+ # Impact parameter
48+ @test B. b >= 1.0
49+ # Impact condition
50+ @test hypot (B. ξ, B. ζ) <= B. b
51+ @test hypot (X, Y) <= 1
52+
53+ end
0 commit comments