mwavepy.network | index /home/alex/docs/python/path/mwavepy/network.py

`Provides the Network class and related functions.`

Modules
`` |  |
mwavepy.mathFunctions numpy | os pylab | mwavepy.touchstone |

Classes
`` |  | __builtin__.object Network
class Network(__builtin__.object)
`` | `Represents a n-port microwave network. the most fundemental properties are: s: scattering matrix. a kxnxn complex matrix where 'n' is number of ports of network. z0: characteristic impedance f: frequency vector in Hz. see also frequency, which is a Frequency object (see help on this class for more info) The following operators are defined as follows: '+' : element-wise addition of the s-matrix '-' : element-wise subtraction of the s-matrix '*' : element-wise multiplication of the s-matrix '/' : element-wise division of the s-matrix '**': cascading of two networks '//': de-embdeding of one network from the other. various other network properties are accesable as well as plotting routines are also defined for convenience, most properties are derived from the specifications given for touchstone files.`
| Methods defined here: __add__(self, other) `element-wise addition of s-matrix` __div__(self, other) `element-wise complex division of s-matrix` __floordiv__(self, other) `implements de-embeding another network[s], from this network see de_embed` __init__(self, touchstone_file=None, name=None) `constructor. takes: file: if given will load information from touchstone file name: name of this network.` __mul__(self, a) `element-wise complex multiplication of s-matrix` __pow__(self, other) `implements cascading this network with another network` __sub__(self, other) `element-wise subtraction of s-matrix` flip(self) `swaps the ports of a two port` interpolate(self) `# self-modifications` plot_polar_generic(self, attribute_r, attribute_theta, m=0, n=0, ax=None, show_legend=True, **kwargs) `generic plotting function for plotting a Network's attribute in polar form takes:` plot_s_db(self, m=0, n=0, ax=None, show_legend=True, **kwargs) `plots the magnitude of the scattering parameter of indecies m, n in log magnitude takes: m - first index, int n - second indext, int ax - matplotlib.axes object to plot on, used in case you want to update an existing plot. show_legend: boolean, to turn legend show legend of not **kwargs - passed to the matplotlib.plot command` plot_s_deg(self, m=0, n=0, ax=None, show_legend=True, **kwargs) `plots the phase of a scattering parameter of indecies m, n in degrees takes: m - first index, int n - second indext, int ax - matplotlib.axes object to plot on, used in case you want to update an existing plot. show_legend: boolean, to turn legend show legend of not **kwargs - passed to the matplotlib.plot command` plot_s_deg_unwrapped(self, m=0, n=0, ax=None, show_legend=True, **kwargs) `plots the phase of a scattering parameter of indecies m, n in unwrapped degrees takes: m - first index, int n - second indext, int ax - matplotlib.axes object to plot on, used in case you want to update an existing plot. show_legend: boolean, to turn legend show legend of not **kwargs - passed to the matplotlib.plot command` plot_s_mag(self, m=0, n=0, ax=None, show_legend=True, **kwargs) `plots the magnitude of a scattering parameter of indecies m, n not in magnitude takes: m - first index, int n - second indext, int ax - matplotlib.axes object to plot on, used in case you want to update an existing plot. show_legend: boolean, to turn legend show legend of not **kwargs - passed to the matplotlib.plot command` plot_s_polar(self, m=0, n=0, ax=None, show_legend=True, **kwargs) `plots the scattering parameter of indecies m, n in polar form takes: m - first index, int n - second indext, int ax - matplotlib.axes object to plot on, used in case you want to update an existing plot. show_legend: boolean, to turn legend show legend of not **kwargs - passed to the matplotlib.plot command` plot_s_rad(self, m=0, n=0, ax=None, show_legend=True, **kwargs) `plots the phase of a scattering parameter of indecies m, n in radians takes: m - first index, int n - second indext, int ax - matplotlib.axes object to plot on, used in case you want to update an existing plot. show_legend: boolean, to turn legend show legend of not **kwargs - passed to the matplotlib.plot command` plot_s_rad_unwrapped(self, m=0, n=0, ax=None, show_legend=True, **kwargs) `plots the phase of a scattering parameter of indecies m, n in unwrapped radians takes: m - first index, int n - second indext, int ax - matplotlib.axes object to plot on, used in case you want to update an existing plot. show_legend: boolean, to turn legend show legend of not **kwargs - passed to the matplotlib.plot command` plot_s_smith(self, m=0, n=0, r=1, ax=None, show_legend=True, **kwargs) `plots the scattering parameter of indecies m, n on smith chart takes: m - first index, int n - second indext, int r - radius of smith chart ax - matplotlib.axes object to plot on, used in case you want to update an existing plot. show_legend: boolean, to turn legend show legend of not **kwargs - passed to thematplotlib.plot command` plot_vs_frequency_generic(self, attribute, y_label=None, m=0, n=0, ax=None, show_legend=True, **kwargs) `generic plotting function for plotting a Network's attribute vs frequency. takes:` read_touchstone(self, filename) `loads values from a touchstone file. takes: filename - touchstone file name, string. note: ONLY 'S' FORMAT SUPORTED AT THE MOMENT all work is tone in the touchstone class.` write_touchstone(self, filename=None, dir='./') `write a touchstone file representing this network. the only format supported at the moment is : HZ S RI takes: filename - filename (not including extension) note: in the future could make possible use of the touchtone class, but at the moment this would not provide any benefit as it has not set_ functions.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` f `the frequency vector for the network, in Hz.` frequency `returns a Frequency object, see frequency.py` number_of_ports `the number of ports the network has.` s `The scattering parameter matrix. s-matrix has shape fxmxn, where; f is frequency axis and, m and n are port indicies` s_db `returns the magnitude of the s-parameters, in dB note: dB is calculated by 20*log10(|s|)` s_deg `returns the phase of the s-parameters, in radians` s_deg_unwrap `returns the unwrapped phase of the s-paramerts, in degrees` s_mag `returns the magnitude of the s-parameters.` s_rad `returns the phase of the s-parameters, in radians.` s_rad_unwrap `returns the unwrapped phase of the s-parameters, in radians.` t `returns the t-parameters, which are also known as wave cascading matrix.` y z0 `the characteristic impedance of the network.`

Functions
`` |  | average(list_of_networks) `complex average of the s-parameters list of Networks` cascade(a, b) `cascade two s-matricies together. a's port 2 == b's port 1 if you want a different port configuration use the flip() fuction takes: a: a 2x2 or kx2x2 s-matrix b: a 2x2, kx2x2, 1x1, or kx1x1 s-matrix note: BE AWARE! this relies on s2t function which has a inf problem if s11 or s22 is 1.` de_embed(a, b) `de-embed a 2x2 s-matrix from another 2x2 s-matrix c = b**-1 * a note: BE AWARE! this relies on s2t function which has a inf problem if s11 or s22 is 1.` flip(a) `invert the ports of a networks s-matrix, 'flipping' it over note: only works for 2-ports at the moment` psd2_2_time_domain() s2t(s) `converts a scattering parameters to 'wave cascading parameters' input matrix shape should be should be 2x2, or kx2x2 BUG: if s -matrix has ones for reflection, thsi will produce inf's you cant cascade a matrix like this anyway, but we should handle it better` t2s(t) `converts a 'wave cascading parameters' to scattering parameters input matrix shape should be should be 2x2, or kx2x2`