Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _at(self, t):
segment = self.spk_segment
try:
position, velocity = segment.compute_and_differentiate(
t.whole, t.tdb_fraction)
except OutOfRangeError as e:
start_time = t.ts.tdb(jd=segment.start_jd)
end_time = t.ts.tdb(jd=segment.end_jd)
# TODO: switch to calendar dates in TDB to produce round numbers?
text = ('ephemeris segment only covers dates %s through %s UT'
% (start_time.utc_iso(' '), end_time.utc_iso(' ')))
mask = e.out_of_range_times
segment = self.spk_segment
e = EphemerisRangeError(text, start_time, end_time, mask, segment)
e.__cause__ = None # avoid exception chaining in Python 3
raise e
return position / AU_KM, velocity / AU_KM, None, None