<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Filippo<div><br></div><div>what do you plan to do? As written by Gian Luca, you have "two versions" of ESP-r, already. You can start every ESP-r component in text mode by invoking with</div><div><br></div><div>$> prj -mode text</div><div><br></div><div>In general, this is definitely possible from Python, also. However, then it may become tricky, because you need to send the started process many instructions to be able to do anything interesting.</div><div><br></div><div>It is quite easy, though, to write scripts that do special tasks and call these scripts from other scripts. E.g. set a new control file by the following ("set_ctl.sh"):</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); ">#!/bin/sh</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); ">#</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "># Script changes control file in .cfg. <set_ctl> expects two</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "># arguments:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "># 1. configuration file name (with relative path)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "># 2. control file name (with relative path)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); ">#</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">CONFIG=$<span style="color: #2f00dd">1</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">CONTRL=$<span style="color: #2f00dd">2</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(224, 0, 0); "><span style="color: #000000">echo </span>"$CONFIG, control: $CTL "</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">prj -file $CONFIG -mode text >> /dev/null <<XXX</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "><span style="color: #000000">m </span># browse/edit/simulate</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "><span style="color: #000000">n </span># global control</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">$CONTRL</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "><span style="color: #000000">- </span># exit</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "><span style="color: #000000">y </span># save changes</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "><span style="color: #000000">y </span># overwrite</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">Run: Whatever</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">-</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">-</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">XXX</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">unset CONFIG</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">unset CONTRL</div></div><div><br></div><div>Creating the instruction sequence is best done by doing whatever you wish in text mode and noting all the steps you need to take. Then simply write a shell script like the example above. In a calling script you can use such a "tool" like this ("run-everything.sh", the snippet uses some more tools of the general type described above):</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span style="color: #c800a3">for</span> CTL <span style="color: #c800a3">in</span> $CTLLIST</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(200, 0, 163); ">do</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(0, 139, 0); "><font class="Apple-style-span" color="#000000"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">. ./set_ctl.sh $VAR.cfg $CTL</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">. ./simulate.sh $VAR.cfg ../../${VAR}_${theOPR}_${CTL}.res $FD $FM $TD $TM $PP</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">. ./res_supplied-energy.sh ../../${VAR}_${theOPR}_${CTL}.res ${VAR}_${theOPR}_${CTL}_supplied.dat</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-style-span" style="color: rgb(0, 139, 0); "><span style="color: #c800a3"><br></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-style-span" style="color: rgb(0, 139, 0); "><span style="color: #c800a3">done</span><span style="color: #000000"> </span># current CTL / complete list</span></div></div><div><br></div><div>Hope this helps.</div><div><br></div><div>Best</div><div>Achim</div><div><br></div><div><br><div><div>On Jul 15, 2011, at 4:22 PM, Filippo Monari wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi,<div>I'd like to have a GUI version and a console version of ESP-r on my Ubuntu box because I want to try making some scripts.</div><div>Can you tell me hoe can I reach this goal?</div><div>Furthermore have anyone of you tried to use ESP-r with Python? There is out there some guide or example?</div>
<div>Kind regards,</div><div>Filippo</div><div> </div>
_______________________________________________<br>esp-r mailing list<br><a href="mailto:esp-r@lists.strath.ac.uk">esp-r@lists.strath.ac.uk</a><br>http://lists.strath.ac.uk/mailman/listinfo/esp-r</blockquote></div><br><div>
<div style="font-size: 12px; "><a href="mailto:achim.geissler@intergga.ch">achim.geissler@intergga.ch</a></div><div style="font-size: 12px; "><br></div><div style="font-size: 12px; "><br></div><br class="Apple-interchange-newline">
</div>
<br></div></body></html>