Hi

Kumar and I ran across an issue with defaulting subparameters. Dave's  
problem with immath illustrates the issue.

Originally in immath.xml we had the mode parameter set as...

         <param type="string" name="mode">
                 <description>mode for math operation (evalexpr, spix,  
pola, poli)</description>
                 <value>evalexpr</value>
                 <allowed kind="enum">
                 <value>evalexpr</value>
                 <value>spix</value>
                 <value>pola</value>
                 <value>poli</value>
                 </allowed>
                 <example>'evalexpr', 'spix', 'pola', or 'poli' </ 
example>
         </param>

And in the constraints block

         <constraints>
                 <when param="mode">
                     <equals value="evalexpr">
                         <default param="expr"><value>""</value></ 
default>
                         <default param="varnames"><value>""</value></ 
default>
                     </equals>
                     <equals value="poli">
                         <default param="sigma"><value>"0.0mJy/beam"</ 
value></default>
                     </equals>
                 </when>

         </constraints>

Unfortunately by missing out the pola and spix the defaulting  
mechanism got confused and issued spurious errors when setting mode to  
either pola or spix. The resolution to the issue was to specify "null"  
operations for pola and spix, i.e. the constraints block would look  
like:

         <constraints>
                 <when param="mode">
                     <equals value="evalexpr">
                         <default param="expr"><value>""</value></ 
default>
                         <default param="varnames"><value>""</value></ 
default>
                     </equals>
                     <equals value="poli">
                         <default param="sigma"><value>"0.0mJy/beam"</ 
value></default>
                     </equals>
                     <equals value="pola"/>
                     <equals value="spix"/>
                 </when>

         </constraints>

This causes the defaulting mechanism to use the right  "default" value.

So the upshot, if you have options for a parameter and put that  
parameter in a when block inside a constraints block, make sure you  
have an entry for each value inside the when block that the parameter  
could take.
Topic revision: r1 - 2010-01-21, RemyIndebetouw
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback