[Radiance-general] Re: Python Radiance Package

Randolph M. Fritz RFritz at lbl.gov
Sat Nov 6 23:40:14 PDT 2010


On 2010-11-06 12:50:49 -0700, Greg Ward said:

> Hi Dave,
> 
> This is an interesting idea.  I'm not very familiar with Python, so I'm 
> going to ask some naive questions:
> 
> 1) Can't you just invoke a system command line from Python?  Is this 
> how you would implement these methods?
> 
> 2) What are the advantages of encapsulating Radiance tools in this way? 
>  Who do you expect will benefit?
> 
> It seems like you're just trading one syntax (the Unix command line) 
> for another (Python objects and methods).  This can be worthwhile if 
> the syntax is easier to use or leverages capabilities of the language 
> in new ways.  Do you have an actual problem in mind that you think is 
> best solved this way?  Your example gives a flavor of what you could 
> do, but you're not really doing anything here you couldn't do by 
> shelling out commands and stowing the results in files instead of 
> variables.

I'll be interested in David's answer, but one reason I use Python 
scripts is that the Python subprocess module implements (relatively) 
platform-independent argument processing.  On Unix execvp() is used, 
unless a shell is specifically chosen.  On Windows, which doesn't have 
an analog of execvp(), arguments are escaped for the MS C runtime 
library.  So scripts aren't dependent on the platform.  I've used this 
and, in fact, it works.   Also, personally, I prefer working with 
Python lists to csh variables, but I doubt you would!

> Can you share a little more of your broader vision?  Are these just 
> hooks for applications like Blender, or are they somehow better than 
> the commands themselves?  Do you plan to store entire images in memory, 
> or does Python manage variables with megabytes of data in them 
> efficiently?

Well, it could be done--numpy does it, for instance.  David?

-- 
Randolph M. Fritz • RFritz at lbl.gov
Environmental Energy Technologies Division • Lawrence Berkeley Labs





More information about the Radiance-general mailing list