Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample script of Ruby to use Python with PyCall.
#! /usr/local/bin/ruby
require 'pycall/import'
include PyCall::Import
pyfrom 'sgp4.earth_gravity', import: :wgs72
pyfrom 'sgp4.io', import: :twoline2rv
TLE_1 = "1 25544U 98067A 17293.55189421 .00016717 00000-0 10270-3 0 9004"
TLE_2 = "2 25544 51.6380 133.3720 0005197 35.8378 324.3123 15.54181626 1244"
satellite = twoline2rv(TLE_1, TLE_2, wgs72)
res = satellite.propagate(2017, 10, 21, 15, 44, 10)
position, velocity = res[0], res[1]
puts "ERROR:\n\t#{satellite.error}(#{satellite.error_message})"
puts "POSITION:\n\t#{position}"
puts "VOLOCITY:\n\t#{velocity}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment