Updated plot names and tweaked alpha function.

This commit is contained in:
Luke 2018-07-24 18:06:24 -07:00
parent 669b144747
commit ea8a3fb4c0
4 changed files with 24 additions and 20 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
# Figures directory # Figures directory
figures* figures*
fromMat
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/

View file

@ -1,35 +1,36 @@
# What is this? # What is this?
This whole tool is a basic front end for using Python's `matplotlib` in a This whole tool is a basic front end for using Python's `matplotlib` in a
moderately interactive and robust manner to do MATLAB-like number crunching and moderately interactive and robust manner to do MATLAB-like number crunching
(more critically) plot generation for papers. and (more critically) plot generation for papers.
## MATLAB Soapbox Explanation ## MATLAB Soapbox Explanation
While MATLAB has routines to save figures, the graphics back-end routinely runs While MATLAB has routines to save figures, the graphics back-end routinely
into issues with NVIDIA GPU based systems, and I'm sick and tired of being tied runs into issues with NVIDIA GPU based systems, and I'm sick and tired of
to a tool that has a heavy resource footprint and only moderate documentation. being tied to a tool that has a heavy resource footprint and only moderate
The licensing restrictions (though not fundamentally debilitating) are a documentation. The licensing restrictions (though not fundamentally
secondary reason I'm moving away from MATLAB. Finally, as I expect to graduate debilitating) are a secondary reason I'm moving away from MATLAB. Finally,
soon, the $50 (or $130 for my toolboxes) annual cost is going to rise to a as I expect to graduate soon, the $50 (or $130 for my toolboxes) annual
debilitating point for things as mundane as personal projects. So I might as cost is going to rise to a debilitating point for things as mundane as
well kick an expensive habit while it's easy to fall back when needed. personal projects. So I might as well kick an expensive habit while it's
easy to fall back when needed.
# Resources # Resources
There are a few tricks to help configuring `matplotlib`. I'll update this There are a few tricks to help configuring `matplotlib`. I'll update this
document to describe the commands and tools to help decipher the information document to describe the commands and tools to help decipher the
required to produce plots in a repeatable and tidy way. information required to produce plots in a repeatable and tidy way.
## 1. Plot Defaults ## 1. Plot Defaults
Plot defaults are managed by the `matplotlib` Plot defaults are managed by the `matplotlib`
## 2. Font Selection ## 2. Font Selection
```python ```python
import `matplotlib`.font_manager import matplotlib.font_manager
print(matplotlib.font_manager.fontManager.afmlist) print(matplotlib.font_manager.fontManager.afmlist)
print(matplotlib.font_manager.fontManager.ttflist) print(matplotlib.font_manager.fontManager.ttflist)
``` ```
I search for fonts using the following method: I search for fonts using the following method:
``` ```python
import matplotlib.font_manager as FM import matplotlib.font_manager as FM
import re import re
@ -45,7 +46,6 @@ fontsAvailable = set([FM.FontProperties(fname=fcFont).get_name()\
[matplotlib docs](https://matplotlib.org/api/font_manager_api.html) [matplotlib docs](https://matplotlib.org/api/font_manager_api.html)
## 3.
# TODO # TODO
* make pySmithPlot a git sub-module * make pySmithPlot a git sub-module

View file

@ -100,11 +100,14 @@ class ampSystem:
@property @property
def alpha_swp(self): def alpha_swp(self):
range_partial = np.ceil(self.gamma_len/2) range_partial = np.ceil(self.gamma_len/2)
lhs = np.linspace(np.sqrt(self.alpha_min),1, range_partial) rhs = np.power(np.linspace(0,1,range_partial),2)*(self.alpha_min-1)+1
rhs = np.flip(lhs,0) lhs = np.flip(rhs,0)
#lhs = np.linspace(np.sqrt(self.alpha_min),1, range_partial)
#rhs = np.flip(lhs,0)
swp = np.concatenate((lhs,rhs[1:])) if np.mod(self.gamma_len,2) == 1 \ swp = np.concatenate((lhs,rhs[1:])) if np.mod(self.gamma_len,2) == 1 \
else np.concatenate((lhs,rhs)) else np.concatenate((lhs,rhs))
return np.power(swp,2) #return np.power(swp,2)
return swp
def set_gamma_swp(self, gamma_swp_function): def set_gamma_swp(self, gamma_swp_function):
self._gamma_map_function = gamma_swp_function self._gamma_map_function = gamma_swp_function

View file

@ -179,9 +179,9 @@ if 1 in plot_list or 11 in plot_list:
ax1[0].plot(f.hz,dB20(tf)) ax1[0].plot(f.hz,dB20(tf))
ax1[1].plot(f.hz,ang_unwrap(tf)) ax1[1].plot(f.hz,ang_unwrap(tf))
ax1[0].set_title('TF Gain') ax1[0].set_title('Stage Gain Response')
ax1[0].set_ylabel('Gain (dB)') ax1[0].set_ylabel('Gain (dB)')
ax1[1].set_title('TF Phase') ax1[1].set_title('Stage Phase Response')
ax1[1].set_ylabel('Phase (deg)') ax1[1].set_ylabel('Phase (deg)')
for axT in ax1: for axT in ax1: