Skip to content

Commit

Permalink
tsanightorder & naive maxsteps
Browse files Browse the repository at this point in the history
  • Loading branch information
LuEdRaMo committed Dec 26, 2023
1 parent 820e4e3 commit 5cef34b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 23 deletions.
19 changes: 0 additions & 19 deletions src/orbit_determination/gauss_method.jl
Original file line number Diff line number Diff line change
Expand Up @@ -413,25 +413,6 @@ function gauss_triplets(dates::Vector{DateTime}, max_triplets::Int = 10, max_ite
return triplets[1:n]
end

@doc raw"""
adaptative_maxsteps(radec::Vector{RadecMPC{T}}) where {T <: AbstractFloat}
Empirical upper bound for the number of steps used for propagation.
"""
function adaptative_maxsteps(radec::Vector{RadecMPC{T}}) where {T <: AbstractFloat}
# Time difference [ms]
Δ_ms = getfield(date(radec[end]) - date(radec[1]), :value)
# Time difference [days]
Δ_day = Δ_ms / 86_400_000
# Adaptative maxsteps
if Δ_day <= 30
return 55 - floor(Int, 5*Δ_day/6)
else
return ceil(Int, (Δ_day + 360)/13)
end
end


@doc raw"""
gaussinitcond(radec::Vector{RadecMPC{T}}, nights::Vector{ObservationNight{T}},
params::Parameters{T}) where {T <: AbstractFloat}
Expand Down
21 changes: 21 additions & 0 deletions src/orbit_determination/orbit_determination.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ function istsa(sol::NEOSolution{T, T}) where {T <: AbstractFloat}
return length(sol.nights) < 3 || numberofdays(sol.nights) < 1
end

@doc raw"""
adaptative_maxsteps(radec::Vector{RadecMPC{T}}) where {T <: AbstractFloat}
Empirical upper bound for the number of steps used for propagation.
"""
function adaptative_maxsteps(radec::Vector{RadecMPC{T}}) where {T <: AbstractFloat}
#=
# Time difference [ms]
Δ_ms = getfield(date(radec[end]) - date(radec[1]), :value)
# Time difference [days]
Δ_day = Δ_ms / 86_400_000
# Adaptative maxsteps
if Δ_day <= 30
return 55 - floor(Int, 5*Δ_day/6)
else
return ceil(Int, (Δ_day + 360)/13)
end
=#
return 100
end

@doc raw"""
orbitdetermination(radec::Vector{RadecMPC{T}}, params::Parameters{T}) where {T <: AbstractFloat}
Expand Down
18 changes: 14 additions & 4 deletions src/orbit_determination/tooshortarc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,15 @@ function tryls(radec::Vector{RadecMPC{T}}, nights::Vector{ObservationNight{T}},

end

# Order in which to check nights in tooshortarc
function tsanightorder(x::ObservationNight{T}, y::ObservationNight{T}) where {T <: AbstractFloat}
if x.nobs == y.nobs
return x.date > y.date
else
return x.nobs > y.nobs
end
end

@doc raw"""
tooshortarc(radec::Vector{RadecMPC{T}}, nights::Vector{ObservationNight{T}},
params::Parameters{T}) where {T <: AbstractFloat}
Expand All @@ -438,13 +447,14 @@ over the admissible region.
"""
function tooshortarc(radec::Vector{RadecMPC{T}}, nights::Vector{ObservationNight{T}},
params::Parameters{T}) where {T <: AbstractFloat}



# Allocate memory for output
sol = zero(NEOSolution{T, T})
# Sort nights by tsanightorder
idxs = sortperm(nights, lt = tsanightorder)

# Iterate observation nights (in reverse temporal order)
for i in reverse(eachindex(nights))
# Iterate observation nights
for i in idxs
# Admissible region
A = AdmissibleRegion(nights[i])
# Center
Expand Down

0 comments on commit 5cef34b

Please sign in to comment.