directory = './data/Sandia/' # Import phase history and create platform dictionary [phs, platform] = phsRead.Sandia(directory) # Correct for reisdual video phase phs_corr = phsTools.RVP_correct(phs, platform) # Import image plane dictionary from './parameters/img_plane' img_plane = imgTools.img_plane_dict(platform, res_factor=1.0, n_hat=platform['n_hat']) # Apply polar format algorithm to phase history data # (Other options not available since platform position is unknown) img_pf = imgTools.polar_format(phs_corr, platform, img_plane, taylor=30) # Degrade image with random 10th order polynomial phase coeff = (np.random.rand(10) - 0.5) * img_pf.shape[0] x = np.linspace(-1, 1, img_pf.shape[0]) y = np.poly1d(coeff)(x) slope, intercept, r_value, p_value, std_err = linregress(x, y) line = slope * x + np.mean(y) y = y - line ph_err = np.tile(np.array([y]).T, (1, img_pf.shape[1])) img_err = sig.ft(sig.ift(img_pf, ax=0) * np.exp(1j * ph_err), ax=0) # Autofocus image print('autofocusing') img_af, af_ph = imgTools.autoFocus2(img_err, win='auto') # img_af, af_ph = imgTools.autoFocus2(img_err, win = 0, win_params = [500,0.8])
#Create platform dictionary platform = plat_dict() #Create image plane dictionary img_plane = imgTools.img_plane_dict(platform) #Simulate phase history, if needed ############################################################################## nsamples = platform['nsamples'] npulses = platform['npulses'] x = img_plane['u']; y = img_plane['v'] points = [[0,0,0], [0,-100,0], [200,0,0]] amplitudes = [1,1,1] phs = phsTools.simulate_phs(platform, points, amplitudes) ############################################################################## #Apply RVP correction phs_corr = phsTools.RVP_correct(phs, platform) #Demodulate phase history with constant reference, if needed phs_fixed = phsTools.phs_to_const_ref(phs_corr, platform, upchirp = 1) #Apply algorithm of choice to phase history data img_pf = imgTools.polar_format(phs_corr, platform, img_plane, taylor = 43) #img_wk = imgTools.omega_k(phs_fixed, platform, taylor = 43, upsample = 2) #img_bp = imgTools.backprojection(phs_corr, platform, img_plane, taylor = 0, upsample = 2) #Output image plt.imshow(np.abs(img_pf))
[phs, platform] = phsRead.AFRL(directory, start_az, n_az=1) # Create subapertures with angle less than 360 to use polar format algorithm phs_list, plat_list = imgTools.subaperture(phs, platform, angle=15, keep_R_c=False) # Or compare to using backprojection on the same (keep_R_c can be true or false with bp) #phs_list,plat_list=imgTools.subaperture(phs,platform,angle=15,keep_R_c=True) print(len(phs_list)) images = [] ####### for i in range(len(phs_list)): checkme = True if i == 0 else False lil_img_plane=imgTools.img_plane_dict(plat_list[i],checkme=checkme,numPixels=160,\ length=22,force_xy=True) img = imgTools.polar_format(phs_list[i], plat_list[i], lil_img_plane, taylor=20, prnt=False) #img = imgTools.backprojection(phs_list[i], plat_list[i], lil_img_plane, taylor = 20,prnt=False) images.append(img) for image in images: plt.figure() imgTools.imshow(image, dB_scale=[-15, 0]) plt.title('')