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

Function _varNoise

SLiCAP/SLiCAPmath.py:1621–1738  ·  view source on GitHub ↗

(noiseResult, noise, fmin, fmax, source=None, CDS=False, tau=None, 
              method="auto", points=0, wf=1)

Source from the content-addressed store, hash-verified

1619 return var
1620
1621def _varNoise(noiseResult, noise, fmin, fmax, source=None, CDS=False, tau=None,
1622 method="auto", points=0, wf=1):
1623 """
1624 """
1625 errors = 0
1626 var = []
1627 if type(source) != list:
1628 sources = [source]
1629 else:
1630 sources = source
1631 numlimits = False
1632 if CDS:
1633 if tau == None:
1634 print(
1635 "Error: rmsNoise() with CDS=True requires a nonzero finite value for 'tau'.")
1636 errors += 1
1637 else:
1638 try:
1639 tau = sp.sympify(str(tau))
1640 except sp.SympifyError:
1641 print("Error in expression: rmsNoise( ... , tau =", tau, ").")
1642 errors += 1
1643 fMi = _checkNumber(fmin)
1644 fMa = _checkNumber(fmax)
1645 if fMi != None:
1646 # Numeric value for fmin
1647 fmin = fMi
1648 if fMa != None:
1649 # Numeric value for fmax
1650 fmax = fMa
1651 if fMi != None and fMa != None:
1652 if fMi >= fMa:
1653 # Numeric values for fmin and fmax but fmin >= fmax
1654 print("Error in frequency range specification.")
1655 errors += 1
1656 elif fMi == 0 and method == "log":
1657 print("Error: method='log' cannot be combined with fmin=0.")
1658 errors += 1
1659 elif fMa > fMi:
1660 # Numeric values for fmin and fmax and fmax >= fmin
1661 numlimits = True
1662 if numlimits:
1663 fmax = float(fmax)
1664 fmin = float(fmin)
1665
1666 if noiseResult.dataType != 'noise':
1667 print("Error: expected dataType noise, got: '{0}'.".format(
1668 noiseResult.dataType))
1669 errors += 1
1670
1671 if method != "symbolic" and numlimits == True:
1672 if noise == "onoise":
1673 if type(noiseResult.onoise) != list:
1674 spectra = [noiseResult.onoise]
1675 else:
1676 spectra = noiseResult.onoise
1677 elif noise == "inoise":
1678 if type(noiseResult.inoise) != list:

Callers 1

rmsNoiseFunction · 0.85

Calls 3

_checkNumberFunction · 0.85
_doVarNoiseDataFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected