Exemple #1
0
n_cv = [np.arange(i) for i in ng]

col = False
# Pretreatement of data
for i in range(n_i):
    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':
Exemple #2
0
            #     mask0 = np.reshape(mask0, (nt, nobs)).T

            # # 2. Generate random gaps
            # elif gen == 'random':
            ngaps = np.arange(int(nobs * nt * k / 100.))
            mask0 = gg.gen_random_gaps(np.zeros((nobs, nt), dtype=bool), nobs,
                                       nt, ngaps)

            # mask for cross validation
            ngaps = [30]
            ngaps_cv = [np.arange(i) for i in ngaps]
            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)