Пример #1
0
    def test_diffImageSmooth(self):
        image = np.arange(12.).reshape(4, 3)
        diff_image = diffImageSmooth(image, dy='x')
        np.testing.assert_array_almost_equal(diff_image, np.array(
            [[0.346482, 0.390491, 0.346482], [0.346482, 0.390491, 0.346482], [0.346482, 0.390491, 0.346482],
             [0.346482, 0.390491, 0.346482]]))

        with self.assertRaises(Exception):
            diffImageSmooth(np.arange(4), dy='x')
Пример #2
0
def cleanSensingImage(im, dy=0, sigma=None, order=3, fixreversal=True, removeoutliers=False, verbose=0):
    """ Clean up image from sensing dot

    Args:
        im (numpy array)
        dy (int or str): direction for differentiation
        order (int)
        fixreversal (bool)
        removeoutliers (bool)

    Returns:
        ww (image): processed image
    """
    verbose = int(verbose)
    removeoutliers = bool(removeoutliers)
    im = np.array(im)
    if sigma is None:
        imx = diffImage(im, dy=dy, size='same')
    else:
        imx = diffImageSmooth(im, dy=dy, sigma=sigma)
    if order >= 0:
        vv = fitBackground(imx, smooth=True, verbose=verbose, fig=None,
                           order=int(order), removeoutliers=removeoutliers)
        ww = (imx - vv).copy()
    else:
        ww = imx.copy()
    if fixreversal:
        ww = fixReversal(ww, verbose=verbose)
    return ww