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

Function _makeNumData

SLiCAP/SLiCAPmath.py:830–862  ·  view source on GitHub ↗

Returns a list of values y, where y[i] = yFunc(x[i]). :param yFunc: Function :type yFunc: sympy.Expr :param xVar: Variable that needs to be substituted in *yFunc* :type xVar: sympy.Symbol :param x: List with values of x :type x: list :param normalize: True if rat

(yFunc, xVar, x, normalize=True)

Source from the content-addressed store, hash-verified

828 return (mrgns, freqs)
829
830def _makeNumData(yFunc, xVar, x, normalize=True):
831 """
832 Returns a list of values y, where y[i] = yFunc(x[i]).
833
834 :param yFunc: Function
835 :type yFunc: sympy.Expr
836
837 :param xVar: Variable that needs to be substituted in *yFunc*
838 :type xVar: sympy.Symbol
839
840 :param x: List with values of x
841 :type x: list
842
843 :param normalize: True if rational function needs to be normalized. Defaults to True.
844 :type normalize: Bool
845
846 :return: list with y values: y[i] = yFunc(x[i]).
847 :rtype: list
848 """
849 if normalize:
850 yFunc = normalizeRational(sp.N(yFunc), xVar)
851 else:
852 yFunc = sp.N(yFunc)
853 if xVar in yFunc.atoms(sp.Symbol):
854 # Check for Heaviside functions (not implemented in sp.lambdify)
855 if len(yFunc.atoms(sp.Heaviside)) != 0:
856 y = [sp.N(yFunc.xreplace({xVar: x[i]})).doit() for i in range(len(x))]
857 else:
858 func = sp.lambdify(xVar, yFunc, ini.lambdify)
859 y = func(x)
860 else:
861 y = [sp.N(yFunc) for i in range(len(x))]
862 return y
863
864def _magFunc_f(LaplaceExpr, f):
865 """

Callers 3

plotSweepFunction · 0.90
_magFunc_fFunction · 0.85
_dB_magFunc_fFunction · 0.85

Calls 1

normalizeRationalFunction · 0.85

Tested by

no test coverage detected