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

Contains calibrations algorithms, used in the Calibration class,

 
Modules
       
numpy
mwavepy.discontinuities.variationalMethods

 
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
parameterized_self_calibration(measured, ideals_ps, showProgress=True, **kwargs)
A self-calibration routine which can take any mixture of parameterized
standards. The total residual error is minimized by adjusting the 
parameters of each standard and re-runing the calibration. 
 
 
 
takes:
        measured: list of Network types holding actual measurements
        ideals: list of ParameterizedStandard types
        showProgress: turn printing progress on/off [boolean]
        **kwargs: passed to minimization algorithm (scipy.optimize.fmin)
 
returns:
        a dictionary holding:
        'error_coefficients': dictionary of error coefficients
        'residuals': residual matrix (shape depends on #stds)
        'parameter_vector_final': final results for parameter vector
        'mean_residual_list': the mean, magnitude of the residuals at each
                iteration of calibration. this is the variable being minimized.
 
see  ParameterizedStandard for more info
unknown_translation_offset(measured, ideals, wb, d, ftol=0.001, xtol=0.001, guessLength=False, solveForLoss=False, showProgress=False, **kwargs)
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(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.