示例#1
0
def t60_fitzroy(surfaces, alpha, volume, c=SOUNDSPEED):
    """
    Reverberation time according to Fitzroy.

    :param surfaces: Surfaces :math:`S`.
    :param alpha: Mean absorption coefficient :math:`\\alpha` or by frequency bands
    :param volume: Volume of the room :math:`V`.
    :param c: Speed of sound :math:`c`.
    :returns: Reverberation time :math:`T_{60}`
    """
    Sx = np.sum(surfaces[0:2])
    Sy = np.sum(surfaces[2:4])
    Sz = np.sum(surfaces[4:6])
    St = np.sum(surfaces)
    alpha = _is_1d(alpha)
    a_x = np.average(alpha[:, 0:2], weights=surfaces[0:2], axis=1)
    a_y = np.average(alpha[:, 2:4], weights=surfaces[2:4], axis=1)
    a_z = np.average(alpha[:, 4:6], weights=surfaces[4:6], axis=1)
    factor = -(Sx / np.log(1.0 - a_x) + Sy / np.log(1.0 - a_y) + Sz / np.log(1 - a_z))
    t60 = 4.0 * np.log(10.0**6.0) * volume * factor / (c * St**2.0)
    return t60
示例#2
0
def t60_fitzroy(surfaces, alpha, volume, c=SOUNDSPEED):
    """
    Reverberation time according to Fitzroy.

    :param surfaces: Surfaces :math:`S`.
    :param alpha: Mean absorption coefficient :math:`\\alpha` or by frequency bands
    :param volume: Volume of the room :math:`V`.
    :param c: Speed of sound :math:`c`.
    :returns: Reverberation time :math:`T_{60}`
    """
    Sx = np.sum(surfaces[0:2])
    Sy = np.sum(surfaces[2:4])
    Sz = np.sum(surfaces[4:6])
    St = np.sum(surfaces)
    alpha = _is_1d(alpha)
    a_x = np.average(alpha[:, 0:2], weights=surfaces[0:2], axis=1)
    a_y = np.average(alpha[:, 2:4], weights=surfaces[2:4], axis=1)
    a_z = np.average(alpha[:, 4:6], weights=surfaces[4:6], axis=1)
    factor = -(Sx / np.log(1.0-a_x) + Sy / np.log(1.0-a_y) + Sz / np.log(1-a_z))
    t60 = 4.0 * np.log(10.0**6.0) * volume * factor / (c * St**2.0)
    return t60
示例#3
0
def test__is1d_vector_2darray():
    a = np.array([[0.1, 0.2, 0.3]])
    is_vector_2darray = _is_1d(a)
    a_return = np.array([0.1, 0.2, 0.3])
    assert_array_equal(a_return, is_vector_2darray)
示例#4
0
def test__is_1d_2darray():
    a = np.array([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]])
    is_2d_array = _is_1d(a)
    assert_array_equal(a, is_2d_array)
示例#5
0
def test__is_1d_1darray():
    a = np.array([0.1, 0.2, 0.3])
    is_1d_array = _is_1d(a)
    a_return = np.array([a])
    assert_array_equal(a_return, is_1d_array)
示例#6
0
def test__is_1d_float():
    a = 0.9
    is_float = _is_1d(a)
    assert a == is_float
def test__is1d_vector_2darray():
    a = np.array([[0.1, 0.2, 0.3]])
    is_vector_2darray = _is_1d(a)
    a_return = np.array([0.1, 0.2, 0.3])
    assert_array_equal(a_return, is_vector_2darray)
def test__is_1d_2darray():
    a = np.array([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]])
    is_2d_array = _is_1d(a)
    assert_array_equal(a, is_2d_array)
def test__is_1d_1darray():
    a = np.array([0.1, 0.2, 0.3])
    is_1d_array = _is_1d(a)
    a_return = np.array([a])
    assert_array_equal(a_return, is_1d_array)
示例#10
0
def test__is_1d_float():
    a = 0.9
    is_float = _is_1d(a)
    assert a == is_float