photutils/background/background_2d.py
def _prepare_data(self):
        """
        Prepare the data.

        First, pad or crop the 2D data array so that there are an
        integer number of meshes in both dimensions, creating a masked
        array.

        Then reshape into a different 2D masked array where each row
        represents the data in a single mesh.  This method also performs
        a first cut at rejecting certain meshes as specified by the
        input keywords.
        """

        self.nyboxes = self.data.shape[0] // self.box_size[0]
        self.nxboxes = self.data.shape[1] // self.box_size[1]
        yextra = self.data.shape[0] % self.box_size[0]
        xextra = self.data.shape[1] % self.box_size[1]

        if (xextra + yextra) == 0:
            # no resizing of the data is necessary
            data_ma = np.ma.masked_array(self.data, mask=self.mask)
        else:
            # pad or crop the data
            if self.edge_method == 'pad':
                data_ma = self._pad_data(yextra, xextra)
                self.nyboxes += 1
                self.nxboxes += 1
            elif self.edge_method == 'crop':
                data_ma = self._crop_data()
            else:
                raise ValueError('edge_method must be "pad" or "crop"')

        # a reshaped 2D array with mesh data along the x axis
        mesh_data = np.ma.swapaxes(data_ma.reshape(
            self.nyboxes, self.box_size[0], self.nxboxes, self.box_size[1]),
            1, 2).reshape(self.nyboxes * self.nxboxes, self.box_npixels)

        # first cut on rejecting meshes
        self.mesh_idx = self._select_meshes(mesh_data)
        self.mesh_data = mesh_data[self.mesh_idx, :]

        return

        Prepare the data.

        First, pad or crop the 2D data array so that there are an
        integer number of meshes in both dimensions, creating a masked
        array.

        Then reshape into a different 2D masked array where each row
        represents the data in a single mesh.  This method also performs
        a first cut at rejecting certain meshes as specified by the
        input keywords.
        
Prepare the data.
First, pad or crop the 2D data array so that there are an
integer number of meshes in both dimensions, creating a masked
array.

Then reshape into a different 2D masked array where each row
represents the data in a single mesh.  This method also performs
a first cut at rejecting certain meshes as specified by the
input keywords.
Prepare the data . First pad or crop the 2D data array so that there are an integer number of meshes in both dimensions creating a masked array . Then reshape into a different 2D masked array where each row represents the data in a single mesh . This method also performs a first cut at rejecting certain meshes as specified by the input keywords .
def _prepare_data(self):
        self.nyboxes = self.data.shape[0] // self.box_size[0]
        self.nxboxes = self.data.shape[1] // self.box_size[1]
        yextra = self.data.shape[0] % self.box_size[0]
        xextra = self.data.shape[1] % self.box_size[1]
        if (xextra + yextra) == 0:
            data_ma = np.ma.masked_array(self.data, mask=self.mask)
        else:
            if self.edge_method == 'pad':
                data_ma = self._pad_data(yextra, xextra)
                self.nyboxes += 1
                self.nxboxes += 1
            elif self.edge_method == 'crop':
                data_ma = self._crop_data()
            else:
                raise ValueError('edge_method must be "pad" or "crop"')
        mesh_data = np.ma.swapaxes(data_ma.reshape(
            self.nyboxes, self.box_size[0], self.nxboxes, self.box_size[1]),
            1, 2).reshape(self.nyboxes * self.nxboxes, self.box_npixels)
        self.mesh_idx = self._select_meshes(mesh_data)
        self.mesh_data = mesh_data[self.mesh_idx, :]
        return
def _prepare_data ( self ) : self . nyboxes = self . data . shape [ 0 ] // self . box_size [ 0 ] self . nxboxes = self . data . shape [ 1 ] // self . box_size [ 1 ] yextra = self . data . shape [ 0 ] % self . box_size [ 0 ] xextra = self . data . shape [ 1 ] % self . box_size [ 1 ] if ( xextra + yextra ) == 0 : data_ma = np . ma . masked_array ( self . data , mask = self . mask ) else : if self . edge_method == 'pad' : data_ma = self . _pad_data ( yextra , xextra ) self . nyboxes += 1 self . nxboxes += 1 elif self . edge_method == 'crop' : data_ma = self . _crop_data ( ) else : raise ValueError ( 'edge_method must be "pad" or "crop"' ) mesh_data = np . ma . swapaxes ( data_ma . reshape ( self . nyboxes , self . box_size [ 0 ] , self . nxboxes , self . box_size [ 1 ] ) , 1 , 2 ) . reshape ( self . nyboxes * self . nxboxes , self . box_npixels ) self . mesh_idx = self . _select_meshes ( mesh_data ) self . mesh_data = mesh_data [ self . mesh_idx , : ] return
Prepare the data.
Prepare the data .
"""
        Prepare the data.

        First, pad or crop the 2D data array so that there are an
        integer number of meshes in both dimensions, creating a masked
        array.

        Then reshape into a different 2D masked array where each row
        represents the data in a single mesh.  This method also performs
        a first cut at rejecting certain meshes as specified by the
        input keywords.
        """ # no resizing of the data is necessary # pad or crop the data # a reshaped 2D array with mesh data along the x axis # first cut on rejecting meshes
self