class EphJpl::Binary
Public Class Methods
new(*args)
click to toggle source
# File lib/eph_jpl/binary.rb, line 3 def initialize(*args) @bin_path, @target, @center, @jd = *args @pos = 0 end
Public Instance Methods
get_binary()
click to toggle source
# File lib/eph_jpl/binary.rb, line 8 def get_binary begin ttl = get_ttl # TTL cnams = get_cnams # CNAM sss = get_sss # SS ncon = get_ncon # NCON au = get_au # AU emrat = get_emrat # EMRAT ipts = get_ipts # IPT numde = get_numde # NUMDE ipts << get_ipts_13 # IPT(Month's libration) cnams += get_cnams_2(ncon) # CNAM(>400) cvals = get_cvals(ncon) # CVAL(定数値) jdepoc = cvals[4] # JDEPOC coeffs, jds_cheb = get_coeffs(sss, ipts) # Coefficient, JDs(for Chebyshev polynomial) return { ttl: ttl, cnams: cnams, sss: sss, ncon: ncon, au: au, emrat: emrat, numde: numde, ipts: ipts, cvals: cvals, jdepoc: jdepoc, coeffs: coeffs, jds_cheb: jds_cheb } rescue => e raise end end
Private Instance Methods
get_au()
click to toggle source
get_cnams()
click to toggle source
get_cnams_2(ncon)
click to toggle source
get_coeffs(sss, ipts)
click to toggle source
¶ ↑
COEFF * Set JD(start, end) for Chebyshev polynomial to the array @jd_cheb @param: Array of SS @param: Array of IPT @return: <none>
¶ ↑
# File lib/eph_jpl/binary.rb, line 261 def get_coeffs(sss, ipts) idx = ((@jd - sss[0]) / sss[2]).floor # レコードインデックス pos = Const::KSIZE * Const::RECL * (2 + idx) recl = 8 coeffs = Array.new begin items = (0..(Const::KSIZE / 2) - 1).map do |i| File.binread(@bin_path, recl, pos + recl * i).unpack("d*")[0] end jd_cheb = [items.shift, items.shift] ipts.each_with_index do |ipt, i| n = i == 11 ? 2 : 3 # 要素数 ary_1 = Array.new ipt[2].times do |j| ary_0 = Array.new n.times do |k| ary_0 << items.shift(ipt[1]) end ary_1 << ary_0 end coeffs << ary_1 end return [coeffs, jd_cheb] rescue => e raise end end
get_cvals(ncon)
click to toggle source
get_emrat()
click to toggle source
get_ipts()
click to toggle source
get_ipts_13()
click to toggle source
get_ncon()
click to toggle source
get_numde()
click to toggle source
get_sss()
click to toggle source