1、Scipy计算SNR,正式版本中已删除,原定义如下:
def signaltonoise(a, axis=0, ddof=0):"""The signal-to-noise ratio of the input data.Returns the signal-to-noise ratio of `a`, here defined as the meandivided by the standard deviation.Parameters----------a : array_likeAn array_like object containing the sample data.axis : int or None, optionalAxis along which to operate. Default is 0. If None, compute overthe whole array `a`.ddof : int, optionalDegrees of freedom correction for standard deviation. Default is 0.Returns-------s2n : ndarrayThe mean to standard deviation ratio(s) along `axis`, or 0 where thestandard deviation is 0."""a = np.asanyarray(a)m = a.mean(axis)sd = a.std(axis=axis, ddof=ddof)return np.where(sd == 0, 0, m/sd)
2、Dipy提供了SNR的计算
https://github.com/scipy/scipy/blob/v0.16.0/scipy/stats/stats.py#L1963
