29 | | 1. open a rappture library object by sending it an xml file |
30 | | 2. "get" inputs that the user specified, from the rappture object |
31 | | 3. create an input file for your science code |
32 | | 4. call your science code |
33 | | 5. parse the output files from the science code |
34 | | 6. "put" the interesting output back into the rappture library object |
35 | | 7. call the result function to tell rappture graphical user interface that the wrapper script is complete. |
| 29 | 1. Open a Rappture library object by sending it an xml file |
| 30 | 2. "get" inputs that the user specified, from the Rappture object |
| 31 | 3. Create an input file for your science code |
| 32 | 4. Call your science code |
| 33 | 5. Parse the output files from the science code |
| 34 | 6. "put" the interesting output back into the Rappture library object |
| 35 | 7. Call the result function to tell Rappture graphical user interface that the wrapper script is complete. |
| 38 | |
| 39 | || Step || Explanation || Tcl Example Code || Python Example Code || |
| 40 | || 1 || Here we open the Rappture library with the first command line argument, argument 0 ||'''set opt [Rappture::library [lindex $argv 0]]''' || '''lib = Rappture.library(sys.argv[1])''' || |
| 41 | || 2 || Pay attention to all lines that use the "get" function. They are grabbing information from the Rappture library || '''$opt get input.(structure).(p_node).current''' || ?? || |
| 42 | || 3 || Look for the appending of information to a variable, and the writing of variables to files || '''append deck ...''' [[BR]] '''set deckfile "pdr[pid]"''' [[BR]] '''set fid [open $deckfile w]''' [[BR]] '''puts $fid $deck '''[[BR]] '''close $fid''' || ?? || |
| 43 | || 4 || Look for the Rappture::exec call. That is how to execute external programs in Tcl || '''set status [catch {Rappture::exec $program $deckfile} out]''' || ?? || |
| 44 | || 5 || Generally the code right after the Rappture::exec function call deals with parsing the output || ?? || ?? || |
| 45 | || 6 || Anywhere you see the "put" function being used, you know we are trying to put information back into the Rappture library. || '''$opt put output.log $out''' || ?? || |
| 46 | || 7 || This line tells the rappture graphical user interface that the wrapper script has completed and that it can start rendering plots. Sometimes in old tcl scripts you see a line like this: [[BR]] puts "=RAPPTURE-RUN=>$oname" [[BR]] This is the old way to end a program and should not be used. || '''Rappture::result $opt $status''' || ?? || |