'Transform world to pixel coordinates. You should pass in a NxM array
where N is the number of points to transform, and M is the number of
dimensions in the WCS. This then returns the (x, y) pixel coordinates
as a Nx2 array.'

def transform(self, world):

    if (world.shape[1] != self.wcs.wcs.naxis):
        raise ValueError('Second    dimension    of    input    values    should    match    number    of    WCS    coordinates')
    if (world.shape[0] == 0):
        pixel = np.zeros((0, 2))
    else:
        pixel = (self.wcs.wcs_world2pix(world, 1) - 1)
    if (self.slice is None):
        return pixel
    else:
        return pixel[:, (self.x_index, self.y_index)]
