Difference: DpHipeTools (65 vs. 66)

Revision 662011-04-06 - JavierDiaz

Line: 1 to 1
 
META TOPICPARENT name="WritingTasks"

Adding Tools to HIPE

Line: 99 to 99
  } });
Added:
>
>
In Jython, your can define your own ParameterValidatorAdapter classes, although we suggest that you use Java validator classes:

from herschel.ia.gui.kernel import ParameterValidatorAdapter, ParameterValidationException

class MyVal(ParameterValidatorAdapter):
    def validate(self, val):
        if (val < 0 or val > 10):
            raise ParameterValidationException("Bad value " + str(val) + ", must be between 0 and 10")

And you can assign instances to your parameters

 p.parameterValidator = MyVal()
  Note how the validation logic is now within the parameter validation block, rather than in the preamble or execution block of your task. One advantage is that the execution block of your task can concentrate on the core algorithm.
 
This site is powered by the TWiki collaboration platform Powered by Perl