Ignore:
Timestamp:
Aug 18, 2008, 9:29:57 AM (15 years ago)
Author:
duncan
Message:

Current Hinwood - calc norm set up for _G end tag comparison

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/development/Hinwood_2008/calc_norm.py

    r5659 r5664  
    131131                 
    132132def plot_rrms_sensor_settings(run_data, outputdir_tags, quantity,
    133               save_as=None,
     133              save_as=True,
    134134              is_interactive=False, max_rmsd=None):
    135135    """
     
    140140    from anuga.shallow_water.data_manager import csv2dict
    141141
    142     # TODO
    143     # scale the plot
     142
    144143    plot_type = ".pdf"
    145144   
     
    196195    close()
    197196
     197def auto_plot_test_rmsd(scenarios, outputdir_tag, quantity="stage",
     198              save_as=True,
     199              is_interactive=False, max_rmsd=1.0):
     200   
     201    tests = []
     202   
     203    for i in range(0,len(scenarios),2):
     204        tests.append([scenarios[i], scenarios[i+1]])
     205
     206    for test in tests:
     207        plot_test_rmsd(test, outputdir_tag, quantity,
     208              save_as=save_as,
     209              is_interactive=is_interactive, max_rmsd=max_rmsd)
     210       
     211def plot_test_rmsd(test, outputdir_tag, quantity,
     212              save_as=None,
     213              is_interactive=False, max_rmsd=None):
     214    """
     215    For a test, plot rmsd vs x location for both runs.
     216    Also, add the break measurement.
     217    """
     218    from pylab import ion, plot, xlabel, ylabel, close, legend, \
     219         savefig, title, axis, setp, subplot, grid, axvspan, figlegend
     220    from anuga.shallow_water.data_manager import csv2dict
     221       
     222    plot_type = ".pdf"   
     223    id = test[0]['scenario_id'][:2]
     224   
     225    if is_interactive:
     226        ion()
     227    time_date = strftime('plot date: %d/%m/%Y Time: %H:%M:%S',
     228                                      localtime())
     229    #subplot(212)   
     230    plot_title = id + " Root Mean Square Deviation comparison" + '\n' \
     231                 + time_date
     232                 
     233    #title(plot_title)
     234    y_label = "RMSD"
     235    ylabel(y_label)
     236    xlabel("x location, m")
     237    grid(True)
     238
     239    lines = []
     240    for run in test:
     241           
     242        outputdir_name = run['scenario_id'] + outputdir_tag
     243        pro_instance = project.Project(['data','flumes','Hinwood_2008'],
     244                                       outputdir_name=outputdir_name)
     245       
     246        file_err = pro_instance.rmsd_dir + sep + outputdir_name + "_" \
     247                   + quantity + "_err.csv"
     248           
     249        simulation, _ = csv2dict(file_err)
     250        locations = [float(x) for x in simulation['x location']]
     251        rmsd_list = [float(x) for x in simulation['rmsd']]
     252        lines.append(plot(locations, rmsd_list))
     253       
     254        for break_x in run['break_xs']:
     255            axvspan(break_x-0.001,break_x+0.001, facecolor='g')
     256       
     257    if max_rmsd is not None:
     258        #print "setting axis"
     259        axis(ymin=0, ymax=max_rmsd)
     260       
     261    figlegend(lines, outputdir_tags,'upper left')
     262   
     263    if is_interactive:
     264        raw_input()
     265
     266    save_as = pro_instance.plots_dir + sep + \
     267              id + "_rmsd" + plot_type
     268    if save_as is not None:
     269        savefig(save_as)
     270   
     271    close()
     272
    198273# Return a bunch of lists
    199274# The err files, for all scenarios
     
    317392    #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!!
    318393    #scenarios = scenarios[4:] # !!!!!!!!!!!!!!!!!!!!!!
    319     #for outputdir_tag in outputdir_tags:
    320     #    auto_rrms(outputdir_tag, scenarios, "stage", y_location_tag=':0.0')
     394    if False:
     395        for outputdir_tag in outputdir_tags:
     396            auto_rrms(outputdir_tag, scenarios, "stage", y_location_tag=':0.0')
    321397   
    322398    #scenarios = [scenarios[0]] # !!!!!!!!!!!!!!!!!!!!!!
    323     auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage")
     399    #auto_plot_rrms_sensor_settings(outputdir_tags, scenarios, "stage")
    324400    #compare_different_settings(outputdir_tags, scenarios, "stage")
     401
     402    outputdir_tag = "_nolmts_wdth_0.1_z_0.0_ys_0.01_mta_0.01_G"
     403    auto_plot_test_rmsd(scenarios, outputdir_tag)
Note: See TracChangeset for help on using the changeset viewer.