diff --git a/lisainstrument/instrument.py b/lisainstrument/instrument.py index c23ca641d87b6c500509552f4cfa59ea5c19f00b..762149b4f5c8430b2190397ef71f8f999ae5fb2e 100644 --- a/lisainstrument/instrument.py +++ b/lisainstrument/instrument.py @@ -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