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

Method coeffsTransfer

SLiCAP/SLiCAPrst.py:538–583  ·  view source on GitHub ↗

Creates a tablestable that displays the numerator and denominator coefficients of a rational expression. If no label AND no caption are given this method returns a LaTeX tabular snippet. Else it returns a table snippet. :param stepVars: List with s

(self, transferCoeffs, label="", caption="")

Source from the content-addressed store, hash-verified

536 return Snippet(RST, self.format)
537
538 def coeffsTransfer(self, transferCoeffs, label="", caption=""):
539 """
540 Creates a tablestable that displays the numerator and denominator
541 coefficients of a rational expression.
542 If no label AND no caption are given this method returns a LaTeX
543 tabular snippet. Else it returns a table snippet.
544
545 :param stepVars: List with step variables (*str, sympy.Symbol*).
546 :type stepVars: list
547
548 :param stepArray: List with lists with step values for each step variable
549 :type stepArray: List
550
551 :param label: Reference label for the table. Defaults to an empty string.
552 :type label: str
553
554 :param caption: Table caption.
555 :type caption: str
556
557 :return: SLiCAP Snippet object
558 :rtype: SLiCAP.SLiCAPprotos.Snippet
559
560 :example:
561
562 >>> import SLiCAP as sl
563 >>> import sympy as sp
564 >>>
565 >>> rst = sl.RSTformatter()
566 >>> expr = sp.sympify("A_0*(1+s*b_1)/(((1+s*a_1))*((1+s*a_2)))")
567 >>> tr_coeffs = sl.coeffsTransfer(expr)
568 >>> rst.coeffsTransfer(tr_coeffs,
569 label="tab-coeffs",
570 caption = "numerator and denominator " +
571 "coefficients").save("coeffs")
572
573 """
574 (gain, numerCoeffs, denomCoeffs) = transferCoeffs
575 headerList = ['Coeff', 'Value']
576 linesList = []
577 for i in range(len(numerCoeffs)):
578 linesList.append([sp.sympify('b_' + str(i)), numerCoeffs[i]])
579 for i in range(len(denomCoeffs)):
580 linesList.append([sp.sympify('a_' + str(i)), denomCoeffs[i]])
581 RST = '**Gain factor:**' + ':math:`' + sp.latex(roundN(gain)) +'`\n\n'
582 RST += _RSTcreateCSVtable(caption, headerList, linesList, label=label)
583 return Snippet(RST, self.format)
584
585 def file(
586 self, fileName, lineRange=None, firstNumber=None):

Callers 3

laplace.pyFile · 0.45
sphinx_report.pyFile · 0.45
feedback.pyFile · 0.45

Calls 3

roundNFunction · 0.90
SnippetClass · 0.90
_RSTcreateCSVtableFunction · 0.85

Tested by

no test coverage detected