Ejemplo n.º 1
0
def makeplots(filenames=[]):
    import os, glob, re
    from pyclaw.plotters.plotclaw import plotclaw

    thisdir = os.path.split(os.getcwd())[1]

    #os.system('make .plots')   # ensure output files and sample plots exist
    #os.system('make .htmls')   # ensure html files exist

    if filenames==[]:
        filenames = glob.glob('setplot_*.py')

    spnames = []
    dirname = os.path.split(os.getcwd())[1]
    rstname = "plot%s-" % dirname

    for setplotfile in filenames:
        print '=== Making plots using ',setplotfile 

        regexp = re.compile(r'setplot_(?P<spname>.*).py')
        result = regexp.search(setplotfile)
        spname = result.group('spname')
        spnames.append(spname)

        plotdir = 'plots_%s' % spname
        plotclaw(outdir="_output", plotdir=plotdir, setplot=setplotfile)

    for spname in spnames:
        setplotfile = 'setplot_%s.py' % spname
        rstfile_name = rstname + spname
        print '=== Making rst file %s.rst' % rstfile_name
        rstfile = open('../%s.rst' % rstfile_name, 'w')
        setplot_lines = open(setplotfile,'r').read()

        regexp = re.compile(r'"""(?P<descr>.*?)""" (?P<rest>.*)', \
                 re.DOTALL)
        result = regexp.search(setplot_lines)
        setplot_descr = result.group('descr')
        setplot_rest = result.group('rest')
        setplot_rest = setplot_rest.replace('\n','\n    ',1000)
        rstfile.write(""".. _%s: \n%s \n\n""" % (rstfile_name, setplot_descr))
	rstfile.write("Example generating data: `$CLAW/doc/sphinx/%s/README.html <../%s/README.html>`_\n\n" \
			% (thisdir, thisdir))
	rstfile.write("Resulting plots: `$CLAW/doc/sphinx/%s/plots_%s/_PlotIndex.html <../%s/plots_%s/_PlotIndex.html>`_\n\n::\n" \
			% (thisdir, spname, thisdir, spname))
        rstfile.write(setplot_rest)
        rstfile.close()
        os.system('chmod og+r ../%s.rst' % rstfile_name)
Ejemplo n.º 2
0
def makeplots(filenames=[]):
    import os, glob, re
    from pyclaw.plotters.plotclaw import plotclaw

    thisdir = os.path.split(os.getcwd())[1]

    #os.system('make .plots')   # ensure output files and sample plots exist
    os.system('make .htmls')  # ensure html files exist

    if filenames == []:
        filenames = glob.glob('setplot_*.py')

    spnames = []

    for setplotfile in filenames:
        print '=== Making plots using ', setplotfile

        regexp = re.compile(r'setplot_(?P<spname>.*).py')
        result = regexp.search(setplotfile)
        spname = result.group('spname')
        spnames.append(spname)

        plotdir = 'plots_%s' % spname
        plotclaw(outdir="_output", plotdir=plotdir, setplot=setplotfile)

    for spname in spnames:
        setplotfile = 'setplot_%s.py' % spname
        rstfile_name = 'plotexample-acou-2d-%s' % spname
        print '=== Making rst file %s.rst' % rstfile_name
        rstfile = open('../%s.rst' % rstfile_name, 'w')
        setplot_lines = open(setplotfile, 'r').read()

        regexp = re.compile(r'"""(?P<descr>.*?)""" (?P<rest>.*)', \
                 re.DOTALL)
        result = regexp.search(setplot_lines)
        setplot_descr = result.group('descr')
        setplot_rest = result.group('rest')
        setplot_rest = setplot_rest.replace('\n', '\n    ', 1000)
        rstfile.write(""".. _%s: \n%s \n\n""" % (rstfile_name, setplot_descr))
        rstfile.write("Example generating data: `<claw/doc/sphinx/%s/README.html>`_\n\n" \
                        % thisdir)
        rstfile.write("Resulting plots: `<claw/doc/sphinx/%s/plots_%s/_PlotIndex.html>`_\n\n::\n" \
                        % (thisdir, spname))
        rstfile.write(setplot_rest)
        rstfile.close()
Ejemplo n.º 3
0
#! /usr/bin/python
"""
Run several tests with different parameters, in this case different
values of d.
"""

from setrun import setrun
from setplot import setplot
from pyclaw.runclaw import runclaw
from pyclaw.plotters.plotclaw import plotclaw

for n in [1, 2, 4]:
    for d in [0.061, 0.080, 0.100, 0.120, 0.140, 0.149, 0.189]:
        rundata = setrun(d_param=d)
        mx = 72 * n
        my = 18 * n
        rundata.clawdata.mx = mx
        rundata.clawdata.my = my
        rundata.write()

        runclaw(xclawcmd="xgeoclaw", outdir="_output_%s_my%s" % (d, my))

        setplot.d = d
        setplot.my = my
        plotclaw(outdir="_output_%s_my%s" % (d,my), \
                 plotdir="_plots_%s_my%s" % (d,my),\
                 setplot=setplot)
Ejemplo n.º 4
0
os.system('make .htmls')   # ensure html files exist

filenames = glob.glob('setplot_*.py')

spnames = []

for setplotfile in filenames:
    print '=== Making plots using ',setplotfile 

    regexp = re.compile(r'setplot_(?P<spname>.*).py')
    result = regexp.search(setplotfile)
    spname = result.group('spname')
    spnames.append(spname)

    plotdir = 'plots_%s' % spname
    plotclaw(outdir="_output", plotdir=plotdir, setplot=setplotfile)

for spname in spnames:
    setplotfile = 'setplot_%s.py' % spname
    rstfile_name = 'plotexample-acou-1d-%s' % spname
    print '=== Making rst file %s.rst' % rstfile_name
    rstfile = open('../%s.rst' % rstfile_name, 'w')
    setplot_lines = open(setplotfile,'r').read()

    regexp = re.compile(r'"""(?P<descr>.*?)""" (?P<rest>.*)', \
             re.DOTALL)
    result = regexp.search(setplot_lines)
    setplot_descr = result.group('descr')
    setplot_rest = result.group('rest')
    setplot_rest = setplot_rest.replace('\n','\n    ',1000)
    rstfile.write(""".. _%s: \n%s \n\n""" % (rstfile_name, setplot_descr))
Ejemplo n.º 5
0
from setrun import setrun
from setplot import setplot
from pyclaw.runclaw import runclaw
from pyclaw.plotters.plotclaw import plotclaw

# initialize rundata using setrun but then change some things for each run:
rundata = setrun()

#--------------
# Run 1:
#--------------
rundata.clawdata.mxnest = 1
rundata.write()

runclaw(xclawcmd = "xgeoclaw", outdir="_output_1level")
plotclaw(outdir="_output_1level", plotdir="_plots_1level")

#--------------
# Run 2:
#--------------
rundata.clawdata.mxnest = 2
rundata.geodata.wavetolerance = 0.01
rundata.write()

runclaw(xclawcmd = "xgeoclaw", outdir="_output_2level")
plotclaw(outdir="_output_2level", plotdir="_plots_2level")

#--------------
# Run 3:
#--------------
rundata.clawdata.mxnest = 3
Ejemplo n.º 6
0
#! /usr/bin/python

"""
Run several tests with different parameters, in this case different
values of d.
"""

from setrun import setrun
from setplot import setplot
from pyclaw.runclaw import runclaw
from pyclaw.plotters.plotclaw import plotclaw

for n in [1,2,4]:
    for d in [0.061, 0.080, 0.100, 0.120, 0.140, 0.149, 0.189]:
        rundata = setrun(d_param=d)
        mx = 72*n
        my = 18*n
        rundata.clawdata.mx = mx
        rundata.clawdata.my = my
        rundata.write()

        runclaw(xclawcmd = "xgeoclaw", outdir="_output_%s_my%s" % (d,my))

        setplot.d = d
        setplot.my = my
        plotclaw(outdir="_output_%s_my%s" % (d,my), \
                 plotdir="_plots_%s_my%s" % (d,my),\
                 setplot=setplot)


Ejemplo n.º 7
0
from setrun import setrun
from setplot import setplot
from pyclaw.runclaw import runclaw
from pyclaw.plotters.plotclaw import plotclaw

# initialize rundata using setrun but then change some things for each run:
rundata = setrun()

#--------------
# Run 1:
#--------------
rundata.clawdata.mxnest = 1
rundata.write()

runclaw(xclawcmd="xgeoclaw", outdir="_output_1level")
plotclaw(outdir="_output_1level", plotdir="_plots_1level")

#--------------
# Run 2:
#--------------
rundata.clawdata.mxnest = 2
rundata.geodata.wavetolerance = 0.01
rundata.write()

runclaw(xclawcmd="xgeoclaw", outdir="_output_2level")
plotclaw(outdir="_output_2level", plotdir="_plots_2level")

#--------------
# Run 3:
#--------------
rundata.clawdata.mxnest = 3
Ejemplo n.º 8
0
os.system('make .htmls')  # ensure html files exist

filenames = glob.glob('setplot_*.py')

spnames = []

for setplotfile in filenames:
    print '=== Making plots using ', setplotfile

    regexp = re.compile(r'setplot_(?P<spname>.*).py')
    result = regexp.search(setplotfile)
    spname = result.group('spname')
    spnames.append(spname)

    plotdir = 'plots_%s' % spname
    plotclaw(outdir="_output", plotdir=plotdir, setplot=setplotfile)

for spname in spnames:
    setplotfile = 'setplot_%s.py' % spname
    rstfile_name = 'plotexample-acou-1d-%s' % spname
    print '=== Making rst file %s.rst' % rstfile_name
    rstfile = open('../%s.rst' % rstfile_name, 'w')
    setplot_lines = open(setplotfile, 'r').read()

    regexp = re.compile(r'"""(?P<descr>.*?)""" (?P<rest>.*)', \
             re.DOTALL)
    result = regexp.search(setplot_lines)
    setplot_descr = result.group('descr')
    setplot_rest = result.group('rest')
    setplot_rest = setplot_rest.replace('\n', '\n    ', 1000)
    rstfile.write(""".. _%s: \n%s \n\n""" % (rstfile_name, setplot_descr))