Corrected gain variation results, and added a helper script to automate plotting all results.
This commit is contained in:
		
							parent
							
								
									5c3f6902cc
								
							
						
					
					
						commit
						581a05201e
					
				
					 4 changed files with 176 additions and 55 deletions
				
			
		| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
# enviornment.
 | 
					# enviornment.
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import matplotlib
 | 
				
			||||||
from matplotlib import rcParams, pyplot as pp
 | 
					from matplotlib import rcParams, pyplot as pp
 | 
				
			||||||
from cycler import cycler
 | 
					from cycler import cycler
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,3 +41,46 @@ for tri in COLOR_CYCLE_LIST:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
figures_directory='figures'
 | 
					figures_directory='figures'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def figAnnotateCorner(hfig, msg, corner=1, clear=True):
 | 
				
			||||||
 | 
						if clear:
 | 
				
			||||||
 | 
							figAnnotateClear(hfig)
 | 
				
			||||||
 | 
						if corner in [1,2]:
 | 
				
			||||||
 | 
							loc_x = 0.01
 | 
				
			||||||
 | 
							algn_h = 'left'
 | 
				
			||||||
 | 
						else:
 | 
				
			||||||
 | 
							loc_x = 0.99
 | 
				
			||||||
 | 
							algn_h = 'right'
 | 
				
			||||||
 | 
						if corner in [1,4]:
 | 
				
			||||||
 | 
							loc_y = 0.01
 | 
				
			||||||
 | 
							algn_v = 'bottom'
 | 
				
			||||||
 | 
						else:
 | 
				
			||||||
 | 
							loc_y = 0.99
 | 
				
			||||||
 | 
							algn_v = 'top'
 | 
				
			||||||
 | 
						ax = hfig.get_axes()[0]
 | 
				
			||||||
 | 
						hfig.text(loc_x, loc_y, msg, transform=ax.transAxes,
 | 
				
			||||||
 | 
							va=algn_v, ha=algn_h)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def axAnnotateCorner(ha, msg, corner=1):
 | 
				
			||||||
 | 
						if corner in [1,2]:
 | 
				
			||||||
 | 
							loc_x = 0.01
 | 
				
			||||||
 | 
							algn_h = 'left'
 | 
				
			||||||
 | 
						else:
 | 
				
			||||||
 | 
							loc_x = 0.99
 | 
				
			||||||
 | 
							algn_h = 'right'
 | 
				
			||||||
 | 
						if corner in [1,4]:
 | 
				
			||||||
 | 
							loc_y = 0.01
 | 
				
			||||||
 | 
							algn_v = 'bottom'
 | 
				
			||||||
 | 
						else:
 | 
				
			||||||
 | 
							loc_y = 0.99
 | 
				
			||||||
 | 
							algn_v = 'top'
 | 
				
			||||||
 | 
						#ax = ha.get_axes()[0]
 | 
				
			||||||
 | 
						ha.text(loc_x, loc_y, msg, transform=ha.transAxes,
 | 
				
			||||||
 | 
							va=algn_v, ha=algn_h)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def figAnnotateClear(hobj):
 | 
				
			||||||
 | 
						if type(hobj == matplotlib.figure.Figure):
 | 
				
			||||||
 | 
							hfig = hobj
 | 
				
			||||||
 | 
						children = hfig.get_children()
 | 
				
			||||||
 | 
						for child in children:
 | 
				
			||||||
 | 
							if type(child) == matplotlib.text.Text:
 | 
				
			||||||
 | 
								child.remove()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,12 @@ def g1_map_default(system):
 | 
				
			||||||
def g1_map_flat(system):
 | 
					def g1_map_flat(system):
 | 
				
			||||||
	return system.g1*np.ones(system.phase_swp.shape)
 | 
						return system.g1*np.ones(system.phase_swp.shape)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def gamma_map_default(system):
 | 
				
			||||||
 | 
						return np.cos(np.pi/2-system.phase_swp) / system.Q1 / system.alpha_swp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def gamma_map_flat(system):
 | 
				
			||||||
 | 
						return np.tan(np.pi/2-system.phase_swp) / system.Q1 / system.alpha_swp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Operating Enviornment
 | 
					# Operating Enviornment
 | 
				
			||||||
#####
 | 
					#####
 | 
				
			||||||
class ampSystem:
 | 
					class ampSystem:
 | 
				
			||||||
| 
						 | 
					@ -45,6 +51,7 @@ class ampSystem:
 | 
				
			||||||
		self._gamma_warn = False
 | 
							self._gamma_warn = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		self._g1_map_function = g1_map_default
 | 
							self._g1_map_function = g1_map_default
 | 
				
			||||||
 | 
							self._gamma_map_function = gamma_map_default
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@property
 | 
						@property
 | 
				
			||||||
	def w0(self):
 | 
						def w0(self):
 | 
				
			||||||
| 
						 | 
					@ -81,7 +88,7 @@ class ampSystem:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# Verify gamma is valid
 | 
							# Verify gamma is valid
 | 
				
			||||||
		#####
 | 
							#####
 | 
				
			||||||
		gamma_max = 1/(self.alpha_min*self.Q1)
 | 
							gamma_max = 1/(np.min((1, self.alpha_min))*self.Q1)
 | 
				
			||||||
		if gamma > (self._gamma_cap_ratio * gamma_max):
 | 
							if gamma > (self._gamma_cap_ratio * gamma_max):
 | 
				
			||||||
			if not self._gamma_warn:
 | 
								if not self._gamma_warn:
 | 
				
			||||||
				self._gamma_warn = True
 | 
									self._gamma_warn = True
 | 
				
			||||||
| 
						 | 
					@ -99,9 +106,12 @@ class ampSystem:
 | 
				
			||||||
												else np.concatenate((lhs,rhs))
 | 
																	else np.concatenate((lhs,rhs))
 | 
				
			||||||
		return np.power(swp,2)
 | 
							return np.power(swp,2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						def set_gamma_swp(self, gamma_swp_function):
 | 
				
			||||||
 | 
							self._gamma_map_function = gamma_swp_function
 | 
				
			||||||
	@property
 | 
						@property
 | 
				
			||||||
	def gamma_swp(self):
 | 
						def gamma_swp(self):
 | 
				
			||||||
		return np.cos(np.pi/2-self.phase_swp) / self.Q1 / self.alpha_swp
 | 
							return self._gamma_map_function(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@property
 | 
						@property
 | 
				
			||||||
	def phase_swp(self):
 | 
						def phase_swp(self):
 | 
				
			||||||
		#def phaseSweepGenerate(g1, gamma, c, l, phase_extreme, phase_steps):
 | 
							#def phaseSweepGenerate(g1, gamma, c, l, phase_extreme, phase_steps):
 | 
				
			||||||
| 
						 | 
					@ -220,4 +230,3 @@ class bufferSystem:
 | 
				
			||||||
		return gm / gx \
 | 
							return gm / gx \
 | 
				
			||||||
			* 1j*(1+delta) \
 | 
								* 1j*(1+delta) \
 | 
				
			||||||
			/ (1j*(1+delta) + Q*(1-np.power(1+delta,2)))
 | 
								/ (1j*(1+delta) + Q*(1-np.power(1+delta,2)))
 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								runAll.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								runAll.sh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MAX_JOBS=4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Starting:"
 | 
				
			||||||
 | 
					for n in 1 2 3 4 5 6; do
 | 
				
			||||||
 | 
						while [[ $MAX_JOBS -le $(jobs -l | wc -l) ]]; do sleep 0.1; done
 | 
				
			||||||
 | 
						(
 | 
				
			||||||
 | 
							echo "  start $n →"
 | 
				
			||||||
 | 
							./tankPlot.py -n $n -sq &>/dev/null
 | 
				
			||||||
 | 
							./tankPlot.py -n $n -rq &>/dev/null
 | 
				
			||||||
 | 
							echo "    止 end $n"
 | 
				
			||||||
 | 
						) &
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					while [[ $(jobs -l | wc -l) -gt 1 ]]; do sleep 0.1; done
 | 
				
			||||||
 | 
					echo "DONE!"
 | 
				
			||||||
							
								
								
									
										118
									
								
								tankPlot.py
									
										
									
									
									
								
							
							
						
						
									
										118
									
								
								tankPlot.py
									
										
									
									
									
								
							| 
						 | 
					@ -5,26 +5,26 @@ import matplotlib
 | 
				
			||||||
import argparse
 | 
					import argparse
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import code
 | 
					import code
 | 
				
			||||||
 | 
					import pdb
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
args_parser = argparse.ArgumentParser()
 | 
					args_parser = argparse.ArgumentParser()
 | 
				
			||||||
args_parser.add_argument('-n', type=int, default=1,\
 | 
					args_parser.add_argument('-n', type=int, default=1,
 | 
				
			||||||
	help='plot testing number')
 | 
						help='plot testing number')
 | 
				
			||||||
args_parser.add_argument('--save','-s', action='store_true',\
 | 
					args_parser.add_argument('--save','-s', action='store_true',
 | 
				
			||||||
	help='save to files')
 | 
						help='save to files')
 | 
				
			||||||
args_parser.add_argument('--raster','-r', action='store_true',\
 | 
					args_parser.add_argument('--raster','-r', action='store_true',
 | 
				
			||||||
	help='save as raster')
 | 
						help='save as raster')
 | 
				
			||||||
args_parser.add_argument('--debug','-d', action='store_true',\
 | 
					args_parser.add_argument('--debug','-d', action='store_true',
 | 
				
			||||||
	help='hold for debugging')
 | 
						help='hold for debugging')
 | 
				
			||||||
args_parser.add_argument('--headless','-q', action='store_true',\
 | 
					args_parser.add_argument('--headless','-q', action='store_true',
 | 
				
			||||||
	help='Remain neadless even if we aren\'t saving files.')
 | 
						help='Remain neadless even if we aren\'t saving files.')
 | 
				
			||||||
args = args_parser.parse_args()
 | 
					args = args_parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#exit()
 | 
					#exit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HEADLESS = not 'DISPLAY' in os.environ.keys()
 | 
					HEADLESS = not 'DISPLAY' in os.environ.keys()
 | 
				
			||||||
if args.headless: HEADLESS = True	# Overide Manually if request
 | 
					if args.headless: HEADLESS = True	# Override Manually if request
 | 
				
			||||||
if HEADLESS: matplotlib.use('Agg');
 | 
					if HEADLESS: matplotlib.use('Agg')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
from matplotlib import rcParams, pyplot as pp
 | 
					from matplotlib import rcParams, pyplot as pp
 | 
				
			||||||
| 
						 | 
					@ -49,7 +49,8 @@ else:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
# Override the defaults for this script
 | 
					# Override the defaults for this script
 | 
				
			||||||
rcParams['figure.figsize'] = [3.4,2.2]
 | 
					figScaleSize = 1.0 if args.save else 1.6
 | 
				
			||||||
 | 
					rcParams['figure.figsize'] = [3.4*figScaleSize,2.25*figScaleSize]
 | 
				
			||||||
default_window_position=['+20+80', '+120+80']
 | 
					default_window_position=['+20+80', '+120+80']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
| 
						 | 
					@ -61,12 +62,20 @@ freq_pts = 501
 | 
				
			||||||
 | 
					
 | 
				
			||||||
S=TankGlobals.ampSystem()
 | 
					S=TankGlobals.ampSystem()
 | 
				
			||||||
B=TankGlobals.bufferSystem()
 | 
					B=TankGlobals.bufferSystem()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					S.q1_L = 15
 | 
				
			||||||
 | 
					if plot_list[0] in [11, 12, 13, 14]:
 | 
				
			||||||
 | 
						gain_variation = +4 # dB
 | 
				
			||||||
 | 
					else:
 | 
				
			||||||
 | 
						gain_variation = 0 # dB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if plot_list[0] in [4, 5]:
 | 
					if plot_list[0] in [4, 5]:
 | 
				
			||||||
	S.bw_plt = 0.5
 | 
						S.bw_plt = 0.5
 | 
				
			||||||
	B.bw_plt = S.bw_plt
 | 
						B.bw_plt = S.bw_plt
 | 
				
			||||||
	freq_pts = 51
 | 
						freq_pts = 51
 | 
				
			||||||
if plot_list[0] == 5:
 | 
					if plot_list[0] == 5:
 | 
				
			||||||
	S.set_g1_swp(TankGlobals.g1_map_flat)
 | 
						S.set_g1_swp(TankGlobals.g1_map_flat)
 | 
				
			||||||
 | 
						S.set_gamma_swp(TankGlobals.gamma_map_flat)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
f=FreqClass(freq_pts, S.f0, S.bw_plt)
 | 
					f=FreqClass(freq_pts, S.f0, S.bw_plt)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -74,7 +83,7 @@ f=FreqClass(freq_pts, S.f0, S.bw_plt)
 | 
				
			||||||
# We want a smooth transition out to alpha. So For now assume a squares
 | 
					# We want a smooth transition out to alpha. So For now assume a squares
 | 
				
			||||||
# weighting out to the maximum alpha at the edges.
 | 
					# weighting out to the maximum alpha at the edges.
 | 
				
			||||||
# This gain variation function is the default function baked into the method.
 | 
					# This gain variation function is the default function baked into the method.
 | 
				
			||||||
gain_variation = 0 # dB
 | 
					#gain_variation = 0 # dB
 | 
				
			||||||
S.alpha_min = dB2Vlt(gain_variation)
 | 
					S.alpha_min = dB2Vlt(gain_variation)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# and compute how much of a negative gm this requres, and it's relative
 | 
					# and compute how much of a negative gm this requres, and it's relative
 | 
				
			||||||
| 
						 | 
					@ -115,7 +124,7 @@ y_tank = y_tank.T
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
mgr = pp.get_current_fig_manager()
 | 
					#mgr = pp.get_current_fig_manager()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
if 6 in plot_list:
 | 
					if 6 in plot_list:
 | 
				
			||||||
| 
						 | 
					@ -134,7 +143,6 @@ if 6 in plot_list:
 | 
				
			||||||
	axT.set_ylabel('Phase (deg)')
 | 
						axT.set_ylabel('Phase (deg)')
 | 
				
			||||||
	setLimitsTicks(axT, ang_unwrap(tf_buf), 6)
 | 
						setLimitsTicks(axT, ang_unwrap(tf_buf), 6)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	for i,axT in enumerate(ax6):
 | 
						for i,axT in enumerate(ax6):
 | 
				
			||||||
		if i==0: axT.grid()
 | 
							if i==0: axT.grid()
 | 
				
			||||||
		axT.set_xlim(f.hz_range)
 | 
							axT.set_xlim(f.hz_range)
 | 
				
			||||||
| 
						 | 
					@ -145,15 +153,15 @@ if 6 in plot_list:
 | 
				
			||||||
		axT.tick_params('y', colors=c_color)
 | 
							axT.tick_params('y', colors=c_color)
 | 
				
			||||||
	h6.tight_layout()
 | 
						h6.tight_layout()
 | 
				
			||||||
	if args.save:
 | 
						if args.save:
 | 
				
			||||||
		h6.savefig('%s/%s.%s' % (figdir, 'NA-6.0', fig_ext))
 | 
								h6.savefig('%s/%s.%s' % (figdir, 'NA-06.0', fig_ext))
 | 
				
			||||||
	if HEADLESS:
 | 
						if HEADLESS:
 | 
				
			||||||
		pp.close()
 | 
							pp.close()
 | 
				
			||||||
	else:
 | 
						else:
 | 
				
			||||||
		mgr.window.geometry(default_window_position[0])
 | 
							#mgr.window.geometry(default_window_position[0])
 | 
				
			||||||
		h6.show()
 | 
							h6.show()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
if 1 in plot_list:
 | 
					if 1 in plot_list or 11 in plot_list:
 | 
				
			||||||
	h1 = [pp.figure() for x in range(2)]
 | 
						h1 = [pp.figure() for x in range(2)]
 | 
				
			||||||
	ax1 = [hT.add_subplot(1,1,1) for hT in h1]
 | 
						ax1 = [hT.add_subplot(1,1,1) for hT in h1]
 | 
				
			||||||
	ax1[0].plot(f.hz,dB20(tf))
 | 
						ax1[0].plot(f.hz,dB20(tf))
 | 
				
			||||||
| 
						 | 
					@ -170,16 +178,25 @@ if 1 in plot_list:
 | 
				
			||||||
		axT.set_xlim(f.hz_range)
 | 
							axT.set_xlim(f.hz_range)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[hT.tight_layout() for hT in h1]
 | 
						[hT.tight_layout() for hT in h1]
 | 
				
			||||||
 | 
						if 11 in plot_list:
 | 
				
			||||||
 | 
							for hT in h1:
 | 
				
			||||||
 | 
								LPRDefaultPlotting.figAnnotateCorner(hT,
 | 
				
			||||||
 | 
									'%g dB gain variation' % (gain_variation))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if args.save:
 | 
						if args.save:
 | 
				
			||||||
		h1[0].savefig('%s/%s.%s' % (figdir, 'NA-1.0', fig_ext))
 | 
							if 11 in plot_list:
 | 
				
			||||||
		h1[1].savefig('%s/%s.%s' % (figdir, 'NA-1.1', fig_ext))
 | 
								h1[0].savefig('%s/%s.%s' % (figdir, 'NA-11.0', fig_ext))
 | 
				
			||||||
 | 
								h1[1].savefig('%s/%s.%s' % (figdir, 'NA-11.1', fig_ext))
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								h1[0].savefig('%s/%s.%s' % (figdir, 'NA-01.0', fig_ext))
 | 
				
			||||||
 | 
								h1[1].savefig('%s/%s.%s' % (figdir, 'NA-01.1', fig_ext))
 | 
				
			||||||
	if HEADLESS:
 | 
						if HEADLESS:
 | 
				
			||||||
		pp.close()
 | 
							pp.close()
 | 
				
			||||||
	else:
 | 
						else:
 | 
				
			||||||
		mgr.window.geometry(default_window_position[0])
 | 
							#mgr.window.geometry(default_window_position[0])
 | 
				
			||||||
		[hT.show() for hT in h1]
 | 
							[hT.show() for hT in h1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if 4 in plot_list:
 | 
					if 4 in plot_list or 14 in plot_list:
 | 
				
			||||||
	h4 = [pp.figure(figsize=(3.4,3.4)) for x in range(2)]
 | 
						h4 = [pp.figure(figsize=(3.4,3.4)) for x in range(2)]
 | 
				
			||||||
	ax4 = []
 | 
						ax4 = []
 | 
				
			||||||
	ax4.append(h4[0].add_subplot(1,1,1, projection='smith'))
 | 
						ax4.append(h4[0].add_subplot(1,1,1, projection='smith'))
 | 
				
			||||||
| 
						 | 
					@ -194,14 +211,27 @@ if 4 in plot_list:
 | 
				
			||||||
	old_pos = ax4[1].title.get_position()
 | 
						old_pos = ax4[1].title.get_position()
 | 
				
			||||||
	ax4[1].title.set_position((old_pos[0], 1.1))
 | 
						ax4[1].title.set_position((old_pos[0], 1.1))
 | 
				
			||||||
	h4[1].tight_layout()
 | 
						h4[1].tight_layout()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if 14 in plot_list:
 | 
				
			||||||
 | 
							for hT in h4:
 | 
				
			||||||
 | 
								LPRDefaultPlotting.figAnnotateCorner(hT,
 | 
				
			||||||
 | 
									'%g dB gain variation' % (gain_variation))
 | 
				
			||||||
	#[hT.tight_layout() for hT in h4]
 | 
						#[hT.tight_layout() for hT in h4]
 | 
				
			||||||
	if args.save:
 | 
						if args.save:
 | 
				
			||||||
		h4[0].savefig('%s/%s.%s' % (figdir, 'ideal-smith_tank_impedance', fig_ext))
 | 
							if 14 in plot_list:
 | 
				
			||||||
		h4[1].savefig('%s/%s.%s' % (figdir, 'ideal-polar_gain_plot', fig_ext))
 | 
								h4[0].savefig('%s/%s.%s' % (figdir,
 | 
				
			||||||
 | 
									'ideal-smith_tank_impedance_wgv', fig_ext))
 | 
				
			||||||
 | 
								h4[1].savefig('%s/%s.%s' % (figdir,
 | 
				
			||||||
 | 
									'ideal-polar_gain_plot_wgv', fig_ext))
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								h4[0].savefig('%s/%s.%s' % (figdir,
 | 
				
			||||||
 | 
									'ideal-smith_tank_impedance', fig_ext))
 | 
				
			||||||
 | 
								h4[1].savefig('%s/%s.%s' % (figdir,
 | 
				
			||||||
 | 
									'ideal-polar_gain_plot', fig_ext))
 | 
				
			||||||
	if HEADLESS:
 | 
						if HEADLESS:
 | 
				
			||||||
		pp.close()
 | 
							pp.close()
 | 
				
			||||||
	else:
 | 
						else:
 | 
				
			||||||
		mgr.window.geometry(default_window_position[0])
 | 
							#mgr.window.geometry(default_window_position[0])
 | 
				
			||||||
		[hT.show() for hT in h4]
 | 
							[hT.show() for hT in h4]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if 5 in plot_list:
 | 
					if 5 in plot_list:
 | 
				
			||||||
| 
						 | 
					@ -221,16 +251,18 @@ if 5 in plot_list:
 | 
				
			||||||
	h5[1].tight_layout()
 | 
						h5[1].tight_layout()
 | 
				
			||||||
	#[hT.tight_layout() for hT in h5]
 | 
						#[hT.tight_layout() for hT in h5]
 | 
				
			||||||
	if args.save:
 | 
						if args.save:
 | 
				
			||||||
		h5[0].savefig('%s/%s.%s' % (figdir, 'ideal-flat_g1-smith_tank_impedance', fig_ext))
 | 
							h5[0].savefig('%s/%s.%s' % (figdir,
 | 
				
			||||||
		h5[1].savefig('%s/%s.%s' % (figdir, 'ideal-flat_g1-polar_gain_plot', fig_ext))
 | 
								'ideal-flat_g1-smith_tank_impedance', fig_ext))
 | 
				
			||||||
 | 
							h5[1].savefig('%s/%s.%s' % (figdir,
 | 
				
			||||||
 | 
								'ideal-flat_g1-polar_gain_plot', fig_ext))
 | 
				
			||||||
	if HEADLESS:
 | 
						if HEADLESS:
 | 
				
			||||||
		pp.close()
 | 
							pp.close()
 | 
				
			||||||
	else:
 | 
						else:
 | 
				
			||||||
		mgr.window.geometry(default_window_position[0])
 | 
							#mgr.window.geometry(default_window_position[0])
 | 
				
			||||||
		[hT.show() for hT in h5]
 | 
							[hT.show() for hT in h5]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
if 2 in plot_list:
 | 
					if 2 in plot_list or 12 in plot_list:
 | 
				
			||||||
	h2 = [pp.figure() for x in range(2)]
 | 
						h2 = [pp.figure() for x in range(2)]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ax2 = [hT.add_subplot(1,1,1) for hT in h2]
 | 
						ax2 = [hT.add_subplot(1,1,1) for hT in h2]
 | 
				
			||||||
| 
						 | 
					@ -249,17 +281,26 @@ if 2 in plot_list:
 | 
				
			||||||
		axT.set_xlabel('Freq (GHz)')
 | 
							axT.set_xlabel('Freq (GHz)')
 | 
				
			||||||
		axT.set_xlim(f.hz_range)
 | 
							axT.set_xlim(f.hz_range)
 | 
				
			||||||
	[hT.tight_layout() for hT in h2]
 | 
						[hT.tight_layout() for hT in h2]
 | 
				
			||||||
 | 
						if 12 in plot_list:
 | 
				
			||||||
 | 
							for hT in h2:
 | 
				
			||||||
 | 
								LPRDefaultPlotting.figAnnotateCorner(hT,
 | 
				
			||||||
 | 
									'%g dB gain variation' % (gain_variation))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if args.save:
 | 
						if args.save:
 | 
				
			||||||
		h2[0].savefig('%s/%s.%s' % (figdir, 'NA-2.0', fig_ext))
 | 
							if 12 in plot_list:
 | 
				
			||||||
		h2[1].savefig('%s/%s.%s' % (figdir, 'NA-2.1', fig_ext))
 | 
								h2[0].savefig('%s/%s.%s' % (figdir, 'NA-12.0', fig_ext))
 | 
				
			||||||
 | 
								h2[1].savefig('%s/%s.%s' % (figdir, 'NA-12.1', fig_ext))
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								h2[0].savefig('%s/%s.%s' % (figdir, 'NA-02.0', fig_ext))
 | 
				
			||||||
 | 
								h2[1].savefig('%s/%s.%s' % (figdir, 'NA-02.1', fig_ext))
 | 
				
			||||||
	if HEADLESS:
 | 
						if HEADLESS:
 | 
				
			||||||
		pp.close()
 | 
							pp.close()
 | 
				
			||||||
	else:
 | 
						else:
 | 
				
			||||||
		mgr.window.geometry(default_window_position[0])
 | 
							#mgr.window.geometry(default_window_position[0])
 | 
				
			||||||
		[hT.show() for hT in h2]
 | 
							[hT.show() for hT in h2]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
if 3 in plot_list:
 | 
					if 3 in plot_list or 13 in plot_list:
 | 
				
			||||||
	h3 = [pp.figure() for x in range(2)]
 | 
						h3 = [pp.figure() for x in range(2)]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ax3 = [hT.add_subplot(1,1,1) for hT in h3]
 | 
						ax3 = [hT.add_subplot(1,1,1) for hT in h3]
 | 
				
			||||||
| 
						 | 
					@ -270,19 +311,30 @@ if 3 in plot_list:
 | 
				
			||||||
	ax3[0].set_ylabel('RMS Gain Error (dB)')
 | 
						ax3[0].set_ylabel('RMS Gain Error (dB)')
 | 
				
			||||||
	ax3[1].set_title('RMS Phase Error')
 | 
						ax3[1].set_title('RMS Phase Error')
 | 
				
			||||||
	ax3[1].set_ylabel('RMS Phase Error (deg)')
 | 
						ax3[1].set_ylabel('RMS Phase Error (deg)')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for axT in ax3:
 | 
						for axT in ax3:
 | 
				
			||||||
		axT.grid()
 | 
							axT.grid()
 | 
				
			||||||
		axT.set_xlim((0,S.bw_plt))
 | 
							axT.set_xlim((0,S.bw_plt))
 | 
				
			||||||
		axT.set_xlabel('Bandwidth (GHz)')
 | 
							axT.set_xlabel('Bandwidth (GHz)')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[hT.tight_layout() for hT in h3]
 | 
						[hT.tight_layout() for hT in h3]
 | 
				
			||||||
 | 
						[hT.tight_layout() for hT in h3]
 | 
				
			||||||
 | 
						if 13 in plot_list:
 | 
				
			||||||
 | 
							for hT in h3:
 | 
				
			||||||
 | 
								LPRDefaultPlotting.figAnnotateCorner(hT,
 | 
				
			||||||
 | 
									'%g dB gain variation' % (gain_variation))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if args.save:
 | 
						if args.save:
 | 
				
			||||||
		h3[0].savefig('%s/%s.%s' % (figdir, 'NA-3.0', fig_ext))
 | 
							if 13 in plot_list:
 | 
				
			||||||
		h3[1].savefig('%s/%s.%s' % (figdir, 'NA-3.1', fig_ext))
 | 
								h3[0].savefig('%s/%s.%s' % (figdir, 'NA-13.0', fig_ext))
 | 
				
			||||||
 | 
								h3[1].savefig('%s/%s.%s' % (figdir, 'NA-13.1', fig_ext))
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								h3[0].savefig('%s/%s.%s' % (figdir, 'NA-03.0', fig_ext))
 | 
				
			||||||
 | 
								h3[1].savefig('%s/%s.%s' % (figdir, 'NA-03.1', fig_ext))
 | 
				
			||||||
	if HEADLESS:
 | 
						if HEADLESS:
 | 
				
			||||||
		pp.close()
 | 
							pp.close()
 | 
				
			||||||
	else:
 | 
						else:
 | 
				
			||||||
		mgr.window.geometry(default_window_position[0])
 | 
							#mgr.window.geometry(default_window_position[0])
 | 
				
			||||||
		[hT.show() for hT in h3]
 | 
							[hT.show() for hT in h3]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if args.debug:
 | 
					if args.debug:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue