During data analysis, it often happens that parts of the data cannot be given a value. For example your image was saturated due to a very bright start and you have to mask that star’s footprint. One other common situation in Gnuastro is when we do processing on tiles (for example to estimate the Sky value and its Standard deviation, see Sky value). Some tiles must not be used for the estimation of the Sky value, for example because they cover a large galaxy. So we need to fill them in with blank values. But ultimately, we need a Sky value for every pixel. This job (assigning a value to blank element(s) based on their nearby neighbors with a value) is known as interpolation.
There are many ways to do interpolation, but (mainly due to lack of time), currently Gnuastro only contains the (median of) nearest-neighbor method. The power of this method of interpolation is its non-parametric nature. The produced values are also always within the range of the known values and strong outliers do not get created. We will hopefully implement other methods too (wrappers around the GNU Scientific Library’s very complete set of functions), but currently the developers are too busy. So if you do have the chance to help your contribution would be very welcome and appreciated.
*input, struct gal_tile_two_layer_params
Interpolate the values in the image using the median value of their
numneighbors closest neighbors. If
onlyblank is non-zero,
then only blank elements will be interpolated and pixels that already have
a value will be left untouched. This function is multi-threaded and will
numthreads threads (see
Multithreaded programming (threads.h)).
tl is Gnuastro’s two later tessellation structure used to define
tiles over an image and is fully described in Tile grid. When
tl!=NULL, then it is assumed that the
one value per tile and interpolation will respect certain tessellation
properties, for example to not interpolate over channel borders.
If several datasets have the same set of blank values, you don’t need to
call this function multiple times. When
aslinkedlist is non-zero,
input will be seen as a List of
gal_data_t and for all
the same neighbor position checking will be done for all the datasets in
the list. Of course, the values for each dataset will be different, so a
different value will be written in the each dataset, but the neighbor
checking that is the most CPU intensive part will only be done once.