Title: | Environmental Noise Pollution Data Analysis |
---|---|
Description: | Provides analyse, interpret and understand noise pollution data. Data are typically regular time series measured with sound meter. The package is partially described in Fogola, Grasso, Masera and Scordino (2023, <DOI:10.61782/fa.2023.0063>). |
Authors: | Pasquale Scordino [aut, cre], Simone Sperotto [ctb], Stefano Masera [ctb], Daniele Grasso [ctb], Jacopo Fogola [ctb] |
Maintainer: | Pasquale Scordino <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.2-18 |
Built: | 2024-11-21 07:21:23 UTC |
Source: | CRAN |
Returns a plot of acoustic quantile of 1/3 band frequency
AcousticQuantilePlot(df, Cols, Quantile, TimeZone = "UTC")
AcousticQuantilePlot(df, Cols, Quantile, TimeZone = "UTC")
df |
is a dataframe |
Cols |
vector of index cols (1/3 band frequency) |
Quantile |
quantile, for example 0.95 |
TimeZone |
Time zone dataset (default is UTC) |
an OpeNoise object of class ggplot
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Plot reverse quantile of 1/3 band frequency library(lubridate) datasetI <- dataset_impulsive1 datasetH <- dfImpulsiveTrasform(datasetI) AcousticQuantilePlot(df = datasetH, Cols =c(3:38), Quantile = 0.95, TimeZone = "UTC")
# Plot reverse quantile of 1/3 band frequency library(lubridate) datasetI <- dataset_impulsive1 datasetH <- dfImpulsiveTrasform(datasetI) AcousticQuantilePlot(df = datasetH, Cols =c(3:38), Quantile = 0.95, TimeZone = "UTC")
Weighting acoustic table
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Returns a vector of acoustic percetile
AcuDNPercentile(df, parameter, from, to, period)
AcuDNPercentile(df, parameter, from, to, period)
df |
is a dataframe with Leq data |
parameter |
is a parameter, example "LAeq" |
from |
is start hour |
to |
is end hour |
period |
is a period night or day |
a list of acoustic percentil values by night and daily period
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Calculate reverse quantile of a dataframe by period data("exampleHourlyData") AcuDNPercentile(df = exampleHourlyData, parameter = "leq", from = "5", to = "22", period = "night")[1:5]
# Calculate reverse quantile of a dataframe by period data("exampleHourlyData") AcuDNPercentile(df = exampleHourlyData, parameter = "leq", from = "5", to = "22", period = "night")[1:5]
Returns a vector of acoustic percentile
AcuPercentile(x)
AcuPercentile(x)
x |
is a vector with Leq data |
vector of acoustic percentil values
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Calculate reverse quantile of a vector of values #data(PTFA) AcuPercentile(PTFA$LAeq)
# Calculate reverse quantile of a vector of values #data(PTFA) AcuPercentile(PTFA$LAeq)
Returns a dataframe with energetic mean
avr.day.night(x, variable, period = "day", stat = "n_mean", ...)
avr.day.night(x, variable, period = "day", stat = "n_mean", ...)
x |
is a data frame |
variable |
is variable to apply function |
period |
is "day" or "night" |
stat |
is "n_mean" or "e_mean" like mean and energetic mean |
... |
another arguments |
dataframe of energetic mean values by night or daily period
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Calculate energetic mean in nightly period (22-06) #data(exampleHourlyData) avr.day.night(exampleHourlyData, "leq", period = "night", stat = "e_mean")[1:5, ] # Calculate energetic mean in daily period (06-22) avr.day.night(exampleHourlyData, "leq", period = "day", stat = "e_mean")[1:5, ] # Calculate mean in daily period (06-22) avr.day.night(exampleHourlyData, "leq", period = "day", stat = "n_mean")[1:5, ]
# Calculate energetic mean in nightly period (22-06) #data(exampleHourlyData) avr.day.night(exampleHourlyData, "leq", period = "night", stat = "e_mean")[1:5, ] # Calculate energetic mean in daily period (06-22) avr.day.night(exampleHourlyData, "leq", period = "day", stat = "e_mean")[1:5, ] # Calculate mean in daily period (06-22) avr.day.night(exampleHourlyData, "leq", period = "day", stat = "n_mean")[1:5, ]
Noise dataset of impulsive event (100 ms acquisition time)
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Noise dataset of impulsive event (100 ms acquisition time)
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Returns energetic sum or difference of values
dbsum(x, y, operator)
dbsum(x, y, operator)
x |
is first value or vector |
y |
is second value or vector |
operator |
is 1 for sum and -1 for difference |
vector of values contain energetic sum or difference
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Calculate energetic sum or difference of values dbsum(x = 55, y = 33, operator = 1) dbsum(x = c(55 , 66), y = c(45, 50), operator = 1) dbsum(x = c(70 , 68), y = c(55, 66), operator = -1)
# Calculate energetic sum or difference of values dbsum(x = 55, y = 33, operator = 1) dbsum(x = c(55 , 66), y = c(45, 50), operator = 1) dbsum(x = c(70 , 68), y = c(55, 66), operator = -1)
Trasform time from hours, minutes and seconds to seconds
deco.time(x, y, z, verbose = TRUE)
deco.time(x, y, z, verbose = TRUE)
x |
are hours |
y |
are minutes |
z |
are seconds |
verbose |
logic argument that on or off message (default is TRUE) |
time decomposition in seconds
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Convert H:M:S to seconds x = 5 # Hours y = 25 # minutes z = 50 # seconds deco.time(x = x, y = y, z = z)
# Convert H:M:S to seconds x = 5 # Hours y = 25 # minutes z = 50 # seconds deco.time(x = x, y = y, z = z)
Table's 1/3 octave bandwidth
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Returns a dataframe (1s samples)
dfImpulsiveTrasform(dfImpulsive, statistic = energetic.mean)
dfImpulsiveTrasform(dfImpulsive, statistic = energetic.mean)
dfImpulsive |
is a dataframe for impulse (data acquired at 100 ms) |
statistic |
is energetic mean (default) |
dataframe
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data("dataset_impulsive1") #data("dataset_impulsive2") dfImpulsiveTrasform(dfImpulsive = dataset_impulsive1, statistic = energetic.mean)[1:5, ]
#data("dataset_impulsive1") #data("dataset_impulsive2") dfImpulsiveTrasform(dfImpulsive = dataset_impulsive1, statistic = energetic.mean)[1:5, ]
Calculate weigth logarithmic mean respect to time
energetic_w.mean(x, t)
energetic_w.mean(x, t)
x |
is a vector of value in decibel (dB) |
t |
is a vector of time string "HH:MM:SS" |
weigth logarithmic mean respect to time
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Calculate weight energetic mean energetic_w.mean(x = c(55.0, 70.0) , t = c("03:55:22", "01:33:12"))
# Calculate weight energetic mean energetic_w.mean(x = c(55.0, 70.0) , t = c("03:55:22", "01:33:12"))
Calculate logarithmic mean
energetic.mean(x)
energetic.mean(x)
x |
is a vector of value in decibel (dB) |
logarithmic mean
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Calculate energetic mean of vector's values of Leq energetic.mean(c(55, 88, 66, 51, 70))
# Calculate energetic mean of vector's values of Leq energetic.mean(c(55, 88, 66, 51, 70))
calculate min value
energetic.min(y)
energetic.min(y)
y |
is a numeric vector |
energetic min vector value
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Noise hourly data of misure in environmental open space
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Returns a list of index and name
ExtractIndexMark(filemarks, dataset, mp)
ExtractIndexMark(filemarks, dataset, mp)
filemarks |
is a dataframe with date and markers |
dataset |
is dataframe in analysis |
mp |
is a name of misure point |
list of index and names
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data(PTFA) #data("markers") ExtractIndexMark(filemarks = markers , dataset = PTFA, mp = "PTFA")
#data(PTFA) #data("markers") ExtractIndexMark(filemarks = markers , dataset = PTFA, mp = "PTFA")
Returns a vector of holiday dates (Gregorian calendar)
HolidaysDate(year_holiday)
HolidaysDate(year_holiday)
year_holiday |
is year example "2022" like character |
string vector of date
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
HolidaysDate(2022)
HolidaysDate(2022)
Returns a dataframe with hourly energetic mean
HourlyEmean(df, variable, timeZone = "Europe/Rome")
HourlyEmean(df, variable, timeZone = "Europe/Rome")
df |
is a dataframe with date (Y-m-d H:M:S) and variables |
variable |
is a variable name |
timeZone |
is time zone defoult is Europe/Rome |
dataframe of hourly energetic mean values
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data(PTFA) HourlyEmean(df = PTFA, variable = "LAeq")
#data(PTFA) HourlyEmean(df = PTFA, variable = "LAeq")
Returns a number
IntrusiveIndex(dfa, dfr, BW)
IntrusiveIndex(dfa, dfr, BW)
dfa |
is a dataframe Lfa (enviromental sound levels) 1/3 octave specta data |
dfr |
is a dataframe Lfr (residual sound levels) 1/3 octave specta data |
BW |
a vector of 1/3 octave bandwidth data |
string of intrusive index
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Calculation of the intrusiveness index library(OpeNoise) library(lubridate) data("dataset_impulsive1") data("dfBW") # dataset handling df_Imp_sec <- dfImpulsiveTrasform(dataset_impulsive1, statistic = energetic.mean) df_Imp_sec$date <- ymd_hms(df_Imp_sec$date, tz = "Europe/Rome") # extraction of frequency bands from the dataset freqDF <- df_Imp_sec[, grep("LZeq\\.", names(df_Imp_sec))] ################################################################################ # INTRUSIVENESS INDEX CALCULATION FUNCTION ################################################################################ dfa <- freqDF # Environmental dataset simulation dfr <- freqDF # Residual dataset simulation by subtracting 4 from dfa dfr[c(5,8,12,15), ] <- dfr[c(5,8,12,15), ] - 4 BW <- dfBW$BW # bandwidth # application of the function IntrusiveIndex(dfa, dfr, BW)
# Calculation of the intrusiveness index library(OpeNoise) library(lubridate) data("dataset_impulsive1") data("dfBW") # dataset handling df_Imp_sec <- dfImpulsiveTrasform(dataset_impulsive1, statistic = energetic.mean) df_Imp_sec$date <- ymd_hms(df_Imp_sec$date, tz = "Europe/Rome") # extraction of frequency bands from the dataset freqDF <- df_Imp_sec[, grep("LZeq\\.", names(df_Imp_sec))] ################################################################################ # INTRUSIVENESS INDEX CALCULATION FUNCTION ################################################################################ dfa <- freqDF # Environmental dataset simulation dfr <- freqDF # Residual dataset simulation by subtracting 4 from dfa dfr[c(5,8,12,15), ] <- dfr[c(5,8,12,15), ] - 4 BW <- dfBW$BW # bandwidth # application of the function IntrusiveIndex(dfa, dfr, BW)
Parameters table of equal loudness curve A (ISO 226:1987 “Acoustics – Normal equal-loudness-level contours”)
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Returns a dataframe with Lden
LdenCalculator(dataframe, variable, type = "daily", ...)
LdenCalculator(dataframe, variable, type = "daily", ...)
dataframe |
is a dataframe |
variable |
is name of variable |
type |
is "daily" or "total" |
... |
is another arguments |
dataframe with Lden values
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data("exampleHourlyData") LdenCalculator(dataframe = exampleHourlyData, variable = "leq", type = "daily") LdenCalculator(dataframe = exampleHourlyData, variable = "leq", type = "total")
#data("exampleHourlyData") LdenCalculator(dataframe = exampleHourlyData, variable = "leq", type = "daily") LdenCalculator(dataframe = exampleHourlyData, variable = "leq", type = "total")
Dataset with markers
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Returns a dataframe
Maskapply(filemarks, dataset, mp)
Maskapply(filemarks, dataset, mp)
filemarks |
is a dataframe with date and markers |
dataset |
is dataframe in analysis |
mp |
is a name of misure point |
dataframe with add marker column
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data(PTFA) #data(markers) Maskapply(filemarks = markers, dataset = PTFA, mp = "PTFA")[1:10, c(1, 2, 45)]
#data(PTFA) #data(markers) Maskapply(filemarks = markers, dataset = PTFA, mp = "PTFA")[1:10, c(1, 2, 45)]
Noise data of misure in house open window condition
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Noise data of misure in house close window condition
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Returns a plot
PlotNoiseTHcompare( df, variable, listvar = NULL, mp, runleq = TRUE, y_lim = c(20, 80) )
PlotNoiseTHcompare( df, variable, listvar = NULL, mp, runleq = TRUE, y_lim = c(20, 80) )
df |
is a dataframe |
variable |
is Leq or another variable to plot first |
listvar |
are names of frequency component you want compare |
mp |
is a misure point |
runleq |
is logical value that plot running leq line |
y_lim |
y axe range |
ggplot object
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data(P1FA) PlotNoiseTHcompare(df = P1FA , variable = "LAeq", listvar = c("LZFmin.100", "LZFmin.250"), mp = "P1FA", runleq = TRUE, y_lim = c(30, 70))
#data(P1FA) PlotNoiseTHcompare(df = P1FA , variable = "LAeq", listvar = c("LZFmin.100", "LZFmin.250"), mp = "P1FA", runleq = TRUE, y_lim = c(30, 70))
Returns a time history plot
PlotNoiseTimeHistory( df = NULL, variable = NULL, filemarks = NULL, escl_marks = NULL, mp, y_lim = c(20, 80) )
PlotNoiseTimeHistory( df = NULL, variable = NULL, filemarks = NULL, escl_marks = NULL, mp, y_lim = c(20, 80) )
df |
is a dataframe with date, leq and markers |
variable |
is a string name of column you want plot |
filemarks |
is a dataframe with date and markers |
escl_marks |
is mark that you want esclude in plot |
mp |
is a name of misure point |
y_lim |
y axes range |
ggplot object
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data(P1FA) #data(markers) PlotNoiseTimeHistory(df = P1FA, variable = "LAeq", mp = "P1FA", y_lim = c(40, 65)) PlotNoiseTimeHistory(df = P1FA, variable = "LAeq", mp = "P1FA", filemarks = markers, y_lim = c(40, 65)) PlotNoiseTimeHistory(df = P1FA, variable = "LAeq", mp = "P1FA", escl_marks = "escludi", y_lim = c(40, 65))
#data(P1FA) #data(markers) PlotNoiseTimeHistory(df = P1FA, variable = "LAeq", mp = "P1FA", y_lim = c(40, 65)) PlotNoiseTimeHistory(df = P1FA, variable = "LAeq", mp = "P1FA", filemarks = markers, y_lim = c(40, 65)) PlotNoiseTimeHistory(df = P1FA, variable = "LAeq", mp = "P1FA", escl_marks = "escludi", y_lim = c(40, 65))
Returns a spectrogram
PlotSpectrogram(df, coLs, plot_title = NULL)
PlotSpectrogram(df, coLs, plot_title = NULL)
df |
is a dataframe |
coLs |
is cols index to plot |
plot_title |
is title of plot |
ggplot object
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data(P1FA) PlotSpectrogram(df = P1FA, coLs = c(3:38) , plot_title = "Spettrogram LZFmin")
#data(P1FA) PlotSpectrogram(df = P1FA, coLs = c(3:38) , plot_title = "Spettrogram LZFmin")
Noise data of misure in house open window condition
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Noise data of misure in house close window condition
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
Returns a number rounded to the nearest specified multiple.
RoundTo(x, multiple = 1, FUN = round)
RoundTo(x, multiple = 1, FUN = round)
x |
is a vector of value in decibel (dB) |
multiple |
numeric. The multiple to which the number is to be rounded. Default is 1. |
FUN |
the rounding function as character or as expression. Can be one out of trunc, ceiling, round (default) or floor. |
value or vector of values rounded
Andri Signorell [email protected]
#data("P1FA") RoundTo(x = P1FA$LAeq, multiple = 0.5)[1:10]
#data("P1FA") RoundTo(x = P1FA$LAeq, multiple = 0.5)[1:10]
Returns a vector of energetic mean of Leq......
runningLeq(x)
runningLeq(x)
x |
is a vector of values in decibel (dB) |
vector of mobile energetic average values
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data("P1FA") runningLeq(x = P1FA$LAeq)[1:10]
#data("P1FA") runningLeq(x = P1FA$LAeq)[1:10]
research pure tone
search.tone(x, statistic = energetic.mean, plot.tone = FALSE)
search.tone(x, statistic = energetic.mean, plot.tone = FALSE)
x |
is a dataframe with llfmin... |
statistic |
is statistic used default is energetic.mean |
plot.tone |
is logic argument default is false don't plot result |
plot of 1/3 octave frequency and isofonic curve A (ISO 226:1987)
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Search pure tone from PTFA dataset # dataframe have to contain date and LLfmin (minor value of Linear level frequency) search.tone(PTFA[, c(3:38)], plot.tone = FALSE) # Plot result search.tone(PTFA[, c(3:38)], plot.tone = TRUE)
# Search pure tone from PTFA dataset # dataframe have to contain date and LLfmin (minor value of Linear level frequency) search.tone(PTFA[, c(3:38)], plot.tone = FALSE) # Plot result search.tone(PTFA[, c(3:38)], plot.tone = TRUE)
Returns a list with dataframe of peaks impulsive and a plot
searchImpulse(df, cri1 = 6, cri2 = -10, Threshold = 30)
searchImpulse(df, cri1 = 6, cri2 = -10, Threshold = 30)
df |
is a impulse dataframe, samples of 100 ms |
cri1 |
is first criteria 6dB (LAImax - LASmax > 6dB) |
cri2 |
is second criteria -10dB ((LAFmax - 10dB) < 1s) |
Threshold |
is minimun level for detect peaks |
list contain a dataframe of peaks values and a plot of it
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
#data("dataset_impulsive1") #data("dataset_impulsive2") searchImpulse(df = dataset_impulsive1) searchImpulse(df = dataset_impulsive2)
#data("dataset_impulsive1") #data("dataset_impulsive2") searchImpulse(df = dataset_impulsive1) searchImpulse(df = dataset_impulsive2)
Returns SEL
SELcalc(x, t)
SELcalc(x, t)
x |
is value in dB |
t |
is period in second |
value of cumulative energy in 1 second
Pasquale Scordino [email protected]
Simone Sperotto [email protected]
# Calculate SEL (Single Event Level) SELcalc(x = 66.8, t = 938)
# Calculate SEL (Single Event Level) SELcalc(x = 66.8, t = 938)