MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / _numRoots2RST

Function _numRoots2RST

SLiCAP/SLiCAPrst.py:761–794  ·  view source on GitHub ↗

Returns a list of lists with row data for the creation of an RST table with numeric poles or zeros. :param roots: List with numeric roots :type roots: List with (complex) numbers :param Hz: True if frequencies must be displayed in Hz, False for rad/s. :type Hz: Bool :

(roots, Hz, pz)

Source from the content-addressed store, hash-verified

759 return RST
760
761def _numRoots2RST(roots, Hz, pz):
762 """
763 Returns a list of lists with row data for the creation of an RST table
764 with numeric poles or zeros.
765
766 :param roots: List with numeric roots
767 :type roots: List with (complex) numbers
768
769 :param Hz: True if frequencies must be displayed in Hz, False for rad/s.
770 :type Hz: Bool
771
772 :param pz: Identifier prefix: 'p' ofr poles 'z' for zeros.
773 :type pz: str
774
775 :return: List of lists with data of poles or zeros
776 :rtype: List of lists
777 """
778 lineList = []
779 i = 0
780 for root in roots:
781 if Hz:
782 root = sp.N(root/2/sp.pi)
783 else:
784 root = sp.N(root)
785 realpart = roundN(sp.re(root))
786 imagpart = roundN(sp.im(root))
787 frequency = roundN(sp.Abs(root))
788 Q = roundN(frequency/(2*sp.Abs(realpart)))
789 if imagpart == 0:
790 line = [sp.Symbol(pz + '_' + str(i)), realpart, imagpart, frequency ]
791 else:
792 line = [sp.Symbol(pz + '_' + str(i)), realpart, imagpart, frequency, Q]
793 lineList.append(line)
794 return lineList
795
796def _symRoots2RST(roots, Hz, pz):
797 """

Callers 1

pzMethod · 0.85

Calls 1

roundNFunction · 0.90

Tested by

no test coverage detected