<s> import pytest <EOL> import numpy as np <EOL> from acoustics . standards . iso_1996_2_2007 import Tonality <EOL> from acoustics import Signal <EOL> import collections <EOL> def test_tonality ( ) : <EOL> duration = <NUM_LIT> <EOL> fs = <NUM_LIT> <EOL> samples = int ( fs * duration ) <EOL> times = np . arange ( samples ) / fs <EOL> signal = Signal ( np . sin ( <NUM_LIT> * np . pi * <NUM_LIT> * times ) , fs ) <EOL> tonality = Tonality ( signal , signal . fs ) <EOL> tonality . spectrum <EOL> tonality . plot_spectrum ( ) <EOL> tonality . frequency_resolution <EOL> tonality . effective_analysis_bandwidth <EOL> with pytest . raises ( ValueError ) : <EOL> print ( tonality . overview ( ) ) <EOL> tonality . results_as_dataframe ( ) <EOL> assert len ( list ( tonality . noise_pauses ) ) == <NUM_LIT:0> <EOL> assert len ( list ( tonality . tones ) ) == <NUM_LIT:0> <EOL> assert len ( list ( tonality . critical_bands ) ) == <NUM_LIT:0> <EOL> tonality . determine_noise_pauses ( ) . analyse ( ) <EOL> assert len ( list ( tonality . noise_pauses ) ) == <NUM_LIT:1> <EOL> assert len ( list ( tonality . tones ) ) == <NUM_LIT:1> <EOL> assert len ( list ( tonality . critical_bands ) ) == <NUM_LIT:1> <EOL> tonality . critical_band_at ( <NUM_LIT> ) <EOL> tonality . dominant_tone <EOL> print ( tonality . overview ( ) ) <EOL> tonality . results_as_dataframe ( ) <EOL> tonality . plot_results ( ) </s>
