[5699] | 1 | """ |
---|
| 2 | |
---|
| 3 | Have the script here that produces the data and graphs for the Anuga paper. |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | Duncan Gray, GA - 2007 |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | """ |
---|
| 11 | |
---|
| 12 | import shutil |
---|
| 13 | from os import path |
---|
| 14 | |
---|
| 15 | from run_dam import main, paras2outputdir_tag |
---|
[5709] | 16 | from calc_rmsd import auto_plot_test_rmsd, auto_rrms |
---|
[5699] | 17 | from plot import plot_exp_sim_comparision, auto_plot_compare_csv_subfigures |
---|
| 18 | |
---|
| 19 | # |
---|
| 20 | # INPUT PARAMETERS |
---|
| 21 | # |
---|
| 22 | |
---|
| 23 | END_TAG = '_I' |
---|
[5714] | 24 | END_TAG = '_Ole' |
---|
[5699] | 25 | |
---|
[5714] | 26 | |
---|
[5699] | 27 | WIDTH = 0.1 |
---|
| 28 | |
---|
| 29 | # run_type 1 is the standard |
---|
| 30 | RUN_TYPE = 1 |
---|
| 31 | MAXIMUM_TRIANGLE_AREA=0.0001 |
---|
| 32 | YIELDSTEP = 0.01 |
---|
| 33 | FRICTION = 0.0 |
---|
| 34 | USE_LIMITS = False |
---|
| 35 | OUTPUTDIR_NAME = "" |
---|
| 36 | #OUTPUTDIR_NAME = "_no_velocity" |
---|
| 37 | |
---|
| 38 | def data(): |
---|
| 39 | """ |
---|
| 40 | Produce the data for the Hinwood part of the anuga paper. |
---|
| 41 | eg run the scenario. |
---|
| 42 | """ |
---|
| 43 | from scenarios import scenarios |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | #scenarios = [scenarios[0]] |
---|
| 47 | for run_data in scenarios: |
---|
| 48 | pro_instance = main( run_data['scenario_id'] + '_boundary.tsm', |
---|
| 49 | run_data, |
---|
| 50 | maximum_triangle_area=MAXIMUM_TRIANGLE_AREA, |
---|
| 51 | yieldstep=YIELDSTEP, |
---|
| 52 | width=WIDTH, |
---|
| 53 | run_type=RUN_TYPE, |
---|
| 54 | outputdir_name=run_data['scenario_id'], |
---|
| 55 | use_limits=USE_LIMITS, |
---|
| 56 | friction=FRICTION, |
---|
| 57 | end_tag=END_TAG) |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | def graph_RMSD(): |
---|
| 61 | """ |
---|
| 62 | Produce the graphs for the Hinwood part of the anuga paper. |
---|
| 63 | """ |
---|
| 64 | from scenarios import scenarios, to_publish_indexes |
---|
| 65 | |
---|
[5708] | 66 | |
---|
[5699] | 67 | # Workout where these plots are |
---|
| 68 | outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA, |
---|
| 69 | yieldstep=YIELDSTEP, |
---|
| 70 | width=WIDTH, |
---|
| 71 | use_limits=USE_LIMITS, |
---|
| 72 | friction=FRICTION, |
---|
| 73 | end_tag=END_TAG, |
---|
| 74 | outputdir_name=OUTPUTDIR_NAME) |
---|
| 75 | paper_dir = path.join('..','..','publications','anuga_2007') |
---|
| 76 | |
---|
[5708] | 77 | # Calculate the RMSD's |
---|
| 78 | auto_rrms(outputdir_tag, scenarios, "stage", y_location_tag=':0.0') |
---|
[5699] | 79 | |
---|
| 80 | # All of the RMSD's , one per TEST |
---|
| 81 | |
---|
| 82 | file_names = auto_plot_test_rmsd(scenarios, outputdir_tag, |
---|
| 83 | to_publish_indexes, |
---|
| 84 | #add_run_info=True) |
---|
| 85 | add_run_info=False) |
---|
| 86 | |
---|
| 87 | # Move the files to the dir where the paper is being put together |
---|
| 88 | for plot_in in file_names: |
---|
| 89 | head, tail = path.split(plot_in) |
---|
| 90 | dest = path.join(paper_dir, tail) |
---|
| 91 | #print "plot_in", plot_in |
---|
| 92 | #print "dest", dest |
---|
| 93 | shutil.copyfile(plot_in,dest) |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | def graph_stage_plots(): |
---|
| 98 | """ |
---|
| 99 | Produce the graphs for the Hinwood part of the anuga paper. |
---|
| 100 | """ |
---|
| 101 | from scenarios import scenarios, to_publish_indexes |
---|
| 102 | |
---|
| 103 | # Workout where these plots are |
---|
| 104 | outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA, |
---|
| 105 | yieldstep=YIELDSTEP, |
---|
| 106 | width=WIDTH, |
---|
| 107 | use_limits=USE_LIMITS, |
---|
| 108 | friction=FRICTION, |
---|
| 109 | end_tag=END_TAG, |
---|
| 110 | outputdir_name=OUTPUTDIR_NAME) |
---|
| 111 | paper_dir = path.join('..','..','publications','anuga_2007') |
---|
| 112 | |
---|
| 113 | # the graphs I want |
---|
| 114 | # stage comparison plots for T1R5, T2R7, T3R29, T4R32. |
---|
| 115 | |
---|
| 116 | plot_files = plot_exp_sim_comparision(scenarios, outputdir_tag, |
---|
| 117 | y_location_tag=':0.0') |
---|
| 118 | for key in to_publish_indexes.iterkeys(): |
---|
| 119 | for plot_i in to_publish_indexes[key]: |
---|
| 120 | plot_file_path_name = plot_files[key][plot_i] |
---|
| 121 | head, tail = path.split(plot_file_path_name) |
---|
| 122 | dest = path.join(paper_dir, tail) |
---|
| 123 | shutil.copyfile(plot_file_path_name,dest) |
---|
| 124 | |
---|
| 125 | def graph_4_stage_plots(): |
---|
| 126 | from scenarios import scenarios, to_publish_indexes |
---|
| 127 | |
---|
| 128 | #scenarios = scenarios[:2] |
---|
| 129 | outputdir_tag = paras2outputdir_tag(mta=MAXIMUM_TRIANGLE_AREA, |
---|
| 130 | yieldstep=YIELDSTEP, |
---|
| 131 | width=WIDTH, |
---|
| 132 | use_limits=USE_LIMITS, |
---|
| 133 | friction=FRICTION, |
---|
| 134 | end_tag=END_TAG, |
---|
| 135 | outputdir_name=OUTPUTDIR_NAME) |
---|
| 136 | paper_dir = path.join('..','..','publications','anuga_2007') |
---|
| 137 | |
---|
| 138 | save_as_list = auto_plot_compare_csv_subfigures(scenarios, outputdir_tag, |
---|
| 139 | to_publish_indexes, |
---|
| 140 | add_run_info=False, |
---|
| 141 | #add_run_info=True, |
---|
| 142 | is_interactive=False) |
---|
| 143 | for plot_in in save_as_list: |
---|
| 144 | head, tail = path.split(plot_in) |
---|
| 145 | dest = path.join(paper_dir, tail) |
---|
| 146 | #print "plot_in", plot_in |
---|
| 147 | #print "dest", dest |
---|
| 148 | shutil.copyfile(plot_in,dest) |
---|
| 149 | |
---|
| 150 | #------------------------------------------------------------- |
---|
| 151 | if __name__ == "__main__": |
---|
| 152 | # Edit the top of this file to change the general input parameters |
---|
| 153 | |
---|
[5700] | 154 | data() |
---|
[5699] | 155 | |
---|
| 156 | # Produce the graphs |
---|
| 157 | graph_RMSD() |
---|
| 158 | graph_4_stage_plots() |
---|