ephem 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.tool-versions +1 -1
- data/CHANGELOG.md +121 -32
- data/README.md +81 -4
- data/benchmarks/run.rb +431 -0
- data/lib/ephem/cli.rb +26 -13
- data/lib/ephem/computation/chebyshev_polynomial.rb +63 -4
- data/lib/ephem/core/orientation.rb +118 -0
- data/lib/ephem/core/rotation.rb +82 -0
- data/lib/ephem/core/state.rb +5 -0
- data/lib/ephem/download.rb +33 -3
- data/lib/ephem/excerpt.rb +17 -12
- data/lib/ephem/io/binary_reader.rb +6 -4
- data/lib/ephem/io/daf.rb +18 -1
- data/lib/ephem/io/record_parser.rb +2 -2
- data/lib/ephem/io/summary_manager.rb +14 -15
- data/lib/ephem/pck.rb +118 -0
- data/lib/ephem/segments/base_segment.rb +25 -8
- data/lib/ephem/segments/chebyshev_type2.rb +142 -0
- data/lib/ephem/segments/orientation_group.rb +59 -0
- data/lib/ephem/segments/orientation_segment.rb +118 -0
- data/lib/ephem/segments/orientation_source.rb +17 -0
- data/lib/ephem/segments/position_group.rb +46 -0
- data/lib/ephem/segments/registry.rb +9 -3
- data/lib/ephem/segments/segment.rb +24 -224
- data/lib/ephem/segments/segment_group.rb +84 -0
- data/lib/ephem/spk.rb +20 -9
- data/lib/ephem/version.rb +1 -1
- data/lib/ephem.rb +9 -0
- metadata +27 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cef92715e68f52ead4e478fab7cdb01ea71a00fbff55dd8e48ad2367c5fd9148
|
|
4
|
+
data.tar.gz: 48ea29041ed2507a5f8365dd865fdb08b9c8fdc498b62e492e4f54fbf93db0ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3164cc106358b4e4289b9887cee06f810d3912493c61ad13dd18d258686a9b86ee640a51cadb42250e57208fd0e822f322b4a1af92dadab788028c2a996401b
|
|
7
|
+
data.tar.gz: 404dc6bd76f297938f12f3f24a3e1bd36477c32da3bb728bb19aa942a3ed82fb84cb28c99019b3103718580999c9f30eb833d65f9627b9f3a200802116452e47
|
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby
|
|
1
|
+
ruby 4.0.5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,99 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.0] - 2026-06-23
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- Read binary PCK (`DAF/PCK`) orientation kernels via `Ephem::PCK`, exposing a
|
|
8
|
+
body's Euler angles and rates over time (`angles_at`, `orientation_at`), the
|
|
9
|
+
foundation for DE440-grade lunar libration ([#76], [#80])
|
|
10
|
+
- Add `Ephem::Core::Orientation` (Euler angles + optional rates) and
|
|
11
|
+
`Ephem::Core::Rotation` (kernel-agnostic rotation-matrix helpers), plus
|
|
12
|
+
`Orientation#to_matrix` / `OrientationSegment#matrix_at` for the built-in
|
|
13
|
+
3-1-3 (Z-X-Z) reference→body convention
|
|
14
|
+
- Excerpt and the `excerpt` CLI now support binary PCK kernels, detecting the
|
|
15
|
+
kernel kind automatically
|
|
16
|
+
- Download binary PCK lunar orientation kernels from NAIF via `Ephem::Download`
|
|
17
|
+
- Add `#inspect` and `#to_s` to `State` for easier debugging ([#67])
|
|
18
|
+
|
|
19
|
+
### Improvements
|
|
20
|
+
|
|
21
|
+
- Route queries to the covering segment when a body/pair spans multiple
|
|
22
|
+
time-split segments (SPK and PCK), with no overhead for single-segment keys
|
|
23
|
+
- Share the type-2 Chebyshev machinery between SPK and PCK segments
|
|
24
|
+
- Evaluate position and velocity in a single Chebyshev pass
|
|
25
|
+
(`ChebyshevPolynomial.evaluate_with_derivative`), speeding up every state /
|
|
26
|
+
orientation query (`compute_and_differentiate`, `state_at`, `orientation_at`)
|
|
27
|
+
with bit-for-bit identical results
|
|
28
|
+
- Correct the documented velocity unit to km/day (the actual, validated value)
|
|
29
|
+
- Remove the `numo-narray` dependency ([#65])
|
|
30
|
+
- Skip derivative evaluation in `Segment#compute` ([#57])
|
|
31
|
+
- Hoist loop-invariant `t2` computation in Chebyshev evaluation ([#58])
|
|
32
|
+
- Cache the `RecordParser` instance in `SummaryManager` ([#63])
|
|
33
|
+
- Eliminate a redundant `read_record` call in `SummaryManager` ([#62])
|
|
34
|
+
- Replace duplicated endianness format lookups with shared constants ([#64])
|
|
35
|
+
- Replace `instance_variable_get` with proper `attr_reader`s in `Excerpt`
|
|
36
|
+
([#66])
|
|
37
|
+
- Use separate error margins for position and velocity validation ([#61])
|
|
38
|
+
- Add a comprehensive benchmark suite ([#68])
|
|
39
|
+
- Upgrade default Ruby to 4.0.5 ([#81])
|
|
40
|
+
- Match SPICE last-loaded-wins precedence for overlapping segments ([#83])
|
|
41
|
+
- Add a dedicated spec for the shared type-2 Chebyshev evaluation ([#84])
|
|
42
|
+
- Bump standard from 1.50.0 to 1.55.0 by @dependabot ([#45], [#46], [#56],
|
|
43
|
+
[#78])
|
|
44
|
+
- Bump actions/checkout from 4 to 7 by @dependabot ([#44], [#52], [#79])
|
|
45
|
+
- Bump rake from 13.3.0 to 13.4.2 by @dependabot ([#48], [#73])
|
|
46
|
+
- Bump zlib from 3.2.1 to 3.2.3 by @dependabot ([#49], [#70])
|
|
47
|
+
- Bump rspec from 3.13.1 to 3.13.2 by @dependabot ([#47])
|
|
48
|
+
- Bump parallel from 1.27.0 to 1.28.0 by @dependabot ([#71])
|
|
49
|
+
- Bump benchmark-ips from 2.14.0 to 2.15.1 by @dependabot ([#75])
|
|
50
|
+
- Bump json from 2.18.1 to 2.19.2 by @dependabot ([#77])
|
|
51
|
+
|
|
52
|
+
### Bug fixes
|
|
53
|
+
|
|
54
|
+
- Fix `compute_and_differentiate` returning mismatched velocities for an array
|
|
55
|
+
of times
|
|
56
|
+
- Fix precision loss in `time_to_seconds` for dates far from J2000 ([#60])
|
|
57
|
+
|
|
58
|
+
[#44]: https://github.com/rhannequin/ruby-ephem/pull/44
|
|
59
|
+
[#45]: https://github.com/rhannequin/ruby-ephem/pull/45
|
|
60
|
+
[#46]: https://github.com/rhannequin/ruby-ephem/pull/46
|
|
61
|
+
[#47]: https://github.com/rhannequin/ruby-ephem/pull/47
|
|
62
|
+
[#48]: https://github.com/rhannequin/ruby-ephem/pull/48
|
|
63
|
+
[#49]: https://github.com/rhannequin/ruby-ephem/pull/49
|
|
64
|
+
[#52]: https://github.com/rhannequin/ruby-ephem/pull/52
|
|
65
|
+
[#56]: https://github.com/rhannequin/ruby-ephem/pull/56
|
|
66
|
+
[#57]: https://github.com/rhannequin/ruby-ephem/pull/57
|
|
67
|
+
[#58]: https://github.com/rhannequin/ruby-ephem/pull/58
|
|
68
|
+
[#60]: https://github.com/rhannequin/ruby-ephem/pull/60
|
|
69
|
+
[#61]: https://github.com/rhannequin/ruby-ephem/pull/61
|
|
70
|
+
[#62]: https://github.com/rhannequin/ruby-ephem/pull/62
|
|
71
|
+
[#63]: https://github.com/rhannequin/ruby-ephem/pull/63
|
|
72
|
+
[#64]: https://github.com/rhannequin/ruby-ephem/pull/64
|
|
73
|
+
[#65]: https://github.com/rhannequin/ruby-ephem/pull/65
|
|
74
|
+
[#66]: https://github.com/rhannequin/ruby-ephem/pull/66
|
|
75
|
+
[#67]: https://github.com/rhannequin/ruby-ephem/pull/67
|
|
76
|
+
[#68]: https://github.com/rhannequin/ruby-ephem/pull/68
|
|
77
|
+
[#70]: https://github.com/rhannequin/ruby-ephem/pull/70
|
|
78
|
+
[#71]: https://github.com/rhannequin/ruby-ephem/pull/71
|
|
79
|
+
[#73]: https://github.com/rhannequin/ruby-ephem/pull/73
|
|
80
|
+
[#75]: https://github.com/rhannequin/ruby-ephem/pull/75
|
|
81
|
+
[#76]: https://github.com/rhannequin/ruby-ephem/issues/76
|
|
82
|
+
[#77]: https://github.com/rhannequin/ruby-ephem/pull/77
|
|
83
|
+
[#78]: https://github.com/rhannequin/ruby-ephem/pull/78
|
|
84
|
+
[#79]: https://github.com/rhannequin/ruby-ephem/pull/79
|
|
85
|
+
[#80]: https://github.com/rhannequin/ruby-ephem/pull/80
|
|
86
|
+
[#81]: https://github.com/rhannequin/ruby-ephem/pull/81
|
|
87
|
+
[#83]: https://github.com/rhannequin/ruby-ephem/pull/83
|
|
88
|
+
[#84]: https://github.com/rhannequin/ruby-ephem/pull/84
|
|
89
|
+
|
|
90
|
+
**Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.4.1...v0.5.0
|
|
91
|
+
|
|
3
92
|
## [0.4.1] - 2025-08-03
|
|
4
93
|
|
|
5
94
|
### Improvements
|
|
6
95
|
|
|
7
|
-
|
|
96
|
+
- Exclude BSP files from release ([#42])
|
|
8
97
|
|
|
9
98
|
[#42]: https://github.com/rhannequin/ruby-ephem/pull/42
|
|
10
99
|
|
|
@@ -14,13 +103,13 @@
|
|
|
14
103
|
|
|
15
104
|
### Improvements
|
|
16
105
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
106
|
+
- Improve Chebyshev polynomial performance ([#33])
|
|
107
|
+
- Improve download file management ([#34])
|
|
108
|
+
- Validate against all kernels and date ranges ([#36])
|
|
109
|
+
- Add supported Ruby versions ([#35])
|
|
110
|
+
- Bump rspec from 3.13.0 to 3.13.1 by @dependabot ([#38])
|
|
111
|
+
- Bump rake from 13.2.1 to 13.3.0 by @dependabot ([#39])
|
|
112
|
+
- Bump csv from 3.3.4 to 3.3.5 by @dependabot ([#40])
|
|
24
113
|
|
|
25
114
|
[#33]: https://github.com/rhannequin/ruby-ephem/pull/33
|
|
26
115
|
[#34]: https://github.com/rhannequin/ruby-ephem/pull/34
|
|
@@ -36,15 +125,15 @@
|
|
|
36
125
|
|
|
37
126
|
### Bug fixes
|
|
38
127
|
|
|
39
|
-
|
|
128
|
+
- Write downloaded ephemeris in binary mode by @trevorturk ([#31])
|
|
40
129
|
|
|
41
130
|
### Improvements
|
|
42
131
|
|
|
43
|
-
|
|
132
|
+
- Bump standard from 1.49.0 to 1.50.0 by @dependabot ([#29])
|
|
44
133
|
|
|
45
134
|
### New Contributors
|
|
46
135
|
|
|
47
|
-
|
|
136
|
+
- @trevorturk made their first contribution in [#31]
|
|
48
137
|
|
|
49
138
|
**Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.3.0...v0.3.1
|
|
50
139
|
|
|
@@ -55,15 +144,15 @@
|
|
|
55
144
|
|
|
56
145
|
## Features
|
|
57
146
|
|
|
58
|
-
|
|
59
|
-
|
|
147
|
+
- Improve find_interval with binary search ([#24])
|
|
148
|
+
- Use alias methods to get segment position or state ([#27])
|
|
60
149
|
|
|
61
150
|
## Improvements
|
|
62
151
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
152
|
+
- Bump irb from 1.15.1 to 1.15.2 by @dependabot ([#21])
|
|
153
|
+
- Bump standard from 1.47.0 to 1.49.0 by @dependabot ([#23])
|
|
154
|
+
- Bump csv from 3.3.3 to 3.3.4 by @dependabot ([#25])
|
|
155
|
+
- Bump parallel from 1.26.3 to 1.27.0 by @dependabot ([#26])
|
|
67
156
|
|
|
68
157
|
**Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.2.0...v0.3.0
|
|
69
158
|
|
|
@@ -78,27 +167,27 @@
|
|
|
78
167
|
|
|
79
168
|
### Features
|
|
80
169
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
170
|
+
- Simplify download ([#12])
|
|
171
|
+
- SPK excerpt generator ([#13])
|
|
172
|
+
- Improve documentation on excerpts ([#16])
|
|
173
|
+
- IMCCE INPOP support ([#20])
|
|
85
174
|
|
|
86
175
|
### Improvements
|
|
87
176
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
177
|
+
- Add Dependabot ([#6])
|
|
178
|
+
- Replace testing kernel ([#17])
|
|
179
|
+
- Add `irb` to dev dependencies ([#14])
|
|
180
|
+
- Add support for Rubies `3.2.7` and `3.4.2` ([#15])
|
|
181
|
+
- Bump csv from 3.3.0 to 3.3.2 by @dependabot ([#7])
|
|
182
|
+
- Bump standard from 1.43.0 to 1.44.0 by @dependabot ([#8])
|
|
183
|
+
- Bump standard from 1.44.0 to 1.45.0 by @dependabot ([#9])
|
|
184
|
+
- Bump csv from 3.3.2 to 3.3.3 by @dependabot ([#11])
|
|
185
|
+
- Bump standard from 1.45.0 to 1.47.0 by @dependabot ([#10])
|
|
186
|
+
- Bump json from 2.10.1 to 2.10.2 by @dependabot ([#18])
|
|
98
187
|
|
|
99
188
|
### New Contributors
|
|
100
189
|
|
|
101
|
-
|
|
190
|
+
- @dependabot made their first contribution in [#7]
|
|
102
191
|
|
|
103
192
|
**Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.1.0...v0.2.0
|
|
104
193
|
|
data/README.md
CHANGED
|
@@ -12,8 +12,9 @@ These files are a collection of numerical integrations of the equations of
|
|
|
12
12
|
motion of the Solar System, used to calculate the positions of the planets,
|
|
13
13
|
the Moon, and other celestial bodies with high precision.
|
|
14
14
|
|
|
15
|
-
Ephem
|
|
16
|
-
|
|
15
|
+
Ephem supports planetary ephemerides like DE421, DE430, INPOP19A, etc. (SPK),
|
|
16
|
+
as well as binary PCK orientation kernels such as the lunar orientation kernel
|
|
17
|
+
`moon_pa_de440_200625.bpc`.
|
|
17
18
|
|
|
18
19
|
The library is in high development mode and does not have a stable version yet.
|
|
19
20
|
The API is subject to major changes at the moment, please keep that in mind if
|
|
@@ -99,6 +100,67 @@ puts "Velocity: #{state.velocity}"
|
|
|
99
100
|
# The velocity is expressed in km/day
|
|
100
101
|
```
|
|
101
102
|
|
|
103
|
+
## Orientation kernels (binary PCK)
|
|
104
|
+
|
|
105
|
+
Binary PCK (`DAF/PCK`) kernels store the orientation of a body frame over time
|
|
106
|
+
as Euler angles, rather than position. The most common use is the Moon's
|
|
107
|
+
physical libration via a lunar orientation kernel such as
|
|
108
|
+
`moon_pa_de440_200625.bpc`.
|
|
109
|
+
|
|
110
|
+
```rb
|
|
111
|
+
# Download and load a binary PCK orientation kernel
|
|
112
|
+
Ephem::Download.call(
|
|
113
|
+
name: "moon_pa_de440_200625.bpc",
|
|
114
|
+
target: "tmp/moon_pa_de440_200625.bpc"
|
|
115
|
+
)
|
|
116
|
+
pck = Ephem::PCK.open("tmp/moon_pa_de440_200625.bpc")
|
|
117
|
+
|
|
118
|
+
puts pck
|
|
119
|
+
# => PCK file with 2 segments:
|
|
120
|
+
# 1549-12-21..2426-02-16 Type 2 orientation of frame 31008 relative to frame 1
|
|
121
|
+
# 2426-02-16..2650-01-25 Type 2 orientation of frame 31008 relative to frame 1
|
|
122
|
+
|
|
123
|
+
# Query a body frame by its NAIF frame ID (31008 = MOON_PA_DE440).
|
|
124
|
+
# The time is expressed in Julian Date (TDB).
|
|
125
|
+
frame = pck[31008]
|
|
126
|
+
orientation = frame.orientation_at(2451545.0)
|
|
127
|
+
|
|
128
|
+
# The three classical 3-1-3 (Z-X-Z) Euler angles, in radians
|
|
129
|
+
puts "phi: #{orientation.phi}"
|
|
130
|
+
puts "theta: #{orientation.theta}"
|
|
131
|
+
puts "psi: #{orientation.psi}"
|
|
132
|
+
|
|
133
|
+
# Rates are in radians/day (ephem's per-day convention, like SPK velocities)
|
|
134
|
+
puts "rates: #{orientation.rates.inspect}"
|
|
135
|
+
|
|
136
|
+
# Use #angles_at when you do not need the rates (it skips the derivative)
|
|
137
|
+
angles = frame.angles_at(2451545.0)
|
|
138
|
+
|
|
139
|
+
pck.close
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Building the body-fixed frame
|
|
143
|
+
|
|
144
|
+
The orientation maps the reference frame into the body-fixed frame through the
|
|
145
|
+
3-1-3 (Z-X-Z) Euler sequence `M = Rz(psi) * Rx(theta) * Rz(phi)`. That
|
|
146
|
+
convention is built in, so you can get the rotation matrix directly:
|
|
147
|
+
|
|
148
|
+
```rb
|
|
149
|
+
# Straight from a frame, at a given time
|
|
150
|
+
matrix = frame.matrix_at(2451545.0)
|
|
151
|
+
|
|
152
|
+
# ...or from an Orientation you already have
|
|
153
|
+
matrix = orientation.to_matrix
|
|
154
|
+
|
|
155
|
+
# Project a geocentric Earth->Moon vector into the body-fixed frame
|
|
156
|
+
body_fixed = Ephem::Core::Rotation.apply(matrix, earth_to_moon)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
`Ephem::Core::Rotation` also exposes the lower-level, kernel-agnostic building
|
|
160
|
+
blocks (`about_x`, `about_y`, `about_z`, `multiply`, `apply`) if you need a
|
|
161
|
+
different axis order or an additional fixed rotation (such as the PA -> ME
|
|
162
|
+
offset, whose constants the consumer supplies).
|
|
163
|
+
|
|
102
164
|
## CLI
|
|
103
165
|
|
|
104
166
|
The gem also provides a CLI to generate an excerpt from an original kernel file.
|
|
@@ -121,6 +183,13 @@ While DE440s originally supports 14 segments from 1849 to 2150 with a size of
|
|
|
121
183
|
Not only the excerpt is smaller, but most importantly it is way more
|
|
122
184
|
efficient to parse and to use in your application.
|
|
123
185
|
|
|
186
|
+
The input kernel kind (SPK or binary PCK) is detected automatically, so the
|
|
187
|
+
same command excerpts orientation kernels too:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
ruby-ephem excerpt --targets 31008 2000-01-01 2030-01-01 /path/to/moon_pa_de440.bpc moon_excerpt.bpc
|
|
191
|
+
```
|
|
192
|
+
|
|
124
193
|
## Accuracy
|
|
125
194
|
|
|
126
195
|
Data from this library has been tested against the Python library [jplephem]
|
|
@@ -136,8 +205,8 @@ The times tested are noon UTC for every day between 2000-01-01 and
|
|
|
136
205
|
2050-01-01. Vectors tested are always with `center` 0 (Solar System Barycenter),
|
|
137
206
|
and `target` from `1` (Mercury Barycenter) to `10` (Sun).
|
|
138
207
|
|
|
139
|
-
Rake tasks ensure data from this library match with `jplephem
|
|
140
|
-
|
|
208
|
+
Rake tasks ensure data from this library match with `jplephem`. Positions match
|
|
209
|
+
exactly and velocities are within 0.002 mm/s.
|
|
141
210
|
|
|
142
211
|
You can run them by following this pattern:
|
|
143
212
|
|
|
@@ -159,6 +228,14 @@ usage time.
|
|
|
159
228
|
|
|
160
229
|
[jplephem]: https://pypi.org/project/jplephem/
|
|
161
230
|
|
|
231
|
+
## Benchmarks
|
|
232
|
+
|
|
233
|
+
Run the benchmark suite to measure performance across the computation pipeline:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
bundle exec ruby benchmarks/run.rb
|
|
237
|
+
```
|
|
238
|
+
|
|
162
239
|
## Development
|
|
163
240
|
|
|
164
241
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|