def background_at_centroid(self):
        """
        The value of the ``background`` at the position of the source
        centroid.

        The background value at fractional position values are
        determined using bilinear interpolation.
        """

        from scipy.ndimage import map_coordinates

        if self._background is not None:
            # centroid can still be NaN if all data values are <= 0
            if (self._is_completely_masked or
                    np.any(~np.isfinite(self.centroid))):
                return np.nan * self._background_unit  # unit for table
            else:
                value = map_coordinates(self._background,
                                        [[self.ycentroid.value],
                                         [self.xcentroid.value]], order=1,
                                        mode='nearest')[0]

                return value * self._background_unit
        else:
            return None
def background_at_centroid ( self ) : from scipy . ndimage import map_coordinates if self . _background is not None : if ( self . _is_completely_masked or np . any ( ~ np . isfinite ( self . centroid ) ) ) : return np . nan * self . _background_unit else : value = map_coordinates ( self . _background , [ [ self . ycentroid . value ] , [ self . xcentroid . value ] ] , order = 1 , mode = 'nearest' ) [ 0 ] return value * self . _background_unit else : return None
The value of the ``background`` at the position of the source
        centroid.

        The background value at fractional position values are
        determined using bilinear interpolation.