Detect sources near image edge with python photutils

As my question suggests, I 'm trying to use a python library photutils in order to detect sources from MUSE cube. MUSE (Multi Unit Spectroscopic Explorer) is an instrument which provides cube, i.e. an image for each wavelength within a certain range.

This is my code:

def extract_cat2(data, error, kernel, wcs, mask):
bkg_estimator = MedianBackground()