MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / _numRoots2TEX

Function _numRoots2TEX

SLiCAP/SLiCAPlatex.py:963–997  ·  view source on GitHub ↗

Returns a list of lists with row data for the creation of a LaTeX 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

961 return TEX
962
963def _numRoots2TEX(roots, Hz, pz):
964 """
965 Returns a list of lists with row data for the creation of a LaTeX table
966 with numeric poles or zeros.
967
968 :param roots: List with numeric roots
969 :type roots: List with (complex) numbers
970
971 :param Hz: True if frequencies must be displayed in Hz, False for rad/s.
972 :type Hz: Bool
973
974 :param pz: Identifier prefix: 'p' ofr poles 'z' for zeros.
975 :type pz: str
976
977 :return: List of lists with data of poles or zeros
978 :rtype: list
979 """
980 lineList = []
981 i = 0
982 for root in roots:
983 i += 1
984 if Hz:
985 root = sp.N(root/2/sp.pi)
986 else:
987 root = sp.N(root)
988 realpart = roundN(sp.re(root))
989 imagpart = roundN(sp.im(root))
990 frequency = roundN(sp.Abs(root))
991 Q = roundN(frequency/(2*sp.Abs(realpart)))
992 if imagpart == 0:
993 line = [sp.Symbol(pz + '_' + str(i)), realpart, imagpart, frequency]
994 else:
995 line = [sp.Symbol(pz + '_' + str(i)), realpart, imagpart, frequency, Q]
996 lineList.append(line)
997 return lineList
998
999def _symRoots2TEX(roots, Hz, pz):
1000 """

Callers 1

pzMethod · 0.85

Calls 1

roundNFunction · 0.90

Tested by

no test coverage detected