Exemple #1
0
def test_crop(input, size, offset, result):
    im1 = AstroImage(data=input)
    im1.crop(size[0], size[1], offset[0], offset[1])
    verifyData(im1.data, result)
                    # Compute uncertainty array for this image
                    tmpImg.sigma = np.sqrt((bkg + tmpImg.arr)/effective_gain)

                    # Create a copy of the temporary image and replace its array
                    # with the x and y positions of the Mimir pixels
                    yImg   = tmpImg.copy()
                    xImg   = tmpImg.copy()
                    ny, nx = tmpImg.arr.shape
                    yImg.arr, xImg.arr = np.mgrid[0:ny, 0:nx]

                    # Apply the Kokopelli mask to the image
                    tmpImg.arr[np.where(kokopelliMask.arr)] = np.nan

                    # Crop all images (and position images) to avoid edges
                    tmpImg.crop(12,1012, 13, 1013)
                    xImg.crop(12, 1012, 13, 1013)
                    yImg.crop(12, 1012, 13, 1013)

                    # Append each image to its respective list
                    imgList.append(tmpImg)
                    xPosList.append(xImg)
                    yPosList.append(yImg)

                    # Append scale factor and background level to their lists
                    scaleFactors.append(thisScale)
                    backgroundLevels.append(bkg)

        # # Loop through each image in the image list and compute its uncertainty
        # imgList1 = imgList.copy()
        # for imgNum, img in enumerate(imgList):