From 05a1a905f3d533d400f106e0766f2522148bdfa4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bayle <j2b.bayle@gmail.com> Date: Mon, 17 Oct 2022 18:14:59 +0000 Subject: [PATCH] Fix fplan's t0 --- lisainstrument/instrument.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisainstrument/instrument.py b/lisainstrument/instrument.py index 27786fe..aa9f3ca 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)) -- GitLab