Changeset 5681
- Timestamp:
- Aug 26, 2008, 9:18:42 AM (15 years ago)
- Files:
-
- 1 deleted
- 5 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/Hinwood_2008/calc_norm.py
r5670 r5681 26 26 27 27 from slope import load_sensors 28 from interp import interp28 from anuga.utilities.interp import interp 29 29 30 30 def get_max_min_condition_array(min, max, vector): … … 195 195 close() 196 196 197 def auto_plot_test_rmsd(scenarios, outputdir_tag, quantity="stage", 198 save_as=True, 199 is_interactive=False, max_rmsd=0.010): 197 def auto_plot_test_rmsd(scenarios, outputdir_tag, 198 to_publish_indexes, quantity="stage", 199 save_as=True,add_run_info=False, 200 is_interactive=False, max_rmsd=0.012): 200 201 """ 201 202 Produce the RMSD graphs for the anuga article. 202 203 203 to do:204 labels205 204 """ 206 205 … … 209 208 210 209 for i in range(0,len(scenarios),2): 211 tests.append([scenarios[i], scenarios[i+1]]) 210 if to_publish_indexes.has_key(scenarios[i]['scenario_id']): 211 tests.append([scenarios[i], scenarios[i+1]]) 212 else: 213 tests.append([scenarios[i+1], scenarios[i]]) 212 214 213 215 for test in tests: 214 216 file_name = plot_test_rmsd(test, outputdir_tag, quantity, 215 save_as=save_as, 216 is_interactive=is_interactive, max_rmsd=max_rmsd) 217 to_publish_indexes, 218 save_as=save_as, add_run_info=add_run_info, 219 is_interactive=is_interactive, 220 max_rmsd=max_rmsd) 217 221 file_names.append(file_name) 218 222 return file_names 219 223 220 224 def plot_test_rmsd(test, outputdir_tag, quantity, 221 save_as=None, 222 is_interactive=False, max_rmsd=None): 225 to_publish_indexes, 226 save_as=None, add_run_info=False, 227 is_interactive=False, max_rmsd=None): 223 228 """ 224 229 For a test, plot rmsd vs x location for both runs. … … 230 235 231 236 plot_type = ".pdf" 232 id = test[0]['scenario_id'][:2] 233 237 id = 'S' + test[0]['scenario_id'][1:2] 238 239 if add_run_info is True: 240 plot_title = "Title will not be in final draft \n" + \ 241 id + outputdir_tag 242 243 title(plot_title) 244 else: 245 plot_title = "" 246 234 247 if is_interactive: 235 248 ion() … … 237 250 localtime()) 238 251 #subplot(212) 239 plot_title = id + " Root Mean Square Deviation comparison" + '\n' \ 240 + time_date 252 241 253 242 254 #title(plot_title) … … 251 263 for run in test: 252 264 i += 1 253 legend_name.append( run['scenario_id'][:2]+"T"+str(i))265 legend_name.append("S" + test[0]['scenario_id'][1:2]+"R"+str(i)) 254 266 outputdir_name = run['scenario_id'] + outputdir_tag 255 267 pro_instance = project.Project(['data','flumes','Hinwood_2008'], … … 262 274 locations = [float(x) for x in simulation['x location']] 263 275 rmsd_list = [float(x) for x in simulation['rmsd']] 264 lines.append(plot(locations, rmsd_list, '-o')) 265 #plot(locations, rmsd_list, 'o') 276 277 278 lines.append(plot(locations, rmsd_list, 'k-x')) # k is black 279 280 for i_gauge, (location, rmsd) in enumerate(map(None, 281 locations, 282 rmsd_list)): 283 if to_publish_indexes.has_key(run['scenario_id']) and \ 284 to_publish_indexes[run['scenario_id']].count(i_gauge) == 1: 285 plot([location], [rmsd], 'ko', markeredgewidth=2, 286 markeredgecolor='k') 287 288 266 289 267 290 for break_x in run['break_xs']: … … 272 295 axis(ymin=0, ymax=max_rmsd) 273 296 297 if id == 'S2': 298 # Hack to get the desired width 299 axis(xmax=7.0) 300 301 setp(lines[1], linestyle='--') 274 302 legend(lines, legend_name,'upper left') 275 303 … … 278 306 279 307 save_as = pro_instance.plots_dir + sep + \ 280 id + " _rmsd" + plot_type308 id + "-rmsd" + plot_type 281 309 print "save_as", save_as 282 310 if save_as is not None: … … 380 408 save_as=None, 381 409 is_interactive=False): 410 """ 411 The general auto, for comparing things. 412 413 """ 382 414 max_rmsd = calc_max_rmsd(scenarios, outputdir_tags, quantity) 383 415 print "max_rmsd", max_rmsd … … 400 432 outputdir_tags.append("_nolmts_wdth_0.1_z_0.012_ys_0.01_mta_0.01_I") 401 433 outputdir_tags.append("_nolmts_wdth_1.0_z_0.0_ys_0.01_mta_0.01_I") 434 outputdir_tags.append("_nolmts_wdth_0.1_z_0.012_ys_0.01_mta_0.0001_I") 435 outputdir_tags.append("_lmts_wdth_0.1_z_0.0_ys_0.01_mta_0.0001_I") 436 outputdir_tags.append("_no_velocity_nolmts_wdth_0.1_z_0.0_ys_0.01_mta_0.0001_I") 402 437 403 438 #outputdir_tag = "_test_limiterC" … … 405 440 #scenarios = scenarios[4:] # !!!!!!!!!!!!!!!!!!!!!! 406 441 calc_norms = True 407 calc_norms = False442 #calc_norms = False 408 443 if calc_norms: 409 444 for outputdir_tag in outputdir_tags: … … 412 447 #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!! 413 448 #auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage") 414 #compare_different_settings(outputdir_tags, scenarios, "stage")449 compare_different_settings(outputdir_tags, scenarios, "stage") 415 450 416 451 outputdir_tag = "_nolmts_wdth_0.1_z_0.0_ys_0.01_mta_0.01_I" 417 auto_plot_test_rmsd(scenarios, outputdir_tag)452 #auto_plot_test_rmsd(scenarios, outputdir_tag) -
anuga_work/development/Hinwood_2008/plot.py
r5670 r5681 156 156 y_location_tag=':0.0', 157 157 add_run_info=False): 158 """ 159 Used by validation graphs to produce the final figures 160 """ 158 161 plot_type = ".pdf" 159 162 save_as_list = [] … … 180 183 #save_as = pro_instance.plots_dir + sep + \ 181 184 # outputdir_name + "_" + quantity + "_" + plot_type 182 save_as = pro_instance.plots_dir + sep + id + quantity+ \183 ' _compare' + plot_type185 save_as = pro_instance.plots_dir + sep + 'S' + id[1:2] + \ 186 '-' + quantity + '-compare' + plot_type 184 187 save_as_list.append(save_as) 185 188 … … 210 213 y_axis=None, 211 214 y_location_tag=':0.0'): 212 """ 215 """ 216 Used by validation graphs to produce the final figures 213 217 """ 214 218 from pylab import ion, plot, xlabel, ylabel, close, legend, \ 215 219 savefig, title, axis, setp, subplot, grid, figlegend, gca, \ 216 text 220 text, sqrt 221 import pylab 217 222 218 223 from anuga.shallow_water.data_manager import csv2dict 219 224 220 225 print "file_sim", file_sim 226 227 if False: 228 fig_width_pt = 246.0 # Get this from LaTeX using \showthe\columnwidth 229 inches_per_pt = 1.0/72.27 # Convert pt to inch 230 golden_mean = (sqrt(5)-1.0)/2.0 # Aesthetic ratio 231 fig_width = fig_width_pt*inches_per_pt # width in inches 232 fig_height = fig_width*golden_mean # height in inches 233 fig_size = [fig_width,fig_height] 234 print "fig_size", fig_size 235 params = {'backend': 'ps', 236 'axes.labelsize': 10, 237 'text.fontsize': 10, 238 'legend.fontsize': 10, 239 'xtick.labelsize': 8, 240 'ytick.labelsize': 8, 241 'text.usetex': True, 242 'figure.figsize': [3.4, 2.1]} 243 if False: 244 params = {'backend': 'ps', 245 'axes.labelsize': 10, 246 'text.fontsize': 10, 247 'legend.fontsize': 10, 248 'xtick.labelsize': 8, 249 'ytick.labelsize': 8, 250 'figure.figsize': [3.4, 3.1]} 251 pylab.rcParams.update(params) 252 253 254 221 255 # Load in the csv files and convert info from strings to floats 222 256 simulation, _ = csv2dict(file_sim) … … 231 265 for position, i in enumerate(gauge_indexs): 232 266 gauge_x = run_data['gauge_x'][i] 233 grid_position = (len(gauge_indexs)+1)*100 + 10 + position +1 267 268 grid_position = (len(gauge_indexs))*100 + 10 + position +1 234 269 subplot(grid_position) 235 270 location_sim = str(gauge_x) + y_location_tag … … 241 276 242 277 l_sim, l_exp = plot(time_sim, quantity_sim, time_exp, quantity_exp) 243 setp(l_sim, color=' r', linestyle='--')244 setp(l_exp, color=' b')278 setp(l_sim, color='k', linestyle='--') 279 setp(l_exp, color='k') 245 280 grid(True) 246 281 … … 282 317 # The order defines the label 283 318 #legend((legend_exp, legend_sim),'upper left') 284 figlegend((l_sim, l_exp), 285 (legend_sim, legend_exp), 286 'lower center') 319 320 # I couldn't get this working 321 #figlegend((l_sim, l_exp), 322 # (legend_sim, legend_exp), 323 # 'lower center', axespad = -0.05) 287 324 288 325 if is_interactive: -
anuga_work/development/Hinwood_2008/prepare_time_boundary.py
r5459 r5681 19 19 from anuga.utilities.numerical_tools import ensure_numeric 20 20 21 from interp import interp21 from anuga.utilities.interp import interp 22 22 23 23 -
anuga_work/development/Hinwood_2008/run_dam.py
r5670 r5681 41 41 import create_mesh 42 42 from prepare_time_boundary import prepare_time_boundary 43 from interp import interp43 from anuga.utilities.interp import interp 44 44 45 45 … … 99 99 finaltime = None 100 100 maximum_triangle_area=0.01 101 #outputdir_name += '_no_velocity'102 101 103 102 elif run_type == 5: … … 136 135 maximum_triangle_area=0.00001 137 136 #outputdir_name += '_good' 137 #outputdir_name += '_no_velocity' 138 138 139 139 outputdir_name = paras2outputdir_tag(mta=maximum_triangle_area, 140 140 yieldstep=yieldstep, 141 141 width=width, 142 run_type=run_type,143 142 use_limits=use_limits, 144 143 friction=friction, … … 341 340 342 341 run_type = 1 343 run_type = 0 342 run_type = 0 # for testing 344 343 345 344 #for run_data in [scenarios[5]]: … … 351 350 #width = 0.01 352 351 353 maximum_triangle_area=0.0 1352 maximum_triangle_area=0.0001 354 353 yieldstep = 0.01 355 354 friction=0.0 -
anuga_work/development/Hinwood_2008/scenarios.py
r5670 r5681 102 102 'offshore_water_depth':.4, 103 103 'scenario_id':'T2R8', 104 'gauge_names':['B','1','2','3','4','5' ,'7'],105 'gauge_x':[-0.68, 1.569, 2.568, 3.566, 4.564, 5.562 , 7.559],106 'gauge_bed_elevation':[-0.400000, -0.293158, 107 -0.234473, -0.175788, -0.117104, 108 -0.058419 , 0.058950],104 'gauge_names':['B','1','2','3','4','5'], 105 'gauge_x':[-0.68, 1.569, 2.568, 3.566, 4.564, 5.562], 106 'gauge_bed_elevation':[-0.400000, -0.293158, 107 -0.234473, -0.175788, -0.117104, 108 -0.058419], 109 109 'start_slope_x':5, 110 110 'finish_slope_x':6.5, … … 258 258 # These are the indexes from 'gauge_x' of the gauges for the journal article. 259 259 to_publish_indexes = {'T1R5':[0, 5, 6], 260 'T2R7':[ 1, 3, 5],261 'T3R29':[ 1, 6, 8],260 'T2R7':[0, 3, 5], 261 'T3R29':[0, 6, 8], 262 262 'T4R32':[0, 5, 8] 263 263 }
Note: See TracChangeset
for help on using the changeset viewer.