mwavepy.calibrationAlgorithms | index /usr/local/lib/python2.6/dist-packages/mwavepy/calibrationAlgorithms.py

`Contains calibrations algorithms, used in the Calibration class,`

Modules
`` |  |
numpy | pdb | 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 = det(e) = 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` eight_term_2_one_port_coefs(coefs) 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: a dictionary containing the following keys 'error coeffcients': dictionary containing standard error coefficients 'residuals': a matrix of residuals from the least squared calculation. see numpy.linalg.lstsq() for more info note: uses numpy.linalg.lstsq() for least squares calculation` one_port_nls(measured, ideals) `one port non-linear least squares.` parameterized_self_calibration(measured, ideals, showProgress=True, **kwargs) `An iterative, general self-calibration routine which can take any mixture of parameterized standards. The correct parameter values are defined as the ones which minimize the mean residual error. 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 on them` parameterized_self_calibration_bounded(measured, ideals_ps, showProgress=True, **kwargs) `An iterative, general self-calibration routine which can take any mixture of parameterized standards. The correct parameter values are defined as the ones which minimize the mean residual error. takes: measured: list of Network types holding actual measurements ideals_ps: 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 on them` parameterized_self_calibration_nls(measured, ideals_ps, showProgress=True, **kwargs) `An iterative, general self-calibration routine which can take any mixture of parameterized standards. The correct parameter values are defined as the ones which minimize the mean residual error. takes: measured: list of Network types holding actual measurements ideals_ps: 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 on them` rand(...) `rand(d0, d1, ..., dn) Random values in a given shape. Create an array of the given shape and propagate it with random samples from a uniform distribution over ``[0, 1)``. Parameters ---------- d0, d1, ..., dn : int Shape of the output. Returns ------- out : ndarray, shape ``(d0, d1, ..., dn)`` Random values. See Also -------- random Notes ----- This is a convenience function. If you want an interface that takes a shape-tuple as the first argument, refer to `random`. Examples -------- >>> np.random.rand(3,2) array([[ 0.14022471, 0.96360618], #random [ 0.37601032, 0.25528411], #random [ 0.49313049, 0.94909878]]) #random` two_port(measured, ideals, switchterms=None) `two port calibration based on the 8-term error model. takes two ordered lists of measured and ideal responses. optionally, switch terms can be taken into account by passing a tuple containing the forward and reverse switch terms as 1-port Networks takes: measured: ordered list of measured networks. list elements should be 2-port Network types. list order must correspond with ideals. ideals: ordered list of ideal networks. list elements should be 2-port Network types. switch_terms: tuple of 1-port Network types holding switch terms in this order (forward, reverse). returns: output: a dictionary containing the follwoing keys: 'error coefficients': 'error vector': 'residuals': note: support for gathering switch terms on HP8510C is in mwavepy.virtualInstruments.vna.py references Doug Rytting " Network Analyzer Error Models and Calibration Methods" RF 8 Microwave. Measurements for Wireless Applications (ARFTG/NIST) Short Course ... Speciale, R.A.; , "A Generalization of the TSD Network-Analyzer Calibration Procedure, Covering n-Port Scattering-Parameter Measurements, Affected by Leakage Errors," Microwave Theory and Techniques, IEEE Transactions on , vol.25, no.12, pp. 1100- 1115, Dec 1977` 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.` unterminate_switch_terms(two_port, gamma_f, gamma_r) `unterminates switch terms from raw measurements. takes: two_port: the raw measurement, a 2-port Network type. gamma_f: the measured forward switch term, a 1-port Network type gamma_r: the measured reverse switch term, a 1-port Network type returns: un-terminated measurement, a 2-port Network type see: 'Formulations of the Basic Vector Network Analyzer Error Model including Switch Terms' by Roger B. Marks` 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.`