Пример #1
0
    datai[i] = im[i][mask == True]
datai_mean = stats.compute_mean(datai, n_i, col)
dataii = copy.copy(datai)
dataii = stats.remove_mean(dataii, datai_mean, n_i, col)

displ = copy.copy(datai)

for i in range(n_i):
    mask_gaps[i][im[i][mask == True] == 0] = True
    mask_g_temp[i] = copy.copy(mask_gaps[i])
    mask_gaps[i] = gg.gen_cv_mask(mask_gaps[i], n_pts, n_cv[0])

mask_cv = np.logical_xor(mask_gaps, mask_g_temp)

# Apply mask on displacement field
displ = gg.mask_field(displ, mask_gaps, np.nan)
displ_mean = stats.compute_mean(displ, n_i, col)
displ = stats.remove_mean(displ, displ_mean, n_i, col)

displtp = copy.copy(displ)

# Initialization
NOISE_TYPE = 'rand'
mu, sigma = 0, 1
blanc = np.random.normal(mu, sigma, len(displtp[mask_gaps == True]))
if NOISE_TYPE == 'corr':
    expo = 1.4  # exponent in correlation function (as: 1/(r)**expo)
    geo_noise = ng.geo(r, expo)
    noise = ng.gen_noise_series(geo_noise, blanc, nt)
elif NOISE_TYPE == 'rand':
    noise = blanc
Пример #2
0
            for m in range(len(ngaps)):
                tng = ngaps[m] * nt
                mask_temp = copy.copy(mask0)
                for i in range(nt):
                    mask_temp[:, i] = gg.gen_cv_mask(mask_temp[:, i], nobs,
                                                     ngaps_cv[m])

                # Generate mask for cross validation
                mask_cv = np.logical_xor(mask_temp, mask0)

                # Create mask where data exists for later use
                mask_data = np.invert(mask_temp)
                n_data = len(mask_data[mask_data == True])

                # Apply mask on displacement field
                fdispl = gg.mask_field(fdispl, mask_temp, np.nan)

                # Create a blank image
                #fdispl[:,10][1000:30000] = np.nan

                displ_mean = compute_mean(fdispl, col)
                fdispl = remove_mean(fdispl, displ_mean, nt, col)

                noise_init = np.random.normal(mu, sigma, (nt, nx, ny))
                noise_init *= 8
                fval = [0.0, np.reshape(noise_init, (nt, nobs)).T]
                for init in inits:  # loop for type of gap initialization
                    # Gap initialization
                    fdispltp = copy.deepcopy(fdispl)
                    if init == 'zero':
                        fdispltp[mask_temp == True] = fval[0]