def test_checkwcs(self):
     newwcs = self.m31image.wcs.deepcopy()
     newwcs = self.m31image.wcs
     checkwcs(self.m31image.wcs, newwcs)
     cellsize = 1.5 * self.cellsize
     newwcs.wcs.cdelt[0] = -cellsize
     newwcs.wcs.cdelt[1] = +cellsize
    def test_reproject(self):
        # Reproject an image
        cellsize = 1.5 * self.cellsize
        newwcs = self.m31image.wcs.deepcopy()
        newwcs.wcs.cdelt[0] = -cellsize
        newwcs.wcs.cdelt[1] = +cellsize

        newshape = numpy.array(self.m31image.data.shape)
        newshape[2] /= 1.5
        newshape[3] /= 1.5
        newimage, footprint = reproject_image(self.m31image,
                                              newwcs,
                                              shape=newshape)
        checkwcs(newimage.wcs, newwcs)
def add_image(im1: Image, im2: Image, docheckwcs=False) -> Image:
    """ Add two images
    
    :param docheckwcs:
    :param im1:
    :param im2:
    :return: Image
    """
    assert isinstance(im1, Image), im1
    assert isinstance(im2, Image), im2
    if docheckwcs:
        checkwcs(im1.wcs, im2.wcs)

    assert im1.polarisation_frame == im2.polarisation_frame

    return create_image_from_array(im1.data + im2.data, im1.wcs,
                                   im1.polarisation_frame)