anscombe.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:CRIkit2 作者: CoherentRamanNIST 项目源码 文件源码
def gen_anscombe_forward(signal, gauss_std, gauss_mean = 0, poisson_multi = 1):
    """
    Applies the generalized Anscombe variance-stabilization transform
    assuming a mixed Poisson-Gaussian noise model as:

    signal = poisson_multi*Poisson{signal0} + Gauss{gauss_mean, gauss_std},

    where Poisson{} and Gauss{} are generalized descriptions of Poisson and
    Gaussian noise.

    Parameters
    ----------
    signal : ndarray
        Noisy signal (1-,2-,3D)

    gauss_std : float, int
        Standard deviation of Gaussian noise

    poisson_multi : float or int, optional (default = 1)
        Effectively a multiplier that scales the effect of the Poisson
        noise

    gauss_mean : float or int, optional (default = 0)
        Mean Gaussian noise level

    Returns
    -------
    fsignal : ndarray (matched to signal shape)
        "Anscombe-transformed" signal with an approximate unity standard \
        deviation/variance (~ 1)

    Note
    ----
    This software is a direct translation (with minor alterations) of the
    original MATLAB software created by Alessandro Foi and Markku Mäkitalo
    (Tampere University of Technology - 2011-2012). Please cite the references
    below if using this software. http://www.cs.tut.fi/~foi/

    References
    ----------
    [1] J.L. Starck, F. Murtagh, and A. Bijaoui, Image  Processing  and
    Data Analysis, Cambridge University Press, Cambridge, 1998)

    """

    SMALL_VAL = 1

    fsignal = 2/poisson_multi * _np.sqrt(_np.fmax(SMALL_VAL,poisson_multi*signal +
                                    (3/8)*poisson_multi**2 +
                                    gauss_std**2 -
                                    poisson_multi*gauss_mean))
#    fsignal = _ne.evaluate('2/poisson_multi * sqrt(where(poisson_multi*signal + (3/8)*poisson_multi**2 +\
#                            gauss_std**2 - poisson_multi*gauss_mean > SMALL_VAL,\
#                            poisson_multi*signal + (3/8)*poisson_multi**2 +\
#                            gauss_std**2 - poisson_multi*gauss_mean, SMALL_VAL))')
    #fsignal = 2/poisson_multi * _np.sqrt(_np.fmax(SMALL_VAL,fsignal))
    return fsignal
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号