Skip to content
Snippets Groups Projects

Resolve "Error when using orbit files v2.0"

Merged Jean-Baptiste Bayle requested to merge 82-error-when-using-orbit-files-v2-0 into master
1 file
+ 5
4
Compare changes
  • Side-by-side
  • Inline
@@ -587,23 +587,24 @@ class Instrument:
# Prepare common interpolation method
times = orbitf.attrs['t0'] + np.arange(orbitf.attrs['size']) * orbitf.attrs['dt']
interpolate = lambda data, t: InterpolatedUnivariateSpline(times, data, ext='raise')(t)
index = {'12': 0, '23': 1, '31': 2, '13': 3, '32': 4, '21': 5}
link_index = {'12': 0, '23': 1, '31': 2, '13': 3, '32': 4, '21': 5}
sc_index = {'1': 0, '2': 1, '3': 2}
# Interpolate necessary orbital quantities,
# show a helpful error message if orbit file is too short
try:
logger.debug("Interpolating proper pseudo-ranges")
dataset = orbitf['tcb/ltt'] if self.orbit_dataset == 'tcb/ltt' else orbitf['tps/ppr']
self.pprs = ForEachMOSA(lambda mosa: interpolate(dataset[:, index[mosa]], self.physics_t))
self.pprs = ForEachMOSA(lambda mosa: interpolate(dataset[:, link_index[mosa]], self.physics_t))
logger.debug("Interpolating proper pseudo-range derivatives")
dataset = orbitf['tcb/d_ltt'] if self.orbit_dataset == 'tcb/ltt' else orbitf['tps/d_ppr']
self.d_pprs = ForEachMOSA(lambda mosa: interpolate(dataset[:, index[mosa]], self.physics_t))
self.d_pprs = ForEachMOSA(lambda mosa: interpolate(dataset[:, link_index[mosa]], self.physics_t))
logger.debug("Interpolating proper time deviation from TCB")
if self.orbit_dataset == 'tcb/ltt':
self.tps_proper_time_deviations = ForEachSC(lambda sc: 0)
else:
dataset = orbitf['tcb/delta_tau']
self.tps_proper_time_deviations = ForEachSC(lambda sc: interpolate(dataset[:, sc - 1], self.physics_t))
self.tps_proper_time_deviations = ForEachSC(lambda sc: interpolate(dataset[:, sc_index[sc]], self.physics_t))
except ValueError as error:
logger.error("Missing orbit information at \n%s", self.physics_t)
raise ValueError("missing orbit information, use longer orbit file or adjust sampling") from error
Loading