Skip to content
Snippets Groups Projects
Commit 10cc4275 authored by Jean-Baptiste Bayle's avatar Jean-Baptiste Bayle
Browse files

Read dPPRs and integrate for PPRs

parent 54d0a68b
No related branches found
No related tags found
1 merge request!162Read dPPRs and integrate for PPRs
Pipeline #246700 passed
......@@ -627,13 +627,20 @@ class Instrument:
def init_orbits_file_1_0(self, orbitf):
"""Initialize orbits from an orbit file version == 1.*."""
def pprs(mosa):
def pprs_const(mosa):
if self.orbit_dataset == 'tcb/ltt':
return orbitf[f'tcb/l_{mosa}']['tt'][0]
if self.orbit_dataset == 'tps/ppr':
return orbitf[f'tps/l_{mosa}']['ppr'][0]
raise ValueError(f"invalid orbit dataset '{self.orbit_dataset}'")
def d_pprs(mosa):
if self.orbit_dataset == 'tcb/ltt':
times = orbitf['tcb']['t'][:]
values = orbitf[f'tcb/l_{mosa}']['tt']
values = orbitf[f'tcb/l_{mosa}']['d_tt']
elif self.orbit_dataset == 'tps/ppr':
times = orbitf['tps']['tau'][:]
values = orbitf[f'tps/l_{mosa}']['ppr']
values = orbitf[f'tps/l_{mosa}']['d_ppr']
else:
raise ValueError(f"invalid orbit dataset '{self.orbit_dataset}'")
return InterpolatedUnivariateSpline(times, values, k=5, ext='raise')
......@@ -656,9 +663,11 @@ class Instrument:
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))
self.pprs = ForEachMOSA(lambda mosa: \
pprs_const(mosa) + d_pprs(mosa).antiderivative()(self.physics_t)
)
logger.debug("Interpolating proper pseudo-range derivatives")
self.d_pprs = ForEachMOSA(lambda mosa: pprs(mosa).derivative()(self.physics_t))
self.d_pprs = ForEachMOSA(lambda mosa: d_pprs(mosa)(self.physics_t))
logger.debug("Interpolating TPSs with respect to TCB")
self.tps_wrt_tcb = ForEachSC(lambda sc: tps_wrt_tcb(sc)(self.physics_t_covering_telemetry))
except ValueError as error:
......@@ -670,7 +679,8 @@ class Instrument:
# Prepare common interpolation method
times = orbitf.attrs['t0'] + np.arange(orbitf.attrs['size']) * orbitf.attrs['dt']
interpolate = lambda data, t, nu=0: InterpolatedUnivariateSpline(times, data, ext='raise')(t, nu=nu)
interpolate = lambda data, t: InterpolatedUnivariateSpline(times, data, k=3, ext='raise')(t)
int_interpolate = lambda data, t: InterpolatedUnivariateSpline(times, data, k=3, ext='raise').antiderivative()(t)
link_index = {'12': 0, '23': 1, '31': 2, '13': 3, '32': 4, '21': 5}
sc_index = {'1': 0, '2': 1, '3': 2}
......@@ -680,10 +690,16 @@ class Instrument:
logger.debug("Reading orbit's t0")
self.orbit_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))
ppr_dataset = orbitf['tcb/ltt'] if self.orbit_dataset == 'tcb/ltt' else orbitf['tps/ppr']
d_ppr_dataset = orbitf['tcb/d_ltt'] if self.orbit_dataset == 'tcb/ltt' else orbitf['tps/d_ppr']
self.pprs = ForEachMOSA(lambda mosa: \
ppr_dataset[0, link_index[mosa]] + \
int_interpolate(d_ppr_dataset[:, link_index[mosa]], self.physics_t)
)
logger.debug("Interpolating proper pseudo-range derivatives")
self.d_pprs = ForEachMOSA(lambda mosa: interpolate(dataset[:, link_index[mosa]], self.physics_t, nu=1))
self.d_pprs = ForEachMOSA(lambda mosa: \
interpolate(d_ppr_dataset[:, link_index[mosa]], 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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment