diff --git a/lisainstrument/instrument.py b/lisainstrument/instrument.py index 27786fead1287b41490f5a3208db36a5c061ce7b..aa9f3cafd5775f17ab4de1ac273a3f73c3c68328 100755 --- a/lisainstrument/instrument.py +++ b/lisainstrument/instrument.py @@ -534,7 +534,7 @@ class Instrument: # Switch between various fplan file standards if version in SpecifierSet('== 1.1.*', True): logger.debug("Interpolating locking beatnote frequencies with piecewise linear functions") - times = self.t0 + np.arange(fplanf.attrs['size']) * fplanf.attrs['dt'] + times = self.orbits_t0 + np.arange(fplanf.attrs['size']) * fplanf.attrs['dt'] interpolate = lambda x: InterpolatedUnivariateSpline(times, x, k=1, ext='raise')(self.physics_t) lock_beatnotes = {} # Go through all MOSAs and pick locking beatnotes @@ -571,6 +571,7 @@ class Instrument: if orbits == 'static': logger.info("Using default set of static proper pseudo-ranges") self.orbit_file = None + self.orbits_t0 = self.t0 self.pprs = ForEachMOSA({ # Default PPRs based on first samples of Keplerian orbits (v2.0.dev) '12': 8.33242295, '23': 8.30282196, '31': 8.33242298, @@ -599,6 +600,7 @@ class Instrument: else: logger.info("Using user-provided proper pseudo-ranges and derivatives") self.orbit_file = None + self.orbits_t0 = self.t0 self.pprs = ForEachMOSA(orbits) self.d_pprs = self.pprs.transformed(lambda _, x: 0 if np.isscalar(x) else np.gradient(x, self.physics_dt) @@ -641,6 +643,13 @@ class Instrument: raise ValueError(f"invalid orbit dataset '{self.orbit_dataset}'") try: + logger.debug("Reading orbit's t0") + if self.orbit_dataset == 'tcb/ltt': + self.orbits_t0 = orbitf['tcb']['t'][0] + elif self.orbit_dataset == 'tps/ppr': + self.orbits_t0 = orbitf['tps']['tau'][0] + else: + raise ValueError(f"invalid orbit dataset '{self.orbit_dataset}'") logger.debug("Interpolating proper pseudo-ranges") self.pprs = ForEachMOSA(lambda mosa: pprs(mosa)(self.physics_t)) logger.debug("Interpolating proper pseudo-range derivatives") @@ -663,6 +672,8 @@ class Instrument: # Interpolate necessary orbital quantities, # show a helpful error message if orbit file is too short try: + logger.debug("Reading orbit's t0") + self.orbits_t0 = orbitf.attrs['t0'] 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[:, link_index[mosa]], self.physics_t))