Least-Squares¶
- class ptp.ls.Ls(N, data, T_ns=inf)[source]¶
Least-squares Time Offset Estimator
- Parameters
N – observation window length (number of measurements per window)
data – Array of objects with simulation data
T_ns – nominal time offset measurement period in nanoseconds, used for debugging only. It is used to obtain the fractional frequency offset y (drift in sec/sec) when using the efficient LS implementation, since the latter only estimates y*T_ns (drif in nanoseconds/measurement). In the end, this is used for plotting the frequency offset.
- process(impl='eff', batch_mode=True, batch_size=4096)[source]¶
Process the observations
Using the raw time offset offset measurements and potentially also the Sync arrival/departure timestamps, estimate the time and frequency offset corresponding to each window of samples.
- Parameters
impl –
Least-squares implementation. Choose between the following:
- ”t2”Uses timestamp “t2” when forming
the observation matrix H.
- ”t1”Uses timestamp “t1” when forming
the observation matrix H.
- ”eff” (default)Computationally-efficient
implementation.
- ”eff-vec”Computationally-efficient
and vectorized implementation.
batch_mode – Whether to process observation windows in batches, rather than trying to process all windows at once. Especially important for the vectorized efficient (eff-vec) implementation.
batch_size – Number of observation windows that compose a batch.