Package: noisemonitor
noisemonitorPython package for sound level monitor (long-term sound level meter) data analysis. Contains various fonctions to analyze and plot sliding averages, weekly and daily averages for noise descriptors such as the Lden, Leq and statistical indicators such as L10, L50 and L90 (see thispaperfor more details on these descriptors). The package works with equivalent sound level data (weighted or un-weighted) captured at regular intervals, typically ranging from 1 second to 1 minute.InstallationYou can install with pip as followspip install noisemonitorFor the latest releases install from the GitHub repopip install git+https://github.com/valerianF/noisemonitorUsageRead sound level monitor dataA function is included to read data in the form of either .csv, .xls, .xlsx or .txt files from a sound level monitor and convert them to a DataFrame with datetime or pandas TimeStamp index. Multiple files can be read at once, and the resulting data will be concatenated in a single DataFrame. Note that you must indicate the datasheet's indexes corresponding to date, time and captured equivalent sound level. Reading files with pandas and automatic parsing into datetime values can be computationaly expensive and the process can last a few minutes, depending on the input data.fromdatetimeimportdatetimeimportnoisemonitorasnm# Load example .xslx data within the github repositorydf=nm.load_data(['tests/data/test.xlsx'],datetimeindex=0,valueindex=1)# Filter out data between or outside specified dates and times if requireddf=nm.filter_data(df,datetime(2022,8,10,3),datetime(2022,8,10,4),between=True)Once sound level data is parsed into a proper dataframe, you can create a NoiseMonitor class instance from it, which will be used for further analyses.average=nm.NoiseMonitor(df)Data analysis and plottingThe hard part is over, now you can just compute the descriptors you want from the NoiseMonitor class instance. Individual average descriptors are returned as dictionnaries.# Equivalent level and percentiles between 7am and 12amleq_am=average.leq(7,12)# Same between 3pm and 7pm on weekendsleq_pm_weekends=average.leq(15,19,day1='saturday',day2='sunday')# Lden overalllden_all=average.lden()# Lden from mondays to fridayslden_weekdays=average.lden(day1='monday',day2='friday')General, daily or weekly sliding averages are returned as DataFrames with datetime (for general averages) or time (for daily and weekly averages) index, and with columns including the corresponding Leq, L10, L50 and L90 values, respectively.# sliding average with a window size of 3600s (1 hour) and a step size of 1200s (20 minutes)general=average.sliding_average(win=3600,step=1200)# daily average from 9pm to 7amdaily=average.daily(21,7,win=3600,step=1200)# weekday average from 2am to 11pmweekday=average.weekly(2,23,'monday','friday',win=3600,step=1200)# weekend average from 2am to 11pmweekend=average.weekly(2,23,'saturday','sunday',win=3600,step=1200)These sliding averages can be plotted using level_plot function.nm.level_plot(general,'Leq')# Showing general Leq valuesnm.level_plot(daily,'Leq','L10','L50','L90')# Showing daily night valuesnm.level_plot(weekday,'L10','L50','L90')# Showing weekday percentiles valuesnm.level_plot(weekend,'L10','L50','L90')# Showing weekend percentiles valuesDependenciesNumPy(http://www.numpy.org/)pandas(https://pandas.pydata.org/)Matplotlib(https://matplotlib.org/)