GNU Astronomy Utilities


Next: , Previous: , Up: Tiling an image   [Contents][Index]


6.5.2.2 Grid interpolation and smoothing

On some of the grid elements, the desired value will not be found, for example the Sky value in Finding the sky value. This can happen for lots of reasons depending on the job that was to be done on a mesh, for example when a large galaxy is present in the image, no Sky value will be found for the grid elements that lie over it. However, the Sky value should be ‘guessed’ over that part of the image. We cannot just ignore those regions! To fill in such blank grid elements, we use interpolation.

Parametric interpolations like bi-linear, bicubic or spline interpolations are not used because they fail terribly on the edges of the image. For example see Figure 16 in Akhlaghi and Ichikawa (2015). They are also prone to cause significant gradients in the image. So to find the interpolated value for each grid element, Gnuastro will look at a certain number of the nearest neighbors. The exact number can be specified through --numnearest. The median value of those grid elements will be taken as the final value for each mesh. The median is chosen because on the fainter wings of bright objects, the mean can easily become biased. If the number of meshes with a good value is less than the value given to --numnearest, then the program will abort and notify you. In such cases you can either decrease the value to this option or set less restrictive requirements (for example a smaller --minmodeq, or larger/smaller meshs) at the expense of less accurate results.

By default the process above will occur on all the grid elements, not just the ones that are blank. This is done to avoid biased results on the faint wings of bright galaxies and stars (the PSF). Because their flux penetrates into the noise very slowly, it might not be possible to completely identify that flux and ignore that mesh. Therefore, if interpolation is only done on blank pixels, such false positives can cause a bias in the vicinity of bright objects, particularly after smoothing in the next step. In order to only interpolate over blank meshs and leave the values of the successful meshs untouched, the --interponlyblank option can be used.

Once all the grid elements are filled, the values given to all the meshs should be smoothed. This is because the median was used in the interpolation. The median is robust in the face of outliers, but there might be strong differences from one grid element to the next. By smoothing the grid, the variation between grid element to grid element will be far less. To smooth the mesh values, Gnuastro uses an average filter. An average filter is just a convolution of the mesh grid (spatial convolution with edge correction) by a kernel with all elements having an equal weight, see Convolution process. The kernel is a square. The length of the kernel edge can be set in units of meshs through the --smoothwidth option (which has to be an odd number as with any kernel). If a width of 1 is given for the kernel width, then no smoothing will take place.

By default the interpolation and smoothing explained above are done independently on each channel. In some circumstances, it might be preferable to do either one of these two steps on the whole image, independent of the channels. For example when there are gradients over the image and their variation over the image is stronger than the variation caused by the channels. Through the two options --fullinterpolation and --fullsmooth you can ask for interpolation or smoothing to use all the meshs in the image, not just those in the same channel of a mesh. Note that it is still very important that no mesh contain pixels from two channels. Since the pixels have been assigned to a mesh prior to these steps (see Tiling an image), there is no problem in this regard.

Even after smoothing, a simple visual examination of the values given to the pixels in each mesh over the image will give a very ‘boxy’ or pixelated impression. To our eyes it feels that it would be much better if the values could be smoothed in sub-mesh (pixel) scales to obtain a smooth variation. An example is the results of bi-linear and bi-cubic interpolations, see Figure 16 in Akhlaghi and Ichikawa (2015) for several examples. The reasons we are not doing that level of smoothing are two fold:


Next: , Previous: , Up: Tiling an image   [Contents][Index]