def validation_sharpness(noise):
    """Test function for the script sharpness_din

    Test function for the script sharpness_din with .wav filesas input. 
    The input files are provided by DIN 45692_2009E
    The compliance is assessed according to chapter 6 of the standard. 
    One .png compliance plot is generated.

    Parameters
    ----------
    None

    Outputs
    -------
    None
    """

    sharpness = np.zeros((len(noise)))
    reference = np.zeros((len(noise)))

    for i in range(len(noise)):
        # Load signal
        sig, fs = load(True, noise[i]["data_file"], calib=1)

        # Compute sharpness
        S = comp_sharpness(True, sig, fs, method='din')
        sharpness[i] = S['values']

        # Load reference value
        reference[i] = noise[i]['S']

    noise_type = noise[0]["type"]

    check_compliance(sharpness, reference, noise_type)
Exemplo n.º 2
0
def test_sharpness():
    """Test function for the sharpness calculation of an audio signal

    Test function for the function "comp_roughness" with 'din' method.
    The input signals come from DIN 45692_2009E. The compliance is assessed
    according to chapter 6 of the standard.
    One .png compliance plot is generated.

    Parameters
    ----------
    None

    Outputs
    -------
    None
    """

    # Input signal from DIN 45692_2009E
    signal = {
        "data_file": r"mosqito\tests\sharpness\Standard\1KHZ60DB.wav",
        "S": 1
    }

    # Load signal
    sig, fs = load(True, signal["data_file"], calib=1)

    # Compute sharpness
    sharpness = comp_sharpness(True, sig, fs, method="din")
    S = sharpness["values"]

    assert check_compliance(S, signal)