Untitled
unknown
plain_text
7 days ago
1.8 kB
4
Indexable
Never
import math import numpy as np from scipy import stats import matplotlib #Q -> Total number of vehicles flowing per hour in the selected locations at different time intervals #VP -> Percentage of heavy vehicles per hour in the selected locations at different time intervals # Three sessions across 2 days each, a weekday and a weekend: # morning (8:30am -8:40am) # afternoon (1:00 pm -1:10 pm) # evening (4:00 pm – 4:10pm) #calculation of LAeq from the formula, given the values of Q and VP: def CalixtoModelCalculation(Q, VP): Qeq = Q * (1 + 0.1 * VP) LAeq = 19.92224 * math.log10(Qeq) + 12.59764 return LAeq #function to calculate standard error: def standard_error(data): return np.std(data, ddof=1) / np.sqrt(len(data)) #input arrays observed: total_vehicles = [328, 358, 378, 224, 254, 252] heavy_vehicles = [55, 68, 47, 36, 48, 51] #arrays to store values: Q_arr = [] VP_arr = [] ind=0 sz=len(total_vehicles) while(ind < sz): Q_arr.append(total_vehicles[ind] * 6) VP_arr.append((heavy_vehicles[ind] / total_vehicles[ind]) * 100) ind = ind+1 #arrays to store Leq Values: ActualLeq = [] PredictedLeq = [] #Noise Standards: WHO = [] CPCB = [] #pointers required: ind=0 sz = len(Q_arr) while(ind < sz): #current values: Q = Q_arr[ind] VP = VP_arr[ind] #calculated values: Leq = CalixtoModelCalculation(Q, VP) PredictedLeq.append(Leq) #incremented pointer: ind = ind+1 #metrics used to test results: correlation_coefficient, p_value = stats.pearsonr(ActualLeq, PredictedLeq) f_statistic, p_value = stats.f_oneway(ActualLeq, PredictedLeq) se_expected = standard_error(ActualLeq) se_observed = standard_error(PredictedLeq)
Leave a Comment