MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / noiseContribs

Method noiseContribs

SLiCAP/SLiCAPlatex.py:381–434  ·  view source on GitHub ↗

Creates a table with results of noise 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

379 return Snippet(TEX, self.format)
380
381 def noiseContribs(self, resultObject, label="", caption="", color="myyellow"):
382 """
383 Creates a table with results of noise analysis stored in *resultObject*.
384 If no label AND no caption are given this method returns a LaTeX
385 tabular snippet. Else it returns a table snippet.
386
387 :param resultObject: SLiCAP circuit object that comprises the circuit data to be listed.
388 :type resultObject: SLiCAP.SLiCAPinstruction.instruction
389
390 :param label: Reference label for the table. Defaults to an empty string.
391 :type label: str
392
393 :param caption: Text that will used as table caption(s).
394 :type caption: str
395
396 :param color: Alternate row color name, should be defined in
397 'preambuleSLiCAP.tex' defaults to 'myyellow'. Use None for
398 no background color.
399 :type color: str
400
401 :return: SLiCAP Snippet object
402 :rtype: SLiCAP.SLiCAPprotos.Snippet
403 """
404 TEX = ''
405 if resultObject.dataType == 'noise' and resultObject.step == False:
406 detunits = resultObject.detUnits + '**2/Hz'
407 if resultObject.srcUnits != None:
408 srcunits = resultObject.srcUnits + '**2/Hz'
409 # Add a table for source contributions
410 linesList = []
411 alignstring = '[c]{lll}'
412 headerList = ['Name', 'Value' , 'Units']
413 linesList = []
414 for src in resultObject.onoiseTerms.keys():
415 if src[0].upper() == 'I':
416 units = 'A**2/Hz'
417 elif src[0].upper() == 'V':
418 units = 'V**2/Hz'
419 #units = sp.sympify(units)
420 line = [src + ': Value' , resultObject.snoiseTerms[src], units]
421 linesList.append(line)
422 if resultObject.srcUnits != None:
423 line = [src + ': Source-referred',
424 resultObject.inoiseTerms[src], srcunits]
425 linesList.append(line)
426 line = [src + ': Detector-referred',
427 resultObject.onoiseTerms[src], detunits]
428 linesList.append(line)
429 TEX += _TEXcreateCSVtable(headerList, linesList, alignstring,
430 unitpos=2, caption=caption,
431 label=label, color=color)
432 else:
433 print('noiseContribs2TEX: Error: wrong data type, or stepped analysis.')
434 return Snippet(TEX, self.format)
435
436 def dcvarContribs(self, resultObject, label="", caption="", color="myyellow"):
437 """

Callers

nothing calls this directly

Calls 2

SnippetClass · 0.90
_TEXcreateCSVtableFunction · 0.85

Tested by

no test coverage detected