NRAO Home > CASA > CASA Cookbook and User Reference Manual
1.4.5.1 The scope of parameters in CASA
Advanced Tip
By default, the scope of CASA parameters is global, as stated here. However, if you call a task as a function with one or more arguments specified, e.g. task(arg1=val1,...), then non-specified parameters will be defaulted and no globals used. This makes scripting more robust. Tasks DO NOT change the value of globals.

All task parameters have global scope within CASA: the parameter values are common to all tasks and also at the CASA command line. This allows the convenience of not changing parameters that are shared between tasks but does require care when chaining together sequences of task invocations (to ensure proper values are provided). Tasks DO NOT change the values of the global parameters, nor does the invocation of tasks using the functional call with arguments change the globals.

This does mean that unless you do an explicit default of the task (§ 1.4.5.2), previously set values may be unexpectedly used if you do not inspect the inp carefully. For example, good practice is:

   default(’imhead’)  
   imagename = ’ngc5921.demo.cleanimg.image’  
   mode = ’list’  
   imhead()

If you supply the task call with arguments, then these will be used for the values of those parameters (see above). However, if some but not all arguments are supplied, then those parameters not given as arguments will default and NOT use the current global values. Thus,

   imhead(’ngc5921.demo.cleanimg.image’,mode=’list’)

will reproduce the above.


More information about CASA may be found at the CASA web page

Copyright © 2010 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search