[Radiance-general] Use Python to execute Radiance command

Guglielmetti, Robert Robert.Guglielmetti at nrel.gov
Mon Jun 20 09:51:21 PDT 2011


Hi Ji,

Yes, the ampersand can be used to send most any program to the background. This is a UNIX thing, not a Radiance thing. You may want to get familiar with the "top" program, so you can check on the status of your background jobs.

You can also have multiple terminal windows open, so you could have your processes running on the foreground and just start up another shell to do other stuff.

The "screen" program can also be useful for popping in and out of processes you have running (http://www.gnu.org/software/screen/).

Rob Guglielmetti  IESNA, LEED AP
Commercial Buildings Research Group
National Renewable Energy Laboratory
1617 Cole Blvd MS:RSF202
Golden, CO 80401
T. 303.275.4319
F. 303.630.2055
E. robert.guglielmetti at nrel.gov


On 6/20/11 10:16 AM, "Ji Zhang" <hope.zh at gmail.com<mailto:hope.zh at gmail.com>> wrote:

Thank you very much for your advice, Greg! It works.

May I ask whether specifying the '&' option for rad command to make it run in background can be applied in similar way to other Radiance command such as rpict, rtrace, etc to make them run in background as well?

Thanks again!

- Cheers, Ji


On Mon, Jun 20, 2011 at 12:58 AM, Greg Ward <gregoryjward at gmail.com<mailto:gregoryjward at gmail.com>> wrote:
Can't you just add an ampersand ('&') to the end of your rad command to run it in the background?

-Greg


From: Ji Zhang <hope.zh at gmail.com<mailto:hope.zh at gmail.com>>

Date: June 19, 2011 5:48:30 AM PDT


Dear Radiance experts,

Suppose you want to use Python to call rad command and render an image using the following script:

################################
import os
rad_command = "rad -e -v vw1 /test.rif"
os.system(rad_command)
################################

Python will hang there until the rad command running in background is finished. During this period, you can do nothing in the Python Shell...

So, is there a way to use Python to call the Terminal and "paste" the rad command string into the Terminal and then run rad? In this way, Python is freed from the rad rendering process once it's be activated in the Terminal.

Appreciate your advices!

(using Mac OS 10.6.7, Radiance 4, and Python 2.6.5)

Ji

_______________________________________________
Radiance-general mailing list
Radiance-general at radiance-online.org<mailto:Radiance-general at radiance-online.org>
http://www.radiance-online.org/mailman/listinfo/radiance-general





More information about the Radiance-general mailing list