示例#1
0
def plot_1d_histogram_diffs(filenames, runtitles, timescale, myregion,
                            plottitle, plotname_root):
    """
    Plot 1d histograms for a small region.
   
    This example uses histogram cubes pre-calculated from two different model datasets 
    on the same timescale, and compares with those from two observational datasets.
   
    NOTE that the region and the timescale will appear automatically in the plot title
    """

    plotname = '{}_actual.png'.format(plotname_root)
    plot_hist1d.plot_1dhist(plotname,
                            myregion,
                            filenames,
                            runtitles,
                            plottitle,
                            timescale,
                            log=1)

    plotname = '{}_fractional.png'.format(plotname_root)
    plot_hist1d.plot_1dhist(plotname,
                            myregion,
                            filenames,
                            runtitles,
                            plottitle,
                            timescale,
                            frac=1,
                            log=1)

    return
示例#2
0
def plot_1d_histograms(filenames, runtitles, filenames_obs, runtitles_obs,
                       timescale, myregion, plottitle, plotname_root, wk_dir,
                       ext):
    """
    Plot 1d histograms for a small region.

    This example uses histogram cubes pre-calculated from two different model datasets
    on the same timescale, and compares with those from two observational datasets.

    NOTE that the region and the timescale will appear automatically in the plot title
    """
    desc = {}
    plotname = '{0}_actual{1}'.format(plotname_root, ext)
    plotname = os.path.join(wk_dir, plotname)
    plot_hist1d.plot_1dhist(plotname,
                            myregion,
                            filenames,
                            runtitles,
                            plottitle,
                            timescale=timescale,
                            filenames_obs=filenames_obs,
                            runtitles_obs=runtitles_obs,
                            log=1)
    desc.update({
        os.path.relpath(plotname, start=wk_dir): {
            "description": "Actual histogram"
        }
    })

    plotname = '{0}_fractional{1}'.format(plotname_root, ext)
    plotname = os.path.join(wk_dir, plotname)
    plot_hist1d.plot_1dhist(plotname,
                            myregion,
                            filenames,
                            runtitles,
                            plottitle,
                            timescale=timescale,
                            filenames_obs=filenames_obs,
                            runtitles_obs=runtitles_obs,
                            frac=1,
                            log=1)
    desc.update({
        os.path.relpath(plotname, start=wk_dir): {
            "description": "Fractional histogram"
        }
    })
    update_json("plots", desc, wk_dir + "/output.json")
    return