diff --git a/lisainstrument/instrument.py b/lisainstrument/instrument.py index 76e5c23d88c815fd00fd266d802be633d83dcea9..e8f0db31ca585c799badfb96e35c2a827a8f7f42 100644 --- a/lisainstrument/instrument.py +++ b/lisainstrument/instrument.py @@ -543,9 +543,13 @@ class Instrument: return InterpolatedUnivariateSpline(times, values, k=5, ext='raise') def tps_proper_time_deviations(sc): - times = orbitf['tcb']['t'][:] - values = orbitf[f'tcb/sc_{sc}']['tau'] - return InterpolatedUnivariateSpline(times, values, k=5, ext='raise') + if self.orbit_dataset == 'tcb/ltt': + return lambda x: 0 + if self.orbit_dataset == 'tps/ppr': + times = orbitf['tcb']['t'][:] + values = orbitf[f'tcb/sc_{sc}']['tau'] + return InterpolatedUnivariateSpline(times, values, k=5, ext='raise') + raise ValueError(f"invalid orbit dataset '{self.orbit_dataset}'") try: logger.debug("Interpolating proper pseudo-ranges") @@ -553,12 +557,7 @@ class Instrument: logger.debug("Interpolating proper pseudo-range derivatives") self.d_pprs = ForEachMOSA(lambda mosa: d_pprs(mosa)(self.physics_t)) logger.debug("Interpolating proper time deviation from TCB") - if self.orbit_dataset =='tcb/ltt': - self.tps_proper_time_deviations = ForEachSC(0) - elif self.orbit_dataset == 'tps/ppr': - self.tps_proper_time_deviations = ForEachSC(lambda sc: tps_proper_time_deviations(sc)(self.telemetry_t)) - else: - raise ValueError(f"invalid orbit dataset '{self.orbit_dataset}'") + self.tps_proper_time_deviations = ForEachSC(lambda sc: tps_proper_time_deviations(sc)(self.telemetry_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