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])
G = abs(s) xg = np.max(np.max(G)); ng = np.min(np.min(G)); cg = 255 / (xg - ng); plt.imshow(256 - cg * (G - ng)[::-1, :], extent=(t.min() * 1e6, t.max() * 1e6, uc.min(), uc.max()), aspect='auto'); plt.xlabel('Fast-time t, $\mu$sec') plt.ylabel('Synthetic Aperture (Slow-time) U, meters') plt.title('Measured Spotlight SAR Signal') # td0 = t - 2 * sqrt(Xc ** 2 + Yc ** 2) / c; s0 = exp(cj * wcm * td0 + cj * alpha * (td0 ** 2)) * ((td0 >= 0) & (td0 <= Tp)); s0 = s0 * exp(-cj * wc * t); # Baseband reference fast-time signal s = sig.ft(s) * (conj(sig.ft(s0))); # Fast-time matched filtering # G = abs(sig.ift(s)); xg = np.max(np.max(G)); ng = np.min(np.min(G)); cg = 255 / (xg - ng); tm = (2 * Rc / c) + dt * arange(-n / 2, n / 2); # fast-time array after matched filtering plt.figure() plt.imshow(256 - cg * (G - ng)[::-1, :], extent=(tm.min() * 1e6, tm.max() * 1e6, uc.min(), uc.max()), aspect='auto'); plt.xlabel('Fast-time t, sec') plt.ylabel('Synthetic Aperture (Slow-time) U, meters') plt.title('SAR Signal after Fast-time Matched Filtering') # ############################################# # Slow-time baseband conversion for squint #
ng = np.min(np.min(G)) cg = 255 / (xg - ng) plt.imshow(256 - cg * (G - ng)[::-1, :], extent=(t.min() * 1e6, t.max() * 1e6, uc.min(), uc.max()), aspect='auto') plt.xlabel('Fast-time t, $\mu$sec') plt.ylabel('Synthetic Aperture (Slow-time) U, meters') plt.title('Measured Spotlight SAR Signal') # td0 = t - 2 * sqrt(Xc**2 + Yc**2) / c s0 = exp(cj * wcm * td0 + cj * alpha * (td0**2)) * ((td0 >= 0) & (td0 <= Tp)) s0 = s0 * exp(-cj * wc * t) # Baseband reference fast-time signal s = sig.ft(s) * (conj(sig.ft(s0))) # Fast-time matched filtering # G = abs(sig.ift(s)) xg = np.max(np.max(G)) ng = np.min(np.min(G)) cg = 255 / (xg - ng) tm = (2 * Rc / c) + dt * arange(-n / 2, n / 2) # fast-time array after matched filtering plt.figure() plt.imshow(256 - cg * (G - ng)[::-1, :], extent=(tm.min() * 1e6, tm.max() * 1e6, uc.min(), uc.max()), aspect='auto') plt.xlabel('Fast-time t, sec') plt.ylabel('Synthetic Aperture (Slow-time) U, meters') plt.title('SAR Signal after Fast-time Matched Filtering')
G = abs(s) xg = np.max(np.max(G)) ng = np.min(np.min(G)) cg = 255 / (xg - ng) plt.imshow(256 - cg * (G - ng)[::-1, :], extent=(t.min() * 1e6, t.max() * 1e6, uc.min(), uc.max()), aspect="auto") plt.xlabel("Fast-time t, $\mu$sec") plt.ylabel("Synthetic Aperture (Slow-time) U, meters") plt.title("Measured Spotlight SAR Signal") # td0 = t - 2 * sqrt(Xc ** 2 + Yc ** 2) / c s0 = exp(cj * wcm * td0 + cj * alpha * (td0 ** 2)) * ((td0 >= 0) & (td0 <= Tp)) s0 = s0 * exp(-cj * wc * t) # Baseband reference fast-time signal s = sig.ft(s) * (conj(sig.ft(s0))) # Fast-time matched filtering # G = abs(sig.ift(s)) xg = np.max(np.max(G)) ng = np.min(np.min(G)) cg = 255 / (xg - ng) tm = (2 * Rc / c) + dt * arange(-n / 2, n / 2) # fast-time array after matched filtering plt.figure() plt.imshow(256 - cg * (G - ng)[::-1, :], extent=(tm.min() * 1e6, tm.max() * 1e6, uc.min(), uc.max()), aspect="auto") plt.xlabel("Fast-time t, sec") plt.ylabel("Synthetic Aperture (Slow-time) U, meters") plt.title("SAR Signal after Fast-time Matched Filtering") # #############################################
#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 = 43) #Degrade image with random 10th order polynomial phase coeff = (np.random.rand(10)-0.5)*img_pf.shape[0]/4 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) #Output image plt.imshow(np.abs(img_pf)**(0.1), cmap = cmap) #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)')