Displays a table with circuit parameters, their definitions and numeric values on the actibe htmal page. :param circuitObject: SLiCAP circuit object of which the element data will be displayed on the HTML page. :type circuitObjec
(circuitObject, label='', caption='')
| 396 | return html |
| 397 | |
| 398 | def params2html(circuitObject, label='', caption=''): |
| 399 | """ |
| 400 | Displays a table with circuit parameters, their definitions and numeric |
| 401 | values on the actibe htmal page. |
| 402 | |
| 403 | :param circuitObject: SLiCAP circuit object of which the element data will |
| 404 | be displayed on the HTML page. |
| 405 | |
| 406 | :type circuitObject: SLiCAPprotos.circuit |
| 407 | :param label: Label that will be assigned to this table. |
| 408 | :type label: str |
| 409 | |
| 410 | :param caption: Caption that will be placed with this table. |
| 411 | :type caption: str |
| 412 | |
| 413 | :return: HTML string that will be placed on the page. |
| 414 | :rtype: str |
| 415 | """ |
| 416 | label = _addLabel(label, fileName='', caption=caption, labelType='data') |
| 417 | if caption == '': |
| 418 | caption = "<caption>Table: Parameter definitions in '%s'.</caption>"%(circuitObject.title) |
| 419 | html = '%s<table>%s\n'%(label, caption) |
| 420 | html += '<tr><th class="left">Name</th><th class="left">Symbolic</th><th class="left">Numeric</th></tr>\n' |
| 421 | parNames = list(circuitObject.parDefs.keys()) |
| 422 | # Sort the list with symbolic keys such that elements are grouped and |
| 423 | # sorted per sub circuit |
| 424 | parNames = [str(parNames[i]) for i in range(len(parNames))] |
| 425 | localPars = [] # list for sub circuit parameters |
| 426 | globalPars = [] # list for main circuit parameters |
| 427 | for i in range(len(parNames)): |
| 428 | par = str(parNames[i]).split('_') |
| 429 | if par[-1][0].upper() == 'X': |
| 430 | localPars.append(str(parNames[i])) |
| 431 | else: |
| 432 | globalPars.append(str(parNames[i])) |
| 433 | # Group per sub circuit ignore case |
| 434 | localPars = sorted(localPars) |
| 435 | names = sorted(globalPars) + localPars |
| 436 | parNames = [sp.Symbol(names[i]) for i in range(len(names))] |
| 437 | for par in parNames: |
| 438 | parName = '$' + sp.latex(par) + '$' |
| 439 | try: |
| 440 | symValue = '$' + _latex_ENG(circuitObject.parDefs[par]) + '$' |
| 441 | #ymValue = '$' + sp.latex(roundN(circuitObject.parDefs[par], numeric=False)) + '$' |
| 442 | numValue = '$' + _latex_ENG(sp.N(fullSubs(circuitObject.parDefs[par], circuitObject.parDefs))) + '$' |
| 443 | #numValue = '$' + sp.latex(roundN(fullSubs(circuitObject.parDefs[par], circuitObject.parDefs), numeric=True)) + '$' |
| 444 | html += '<tr><td class="left">' + parName +'</td><td class="left">' + symValue + '</td><td class="left">' + numValue + '</td></tr>\n' |
| 445 | except: |
| 446 | pass |
| 447 | html += '</table>\n' |
| 448 | if len(circuitObject.params) > 0: |
| 449 | caption = "<caption>Table: Parameters without definition in '%s.</caption>\n"%(circuitObject.title) |
| 450 | html += '<table>%s\n'%(caption) |
| 451 | html += '<tr><th class="left">Name</th></tr>\n' |
| 452 | for par in circuitObject.params: |
| 453 | parName = '$' + sp.latex(par) + '$' |
| 454 | html += '<tr><td class="left">' + parName +'</td></tr>\n' |
| 455 | html += '</table>\n' |
no test coverage detected