ephem 0.4.1 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1c6e88ad1dcd62c35cc6e4cff28ee9f119f85480714927a93de144ee27fb999
4
- data.tar.gz: 7bc8cb949dac93e4e5aab30624144033323ca8e1e7d337d64cfcb92186dac68e
3
+ metadata.gz: 7d73289c3e0cfb6ad800b9c2af244185312811fa7b5ea63dc30c582da5f4ae7b
4
+ data.tar.gz: f24bc11328aac562da963675d3226e9d28747757404299b8756ffab601e22e10
5
5
  SHA512:
6
- metadata.gz: 946a9bec06bb68047fde60fed001516e4dc735b7f18869bcf52aca60ce4d1a8c7335c8f679e4dfb7c8ebc248a5cbdff1781876e0882729bd8ce8e3b77692ff8a
7
- data.tar.gz: df5949acbd246409f664a2188256652808cd2f9e2aa50c3ea6362a9db19ea7cad89e4d7597bbe34429e5acd6e13556d6b776d0119ec14835fa1db378e5c24dc2
6
+ metadata.gz: a29be8a6fd73f95139d0121812913801edc7a108d481cdcae010a775056cffd76d0b9cc57f1f816fd29f3db7cd56d5e2ffb6fd0ebca2ddf8fdea55d383f5aa80
7
+ data.tar.gz: f6d84d22be037c7c0822b8e2bfaea1c2dc2b6d9483354fa4a2b38d22bd0819d95ebdcd80fa4f949b1a92159a78c419a60963f08f344cbf3ada53763935727646
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.4.1
1
+ ruby 4.0.5
data/CHANGELOG.md CHANGED
@@ -1,10 +1,127 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.1] - 2026-11-24
4
+
5
+ ### Improvements
6
+
7
+ - Replace the `minitar` dependency with RubyGems' built-in tar reader, which
8
+ clears the GHSA-r6vf-943r-2wvw advisory reported by `bundle audit` while
9
+ keeping Ruby 3.0 support ([#88])
10
+ - Copy IMCCE kernels out of their archive in chunks instead of reading them
11
+ into memory whole ([#89])
12
+ - Pin CI runners to Ubuntu 24.04 ([#86])
13
+
14
+ ### Bug fixes
15
+
16
+ - `Ephem::Download` raises `Ephem::DownloadError` on HTTP errors instead of
17
+ saving the error page as the kernel ([#87], [#89])
18
+ - `Ephem::Download` raises `Ephem::DownloadError` when an IMCCE archive does
19
+ not contain the requested kernel, instead of returning without writing a
20
+ file ([#87], [#89])
21
+ - A failed or interrupted download no longer leaves a partial file behind or
22
+ removes an existing kernel at the target path ([#89])
23
+
24
+ [#86]: https://github.com/rhannequin/ruby-ephem/pull/86
25
+ [#87]: https://github.com/rhannequin/ruby-ephem/issues/87
26
+ [#88]: https://github.com/rhannequin/ruby-ephem/pull/88
27
+ [#89]: https://github.com/rhannequin/ruby-ephem/pull/89
28
+
29
+ **Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.5.0...v0.5.1
30
+
31
+ ## [0.5.0] - 2026-06-23
32
+
33
+ ### Features
34
+
35
+ - Read binary PCK (`DAF/PCK`) orientation kernels via `Ephem::PCK`, exposing a
36
+ body's Euler angles and rates over time (`angles_at`, `orientation_at`), the
37
+ foundation for DE440-grade lunar libration ([#76], [#80])
38
+ - Add `Ephem::Core::Orientation` (Euler angles + optional rates) and
39
+ `Ephem::Core::Rotation` (kernel-agnostic rotation-matrix helpers), plus
40
+ `Orientation#to_matrix` / `OrientationSegment#matrix_at` for the built-in
41
+ 3-1-3 (Z-X-Z) reference→body convention
42
+ - Excerpt and the `excerpt` CLI now support binary PCK kernels, detecting the
43
+ kernel kind automatically
44
+ - Download binary PCK lunar orientation kernels from NAIF via `Ephem::Download`
45
+ - Add `#inspect` and `#to_s` to `State` for easier debugging ([#67])
46
+
47
+ ### Improvements
48
+
49
+ - Route queries to the covering segment when a body/pair spans multiple
50
+ time-split segments (SPK and PCK), with no overhead for single-segment keys
51
+ - Share the type-2 Chebyshev machinery between SPK and PCK segments
52
+ - Evaluate position and velocity in a single Chebyshev pass
53
+ (`ChebyshevPolynomial.evaluate_with_derivative`), speeding up every state /
54
+ orientation query (`compute_and_differentiate`, `state_at`, `orientation_at`)
55
+ with bit-for-bit identical results
56
+ - Correct the documented velocity unit to km/day (the actual, validated value)
57
+ - Remove the `numo-narray` dependency ([#65])
58
+ - Skip derivative evaluation in `Segment#compute` ([#57])
59
+ - Hoist loop-invariant `t2` computation in Chebyshev evaluation ([#58])
60
+ - Cache the `RecordParser` instance in `SummaryManager` ([#63])
61
+ - Eliminate a redundant `read_record` call in `SummaryManager` ([#62])
62
+ - Replace duplicated endianness format lookups with shared constants ([#64])
63
+ - Replace `instance_variable_get` with proper `attr_reader`s in `Excerpt`
64
+ ([#66])
65
+ - Use separate error margins for position and velocity validation ([#61])
66
+ - Add a comprehensive benchmark suite ([#68])
67
+ - Upgrade default Ruby to 4.0.5 ([#81])
68
+ - Match SPICE last-loaded-wins precedence for overlapping segments ([#83])
69
+ - Add a dedicated spec for the shared type-2 Chebyshev evaluation ([#84])
70
+ - Bump standard from 1.50.0 to 1.55.0 by @dependabot ([#45], [#46], [#56],
71
+ [#78])
72
+ - Bump actions/checkout from 4 to 7 by @dependabot ([#44], [#52], [#79])
73
+ - Bump rake from 13.3.0 to 13.4.2 by @dependabot ([#48], [#73])
74
+ - Bump zlib from 3.2.1 to 3.2.3 by @dependabot ([#49], [#70])
75
+ - Bump rspec from 3.13.1 to 3.13.2 by @dependabot ([#47])
76
+ - Bump parallel from 1.27.0 to 1.28.0 by @dependabot ([#71])
77
+ - Bump benchmark-ips from 2.14.0 to 2.15.1 by @dependabot ([#75])
78
+ - Bump json from 2.18.1 to 2.19.2 by @dependabot ([#77])
79
+
80
+ ### Bug fixes
81
+
82
+ - Fix `compute_and_differentiate` returning mismatched velocities for an array
83
+ of times
84
+ - Fix precision loss in `time_to_seconds` for dates far from J2000 ([#60])
85
+
86
+ [#44]: https://github.com/rhannequin/ruby-ephem/pull/44
87
+ [#45]: https://github.com/rhannequin/ruby-ephem/pull/45
88
+ [#46]: https://github.com/rhannequin/ruby-ephem/pull/46
89
+ [#47]: https://github.com/rhannequin/ruby-ephem/pull/47
90
+ [#48]: https://github.com/rhannequin/ruby-ephem/pull/48
91
+ [#49]: https://github.com/rhannequin/ruby-ephem/pull/49
92
+ [#52]: https://github.com/rhannequin/ruby-ephem/pull/52
93
+ [#56]: https://github.com/rhannequin/ruby-ephem/pull/56
94
+ [#57]: https://github.com/rhannequin/ruby-ephem/pull/57
95
+ [#58]: https://github.com/rhannequin/ruby-ephem/pull/58
96
+ [#60]: https://github.com/rhannequin/ruby-ephem/pull/60
97
+ [#61]: https://github.com/rhannequin/ruby-ephem/pull/61
98
+ [#62]: https://github.com/rhannequin/ruby-ephem/pull/62
99
+ [#63]: https://github.com/rhannequin/ruby-ephem/pull/63
100
+ [#64]: https://github.com/rhannequin/ruby-ephem/pull/64
101
+ [#65]: https://github.com/rhannequin/ruby-ephem/pull/65
102
+ [#66]: https://github.com/rhannequin/ruby-ephem/pull/66
103
+ [#67]: https://github.com/rhannequin/ruby-ephem/pull/67
104
+ [#68]: https://github.com/rhannequin/ruby-ephem/pull/68
105
+ [#70]: https://github.com/rhannequin/ruby-ephem/pull/70
106
+ [#71]: https://github.com/rhannequin/ruby-ephem/pull/71
107
+ [#73]: https://github.com/rhannequin/ruby-ephem/pull/73
108
+ [#75]: https://github.com/rhannequin/ruby-ephem/pull/75
109
+ [#76]: https://github.com/rhannequin/ruby-ephem/issues/76
110
+ [#77]: https://github.com/rhannequin/ruby-ephem/pull/77
111
+ [#78]: https://github.com/rhannequin/ruby-ephem/pull/78
112
+ [#79]: https://github.com/rhannequin/ruby-ephem/pull/79
113
+ [#80]: https://github.com/rhannequin/ruby-ephem/pull/80
114
+ [#81]: https://github.com/rhannequin/ruby-ephem/pull/81
115
+ [#83]: https://github.com/rhannequin/ruby-ephem/pull/83
116
+ [#84]: https://github.com/rhannequin/ruby-ephem/pull/84
117
+
118
+ **Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.4.1...v0.5.0
119
+
3
120
  ## [0.4.1] - 2025-08-03
4
121
 
5
122
  ### Improvements
6
123
 
7
- * Exclude BSP files from release ([#42])
124
+ - Exclude BSP files from release ([#42])
8
125
 
9
126
  [#42]: https://github.com/rhannequin/ruby-ephem/pull/42
10
127
 
@@ -14,13 +131,13 @@
14
131
 
15
132
  ### Improvements
16
133
 
17
- * Improve Chebyshev polynomial performance ([#33])
18
- * Improve download file management ([#34])
19
- * Validate against all kernels and date ranges ([#36])
20
- * Add supported Ruby versions ([#35])
21
- * Bump rspec from 3.13.0 to 3.13.1 by @dependabot ([#38])
22
- * Bump rake from 13.2.1 to 13.3.0 by @dependabot ([#39])
23
- * Bump csv from 3.3.4 to 3.3.5 by @dependabot ([#40])
134
+ - Improve Chebyshev polynomial performance ([#33])
135
+ - Improve download file management ([#34])
136
+ - Validate against all kernels and date ranges ([#36])
137
+ - Add supported Ruby versions ([#35])
138
+ - Bump rspec from 3.13.0 to 3.13.1 by @dependabot ([#38])
139
+ - Bump rake from 13.2.1 to 13.3.0 by @dependabot ([#39])
140
+ - Bump csv from 3.3.4 to 3.3.5 by @dependabot ([#40])
24
141
 
25
142
  [#33]: https://github.com/rhannequin/ruby-ephem/pull/33
26
143
  [#34]: https://github.com/rhannequin/ruby-ephem/pull/34
@@ -36,15 +153,15 @@
36
153
 
37
154
  ### Bug fixes
38
155
 
39
- * Write downloaded ephemeris in binary mode by @trevorturk ([#31])
156
+ - Write downloaded ephemeris in binary mode by @trevorturk ([#31])
40
157
 
41
158
  ### Improvements
42
159
 
43
- * Bump standard from 1.49.0 to 1.50.0 by @dependabot ([#29])
160
+ - Bump standard from 1.49.0 to 1.50.0 by @dependabot ([#29])
44
161
 
45
162
  ### New Contributors
46
163
 
47
- * @trevorturk made their first contribution in [#31]
164
+ - @trevorturk made their first contribution in [#31]
48
165
 
49
166
  **Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.3.0...v0.3.1
50
167
 
@@ -55,15 +172,15 @@
55
172
 
56
173
  ## Features
57
174
 
58
- * Improve find_interval with binary search ([#24])
59
- * Use alias methods to get segment position or state ([#27])
175
+ - Improve find_interval with binary search ([#24])
176
+ - Use alias methods to get segment position or state ([#27])
60
177
 
61
178
  ## Improvements
62
179
 
63
- * Bump irb from 1.15.1 to 1.15.2 by @dependabot ([#21])
64
- * Bump standard from 1.47.0 to 1.49.0 by @dependabot ([#23])
65
- * Bump csv from 3.3.3 to 3.3.4 by @dependabot ([#25])
66
- * Bump parallel from 1.26.3 to 1.27.0 by @dependabot ([#26])
180
+ - Bump irb from 1.15.1 to 1.15.2 by @dependabot ([#21])
181
+ - Bump standard from 1.47.0 to 1.49.0 by @dependabot ([#23])
182
+ - Bump csv from 3.3.3 to 3.3.4 by @dependabot ([#25])
183
+ - Bump parallel from 1.26.3 to 1.27.0 by @dependabot ([#26])
67
184
 
68
185
  **Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.2.0...v0.3.0
69
186
 
@@ -78,27 +195,27 @@
78
195
 
79
196
  ### Features
80
197
 
81
- * Simplify download ([#12])
82
- * SPK excerpt generator ([#13])
83
- * Improve documentation on excerpts ([#16])
84
- * IMCCE INPOP support ([#20])
198
+ - Simplify download ([#12])
199
+ - SPK excerpt generator ([#13])
200
+ - Improve documentation on excerpts ([#16])
201
+ - IMCCE INPOP support ([#20])
85
202
 
86
203
  ### Improvements
87
204
 
88
- * Add Dependabot ([#6])
89
- * Replace testing kernel ([#17])
90
- * Add `irb` to dev dependencies ([#14])
91
- * Add support for Rubies `3.2.7` and `3.4.2` ([#15])
92
- * Bump csv from 3.3.0 to 3.3.2 by @dependabot ([#7])
93
- * Bump standard from 1.43.0 to 1.44.0 by @dependabot ([#8])
94
- * Bump standard from 1.44.0 to 1.45.0 by @dependabot ([#9])
95
- * Bump csv from 3.3.2 to 3.3.3 by @dependabot ([#11])
96
- * Bump standard from 1.45.0 to 1.47.0 by @dependabot ([#10])
97
- * Bump json from 2.10.1 to 2.10.2 by @dependabot ([#18])
205
+ - Add Dependabot ([#6])
206
+ - Replace testing kernel ([#17])
207
+ - Add `irb` to dev dependencies ([#14])
208
+ - Add support for Rubies `3.2.7` and `3.4.2` ([#15])
209
+ - Bump csv from 3.3.0 to 3.3.2 by @dependabot ([#7])
210
+ - Bump standard from 1.43.0 to 1.44.0 by @dependabot ([#8])
211
+ - Bump standard from 1.44.0 to 1.45.0 by @dependabot ([#9])
212
+ - Bump csv from 3.3.2 to 3.3.3 by @dependabot ([#11])
213
+ - Bump standard from 1.45.0 to 1.47.0 by @dependabot ([#10])
214
+ - Bump json from 2.10.1 to 2.10.2 by @dependabot ([#18])
98
215
 
99
216
  ### New Contributors
100
217
 
101
- * @dependabot made their first contribution in [#7]
218
+ - @dependabot made their first contribution in [#7]
102
219
 
103
220
  **Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.1.0...v0.2.0
104
221
 
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 currently only support planetary ephemerides like DE421, DE430,
16
- INPOP19A, etc.
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` with a margin
140
- error of 2 centimeters.
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