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

Method dcvarContribs

SLiCAP/SLiCAPrst.py:340–385  ·  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="")

Source from the content-addressed store, hash-verified

338 return Snippet(RST, self.format)
339
340 def dcvarContribs(self, resultObject, label="", caption=""):
341 """
342 Creates a table with results of dcvar analysis stored in *resultObject*.
343 If no label AND no caption are given this method returns a LaTeX
344 tabular snippet. Else it returns a table snippet.
345
346 :param resultObject: SLiCAP circuit object that comprises the circuit data to be listed.
347 :type resultObject: SLiCAP.SLiCAPinstruction.instruction
348
349 :param label: Reference label for the table. Defaults to an empty string.
350 :type label: str
351
352 :param caption: Text that will used as table caption(s).
353 :type caption: str
354
355 :return: SLiCAP Snippet object
356 :rtype: SLiCAP.SLiCAPprotos.Snippet
357 """
358 if resultObject.dataType == 'dcvar' and resultObject.step == False:
359 detunits = resultObject.detUnits + '**2'
360 if resultObject.srcUnits != None:
361 srcunits = resultObject.srcUnits + '**2'
362 # Add a table with dcvar contributions
363 linesList = []
364 headerList = ['', 'Value' , 'Units']
365 for src in resultObject.ovarTerms.keys():
366 if src[0].upper() == 'I':
367 units = 'A**2'
368 elif src[0].upper() == 'V':
369 units = 'V**2'
370 #units = sp.sympify(units)
371 line = [src + ': Source value', resultObject.svarTerms[src], units]
372 linesList.append(line)
373 if resultObject.srcUnits != None:
374 line = [src + ': Source-referred', resultObject.ivarTerms[src],
375 srcunits]
376 linesList.append(line)
377 line = [src + ': Detector-referred', resultObject.ovarTerms[src],
378 detunits]
379 linesList.append(line)
380 RST = _RSTcreateCSVtable(caption, headerList, linesList, unitpos=2,
381 label=label)
382 else:
383 RST = ''
384 print('dcvar2RST: Error: wrong data type, or stepped analysis.')
385 return Snippet(RST, self.format)
386
387 def specs(self, specs, specType, label="", caption=""):
388 """

Callers 2

sphinx_report.pyFile · 0.45
dcvar.pyFile · 0.45

Calls 2

SnippetClass · 0.90
_RSTcreateCSVtableFunction · 0.85

Tested by

no test coverage detected