Interpolation is a nuanced subject. There are several ways that one may want to interpolate, many of which we have probably not captured here. This module is built to be extensible if other interpolation strategies are desired in the future. Here we present a number of interpreters that are available in Dante so users can get an intuitive feeling for what the code they are calling is actually doing.
This document is meant to be an artifact that projects can use for validation of this module. It's a bit technical and can be hard to blindly trust, so we've made some plots using the various interpolators provided by this module. The unit tests for this library can be seen as the verification that we are doing the thing right, but this report is meant to be the validation that we are doing the right thing.
In all plots below we have taken a set of "original" data points and interpolated them in various ways. The "original" points are expressed as circles and the interpolated points as Xs. The lines in each trace go through the Xs (or both) in cases where the two are aligned. Explanations of each interpolator type are below in the discussion of each plot.
Interpolating a point is only half the battle. Once you know where in time a point lies along with the points areound it you can determin its value in a number of ways: take the latest value as of that time, the nearest value knowing omnisciently what it will be, or something like a weighted average of the values around it (e.g. linear).
But before you even get that far, you need to know what the times at which you are doing this interpolation. This is what we call a Trigger. We provide a number of triggers as well as interpolators. For this you can take a naive regular cycle (PeriodicTrigger), choose to take one point completely at face value while interpolating the other points you care about at those times (DriverTrigger), or you can take any time that any of your data points arrive and interpolate all of the others (UnionTrigger).
Finally, we need to talk about timeouts. Clearly we need to be careful about how close data points need to be in order to be considered valid for combination. This is configurable and defaults to five seconds. This keeps us from trying to combine a data point with one that happened hours before. This is particularly important when there are data gaps, which is common on space missions.
The first example here potentially a naive one, but if nothing else, it is useful for getting the would-be validator up to speed on looking at these plots. In this example, we simply put a 1Hz clock on and record the latest avaiable value at each tick. The Valve channel is discrete, so it has been set to be interpolated with a StepInterpolator. The Temp data is continuous, so it is linearly interpolated between points.
A very similar example to the above, but instead with 10Hz refresh rate
In this example, the trigger is a UnionTrigger. This means taht any time the raw data for Primary or Secondary has a data point, we will take that point and interpolate the other.
Once again for the blue plot, we have chosen to use a StepInterpolator as above. But this time we have chosen a CubicInterpolator for the red plot. This makes the interploation somewhat more organic. We have also chose to use the spline feature in Dtat/Plotly for smoother plotting.
In this example we use the Driver Trigger with the Leader_Channel as the trigger channel. This means that any time Leader_Channel updates, Follower_Channel will be interpolated. If more channels were in this same interpolation, they would also be interpolated whenever Leader_Channel updates.
This example shows the timeout feature. Notice the gap around 12:00:04. No data is interpolated here because there is no recent enough data to do so.
Between t=2 and t=7, there is a 5-second gap in data. With a 2.0s timeout, the aligner produces None, causing a break in the aligned markers.
This example shows that more than one channel can be included in an interpolation. Here all three are in a Union together, meaning that any time any of the channels updates, the others are interpolated.
When a transition occurs between two reports (e.g. t=1.5 to t=4.5), we don't know exactly when the state changed. The SuperpositionInterpolator plots BOTH possible states during the interval to reflect this uncertainty.