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

Function pz2html

SLiCAP/SLiCAPhtml.py:621–746  ·  view source on GitHub ↗

Displays the DC transfer, and tables with poles and zeros on the active HTML page. Not implemented with parameter stepping. :param instObj: Results of an instruction with data type 'poles', 'zeros' or 'pz'. :type instObj: SLiCAP.protos.allResults :param label: ID of t

(instObj, label = '', labelText = '')

Source from the content-addressed store, hash-verified

619 return html
620
621def pz2html(instObj, label = '', labelText = ''):
622 """
623 Displays the DC transfer, and tables with poles and zeros on the active
624 HTML page.
625
626 Not implemented with parameter stepping.
627
628 :param instObj: Results of an instruction with data type 'poles', 'zeros' or 'pz'.
629 :type instObj: SLiCAP.protos.allResults
630
631 :param label: ID of the label assigned to these tables; defaults to ''.
632 :type label: str
633
634 :param labelText: Label text to be displayed by **links2html()**; defaults to ''
635 :type labelText: str
636
637 :return: HTML string that will be placed on the page.
638 :rtype: str
639 """
640 html = ''
641 if instObj.errors != 0:
642 print("Errors found in instruction.")
643 return html
644 elif instObj.dataType != 'poles' and instObj.dataType != 'zeros' and instObj.dataType != 'pz':
645 print("Error: 'pz2html()' expected dataType: 'poles', 'zeros', or 'pz', got: '{0}'.".format(instObj.dataType))
646 return html
647 elif instObj.step == True :
648 print("Error: parameter stepping not implemented for 'pz2html()'.")
649 return html
650 label = _addLabel(label, caption=labelText, labelType="data")
651 (poles, zeros, DCgain) = (instObj.poles, instObj.zeros, instObj.DCvalue)
652 if type(DCgain) == list and len(DCgain) != 0:
653 DCgain = DCgain[0]
654 if instObj.dataType == 'poles':
655 headTxt = 'Poles '
656 elif instObj.dataType == 'zeros':
657 headTxt = 'Zeros '
658 elif instObj.dataType == 'pz':
659 headTxt = 'PZ '
660 html = '<h2>' + label + headTxt + ' analysis results</h2>\n'
661 html += '<h3>Gain type: %s</h3>'%(instObj.gainType)
662 if DCgain != None and instObj.dataType =='pz':
663 if instObj.numeric == True:
664 html += '\n' + '<p>DC value = $' + sp.latex(roundN(sp.N(DCgain))) + '$</p>\n'
665 else:
666 html += '\n<p>DC gain = $' + sp.latex(roundN(DCgain)) + '$</p>\n'
667 elif instObj.dataType =='pz':
668 html += '<p>DC gain could not be determined.</p>\n'
669 if ini.hz == True:
670 unitsM = 'Mag [Hz]'
671 unitsR = 'Re [Hz]'
672 unitsI = 'Im [Hz]'
673 unitsS = '[Hz]'
674 else:
675 unitsM = 'Mag [rad/s]'
676 unitsR = 'Re [rad/s]'
677 unitsI = 'Im [rad/s]'
678 unitsS = '[rad/s]'

Callers

nothing calls this directly

Calls 6

roundNFunction · 0.90
_checkNumericFunction · 0.90
_addLabelFunction · 0.85
_latex_ENGFunction · 0.85
_insertHTMLFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected