diff --git a/_images/spatial_tapering_animation.gif b/_images/spatial_tapering_animation.gif index f405bde..9fdc698 100644 Binary files a/_images/spatial_tapering_animation.gif and b/_images/spatial_tapering_animation.gif differ diff --git a/_images/spatial_tapering_animation2.gif b/_images/spatial_tapering_animation2.gif index 53ec0c4..a860c33 100644 Binary files a/_images/spatial_tapering_animation2.gif and b/_images/spatial_tapering_animation2.gif differ diff --git a/figure-generating-scripts/spatial_tapering.py b/figure-generating-scripts/spatial_tapering.py index c486dc4..472bcef 100644 --- a/figure-generating-scripts/spatial_tapering.py +++ b/figure-generating-scripts/spatial_tapering.py @@ -3,14 +3,15 @@ import numpy as np import time from matplotlib.gridspec import GridSpec +import matplotlib.ticker as ticker Nr = 8 # elements N = 10000 # samples to simulate sample_rate = 1e6 d = 0.5 -#num_frames = 10 # for first animnation -num_frames = 30 # for second animation +num_frames = 10 # for first animnation +#num_frames = 30 # for second animation filenames = [] for frame_i in range(0, num_frames): # Simulate received signal signal, high SNR @@ -23,8 +24,8 @@ # Decide on the weights w = np.exp(-2j * np.pi * d * np.arange(Nr) * np.sin(0)) # steering vector at boresight - #tapering = np.random.uniform(0, 1, Nr) # random tapering - tapering = np.hamming(Nr) * frame_i / (num_frames - 1) + np.ones(Nr) * (num_frames - frame_i - 1)/(num_frames - 1) # switch between rect and hamming window slowly + tapering = np.random.uniform(0, 1, Nr) # random tapering + #tapering = np.hamming(Nr) * frame_i / (num_frames - 1) + np.ones(Nr) * (num_frames - frame_i - 1)/(num_frames - 1) # switch between rect and hamming window slowly w *= tapering ''' @@ -57,11 +58,13 @@ #ax.legend(['Conventional DOA', 'Theoretical Beam Shape']) ax.set_theta_zero_location('N') # make 0 degrees point up ax.set_theta_direction(-1) # increase clockwise - ax.set_rlabel_position(30) # Move grid labels away from other labels - ax.set_ylim(-30, 0) # dB scale + ax.set_ylim(-40, 0) # dB scale + ax.yaxis.set_ticks(np.arange(-40, 10, 10)) ax.set_thetamin(-90) # only show top half ax.set_thetamax(90) + ax.text(2.3, -32.5, 'dB') #plt.show() + #exit() # Add text showing n #ax.text(np.pi/4, 5, str(frame_i), fontsize=16, color='red') @@ -118,10 +121,10 @@ for filename in filenames: images.append(imageio.imread(filename)) -if True: # only use for 2nd animation +if False: # only use for 2nd animation for filename in reversed(filenames): images.append(imageio.imread(filename)) # requires specific version if imageio! see top. new version doesnt have fps arg, and it doesnt repeat for some reason -#imageio.mimsave('../_images/spatial_tapering_animation.gif', images, fps=2) +imageio.mimsave('../_images/spatial_tapering_animation.gif', images, fps=2) #imageio.mimsave('../_images/spatial_tapering_animation2.gif', images, fps=10)