Changes between Version 22 and Version 23 of SwiggingHlsvd
- Timestamp:
- Jul 14, 2009, 4:54:20 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SwiggingHlsvd
v22 v23 101 101 #!rst 102 102 The code to call an ideal Python version of ``hlsvd()`` might look something like the example below. (For clarity's sake I'm sticking with the same variable names as in the comments above; I generally prefer to avoid abbreviations.) 103 :: 104 103 }}} 104 105 {{{ 106 #!python 105 107 # - y is an iterable type (e.g. a list) of complex numbers. Complex 106 108 # numbers are a native type in Python. … … 113 115 # - snoise, rms, nitf and ndiv are floats or ints as appropriate 114 116 root, fre, dam, amp, phase, sv, snoise, rms, nitf, ndiv = return_tuple 115 116 117 }}} 118 119 {{{ 120 #!rst 117 121 This code has several advantages over the C version. For starters, the input and output parameters are clearly separated which makes the code easier to read. Second, since complex numbers are a native type in Python, there's no need to represent them as two correlated lists of floats. That makes the input parameter y and the output parameter root simpler to read and manipulate. It also eliminates the possibility of a mismatched list-size bug (i.e. if a different number of real and imaginary values are supplied). Yet another advantage is that we can eliminate one parameter (ndata) that can be inferred from ``len(y)``. 118 122