gen.py 文件源码

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

项目:sound_field_analysis-py 作者: QULab 项目源码 文件源码
def spherical_noise(gridData=None, order_max=8, spherical_harmonic_bases=None):
    ''' Returns order-limited random weights on a spherical surface

    Parameters
    ----------
    gridData : io.SphericalGrid
       SphericalGrid containing azimuth and colatitude
    order_max : int, optional
        Spherical order limit [Default: 8]

    Returns
    -------
    noisy_weights : array_like, complex
       Noisy weigths
    '''

    if spherical_harmonic_bases is None:
        if gridData is None:
            raise TypeError('Either a grid or the spherical harmonic bases have to be provided.')
        gridData = SphericalGrid(*gridData)
        spherical_harmonic_bases = sph_harm_all(order_max, gridData.azimuth, gridData.colatitude)
    else:
        order_max = _np.int(_np.sqrt(spherical_harmonic_bases.shape[1]) - 1)
    return _np.inner(spherical_harmonic_bases, _np.random.randn((order_max + 1) ** 2) + 1j * _np.random.randn((order_max + 1) ** 2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号