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

Raymond Rusk Raymond.Rusk at nrc-cnrc.gc.ca
Fri Dec 8 18:00:45 EST 2006


On Fri, 8 Dec 2006, Wes Young wrote:

> So, you've got me thinking that maybe we should do something like
>
> <example name="myexample.py" language="python>
> ....
> </example>
>
> We could then run split out all the examples and turn them into working 
> scripts.  If I tweak the xslt we can lose the verbatim tags and you could get 
> a pointer to the script from the docs.
>
> Comments?

Yes, this would be fine.  It wouldn't take me long to convert to this way 
of doing things.  If all the Python example scripts are kept somewhere 
where they can be ran easily it would be very convenient for users and for 
developer's maintaining the documentation.  As a software user, nothing 
discourages me more than examples that don't work but as a developer I 
don't want to manually verify that they are up to date.

> As for the data sets, they should be getable from the data repository.

At the moment I am looking for a dataset with an image containing rotation 
measures.  Ironically, I generated hundreds of polarization images for my 
Ph.D but I have been away from observing for so long that I can't locate a 
suitable dataset.  I suspect that the data repository doesn't contain one 
though I could probably create one using imager.  However, I would prefer 
to avoid such recursive diversions.  Maybe in the future I can get some 
science time in my job description so that I can be more on top of such 
things.

> wes
> wyoung at aoc.nrao.edu
>
>
> On Dec 8, 2006, at 10:29 PM, Raymond Rusk wrote:
>
>> 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
>

-- 
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