本文整理汇总了Python中scipy.zeros_like方法的典型用法代码示例。如果您正苦于以下问题:Python scipy.zeros_like方法的具体用法?Python scipy.zeros_like怎么用?Python scipy.zeros_like使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy
的用法示例。
在下文中一共展示了scipy.zeros_like方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _RLSortRoots
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import zeros_like [as 别名]
def _RLSortRoots(mymat):
"""Sort the roots from sys._RLFindRoots, so that the root
locus doesn't show weird pseudo-branches as roots jump from
one branch to another."""
sorted = zeros_like(mymat)
for n, row in enumerate(mymat):
if n == 0:
sorted[n, :] = row
else:
# sort the current row by finding the element with the
# smallest absolute distance to each root in the
# previous row
available = list(range(len(prevrow)))
for elem in row:
evect = elem-prevrow[available]
ind1 = abs(evect).argmin()
ind = available.pop(ind1)
sorted[n, ind] = elem
prevrow = sorted[n, :]
return sorted
示例2: ranktrafo
# 需要导入模块: import scipy [as 别名]
# 或者: from scipy import zeros_like [as 别名]
def ranktrafo(data):
X = data.values[:, None]
Is = X.argsort(axis=0)
RV = sp.zeros_like(X)
rank = sp.zeros_like(X)
for i in xrange(X.shape[1]):
x = X[:,i]
rank = sp.stats.rankdata(x)
rank /= (X.shape[0]+1)
RV[:,i] = sp.sqrt(2) * sp.special.erfinv(2*rank-1)
return RV.flatten()