Changeset 4330
 Timestamp:
 Mar 28, 2007, 2:49:59 PM (17 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_validation/automated_validation_tests/okushiri_tank_validation/compare_timeseries_with_measures.py
r4329 r4330 24 24 # No plotting for automated unittest (unless one wishes to run 25 25 # this manually and look at the outputs) 26 plotting = True26 plotting = False 27 27 28 28 … … 43 43 44 44 45 # Results from lwru2_variable_mesh.sww (aug 2005) 46 # 47 #Validating Boundary 48 #Covariance = 5.265850426352561254e05 49 #Accumulated difference = 9.188561500629542633e04 50 #Difference in maxima = 4.865498851439054029e05 51 #Difference in minima = 2.293007809784416290e04 52 #Timelag between maxima = 3.000000000000007105e01 53 #Timelag between minima = 3.000000000000007105e01 54 #Next 55 # 56 #Validating ch5 57 #Covariance = 1.171913883449135149e04 58 #Accumulated difference = 3.439740513194261117e03 59 #Difference in maxima = 1.808007760316858448e03 60 #Difference in minima = 1.494336068527772621e04 61 #Timelag between maxima = 9.999999999999786837e02 62 #Timelag between minima = 8.499999999999996447e01 63 #Next# 64 # 65 #Validating ch7 66 #Covariance = 1.130834789656423632e04 67 #Accumulated difference = 2.868914369295409543e03 68 #Difference in maxima = 5.464055727564115506e04 69 #Difference in minima = 4.515664278503157131e03 70 #Timelag between maxima = 0.000000000000000000e+00 71 #Timelag between minima = 4.500000000000010658e01 72 # 73 #Next 74 #Validating ch9 75 #Covariance = 1.257648236914514148e04 76 #Accumulated difference = 3.287722754612562841e03 77 #Difference in maxima = 1.856547605566957748e03 78 #Difference in minima = 3.406785970601119290e03 79 #Timelag between maxima = 0.000000000000000000e+00 80 #Timelag between minima = 9.499999999999992895e01 81 82 83 84 85 86 # New validation mesh 87 #Validating Boundary 88 #Covariance = 5.294418463841652839e05 89 #Accumulated difference = 8.222031767747334978e04 90 #Difference in maxima = 2.074639250243537347e05 91 #Difference in minima = 2.594698240608837858e04 92 #Timelag between maxima = 2.500000000000000000e01 93 #Timelag between minima = 2.500000000000000000e01 94 #Next 95 # 96 #Validating ch5 97 #Covariance = 1.169700827457795071e04 98 #Accumulated difference = 3.390769873961110153e03 99 #Difference in maxima = 1.443103996215826246e03 100 #Difference in minima = 6.360676810760659133e04 101 #Timelag between maxima = 4.999999999999715783e02 102 #Timelag between minima = 7.999999999999989342e01 103 #Next 104 # 105 #Validating ch7 106 #Covariance = 1.131522443178145860e04 107 #Accumulated difference = 2.815084054773397005e03 108 #Difference in maxima = 8.380973795966278894e05 109 #Difference in minima = 4.604184345996111850e03 110 #Timelag between maxima = 0.000000000000000000e+00 111 #Timelag between minima = 2.050000000000000711e+00 112 # 113 #Next 114 #Validating ch9 115 #Covariance = 1.251932626774203753e04 116 #Accumulated difference = 3.208757435748204462e03 117 #Difference in maxima = 2.081659579598611753e03 118 #Difference in minima = 3.428854197019200710e03 119 #Timelag between maxima = 0.000000000000000000e+00 120 #Timelag between minima = 1.000000000000000000e+00 121 122 123 #expected_covariance = {'Boundary': 5.294418463841652839e05, 124 # 'ch5': 1.169700827457795071e04, 125 # 'ch7': 1.131522443178145860e04, 126 # 'ch9': 1.251932626774203753e04} 127 # 128 #expected_difference = {'Boundary': 8.222031767747334978e04, 129 # 'ch5': 3.390769873961110153e03, 130 # 'ch7': 2.815084054773397005e03, 131 # 'ch9': 3.208757435748204462e03} 132 # 133 #expected_maximum_diff = {'Boundary': 2.074639250243537347e05, 134 # 'ch5': 1.443103996215826246e03, 135 # 'ch7': 8.380973795966278894e05, 136 # 'ch9': 2.081659579598611753e03} 137 # 138 #expected_minimum_diff = {'Boundary': 2.594698240608837858e04, 139 # 'ch5': 6.360676810760659133e04, 140 # 'ch7': 4.604184345996111850e03, 141 # 'ch9': 3.428854197019200710e03} 142 # 143 #expected_argmax_timelag = {'Boundary': 2.500000000000000000e01, 144 # 'ch5': 4.999999999999715783e02, 145 # 'ch7': 0.000000000000000000e+00, 146 # 'ch9': 0.000000000000000000e+00} 147 # 148 #expected_argmin_timelag = {'Boundary': 2.500000000000000000e01, 149 # 'ch5': 7.999999999999989342e01, 150 # 'ch7': 2.050000000000000711e+00, 151 # 'ch9': 1.000000000000000000e+00} 152 153 154 155 156 # New validation mesh  smaller regions 157 #Validating Boundary 158 #Covariance = 5.269749049737429159e05 159 #Accumulated difference = 8.337114775060755880e04 160 #Difference in maxima = 7.166795837686146253e05 161 #Difference in minima = 1.335627610594206094e04 162 #Timelag between maxima = 3.000000000000007105e01 163 #Timelag between minima = 2.500000000000000000e01 164 #Next 165 # 166 #Validating ch5 167 #Covariance = 1.163749077455013324e04 168 #Accumulated difference = 3.385911115917152742e03 169 #Difference in maxima = 1.326867779957524585e03 170 #Difference in minima = 9.334970576141445042e04 171 #Timelag between maxima = 4.999999999999715783e02 172 #Timelag between minima = 7.999999999999989342e01 173 #Next 174 # 175 #Validating ch7 176 #Covariance = 1.126985405540967749e04 177 #Accumulated difference = 2.857119198201266575e03 178 #Difference in maxima = 3.582696745840288632e04 179 #Difference in minima = 4.523664511720201960e03 180 #Timelag between maxima = 0.000000000000000000e+00 181 #Timelag between minima = 2.150000000000000355e+00 182 #Next 183 # 184 #Validating ch9 185 #Covariance = 1.250280909578863607e04 186 #Accumulated difference = 3.247257369996859894e03 187 #Difference in maxima = 2.212919173501755321e03 188 #Difference in minima = 3.427581218447350343e03 189 #Timelag between maxima = 0.000000000000000000e+00 190 #Timelag between minima = 1.150000000000000355e+00 191 45 # Expected values 192 46 expected_covariance = {'Boundary': 5.269749049737429159e05, 193 47 'ch5': 1.163749077455013324e04, … … 200 54 'ch9': 3.247257369996859894e03} 201 55 56 57 58 expected_maximum = {'Boundary': 0.0161886, 59 'ch5': 0.03694, 60 'ch7': 0.03895, 61 'ch9': 0.04535} 62 63 expected_minimum = {'Boundary': 0.0115097, 64 'ch5': 0.00896, 65 'ch7': 0.00725, 66 'ch9': 0.00255} 67 68 expected_argmax = {'Boundary': 12.25, 69 'ch5': 18.35, 70 'ch7': 17.0, 71 'ch9': 16.85} 72 73 expected_argmin = {'Boundary': 20.4, 74 'ch5': 13.8, 75 'ch7': 14.4, 76 'ch9': 14.35} 77 78 # Obsolete 202 79 expected_maximum_diff = {'Boundary': 7.166795837686146253e05, 203 80 'ch5': 1.326867779957524585e03, … … 277 154 print '%s = %.18e' %(name, computed_value) 278 155 279 if computed_value < reference_valueeps:280 print ' Result is better than expected by: %.18e'\281 %(computed_value  reference_value)282 print ' Expect = %.18e' %reference_value283 elif computed_value > reference_value+eps:284 print ' FAIL: Result is worse than expected by: %.18e'\285 %(computed_valuereference_value)286 print ' Expect = %.18e' %reference_value287 else:288 pass156 #if computed_value < reference_valueeps: 157 # print ' Result is better than expected by: %.18e'\ 158 # %(computed_value  reference_value) 159 # print ' Expect = %.18e' %reference_value 160 #elif computed_value > reference_value+eps: 161 # print ' FAIL: Result is worse than expected by: %.18e'\ 162 # %(computed_valuereference_value) 163 # print ' Expect = %.18e' %reference_value 164 #else: 165 # pass 289 166 290 167 if abs(reference_value) > 0: 291 168 msg = '%s (expected, computed): (%.18e, %.18e): Relative error=%.18e'\ 292 %(name, reference_value, computed_value, abs(reference_valuecomputed_value)/reference_value) 169 %(name, reference_value, computed_value, 170 abs(reference_valuecomputed_value)/reference_value) 293 171 else: 294 172 msg = '%s (expected, computed): (%.18e, %.18e): Absolute error=%.18e'\ 295 %(name, reference_value, computed_value, abs(reference_valuecomputed_value)) 173 %(name, reference_value, computed_value, 174 abs(reference_valuecomputed_value)) 296 175 print msg 297 298 #assert allclose( expected_covariance[name], res), msg176 177 #assert allclose(reference_value, computed_value), msg 299 178 300 179 … … 326 205 327 206 # Extrema 328 res = abs(max(observed_timeseries)max(model))329 report_difference(' Difference in maxima', res, expected_maximum_diff[name], eps)330 331 res = abs(min(observed_timeseries)min(model))332 report_difference(' Difference in minima', res, expected_minimum_diff[name], eps)207 res = max(observed_timeseries) 208 report_difference('Maximum', res, expected_maximum[name], eps) 209 210 res = min(observed_timeseries) 211 report_difference('Minimum', res, expected_minimum[name], eps) 333 212 334 213 # Locations of extrema 335 214 i0 = argmax(observed_timeseries) 336 i1 = argmax(model)337 res = abs(reference_time[i1]  reference_time[i0])338 report_difference(' Timelag between maxima', res, expected_argmax_timelag[name], eps)215 #i1 = argmax(model) 216 res = reference_time[i0] 217 report_difference('Location of maximum', res, expected_argmax[name], eps) 339 218 340 219 341 220 i0 = argmin(observed_timeseries) 342 i1 = argmin(model)343 res = abs(reference_time[i1]  reference_time[i0])344 report_difference(' Timelag between minima', res, expected_argmin_timelag[name], eps)221 #i1 = argmin(model) 222 res = reference_time[i0] 223 report_difference('Location of minimum', res, expected_argmin[name], eps) 345 224 346 225
Note: See TracChangeset
for help on using the changeset viewer.