[Casa-framework] Making image.xml an executable Python script

Raymond Rusk Raymond.Rusk at nrc-cnrc.gc.ca
Fri Dec 8 17:29:04 EST 2006


Hi Wes/Joe,

I am looking at the examples in image.  They are daunting in number and 
complexity with respect to required datasets.  (If there is a known 
correspondence of datasets in the repository to examples, I need to hear 
of it to reduce redundant effort.)  In any case, when I finally get the 
examples converted to Python I want to be sure that they remain valid.  I 
have been considering zero labour ways that this might be done and the 
following scenario seems to work.

Inside the image.xml file, in each example I add triple quotes as shown 
here:

<example>
<verbatim>
"""# Example xyz
ia.maketestimage('zz')
ia.summary()
#expected output
#other stuff
"""# End of example
</verbatim>
</example>

If I include the triple quotes in all the examples that I want to verify, 
and then create a text file containing nothing but a triple quote called 
triplequote, I can generate an executable Python script from image.xml 
using 'cat triplequote image.xml triplequote > examplesImage.py'.

With this trivial investment in effort, I seem to have what I need for 
example verification.  I intend to write all of the Python examples for 
image in this way unless there is some complication I am overlooking.  As 
far as I can tell, the generated code doesn't change and the generated 
documentation remains readable.

Comments?

Raymond

-- 
Dr. Raymond Rusk                                        Dr. Raymond Rusk
ALMA Software Engineer                           Ingenieur Logiciel ALMA
National Research Council Canada   Conseil national de recherches Canada
Herzberg Institute of Astrophysics   L'Institut Herzberg d'Astrophysique
DRAO, P.O. Box 248                                    OFRA, B.P. Box 248
Penticton, BC V2A 6J9           |\^/|         Penticton, (C.-B.) V2A 6J9
Government of Canada         _|\|   |/|_          Gouvernement du Canada
Tel: (250)490-4347           >         <              Tel: (250)490-4347
Fax: (250)493-7767            >_./|\._<               Fax: (250)493-7767
Raymond.Rusk at nrc-cnrc.gc.ca                  Raymond.Rusk at nrc-cnrc.gc.ca


More information about the Casa-framework mailing list