mwavepy.calibrationAlgorithms
index
/home/alex/docs/python/path/mwavepy/calibrationAlgorithms.py

#       calibrationAlgorithms.py
#       
#       
#       Copyright 2010 alex arsenovic <arsenovic@virginia.edu>
#       
#
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later versionpy.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.

 
Modules
       
numpy

 
Functions
       
abc_2_coefs_dict(abc)
converts an abc ndarry to a dictionarry containing the error 
coefficients.
 
takes: 
        abc : Nx3 numpy.ndarray, which holds the complex calibration 
                coefficients. the components of abc are 
                        a[:] = abc[:,0]
                        b[:] = abc[:,1]
                        c[:] = abc[:,2],
                a, b and c are related to the error network by 
                        a = e01*e10 - e00*e11 
                        b = e00 
                        c = e11
returns:
        coefsDict: dictionary containing the following
                'directivity':e00
                'reflection tracking':e01e10
                'source match':e11
note: 
        e00 = directivity error
        e10e01 = reflection tracking error
        e11 = source match error
guess_length_of_delay_short(aNtwk, tline)
guess length of physical length of a Delay Short given by aNtwk
 
takes:
        aNtwk: a mwavepy.ntwk type . (note: if this is a measurment 
                it needs to be normalized to the short plane
        tline: transmission line class of the medium. needed for the 
                calculation of propagation constant
one_port(measured, ideals)
standard algorithm for a one port calibration. If more than three 
standards are supplied then a least square algorithm is applied.
 
takes: 
        measured - list of measured reflection coefficients. can be 
                lists of either a kxnxn numpy.ndarray, representing a 
                s-matrix or list of  1-port mwavepy.ntwk types. 
        ideals - list of assumed reflection coefficients. can be 
                lists of either a kxnxn numpy.ndarray, representing a 
                s-matrix or list of  1-port mwavepy.ntwk types. 
 
returns:
        (abc, residues) - a tuple. abc is a Nx3 ndarray containing the
                complex calibrations coefficients,where N is the number 
                of frequency points in the standards that where given.
                
                abc: 
                the components of abc are 
                        a = abc[:,0] = e01*e10 - e00*e11
                        b = abc[:,1] = e00
                        c = abc[:,2] = e11
                
                residuals: a matrix of residuals from the least squared 
                        calculation. see numpy.linalg.lstsq() for more info
xds(measured, ideals, wb, d, ftol=0.001, xtol=0.001, guessLength=False, solveForLoss=False, showProgress=False)
A one port calibration, which can use a redundent number of delayed 
shorts to solve for their unknown lengths.
 
!see note at bottom about order!
 
takes: 
        measured - list of measured reflection coefficients. can be 
                lists of either a kxnxn numpy.ndarray. 
        ideals - list of measured reflection coefficients. can be 
                lists of either a kxnxn numpy.ndarray. see note about order.
        wb - a mwavepy.workingBand.WorkingBand type. 
        d - vector containing initial guesses for the delay short lengths
                see note about order.
        ftol - functional tolerance, passed to the scipy.optimize.fmin 
                function
        solveForLoss - 
        guessLength - 
        showProgress - 
 
returns:
        (abc, residues) - a tuple. abc is a Nx3 ndarray containing the
                complex calibrations coefficients,where N is the number 
                of frequency points in the standards that where given.
                
                abc: 
                the components of abc are 
                        a[:] = abc[:,0]
                        b[:] = abc[:,1]
                        c[:] = abc[:,2],
                a, b and c are related to the error network by 
                        a = e01*e10 - e00*e11 
                        b = e00 
                        c = e11
                
                residues: a matrix of residues from the least squared 
                        calculation. see numpy.linalg.lstsq() for more info
 
 
        
 note:
        ORDER MATTERS.
 
        all standard lists, and d-vector must be in order. The first
        m-standards are assumed to be delayed shorts, where m is the
         length of d. Any standards after may be anything.
xds_xdl(measured, ideals, wb, ds, dl, Gamma0=None, ftol=0.001, xtol=0.001, guessLength=False, solveForLoss=False, solveForLoad=False, showProgress=False)
A one port calibration, which can use a redundent number of delayed 
shorts to solve for their unknown lengths.
 
!see note at bottom about order!
 
takes: 
        measured - list of measured reflection coefficients. can be 
                lists of either a kxnxn numpy.ndarray. 
        ideals - list of measured reflection coefficients. can be 
                lists of either a kxnxn numpy.ndarray. see note about order.
        wb - a mwavepy.workingBand.WorkingBand type. 
        d - vector containing initial guesses for the delay short lengths
                see note about order.
        ftol - functional tolerance, passed to the scipy.optimize.fmin 
                function
        solveForLoss - 
        guessLength - 
        showProgress - 
 
returns:
        (abc, residues) - a tuple. abc is a Nx3 ndarray containing the
                complex calibrations coefficients,where N is the number 
                of frequency points in the standards that where given.
                
                abc: 
                the components of abc are 
                        a[:] = abc[:,0]
                        b[:] = abc[:,1]
                        c[:] = abc[:,2],
                a, b and c are related to the error network by 
                        a = e01*e10 - e00*e11 
                        b = e00 
                        c = e11
                
                residues: a matrix of residues from the least squared 
                        calculation. see numpy.linalg.lstsq() for more info
 
 
        
 note:
        ORDER MATTERS.
 
        all standard lists, and d-vector must be in order. The first
        m-standards are assumed to be delayed shorts, where m is the
         length of d. Any standards after may be anything.