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]) # Output image plt.figure() plt.plot(x, y, x, af_ph) plt.legend(['true error', 'estimated error'], loc='best') plt.ylabel('Phase (radians)') # Output image plt.figure() imgTools.imshow(img_af, dB_scale=[-45, 0])
platform = plat_dict() #Create image plane dictionary img_plane = imgTools.img_plane_dict(platform, aspect = 1) #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 = 17) #img_wk = imgTools.omega_k(phs_fixed, platform, taylor = 17, upsample = 2) #img_bp = imgTools.backprojection(phs_corr, platform, img_plane, taylor = 17, upsample = 2) #Output image imgTools.imshow(img_pf, dB_scale = [-25,0])
#Include SARIT toolset from ritsar import phsRead from ritsar import phsTools from ritsar import imgTools #Define directory containing *.au2 and *.phs files directory = './data/Sandia/' #Import phase history and create platform dictionary [phs, platform] = phsRead.Sandia(directory) #Correct for residual 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) #Output image imgTools.imshow(img_pf, [-45, 0]) if batch: plt.savefig("Sandia_demo.png") else: plt.show()
from sys import path path.append('../') #Include SARIT toolset from ritsar import phsRead from ritsar import phsTools from ritsar import imgTools #Define directory containing *.au2 and *.phs files directory = './data/DIRSIG/' #Import phase history and create platform dictionary [phs, platform] = phsRead.DIRSIG(directory) #Correct for reisdual video phase 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) #Import image plane dictionary from './parameters/img_plane' img_plane = imgTools.img_plane_dict(platform, res_factor = 1.0, aspect = 1.0) #Apply polar format algorithm to phase history data img_wk = imgTools.omega_k(phs_fixed, platform, taylor = 13, upsample = 2) #img_bp = imgTools.backprojection(phs_corr, platform, img_plane, taylor = 13, upsample = 6) #img_pf = imgTools.polar_format(phs_corr, platform, img_plane, taylor = 13) #Output image imgTools.imshow(img_wk, [-20,0])
############################################################################## #Add include directories to default path list from sys import path path.append('../') #Include SARIT toolset from ritsar import phsRead from ritsar import phsTools from ritsar import imgTools #Define directory containing *.au2 and *.phs files directory = './data/Sandia/' #Import phase history and create platform dictionary [phs, platform] = phsRead.Sandia(directory) #Correct for residual 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) #Output image imgTools.imshow(img_pf, [-45,0])
#Include SARIT toolset from ritsar import phsRead from ritsar import imgTools #Define top level directory containing *.mat file #and choose polarization and starting azimuth pol = 'HH' directory = './data/AFRL/pass1' start_az = 1 #Import phase history and create platform dictionary [phs, platform] = phsRead.AFRL(directory, pol, start_az, n_az=3) #Create image plane dictionary img_plane = imgTools.img_plane_dict(platform, res_factor=1.4, upsample=True, aspect=1.0) #Apply algorithm of choice to phase history data img_bp = imgTools.backprojection(phs, platform, img_plane, taylor=20, upsample=6) #img_pf = imgTools.polar_format(phs, platform, img_plane, taylor = 20) #Output image imgTools.imshow(img_bp, dB_scale=[-30, 0]) plt.title('Backprojection')
fbp_time = time() - start # Fast-factorized backprojection with multi-processing start = time() img_FFBP = imgTools.FFBPmp(phs, platform, img_plane, taylor=17, factor_max=2) fbpmp_time = time() - start # Output image u = img_plane['u']; v = img_plane['v'] extent = [u.min(), u.max(), v.min(), v.max()] plt.subplot(2, 1, 1) plt.title('Full Backprojection \n \ Runtime = %i s' % bp_time) imgTools.imshow(img_bp, dB_scale=[-30, 0], extent=extent) plt.xlabel('meters'); plt.ylabel('meters') plt.subplot(2, 2, 3) plt.title('Fast Factorized Backprojection \n w/o multi-processing \n \ Runtime = %i s' % fbp_time) imgTools.imshow(img_FFBP, dB_scale=[-30, 0], extent=extent) plt.xlabel('meters'); plt.ylabel('meters') plt.subplot(2, 2, 4) plt.title('Fast Factorized Backprojection \n w/ multi-processing \n \ Runtime = %i s' % fbpmp_time) imgTools.imshow(img_FFBP, dB_scale=[-30, 0], extent=extent) plt.xlabel('meters');
img_bp = imgTools.backprojection(phs, platform, img_plane, taylor = 17, upsample = 2) bp_time = time()-start #Fast-factorized backprojection start = time() img_FFBP = imgTools.FFBP(phs, platform, img_plane, taylor = 17, factor_max = 2) fbp_time = time()-start #Output image u = img_plane['u']; v = img_plane['v'] extent = [u.min(), u.max(), v.min(), v.max()] plt.subplot(1,2,1) plt.title('Full Backprojection \n \ Runtime = %i s'%bp_time) imgTools.imshow(img_bp, dB_scale = [-30,0], extent = extent) plt.xlabel('meters'); plt.ylabel('meters') plt.subplot(1,2,2) plt.title('Fast Factorized Backprojection \n \ Runtime = %i s'%fbp_time) imgTools.imshow(img_FFBP, dB_scale = [-30,0], extent = extent) plt.xlabel('meters'); plt.ylabel('meters') plt.tight_layout() ''' #DIRSIG DSBP demo ############################################################################### #Define directory containing *.au2 and *.phs files directory = './data/DIRSIG/' #Import phase history and create platform dictionary
#Create platform dictionary platform = plat_dict() #Create image plane dictionary img_plane = imgTools.img_plane_dict(platform, aspect=1) #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=17) #img_wk = imgTools.omega_k(phs_fixed, platform, taylor = 17, upsample = 2) #img_bp = imgTools.backprojection(phs_corr, platform, img_plane, taylor = 17, upsample = 2) #Output image imgTools.imshow(img_pf, dB_scale=[-25, 0])
center=[200, 0, 0], size=[N, N], n=8) #Output image du = img_plane['du'] dv = img_plane['dv'] #u = img_plane['u']; v = img_plane['v'] u = np.arange(-N / 2, N / 2) * du v = np.arange(-N / 2, N / 2) * dv extent = [u.min(), u.max(), v.min(), v.max()] plt.subplot(1, 2, 1) plt.title('Full Backprojection') imgTools.imshow(img_bp[1024 - N / 2:1024 + N / 2, 1315 - N / 2:1315 + N / 2], dB_scale=[-25, 0], extent=extent) plt.xlabel('meters') plt.ylabel('meters') plt.subplot(1, 2, 2) plt.title('Digital Spotlight Backprojection') imgTools.imshow(img_DSBP, dB_scale=[-25, 0], extent=extent) plt.xlabel('meters') plt.ylabel('meters') plt.tight_layout() #%% #AFRL DSBP demo ###############################################################################
#Apply algorithm of choice to phase history data img_bp = imgTools.backprojection(phs, platform, img_plane, taylor = 17, upsample = 2) N = 128 img_DSBP = imgTools.DSBP(phs, platform, img_plane, center = [-15-0.6,22-0.4,0], size = [N,N]) #Output image du = img_plane['du']; dv = img_plane['dv'] #u = img_plane['u']; v = img_plane['v'] u = np.arange(-N/2,N/2)*du v = np.arange(-N/2,N/2)*dv extent = [u.min(), u.max(), v.min(), v.max()] plt.subplot(1,2,1) plt.title('Full Backprojection') imgTools.imshow(img_bp[177-N/2:177+N/2,202-N/2:202+N/2], dB_scale = [-25,0], extent = extent) plt.xlabel('meters'); plt.ylabel('meters') plt.subplot(1,2,2) plt.title('Digital Spotlight Backprojection') imgTools.imshow(img_DSBP, dB_scale = [-25,0], extent = extent) plt.xlabel('meters'); plt.ylabel('meters') plt.tight_layout() ''' #DIRSIG DSBP demo ############################################################################### #Define directory containing *.au2 and *.phs files directory = './data/DIRSIG/' #Import phase history and create platform dictionary [phs, platform] = phsRead.DIRSIG(directory)
img_plane, center=[-15 - 0.6, 22 - 0.4, 0], size=[N, N]) #Output image du = img_plane['du'] dv = img_plane['dv'] #u = img_plane['u']; v = img_plane['v'] u = np.arange(-N / 2, N / 2) * du v = np.arange(-N / 2, N / 2) * dv extent = [u.min(), u.max(), v.min(), v.max()] plt.subplot(1, 2, 1) plt.title('Full Backprojection') imgTools.imshow(img_bp[177 - N // 2:177 + N // 2, 202 - N // 2:202 + N // 2], dB_scale=[-25, 0], extent=extent) plt.xlabel('meters') plt.ylabel('meters') plt.subplot(1, 2, 2) plt.title('Digital Spotlight Backprojection') imgTools.imshow(img_DSBP, dB_scale=[-25, 0], extent=extent) plt.xlabel('meters') plt.ylabel('meters') plt.tight_layout() if batch: plt.savefig("DSBP_demo.png") else: plt.show() '''
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]) #Output image plt.figure() plt.plot(x,y,x,af_ph); plt.legend(['true error','estimated error'], loc = 'best') plt.ylabel('Phase (radians)') #Output image plt.figure() imgTools.imshow(img_af, dB_scale = [-45,0])
#Add include directories to default path list from sys import path path.append('../') #Include standard library dependencies import matplotlib.pylab as plt #Include SARIT toolset from ritsar import phsRead from ritsar import imgTools #Define top level directory containing *.mat file #and choose polarization and starting azimuth pol = 'HH' directory = './data/AFRL/pass1' start_az = 1 #Import phase history and create platform dictionary [phs, platform] = phsRead.AFRL(directory, pol, start_az, n_az = 3) #Create image plane dictionary img_plane = imgTools.img_plane_dict(platform, res_factor = 1.4, upsample = True, aspect = 1.0) #Apply algorithm of choice to phase history data img_bp = imgTools.backprojection(phs, platform, img_plane, taylor = 20, upsample = 6) #img_pf = imgTools.polar_format(phs, platform, img_plane, taylor = 20) #Output image imgTools.imshow(img_bp, dB_scale = [-30,0]) plt.title('Backprojection')