source: trunk/gui/apps/rerun @ 55

Last change on this file since 55 was 55, checked in by dkearney, 16 years ago

python/Rappture/number.py

  • added ability for number to choose between default and current tags
  • changed structure of init so the basePath and the id are separate arguments to keep compatibility with how the driver program expects a number xml structure

python/Rappture/interface.py

  • included a more complete xml structure including tool and command i structures, for writing the xml to the file when the -g option is used
  • adjusted the finish() function to utilize the new Rappture.result() function

examples/app-fermi/fermi_io.py

  • adjusted the Rappture.number() fxn call to split the path and id.
  • commented out the result = [] because we now write the result to xml

examples/app-fermi/fermi.py

  • added output section with curve xml details for writing to xml
  • directly write the results to xml instead of to a result[] array

gui/apps/rerun

  • added script to re-visualize output from previously created run.xml file
  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#! /bin/sh
2# ----------------------------------------------------------------------
3#  rerun
4
5#  script to view the output of a previously created run.xml file
6#  rerunning the simulation with new data is outside of the scope
7#  of this script. it is currently only for viewing the output
8#  of a previously created run.xml file.
9
10#
11#  RUN AS FOLLOWS:
12#    rerun [-h | -d driver_path] <run.xml-file>
13#
14#      -h | --help                  - print the help menu
15#      -d | --driver driver_path    - specify the path to the driver
16#                                     program. You will need to specify
17#                                     the path if the driver program is
18#                                     not in your PATH environment
19#                                     variable.
20#
21#      <run.xml-file> - the run.xml file you containing an output
22#                       section you would like to re-generate.
23#
24# ======================================================================
25#  AUTHOR:  Derrick Kearney, Purdue University
26#  Copyright (c) 2005  Purdue Research Foundation, West Lafayette, IN
27# ======================================================================
28#
29#
30""":"
31exec python $0 ${1+"$@"}
32"""
33
34import getopt, shutil, re, os, sys
35
36def printHelp():
37    print """rerun [-h | -d driver_path] runFile
38
39      -h | --help                  - print the help menu
40      -d | --driver driver_path    - specify the path to the driver
41                                     program. You will need to specify
42                                     the path if the driver program is
43                                     not in your PATH environment
44                                     variable.
45
46      <run.xml-file> - the run.xml file you containing an output
47                       section you would like to re-generate.
48"""
49    sys.exit()
50
51
52if __name__ == '__main__' :
53
54    longOpts = ["driver=","help"]
55    shortOpts = "d:h"
56    opts, args = getopt.getopt(sys.argv[1:], shortOpts, longOpts)
57
58    driverPath = 'driver'
59    runFile = args[0]
60
61    # match options
62    for o, v in opts:
63        if o in ("-d", "--driver"):
64            driverPath = v
65        elif o in ("-h", "--help"):
66            printHelp()
67
68    # look for the text <command> (any characters) </command>
69    re_command = re.compile(r'<command>.*</command>', re.I|re.DOTALL)
70
71    # prepare text variables
72    outTmpFileName = '/tmp/rerun_' + os.path.basename(runFile)
73    outCmd = '<command>echo =RAPPTURE-RUN=>%s</command>' % outTmpFileName
74
75    # do the file <command> switheroo!
76    xmlfile = open(runFile, "rb").read()
77    tmpfile = open(outTmpFileName, "wb")
78    outText = re_command.sub(outCmd,xmlfile)
79    tmpfile.write(outText)
80    tmpfile.close()
81
82    # run driver on the temporary run file
83    systemCmd = '%s -tool %s' % (driverPath, outTmpFileName)
84    os.system(systemCmd)
85   
86    # presto-change-o
87   
88    # clean up our tmp file
89    os.remove(outTmpFileName)
90    sys.exit()
Note: See TracBrowser for help on using the repository browser.