Skip to content

Commit 9d0766d

Browse files
Merge pull request #46 from JuliaSpaceMissionDesign/dev
Update to v1.2.1
2 parents 63232cf + 879aa50 commit 9d0766d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1894
-189
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
- push
44
- pull_request
55
env:
6-
JULIA_NUM_THREADS: 1
6+
JULIA_NUM_THREADS: 4
77
jobs:
88
test:
99
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}

Artifacts.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[testdata]
2-
git-tree-sha1 = "b58880275ed655c31bcb6be63df686bc1539af6e"
3-
lazy = true
2+
git-tree-sha1 = "d97cce4a3c744330b363c292097a96a1aab69e6d"
3+
lazy = true
44

55
[[testdata.download]]
6-
sha256 = "4fc7a9ef011b2f90379f5129e3015d30ff313dd0493724cec5c55fc560180e13"
7-
url = "https://gist.github.com/MicheleCeresoli/ff9f8eeea149022b32979e94ef969d96/raw/b58880275ed655c31bcb6be63df686bc1539af6e.tar.gz"
6+
sha256 = "4d8ca82289ffe9161cdb49b68b0a373b472fc393255544d5d43ca6ead1774baa"
7+
url = "https://gist.github.com/MicheleCeresoli/141622fbf94e6da4c9fec7ff815192da/raw/d97cce4a3c744330b363c292097a96a1aab69e6d.tar.gz"

Project.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
name = "Ephemerides"
22
uuid = "6a9c3322-c8fe-4c26-8ad6-14a6f8acd2a0"
33
authors = ["JSMD Team"]
4-
version = "1.2.0"
4+
version = "1.2.1"
55

66
[deps]
77
JSMDInterfaces = "6b30ee2f-618e-4a15-bf4e-7df7b496e609"
88
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
99
Mmap = "a63ad114-7e13-5084-954f-fe012c677804"
1010
PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
1111
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
12-
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
12+
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
1313

1414
[compat]
1515
JSMDInterfaces = "1.4"
1616
LazyArtifacts = "1"
1717
PreallocationTools = "0.4"
1818
PrecompileTools = "1"
19-
StaticArrays = "1"
19+
StaticArraysCore = "1.4"
2020
julia = "1.7"
2121

2222
[extras]

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ angles = ephem_rotation3(eph, 1, 31006, time)
6767
```
6868

6969
## Current Limitations
70-
- The supported JPL binary SPK/PCK segments types are: 1, 2, 3, 8, 9, 12, 13, 14, 18, 19, 20, 21.
70+
- The supported JPL binary SPK/PCK segments types are: 1, 2, 3, 5, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 21.
7171
- Binary INPOP kernels are not supported.
72-
- Acceleration and jerk computations are natively unavailable for SPK segments of type 1 and 21, but can be computed with Automatic Differentiation (AD) of the position and velocity components.
72+
- Acceleration and jerk computations are natively unavailable for SPK segments of type 1, 5, 15, 17 and 21, but can be computed with Automatic Differentiation (AD) of the position and velocity components.
7373

7474
## Documentation
7575
For further information on this package please refer to the [stable documentation](https://juliaspacemissiondesign.github.io/Ephemerides.jl/stable/)

docs/src/api/lapi.md

+35-2
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ Ephemerides.SPKSegmentCache2
125125
Ephemerides.SPKSegmentType2
126126
```
127127

128+
### SPK Type 5
129+
```@docs
130+
Ephemerides.SPKSegmentHeader5
131+
Ephemerides.SPKSegmentCache5
132+
Ephemerides.SPKSegmentType5
133+
```
134+
128135
### SPK Type 8 and 12
129136
```@docs
130137
Ephemerides.SPKSegmentHeader8
@@ -148,6 +155,27 @@ Ephemerides.SPKSegmentType14
148155
!!! note
149156
SPK segments of type 14 have the same cache structure of SPK type 2 and 3.
150157

158+
159+
### SPK Type 15
160+
```@docs
161+
Ephemerides.SPKSegmentHeader15
162+
Ephemerides.SPKSegmentType15
163+
```
164+
165+
!!! note
166+
The cache of SPK Type 15 segments is made of [`Ephemerides.TwoBodyUniversalCache`](@ref) objects.
167+
168+
169+
### SPK Type 17
170+
```@docs
171+
Ephemerides.SPKSegmentHeader17
172+
Ephemerides.SPKSegmentType17
173+
```
174+
175+
!!! note
176+
SPK segments of type 17 do not require a cache structure.
177+
178+
151179
### SPK Type 18 and 19
152180
```@docs
153181
Ephemerides.SPKSegmentHeader18
@@ -181,8 +209,6 @@ Ephemerides.find_logical_record
181209
Ephemerides.get_coefficients!
182210
```
183211

184-
### Parsing
185-
186212
## Interpolating Functions
187213

188214
### Caches
@@ -227,5 +253,12 @@ Ephemerides.final_times
227253
Ephemerides.analyse_timespan
228254
```
229255

256+
## TwoBody Routines
257+
```@docs
258+
Ephemerides.TwoBodyUniversalCache
259+
Ephemerides.update_cache!
260+
Ephemerides.propagate_twobody
261+
Ephemerides.stumpff
262+
```
230263

231264

docs/src/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@ angles = ephem_rotation3(eph, 1, 31006, time)
6262
```
6363

6464
## Current Limitations
65-
- The supported JPL binary SPK/PCK segments types are: 1, 2, 3, 8, 9, 12, 13, 14, 18, 19, 20, 21.
65+
- The supported JPL binary SPK/PCK segments types are: 1, 2, 3, 5, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, 21.
6666
- Binary INPOP kernels are not supported.
67-
- Acceleration and jerk computations are unavailable for SPK segments of type 1 and 21.
67+
- Acceleration and jerk computations are unavailable for SPK segments of type 1, 5, 15, 17 and 21.

docs/src/tutorials/load.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This tutorial will walk you through the basic features and interfaces that allow you to load binary ephemeris kernels.
44

5-
The supported sources of ephemerides are currently limited to binary PCK and SPK segments of type: 1, 2, 3, 8, 9, 12, 13, 18, 19, 20 and 21.
5+
The supported sources of ephemerides are currently limited to binary PCK and SPK segments of type: 1, 2, 3, 5, 8, 9, 12, 13, 14, 15, 17, 18, 19, 20, and 21.
66

77
!!! note
88
Support for IMCCE INPOP ephemerides is yet to be implemented.

docs/src/tutorials/position.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pvaj = ephem_vector12(eph, 3, 399, 0)
5050
In all these examples, the returned data is always in the form of a `StaticArray` in order to minimise memory allocations.
5151

5252
!!! warning
53-
SPK segments of types 1 and 21 do not natively support acceleration and jerk computations. However, these values can be computed by Automatic Differentiation (AD) of the position and/or velocity components.
53+
SPK segments of types 1 5, 15, 17 and 21 do not natively support acceleration and jerk computations. However, these values can be computed by Automatic Differentiation (AD) of the position and/or velocity components.
5454

5555

5656
## Computing orientation angles

src/Ephemerides.jl

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using LazyArtifacts
55
using Mmap
66
using PreallocationTools
77
using PrecompileTools: PrecompileTools
8-
using StaticArrays
8+
using StaticArraysCore
99

1010
import JSMDInterfaces.Ephemeris as jEph
1111

@@ -18,6 +18,9 @@ include("interp/hermite.jl")
1818
include("interp/lagrange.jl")
1919
include("interp/chebyshev.jl")
2020

21+
# Twobody utilities
22+
include("twobody.jl")
23+
2124
# SPK segment types definitions
2225
include("spk/spktypes.jl")
2326

@@ -27,9 +30,12 @@ include("daf.jl")
2730
# SPK segments implementations
2831
include("spk/spk1.jl")
2932
include("spk/spk2.jl")
33+
include("spk/spk5.jl")
3034
include("spk/spk8.jl")
3135
include("spk/spk9.jl")
3236
include("spk/spk14.jl")
37+
include("spk/spk15.jl")
38+
include("spk/spk17.jl")
3339
include("spk/spk18.jl")
3440
include("spk/spk19.jl")
3541
include("spk/spk20.jl")

src/daf.jl

+15-6
Original file line numberDiff line numberDiff line change
@@ -588,25 +588,34 @@ function create_spk_segment(daf::DAF, desc::DAFSegmentDescriptor)
588588

589589
mapped_spktype = SPK_SEGMENTLIST_MAPPING[segment_type(desc)]
590590
if mapped_spktype == 1
591-
SPKSegmentType1(daf, desc)
591+
SPKSegmentType2(daf, desc)
592592

593593
elseif mapped_spktype == 2
594-
SPKSegmentType2(daf, desc)
594+
SPKSegmentType9(daf, desc)
595595

596596
elseif mapped_spktype == 3
597-
SPKSegmentType8(daf, desc)
597+
SPKSegmentType1(daf, desc)
598598

599599
elseif mapped_spktype == 4
600-
SPKSegmentType9(daf, desc)
600+
SPKSegmentType14(daf, desc)
601601

602602
elseif mapped_spktype == 5
603-
SPKSegmentType14(daf, desc)
603+
SPKSegmentType15(daf, desc)
604604

605605
elseif mapped_spktype == 6
606+
SPKSegmentType8(daf, desc)
607+
608+
elseif mapped_spktype == 7
606609
SPKSegmentType19(daf, desc)
607610

608-
else
611+
elseif mapped_spktype == 8
609612
SPKSegmentType20(daf, desc)
613+
614+
elseif mapped_spktype == 9
615+
SPKSegmentType5(daf, desc)
616+
617+
else
618+
SPKSegmentType17(daf, desc)
610619
end
611620

612621
end

src/precompile.jl

+16-13
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ PrecompileTools.@setup_workload begin
44
test_dir = artifact"testdata"
55

66
spks = [
7-
"example1spk_seg1.bsp",
8-
"example1spk_seg2.bsp",
9-
"example1spk_seg3.bsp",
10-
"example1spk_seg8.bsp",
11-
"example1spk_seg9.bsp",
12-
"example1spk_seg12.bsp",
13-
"example1spk_seg13.bsp",
14-
"example1spk_seg14.bsp",
15-
"example1spk_seg18.bsp",
16-
"example1spk_seg19.bsp",
17-
"example1spk_seg20.bsp",
18-
"example1spk_seg21.bsp",
7+
"spk1_ex1.bsp",
8+
"spk2_ex1.bsp",
9+
"spk3_ex1.bsp",
10+
"spk5_ex1.bsp",
11+
"spk8_ex1.bsp",
12+
"spk9_ex1.bsp",
13+
"spk12_ex1.bsp",
14+
"spk13_ex1.bsp",
15+
"spk14_ex1.bsp",
16+
"spk15_ex1.bsp",
17+
"spk17_ex1.bsp",
18+
"spk18_ex1.bsp",
19+
"spk19_ex1.bsp",
20+
"spk20_ex1.bsp",
21+
"spk21_ex1.bsp",
1922
]
2023

2124
pcks = [
@@ -37,7 +40,7 @@ PrecompileTools.@setup_workload begin
3740
_ = ephem_vector3(ephj, cid, tid, tj);
3841
_ = ephem_vector6(ephj, cid, tid, tj);
3942

40-
if !(segment_type(desc) in (1, 21))
43+
if !(segment_type(desc) in (1, 5, 15, 17, 21))
4144
_ = ephem_vector9(ephj, cid, tid, tj);
4245
_ = ephem_vector12(ephj, cid, tid, tj);
4346
end

src/spk/spk1.jl

+18-18
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ Initialise the cache for an SPK segment of type 1.
5858
"""
5959
function SPKSegmentCache1(head::SPKSegmentHeader1)
6060
SPKSegmentCache1(
61-
Int[0.0], zeros(head.maxdim), zeros(3), zeros(3), zeros(head.maxdim, 3),
62-
Int[0.0], zeros(Int, 3), MVector(-1),
61+
0.0, zeros(head.maxdim), zeros(3), zeros(3), zeros(head.maxdim, 3),
62+
0, zeros(Int, 3), -1,
6363
DiffCache(zeros(head.maxdim-1)), DiffCache(zeros(head.maxdim-2)),
6464
DiffCache(zeros(head.maxdim+2)), DiffCache(zeros(3))
6565
)
@@ -89,7 +89,7 @@ function spk_vector3(daf::DAF, seg::SPKSegmentType1, time::Number)
8989
# Retrieve the MDA coefficients
9090
get_coefficients!(daf, header(seg), cache(seg), index)
9191

92-
Δ = time - cache(seg).tl[1]
92+
Δ = time - cache(seg).tl
9393

9494
# Compute MDA position coefficients
9595
compute_mda_pos_coefficients!(cache(seg), Δ)
@@ -105,7 +105,7 @@ function spk_vector6(daf::DAF, seg::SPKSegmentType1, time::Number)
105105
# Retrieve the MDA coefficients
106106
get_coefficients!(daf, header(seg), cache(seg), index)
107107

108-
Δ = time - cache(seg).tl[1]
108+
Δ = time - cache(seg).tl
109109

110110
# Compute MDA position coefficients
111111
compute_mda_pos_coefficients!(cache(seg), Δ)
@@ -115,10 +115,10 @@ function spk_vector6(daf::DAF, seg::SPKSegmentType1, time::Number)
115115
compute_mda_vel_coefficients!(cache(seg), Δ)
116116
vel = compute_mda_velocity(cache(seg), Δ)
117117

118-
return @inbounds SA[
118+
return @inbounds SVector{6}(
119119
pos[1], pos[2], pos[3],
120120
vel[1], vel[2], vel[3]
121-
]
121+
)
122122
end
123123

124124
function spk_vector9(::DAF, ::SPKSegmentType1, ::Number)
@@ -179,12 +179,12 @@ function get_coefficients!(daf::DAF, head::SPKSegmentHeader1, cache::SPKSegmentC
179179
index::Int)
180180

181181
# Check whether the coefficients for this record are already loaded
182-
index == cache.id[1] && return nothing
183-
cache.id[1] = index
182+
index == cache.id && return nothing
183+
cache.id = index
184184

185185
# Initial record address
186186
i0 = 8*(head.iaa - 1) + 8*head.recsize*index
187-
cache.tl[1] = get_float(array(daf), i0, endian(daf))
187+
cache.tl = get_float(array(daf), i0, endian(daf))
188188

189189
@inbounds for k = 1:head.maxdim
190190
cache.g[k] = get_float(array(daf), i0 + 8k, endian(daf))
@@ -207,7 +207,7 @@ function get_coefficients!(daf::DAF, head::SPKSegmentHeader1, cache::SPKSegmentC
207207
end
208208

209209
i4 = i3 + 3*head.maxdim*8
210-
cache.kqmax[1] = Int(get_float(array(daf), i4, endian(daf)))
210+
cache.kqmax = Int(get_float(array(daf), i4, endian(daf)))
211211

212212
@inbounds for j = 1:3
213213
cache.kq[j] = get_float(array(daf), i4 + 8j, endian(daf))
@@ -228,11 +228,11 @@ function compute_mda_position(cache::SPKSegmentCache1, Δ::Number)
228228
end
229229

230230
# At this point by definition of the above while loop, ks will always be = 1
231-
return SA[
231+
return SVector{3}(
232232
cache.refpos[1] + Δ*(cache.refvel[1] + Δ*get_tmp(cache.vct, Δ)[1]),
233233
cache.refpos[2] + Δ*(cache.refvel[2] + Δ*get_tmp(cache.vct, Δ)[2]),
234234
cache.refpos[3] + Δ*(cache.refvel[3] + Δ*get_tmp(cache.vct, Δ)[3])
235-
]
235+
)
236236

237237
end
238238

@@ -249,11 +249,11 @@ function compute_mda_velocity(cache::SPKSegmentCache1, Δ::Number)
249249
end
250250

251251
# At this point by definition of the above while loop, ks will always be = 0
252-
return SA[
252+
return SVector{3}(
253253
cache.refvel[1] + Δ*get_tmp(cache.vct, Δ)[1],
254254
cache.refvel[2] + Δ*get_tmp(cache.vct, Δ)[2],
255255
cache.refvel[3] + Δ*get_tmp(cache.vct, Δ)[3]
256-
]
256+
)
257257

258258
end
259259

@@ -262,8 +262,8 @@ end
262262
@inbounds function compute_mda_pos_coefficients!(cache::SPKSegmentCache1, Δ::Number)
263263

264264
tp = Δ
265-
mq2 = cache.kqmax[1] - 2
266-
ks = cache.kqmax[1] - 1
265+
mq2 = cache.kqmax - 2
266+
ks = cache.kqmax - 1
267267

268268
get_tmp(cache.fc, Δ)[1] = 1.0
269269
for j = 1:mq2
@@ -273,7 +273,7 @@ end
273273
end
274274

275275
# compute inverse coefficients
276-
for j = 1:cache.kqmax[1]
276+
for j = 1:cache.kqmax
277277
get_tmp(cache.w, Δ)[j] = 1.0 / j
278278
end
279279

@@ -297,7 +297,7 @@ end
297297
# This function is such that the output ks = 0
298298
@inbounds function compute_mda_vel_coefficients!(cache::SPKSegmentCache1, Δ::Number)
299299

300-
for j = 1:cache.kqmax[1]
300+
for j = 1:cache.kqmax
301301
get_tmp(cache.w, Δ)[j+1] = get_tmp(cache.fc, Δ)[j+1]*get_tmp(cache.w, Δ)[j] - get_tmp(cache.wc, Δ)[j]*get_tmp(cache.w, Δ)[j+1]
302302
end
303303

0 commit comments

Comments
 (0)