Skip to content

Commit 2e0c684

Browse files
authored
Modified Target Plane (#70)
* Add mtp(::Vector{U}) * Add bplane tests * Bump patch version * Add Roots to test/Project.toml
1 parent 7703227 commit 2e0c684

File tree

7 files changed

+89
-3
lines changed

7 files changed

+89
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NEOs"
22
uuid = "b41c07a2-2abb-11e9-070a-c3c1b239e7df"
33
authors = ["Jorge A. Pérez Hernández", "Luis Benet", "Luis Eduardo Ramírez Montoya"]
4-
version = "0.8.7"
4+
version = "0.8.8"
55

66
[deps]
77
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

src/NEOs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export gauss_method, gaussinitcond
7575
# Orbit determination
7676
export curvature, issinglearc, isgauss, orbitdetermination
7777
# B plane
78-
export valsecchi_circle, bopik
78+
export valsecchi_circle, bopik, mtp
7979
# Outlier rejection
8080
export outlier_rejection
8181

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,35 @@ function valsecchi_circle(U_y, U_norm, k, h; m_pl=3.003489614915764e-6, a_pl=1.0
206206
D0 = c*sinθ/(cosθ0p-cosθ)
207207

208208
return R0, D0
209+
end
210+
211+
@doc raw"""
212+
mtp(xae::Vector{U}) where {U <: Number}
213+
214+
Return the cartesian coordinates [Earth radii] on the modified
215+
target plane of an asteroid's close approach with the Earth.
216+
217+
# Arguments
218+
219+
- `xae::Vector{U}`: asteroid's geocentric position/velocity
220+
vector at close approach [au, au/day].
221+
222+
!!! reference
223+
See equations (43)-(44) in page 15 of https://doi.org/10.1007/s10569-019-9914-4.
224+
"""
225+
function mtp(xae::Vector{U}) where {U <: Number}
226+
# Unfold geocentric position and velocity
227+
r, v = xae[1:3], xae[4:6]
228+
# Reference direction
229+
V = [0, 0, -1]
230+
# Unit vectors
231+
ez = v ./ euclid3D(v)
232+
_ey_ = cross(V, ez)
233+
ey = _ey_ ./ euclid3D(_ey_)
234+
ex = cross(ey, ez)
235+
# Cartesian coordinates [Earth radii]
236+
X = dot3D(r, ex)*au/RE
237+
Y = dot3D(r, ey)*au/RE
238+
239+
return X, Y
209240
end

src/postprocessing/outlier_rejection.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include("b_plane.jl")
1+
include("bplane.jl")
22

33
@doc raw"""
44
residual_norm(x::OpticalResidual{T, T}) where {T <: Real}

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1111
PlanetaryEphemeris = "d83715d0-7e5f-11e9-1a59-4137b20d8363"
1212
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1313
Query = "1a8c2f83-1ff3-5112-b086-8aa67b057ba1"
14+
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
1415
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1516
TaylorIntegration = "92b13dbe-c966-51a2-8445-caca9f8a7d42"
1617
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

test/bplane.jl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ testfiles = (
55
"observations.jl",
66
"propagation.jl",
77
"orbitdetermination.jl",
8+
"bplane.jl",
89
"dataframes.jl",
910
"aqua.jl",
1011
)

0 commit comments

Comments
 (0)