Changeset 44:10d33af464cf
- Timestamp:
- 10/05/09 13:31:04 (4 years ago)
- Author:
- Andrew Davison <andrew.davison@…>
- Branch:
- default
- Message:
-
Minor documentation changes
- Location:
- doc
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r37
|
r44
|
|
| 2 | 2 | from sumatra import commands |
| 3 | 3 | |
| 4 | | modes = ("init", "configure", "info", "run", "list", "delete", "comment", "tag", "repeat") |
| | 4 | modes = ["init", "configure", "info", "run", "list", "delete", "comment", "tag", "repeat"] |
| 5 | 5 | modes.sort() |
| 6 | 6 | |
| … |
… |
|
| 26 | 26 | f.write("=====================\n\n") |
| 27 | 27 | |
| 28 | | for mode, sio in usage.items(): |
| | 28 | for mode in modes: |
| | 29 | sio = usage[mode] |
| 29 | 30 | f.write(mode + '\n') |
| 30 | 31 | f.write('-'*len(mode) + '\n::\n\n ') |
-
|
r42
|
r44
|
|
| 64 | 64 | the parameters for later use in searching and comparison, so they need to be |
| 65 | 65 | transformed into a form Sumatra can use. This is very simple, we just replace |
| 66 | | the ``execfile()`` call with a ``build_parameters()`` call. |
| | 66 | the ``execfile()`` call with a ``build_parameters()`` call:: |
| 67 | 67 | |
| 68 | 68 | from sumatra.parameters import build_parameters |
| 69 | 69 | parameters = build_parameters(parameter_file) |
| 70 | 70 | |
| 71 | | Now we create a new ``SimRecord`` object, telling it which script and executable |
| 72 | | to use (these are obviously inferable, but in the current version of Sumatra |
| 73 | | we have to specify them explicitly):: |
| | 71 | Now we create a new ``SimRecord`` object, telling it that the script is the |
| | 72 | current file:: |
| 74 | 73 | |
| 75 | | from sumatra.programs import Script, get_executable |
| 76 | | simulator = get_executable('python') |
| | 74 | from sumatra.programs import Script |
| 77 | 75 | script = Script(main_file=__file__) |
| 78 | 76 | script.update_code() |
| 79 | 77 | |
| 80 | 78 | sim_record = project.new_record(parameters=parameters, |
| 81 | | executable=simulator, |
| 82 | 79 | script=script, |
| 83 | 80 | label="api_example", |
| … |
… |
|
| 85 | 82 | |
| 86 | 83 | Now comes the main body of the simulation, which is unchanged except that we |
| 87 | | take the opportunity to give the output data file a more informative name: |
| | 84 | take the opportunity to give the output data file a more informative name:: |
| 88 | 85 | |
| 89 | 86 | output_file = "%s.dat" % sim_record.label |
| … |
… |
|
| 106 | 103 | import time |
| 107 | 104 | from sumatra.projects import load_simulation_project |
| 108 | | from sumatra.programs import Script, get_executable |
| | 105 | from sumatra.programs import Script |
| 109 | 106 | from sumatra.parameters import build_parameters |
| 110 | 107 | |
| … |
… |
|
| 115 | 112 | parameters = build_parameters(parameter_file) |
| 116 | 113 | |
| 117 | | simulator = get_executable('python') |
| 118 | 114 | script = Script(main_file=__file__) |
| 119 | 115 | script.update_code() |
| 120 | 116 | |
| 121 | 117 | sim_record = project.new_record(parameters=parameters, |
| 122 | | executable=simulator, |
| 123 | 118 | script=script, |
| 124 | 119 | label="api_example", |
-
|
r42
|
r44
|
|
| 3 | 3 | import time |
| 4 | 4 | from sumatra.projects import load_simulation_project |
| 5 | | from sumatra.programs import Script, get_executable |
| | 5 | from sumatra.programs import Script |
| 6 | 6 | from sumatra.parameters import build_parameters |
| 7 | 7 | |
| … |
… |
|
| 12 | 12 | parameters = build_parameters(parameter_file) |
| 13 | 13 | |
| 14 | | simulator = get_executable('python') |
| 15 | 14 | script = Script(main_file=__file__) |
| 16 | 15 | script.update_code() |
| 17 | 16 | |
| 18 | 17 | sim_record = project.new_record(parameters=parameters, |
| 19 | | executable=simulator, |
| 20 | 18 | script=script, |
| 21 | 19 | label="api_example", |