ephem 0.2.0 → 0.3.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: 24301ad81a75b670a87dd1b33e7d8c84e9e2bd9bd007e5d6f3564dbdc5d387ae
4
- data.tar.gz: b6c16db80b49173c1aea2853774c2c1fb81bc0513d0273bb1f5564fd2043109c
3
+ metadata.gz: e8bc9fc6e66dd3aa9d61960cb3b28d43f4c90df7a70eedc1a6460f0dde73b25a
4
+ data.tar.gz: a39afb7d865bf976cff25c0839557c22c8aede2ba29bb9ce5b2fa4fef9c17aef
5
5
  SHA512:
6
- metadata.gz: 28e9df83433cb9a338197c1911cf136147c05b22909932ed591ce6512be2d58304c182947cc8232437f65342c2ac2d600329fdde648b9378d63ba0770ef724a6
7
- data.tar.gz: 4d1a96e724299ecd9c220283807eb47312ea7134698d9cffd31edb1d3be716add8da1af15b831246066ad2cd894c6249d185c3bf8bec87c2b525c931ff3b4a70
6
+ metadata.gz: b832de3f8565111c21e55f8040fb7b8d337cce7d569ccd67a4499949176467bc7eff3f8fa27edabb5af07019637b2f93951cbddbe36ee91e7080b1c11a045144
7
+ data.tar.gz: 48a6ef091dd882b9c480e50146bb4038bce15af264ad1e6b8f52a27f21c3796a6c6500a3fe6ee0229d9d534a611daf80f25cd2c0fccf00ee67202699785e033b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.1] - 2025-05-16
4
+
5
+ ### Bug fixes
6
+
7
+ * Write downloaded ephemeris in binary mode by @trevorturk ([#31])
8
+
9
+ ### Improvements
10
+
11
+ * Bump standard from 1.49.0 to 1.50.0 by @dependabot ([#29])
12
+
13
+ ### New Contributors
14
+
15
+ * @trevorturk made their first contribution in [#31]
16
+
17
+ **Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.3.0...v0.3.1
18
+
19
+ [#29]: https://github.com/rhannequin/ruby-ephem/pull/29
20
+ [#31]: https://github.com/rhannequin/ruby-ephem/pull/31
21
+
22
+ ## [0.3.0] - 2025-04-30
23
+
24
+ ## Features
25
+
26
+ * Improve find_interval with binary search ([#24])
27
+ * Use alias methods to get segment position or state ([#27])
28
+
29
+ ## Improvements
30
+
31
+ * Bump irb from 1.15.1 to 1.15.2 by @dependabot ([#21])
32
+ * Bump standard from 1.47.0 to 1.49.0 by @dependabot ([#23])
33
+ * Bump csv from 3.3.3 to 3.3.4 by @dependabot ([#25])
34
+ * Bump parallel from 1.26.3 to 1.27.0 by @dependabot ([#26])
35
+
36
+ **Full Changelog**: https://github.com/rhannequin/ruby-ephem/compare/v0.2.0...v0.3.0
37
+
38
+ [#21]: https://github.com/rhannequin/ruby-ephem/pull/21
39
+ [#23]: https://github.com/rhannequin/ruby-ephem/pull/23
40
+ [#24]: https://github.com/rhannequin/ruby-ephem/pull/24
41
+ [#25]: https://github.com/rhannequin/ruby-ephem/pull/25
42
+ [#26]: https://github.com/rhannequin/ruby-ephem/pull/26
43
+ [#27]: https://github.com/rhannequin/ruby-ephem/pull/27
44
+
3
45
  ## [0.2.0] - 2025-03-28
4
46
 
5
47
  ### Features
data/README.md CHANGED
@@ -87,7 +87,7 @@ puts segment.describe(verbose: true)
87
87
  # Get the position and velocity of the target body at a given time
88
88
  # The time is expressed in Julian Date
89
89
  time = 2460676.5
90
- state = segment.compute_and_differentiate(time)
90
+ state = segment.state_at(time)
91
91
 
92
92
  # Display the position and velocity vectors
93
93
  puts "Position: #{state.position}"
@@ -102,7 +102,7 @@ module Ephem
102
102
 
103
103
  def call
104
104
  content = jpl_kernel? ? download_from_jpl : download_from_imcce
105
- File.write(@local_path, content)
105
+ File.binwrite(@local_path, content)
106
106
 
107
107
  true
108
108
  end
data/lib/ephem/excerpt.rb CHANGED
@@ -158,8 +158,8 @@ module Ephem
158
158
  end
159
159
 
160
160
  # Calculate which portion of the data to extract based on the date range
161
- i = clip(0, n, ((start_seconds - init) / intlen)).to_i
162
- j = clip(0, n, ((end_seconds - init) / intlen + 1)).to_i
161
+ i = clip(0, n, (start_seconds - init) / intlen).to_i
162
+ j = clip(0, n, (end_seconds - init) / intlen + 1).to_i
163
163
 
164
164
  puts " Date range: i=#{i}, j=#{j} out of n=#{n}" if debug
165
165
 
@@ -71,6 +71,7 @@ module Ephem
71
71
  def compute(tdb, tdb2 = 0.0)
72
72
  Core::Vector.new(*generate(tdb, tdb2).first)
73
73
  end
74
+ alias_method :position_at, :compute
74
75
 
75
76
  # Computes both position and velocity vectors at the specified time.
76
77
  #
@@ -109,6 +110,7 @@ module Ephem
109
110
  end
110
111
  end
111
112
  end
113
+ alias_method :state_at, :compute_and_differentiate
112
114
 
113
115
  # Clears cached coefficient data, forcing reload on next computation.
114
116
  #
@@ -256,11 +258,29 @@ module Ephem
256
258
  end
257
259
 
258
260
  def find_interval(tdb_seconds)
259
- interval = (0...@midpoints.size).find do |i|
260
- time_in_interval?(tdb_seconds, i)
261
+ left = 0
262
+ right = @midpoints.size - 1
263
+
264
+ if @last_interval && time_in_interval?(tdb_seconds, @last_interval)
265
+ return @last_interval
266
+ end
267
+
268
+ while left <= right
269
+ mid = (left + right) / 2
270
+ min_time = @midpoints[mid] - @radii[mid]
271
+ max_time = @midpoints[mid] + @radii[mid]
272
+
273
+ if tdb_seconds < min_time
274
+ right = mid - 1
275
+ elsif tdb_seconds > max_time
276
+ left = mid + 1
277
+ else
278
+ @last_interval = mid
279
+ return mid
280
+ end
261
281
  end
262
282
 
263
- interval or raise OutOfRangeError.new(
283
+ raise OutOfRangeError.new(
264
284
  "Time #{tdb_seconds} is outside the coverage of this segment",
265
285
  tdb_seconds
266
286
  )
data/lib/ephem/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ephem
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.1"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ephem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémy Hannequin
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-02 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: minitar
@@ -136,7 +136,7 @@ dependencies:
136
136
  - !ruby/object:Gem::Version
137
137
  version: '1.43'
138
138
  description: Ruby implementation of the parsing and computation of ephemerides from
139
- NASA JPL Development Ephemerides DE4xx
139
+ NASA/JPL Development Ephemerides DE4xx and IMCCE INPOP
140
140
  email:
141
141
  - remy.hannequin@gmail.com
142
142
  executables:
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  - !ruby/object:Gem::Version
245
245
  version: '0'
246
246
  requirements: []
247
- rubygems_version: 3.6.2
247
+ rubygems_version: 3.6.7
248
248
  specification_version: 4
249
- summary: Compute astronomical ephemerides from NASA JPL Development Ephemerides
249
+ summary: Compute astronomical ephemerides from NASA/JPL DE and IMCCE INPOP
250
250
  test_files: []