Mark stable point of tank plotting with hard gain limit
This commit is contained in:
parent
17d08cfaed
commit
d6d75b804f
3 changed files with 179 additions and 14 deletions
26
tankPlot.py
26
tankPlot.py
|
@ -32,7 +32,7 @@ def atan(x):
|
|||
################################################################################
|
||||
# Override the defaults for this script
|
||||
rcParams['figure.figsize'] = [10,7]
|
||||
default_window_position='+20+80'
|
||||
default_window_position=['+20+80', '+120+80']
|
||||
|
||||
################################################################################
|
||||
# Operating Enviornment (i.e. circuit parameters)
|
||||
|
@ -50,6 +50,15 @@ g1_limit = np.sqrt( g1*g1 - (gamma*gamma) * c1/l1 )
|
|||
K_limit = np.sqrt(c1/l1)*1/g1_limit
|
||||
phase_limit = np.mod(np.pi/2 - np.arctan( -1/K_limit * 1/gamma ),np.pi) - np.pi
|
||||
|
||||
if abs(phase_limit) < phase_limit_requested:
|
||||
print("==> WARN: Phase Beyond bounds, leaving at limits. <==")
|
||||
print("==> %.3f requested, but hardware limit is %.3f <==" % \
|
||||
(180/np.pi*phase_limit_requested, 180/np.pi*abs(phase_limit)))
|
||||
sys.exit(-1)
|
||||
else:
|
||||
phase_limit = phase_limit_requested
|
||||
|
||||
|
||||
# This gives us our equal phase spacing points
|
||||
phase_swp = np.linspace(-1,1,gamma_sweep_steps) * phase_limit
|
||||
# Then use this to compute the gamma steps to produce arbitrary phase given
|
||||
|
@ -85,9 +94,14 @@ for itune,gamma_tune in enumerate(gamma_swp):
|
|||
tf[itune,:] = tf_tmp
|
||||
|
||||
tf = tf.T
|
||||
tf_d = tf[:,1:]-tf[:,:-1]
|
||||
tf_r = tf / (tf[:,int(tf.shape[1]/2)]*np.ones((tf.shape[1],1))).T
|
||||
# double to describe with perfect inversion stage
|
||||
tf = np.column_stack((tf,-tf))
|
||||
|
||||
ref_index = int(gamma_swp.shape[0]/2)
|
||||
tf_r = tf / (tf[:,ref_index]*np.ones((tf.shape[1],1))).T
|
||||
y_tank = y_tank.T
|
||||
|
||||
print(ang(tf[f==28,:]))
|
||||
################################################################################
|
||||
|
||||
h1 = pp.figure()
|
||||
|
@ -102,7 +116,7 @@ ax4 = h1.add_subplot(2,2,4)
|
|||
ax1.plot(y_tank, datatype=SmithAxes.Y_PARAMETER, marker="None")
|
||||
ax2.plot(np.angle(tf), dB20(tf))
|
||||
ax3.plot(f,dB20(tf))
|
||||
ax4.plot(f,ang(tf))
|
||||
ax4.plot(f,ang_unwrap(tf))
|
||||
|
||||
################################################################################
|
||||
ax8 = h2.add_subplot(2,1,1)
|
||||
|
@ -130,7 +144,7 @@ for ax_T in [ax3, ax4, ax8, ax9]:
|
|||
################################################################################
|
||||
h1.tight_layout()
|
||||
h2.tight_layout()
|
||||
mgr.window.geometry(default_window_position)
|
||||
mgr.window.geometry(default_window_position[0])
|
||||
h1.show()
|
||||
mgr.window.geometry(default_window_position)
|
||||
mgr.window.geometry(default_window_position[1])
|
||||
h2.show()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue