'Transform pixel to world coordinates. You should pass in a Nx2 array
of (x, y) pixel coordinates to transform to world coordinates. This
will then return an NxM array where M is the number of dimensions in
the WCS'

def transform(self, pixel):

    if (self.slice is None):
        pixel_full = pixel.copy()
    else:
        pixel_full = []
        for index in self.slice:
            if (index == 'x'):
                pixel_full.append(pixel[:, 0])
            elif (index == 'y'):
                pixel_full.append(pixel[:, 1])
            else:
                pixel_full.append(index)
        pixel_full = np.array(np.broadcast_arrays(*pixel_full)).transpose()
    pixel_full += 1
    if (pixel_full.shape[0] == 0):
        world = np.zeros((0, 2))
    else:
        world = self.wcs.wcs_pix2world(pixel_full, 1)
    pixel_check = self.wcs.wcs_world2pix(world, 1)
    with np.errstate(invalid='ignore'):
        invalid = np.any((np.abs((pixel_check - pixel_full)) > 1.0), axis=1)
    world[invalid] = np.nan
    return world
