The first stage is that of the previous section, finding the optimal PEF while carefully avoiding using any regression equations that involve boundaries or missing data. For the second stage, we take the PEF as known and find values for the empty bins so that the power out of the predictionerror filter is minimized. To do this we find missing data with module mis2() .
This twostage method avoids the nonlinear problem we would otherwise face if we included the fitting equations containing both free data values and free filter values. Presumably, after two stages of linear least squares we are close enough to the final solution that we could switch over to the full nonlinear setup described near the end of this chapter.
The synthetic data in Figure is a superposition of two plane waves of different directions, each with a random (but lowpassed) waveform. After punching a hole in the data, we find that the lost data is pleasingly restored, though a bit weak near the side boundary. This imperfection could result from the sideboundary behavior of the operator or from an insufficient number of missingdata iterations.
The residual selector in Figure shows where the filter output has valid inputs. From it you can deduce the size and shape of the filter, namely that it matches up with Figure . The ellipsoidal hole in the residual selector is larger than that in the data because we lose regression equations not only at the hole, but where any part of the filter overlaps the hole.
The results in Figure are essentially perfect
representing the fact that that synthetic example
fits the conceptual model perfectly.
Before we look at the many examples
in Figures

we will examine another gapfilling strategy.