示例#1
0
文件: plait.py 项目: keflavich/sdpy
def test(scale=3, size=256, amplitude=1, seed=0):
    np.random.seed(0)
    real_im = make_extended(size)
    m0 = add_stripe_noise(real_im, amplitude, axis=0)
    m1 = add_stripe_noise(real_im, amplitude, axis=1)
    rebuilt_im = plait_plane([m0,m1], [0,90], scale)
    bad = m0+m1
    return real_im, rebuilt_im, bad, [m0,m1]
def test_measure_offsets(xsh, ysh, imsize, noise_taper=False, noise=0.5, chi2_shift=chi2_shifts.chi2_shift):
    image = rt.make_extended(imsize)
    offset_image = rt.make_offset_extended(image, xsh, ysh, noise_taper=noise_taper, noise=noise)
    if noise_taper:
        noise = noise/rt.edge_weight(imsize)
    else:
        noise = noise

    return chi2_shift(image,offset_image,noise,return_error=True,upsample_factor='auto')