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

Method dcvarContribs

SLiCAP/SLiCAPlatex.py:436–491  ·  view source on GitHub ↗

Creates a table with results of dcvar analysis stored in *resultObject*. If no label AND no caption are given this method returns a LaTeX tabular snippet. Else it returns a table snippet. :param resultObject: SLiCAP circuit object that comprises the circuit data to

(self, resultObject, label="", caption="", color="myyellow")

Source from the content-addressed store, hash-verified

434 return Snippet(TEX, self.format)
435
436 def dcvarContribs(self, resultObject, label="", caption="", color="myyellow"):
437 """
438 Creates a table with results of dcvar analysis stored in *resultObject*.
439 If no label AND no caption are given this method returns a LaTeX
440 tabular snippet. Else it returns a table snippet.
441
442 :param resultObject: SLiCAP circuit object that comprises the circuit data to be listed.
443 :type resultObject: SLiCAP.SLiCAPinstruction.instruction
444
445 :param label: Reference label for the table. Defaults to an empty string.
446 :type label: str
447
448 :param caption: Text that will used as table caption(s).
449 :type caption: str
450
451 :param color: Alternate row color name, should be defined in
452 'preambuleSLiCAP.tex' defaults to 'myyellow'. Use None for
453 no background color.
454 :type color: str
455
456 :return: SLiCAP Snippet object
457 :rtype: SLiCAP.SLiCAPprotos.Snippet
458 """
459 TEX = ''
460 if resultObject.dataType == 'dcvar' and resultObject.step == False:
461 detUnits = resultObject.detUnits + '**2'
462 if resultObject.srcUnits != None:
463 srcUnits = resultObject.srcUnits + '**2'
464 else:
465 srcUnits = ""
466 # Add a table for source contributions
467 linesList = []
468 alignstring = '[c]{lll}'
469 headerList = ['Name', 'Value' , 'Units']
470 linesList = []
471 for src in resultObject.ovarTerms.keys():
472 if src[0].upper() == 'I':
473 units = 'A**2'
474 elif src[0].upper() == 'V':
475 units = 'V**2'
476 #units = sp.sympify(units)
477 line = [src + ': Value' , resultObject.svarTerms[src], units]
478 linesList.append(line)
479 if resultObject.srcUnits != None:
480 line = [src + ': Source-referred',
481 resultObject.ivarTerms[src], srcUnits]
482 linesList.append(line)
483 line = [src + ': Detector-referred',
484 resultObject.ovarTerms[src], detUnits]
485 linesList.append(line)
486 TEX += _TEXcreateCSVtable(headerList, linesList, alignstring,
487 unitpos=2, caption=caption, label=label,
488 color=color)
489 else:
490 print('dcvarContribs2TEX: Error: wrong data type, or stepped analysis.')
491 return Snippet(TEX, self.format)
492
493 def specs(self, specs, specType, label="", caption="", color="myyellow"):

Callers

nothing calls this directly

Calls 2

SnippetClass · 0.90
_TEXcreateCSVtableFunction · 0.85

Tested by

no test coverage detected