Best Python code snippet using green
itkReinitializeLevelSetImageFilterPython.py
Source:itkReinitializeLevelSetImageFilterPython.py
1# This file was automatically generated by SWIG (http://www.swig.org).2# Version 1.3.403#4# Do not make changes to this file unless you know what you are doing--modify5# the SWIG interface file instead.6from sys import version_info7if version_info >= (3,0,0):8 new_instancemethod = lambda func, inst, cls: _itkReinitializeLevelSetImageFilterPython.SWIG_PyInstanceMethod_New(func)9else:10 from new import instancemethod as new_instancemethod11if version_info >= (2,6,0):12 def swig_import_helper():13 from os.path import dirname14 import imp15 fp = None16 try:17 fp, pathname, description = imp.find_module('_itkReinitializeLevelSetImageFilterPython', [dirname(__file__)])18 except ImportError:19 import _itkReinitializeLevelSetImageFilterPython20 return _itkReinitializeLevelSetImageFilterPython21 if fp is not None:22 try:23 _mod = imp.load_module('_itkReinitializeLevelSetImageFilterPython', fp, pathname, description)24 finally:25 fp.close()26 return _mod27 _itkReinitializeLevelSetImageFilterPython = swig_import_helper()28 del swig_import_helper29else:30 import _itkReinitializeLevelSetImageFilterPython31del version_info32try:33 _swig_property = property34except NameError:35 pass # Python < 2.2 doesn't have 'property'.36def _swig_setattr_nondynamic(self,class_type,name,value,static=1):37 if (name == "thisown"): return self.this.own(value)38 if (name == "this"):39 if type(value).__name__ == 'SwigPyObject':40 self.__dict__[name] = value41 return42 method = class_type.__swig_setmethods__.get(name,None)43 if method: return method(self,value)44 if (not static) or hasattr(self,name):45 self.__dict__[name] = value46 else:47 raise AttributeError("You cannot add attributes to %s" % self)48def _swig_setattr(self,class_type,name,value):49 return _swig_setattr_nondynamic(self,class_type,name,value,0)50def _swig_getattr(self,class_type,name):51 if (name == "thisown"): return self.this.own()52 method = class_type.__swig_getmethods__.get(name,None)53 if method: return method(self)54 raise AttributeError(name)55def _swig_repr(self):56 try: strthis = "proxy of " + self.this.__repr__()57 except: strthis = ""58 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)59try:60 _object = object61 _newclass = 162except AttributeError:63 class _object : pass64 _newclass = 065def _swig_setattr_nondynamic_method(set):66 def set_attr(self,name,value):67 if (name == "thisown"): return self.this.own(value)68 if hasattr(self,name) or (name == "this"):69 set(self,name,value)70 else:71 raise AttributeError("You cannot add attributes to %s" % self)72 return set_attr73import ITKCommonBasePython74import itkEventObjectsPython75import pyBasePython76import itkImageToImageFilterAPython77import itkImagePython78import itkFixedArrayPython79import itkCovariantVectorPython80import vnl_vectorPython81import vcl_complexPython82import vnl_matrixPython83import itkVectorPython84import vnl_vector_refPython85import ITKRegionsPython86import itkSizePython87import itkIndexPython88import itkOffsetPython89import itkPointPython90import itkMatrixPython91import vnl_matrix_fixedPython92import itkRGBAPixelPython93import itkSymmetricSecondRankTensorPython94import itkRGBPixelPython95import itkImageSourcePython96import itkVectorImagePython97import itkVariableLengthVectorPython98import itkVectorContainerPython99import itkContinuousIndexPython100import itkLevelSetPython101def itkReinitializeLevelSetImageFilterID3_New():102 return itkReinitializeLevelSetImageFilterID3.New()103def itkReinitializeLevelSetImageFilterID2_New():104 return itkReinitializeLevelSetImageFilterID2.New()105def itkReinitializeLevelSetImageFilterIF3_New():106 return itkReinitializeLevelSetImageFilterIF3.New()107def itkReinitializeLevelSetImageFilterIF2_New():108 return itkReinitializeLevelSetImageFilterIF2.New()109class itkReinitializeLevelSetImageFilterID2(itkImageToImageFilterAPython.itkImageToImageFilterID2ID2):110 """Proxy of C++ itkReinitializeLevelSetImageFilterID2 class"""111 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')112 def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")113 __repr__ = _swig_repr114 SetDimension = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetDimension115 LevelSetDoubleAdditiveOperatorsCheck = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_LevelSetDoubleAdditiveOperatorsCheck116 LevelSetOStreamWritableCheck = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_LevelSetOStreamWritableCheck117 def __New_orig__():118 """__New_orig__()"""119 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2___New_orig__()120 __New_orig__ = staticmethod(__New_orig__)121 def SetLevelSetValue(self, *args):122 """SetLevelSetValue(self, double _arg)"""123 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetLevelSetValue(self, *args)124 def GetLevelSetValue(self):125 """GetLevelSetValue(self) -> double"""126 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetLevelSetValue(self)127 def SetNarrowBanding(self, *args):128 """SetNarrowBanding(self, bool _arg)"""129 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetNarrowBanding(self, *args)130 def GetNarrowBanding(self):131 """GetNarrowBanding(self) -> bool"""132 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetNarrowBanding(self)133 def NarrowBandingOn(self):134 """NarrowBandingOn(self)"""135 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_NarrowBandingOn(self)136 def NarrowBandingOff(self):137 """NarrowBandingOff(self)"""138 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_NarrowBandingOff(self)139 def SetInputNarrowBandwidth(self, *args):140 """SetInputNarrowBandwidth(self, double _arg)"""141 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetInputNarrowBandwidth(self, *args)142 def GetInputNarrowBandwidth(self):143 """GetInputNarrowBandwidth(self) -> double"""144 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetInputNarrowBandwidth(self)145 def SetOutputNarrowBandwidth(self, *args):146 """SetOutputNarrowBandwidth(self, double _arg)"""147 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetOutputNarrowBandwidth(self, *args)148 def GetOutputNarrowBandwidth(self):149 """GetOutputNarrowBandwidth(self) -> double"""150 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetOutputNarrowBandwidth(self)151 def SetNarrowBandwidth(self, *args):152 """SetNarrowBandwidth(self, double value)"""153 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetNarrowBandwidth(self, *args)154 def SetInputNarrowBand(self, *args):155 """SetInputNarrowBand(self, itkVectorContainerUILSND2 ptr)"""156 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetInputNarrowBand(self, *args)157 def GetInputNarrowBand(self):158 """GetInputNarrowBand(self)"""159 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetInputNarrowBand(self)160 def GetOutputNarrowBand(self):161 """GetOutputNarrowBand(self)"""162 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetOutputNarrowBand(self)163 __swig_destroy__ = _itkReinitializeLevelSetImageFilterPython.delete_itkReinitializeLevelSetImageFilterID2164 def cast(*args):165 """cast(itkLightObject obj) -> itkReinitializeLevelSetImageFilterID2"""166 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_cast(*args)167 cast = staticmethod(cast)168 def GetPointer(self):169 """GetPointer(self) -> itkReinitializeLevelSetImageFilterID2"""170 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetPointer(self)171 def New(*args, **kargs):172 """New() -> itkReinitializeLevelSetImageFilterID2173 174 Create a new object of the class itkReinitializeLevelSetImageFilterID2 and set the input and the parameters if some175 named or non-named arguments are passed to that method.176 177 New() tries to assign all the non named parameters to the input of the new objects - the178 first non named parameter in the first input, etc.179 180 The named parameters are used by calling the method with the same name prefixed by 'Set'.181 182 Ex:183 184 itkReinitializeLevelSetImageFilterID2.New( reader, Threshold=10 ) 185 186 is (most of the time) equivalent to:187 188 obj = itkReinitializeLevelSetImageFilterID2.New()189 obj.SetInput( 0, reader.GetOutput() )190 obj.SetThreshold( 10 )191 """192 obj = itkReinitializeLevelSetImageFilterID2.__New_orig__()193 import itkTemplate194 itkTemplate.New(obj, *args, **kargs)195 return obj196 New = staticmethod(New)197itkReinitializeLevelSetImageFilterID2.SetLevelSetValue = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetLevelSetValue,None,itkReinitializeLevelSetImageFilterID2)198itkReinitializeLevelSetImageFilterID2.GetLevelSetValue = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetLevelSetValue,None,itkReinitializeLevelSetImageFilterID2)199itkReinitializeLevelSetImageFilterID2.SetNarrowBanding = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetNarrowBanding,None,itkReinitializeLevelSetImageFilterID2)200itkReinitializeLevelSetImageFilterID2.GetNarrowBanding = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetNarrowBanding,None,itkReinitializeLevelSetImageFilterID2)201itkReinitializeLevelSetImageFilterID2.NarrowBandingOn = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_NarrowBandingOn,None,itkReinitializeLevelSetImageFilterID2)202itkReinitializeLevelSetImageFilterID2.NarrowBandingOff = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_NarrowBandingOff,None,itkReinitializeLevelSetImageFilterID2)203itkReinitializeLevelSetImageFilterID2.SetInputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetInputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID2)204itkReinitializeLevelSetImageFilterID2.GetInputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetInputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID2)205itkReinitializeLevelSetImageFilterID2.SetOutputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetOutputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID2)206itkReinitializeLevelSetImageFilterID2.GetOutputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetOutputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID2)207itkReinitializeLevelSetImageFilterID2.SetNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID2)208itkReinitializeLevelSetImageFilterID2.SetInputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_SetInputNarrowBand,None,itkReinitializeLevelSetImageFilterID2)209itkReinitializeLevelSetImageFilterID2.GetInputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetInputNarrowBand,None,itkReinitializeLevelSetImageFilterID2)210itkReinitializeLevelSetImageFilterID2.GetOutputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetOutputNarrowBand,None,itkReinitializeLevelSetImageFilterID2)211itkReinitializeLevelSetImageFilterID2.GetPointer = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_GetPointer,None,itkReinitializeLevelSetImageFilterID2)212itkReinitializeLevelSetImageFilterID2_swigregister = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_swigregister213itkReinitializeLevelSetImageFilterID2_swigregister(itkReinitializeLevelSetImageFilterID2)214def itkReinitializeLevelSetImageFilterID2___New_orig__():215 """itkReinitializeLevelSetImageFilterID2___New_orig__()"""216 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2___New_orig__()217def itkReinitializeLevelSetImageFilterID2_cast(*args):218 """itkReinitializeLevelSetImageFilterID2_cast(itkLightObject obj) -> itkReinitializeLevelSetImageFilterID2"""219 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID2_cast(*args)220class itkReinitializeLevelSetImageFilterID3(itkImageToImageFilterAPython.itkImageToImageFilterID3ID3):221 """Proxy of C++ itkReinitializeLevelSetImageFilterID3 class"""222 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')223 def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")224 __repr__ = _swig_repr225 SetDimension = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetDimension226 LevelSetDoubleAdditiveOperatorsCheck = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_LevelSetDoubleAdditiveOperatorsCheck227 LevelSetOStreamWritableCheck = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_LevelSetOStreamWritableCheck228 def __New_orig__():229 """__New_orig__()"""230 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3___New_orig__()231 __New_orig__ = staticmethod(__New_orig__)232 def SetLevelSetValue(self, *args):233 """SetLevelSetValue(self, double _arg)"""234 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetLevelSetValue(self, *args)235 def GetLevelSetValue(self):236 """GetLevelSetValue(self) -> double"""237 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetLevelSetValue(self)238 def SetNarrowBanding(self, *args):239 """SetNarrowBanding(self, bool _arg)"""240 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetNarrowBanding(self, *args)241 def GetNarrowBanding(self):242 """GetNarrowBanding(self) -> bool"""243 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetNarrowBanding(self)244 def NarrowBandingOn(self):245 """NarrowBandingOn(self)"""246 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_NarrowBandingOn(self)247 def NarrowBandingOff(self):248 """NarrowBandingOff(self)"""249 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_NarrowBandingOff(self)250 def SetInputNarrowBandwidth(self, *args):251 """SetInputNarrowBandwidth(self, double _arg)"""252 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetInputNarrowBandwidth(self, *args)253 def GetInputNarrowBandwidth(self):254 """GetInputNarrowBandwidth(self) -> double"""255 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetInputNarrowBandwidth(self)256 def SetOutputNarrowBandwidth(self, *args):257 """SetOutputNarrowBandwidth(self, double _arg)"""258 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetOutputNarrowBandwidth(self, *args)259 def GetOutputNarrowBandwidth(self):260 """GetOutputNarrowBandwidth(self) -> double"""261 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetOutputNarrowBandwidth(self)262 def SetNarrowBandwidth(self, *args):263 """SetNarrowBandwidth(self, double value)"""264 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetNarrowBandwidth(self, *args)265 def SetInputNarrowBand(self, *args):266 """SetInputNarrowBand(self, itkVectorContainerUILSND3 ptr)"""267 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetInputNarrowBand(self, *args)268 def GetInputNarrowBand(self):269 """GetInputNarrowBand(self)"""270 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetInputNarrowBand(self)271 def GetOutputNarrowBand(self):272 """GetOutputNarrowBand(self)"""273 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetOutputNarrowBand(self)274 __swig_destroy__ = _itkReinitializeLevelSetImageFilterPython.delete_itkReinitializeLevelSetImageFilterID3275 def cast(*args):276 """cast(itkLightObject obj) -> itkReinitializeLevelSetImageFilterID3"""277 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_cast(*args)278 cast = staticmethod(cast)279 def GetPointer(self):280 """GetPointer(self) -> itkReinitializeLevelSetImageFilterID3"""281 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetPointer(self)282 def New(*args, **kargs):283 """New() -> itkReinitializeLevelSetImageFilterID3284 285 Create a new object of the class itkReinitializeLevelSetImageFilterID3 and set the input and the parameters if some286 named or non-named arguments are passed to that method.287 288 New() tries to assign all the non named parameters to the input of the new objects - the289 first non named parameter in the first input, etc.290 291 The named parameters are used by calling the method with the same name prefixed by 'Set'.292 293 Ex:294 295 itkReinitializeLevelSetImageFilterID3.New( reader, Threshold=10 ) 296 297 is (most of the time) equivalent to:298 299 obj = itkReinitializeLevelSetImageFilterID3.New()300 obj.SetInput( 0, reader.GetOutput() )301 obj.SetThreshold( 10 )302 """303 obj = itkReinitializeLevelSetImageFilterID3.__New_orig__()304 import itkTemplate305 itkTemplate.New(obj, *args, **kargs)306 return obj307 New = staticmethod(New)308itkReinitializeLevelSetImageFilterID3.SetLevelSetValue = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetLevelSetValue,None,itkReinitializeLevelSetImageFilterID3)309itkReinitializeLevelSetImageFilterID3.GetLevelSetValue = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetLevelSetValue,None,itkReinitializeLevelSetImageFilterID3)310itkReinitializeLevelSetImageFilterID3.SetNarrowBanding = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetNarrowBanding,None,itkReinitializeLevelSetImageFilterID3)311itkReinitializeLevelSetImageFilterID3.GetNarrowBanding = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetNarrowBanding,None,itkReinitializeLevelSetImageFilterID3)312itkReinitializeLevelSetImageFilterID3.NarrowBandingOn = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_NarrowBandingOn,None,itkReinitializeLevelSetImageFilterID3)313itkReinitializeLevelSetImageFilterID3.NarrowBandingOff = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_NarrowBandingOff,None,itkReinitializeLevelSetImageFilterID3)314itkReinitializeLevelSetImageFilterID3.SetInputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetInputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID3)315itkReinitializeLevelSetImageFilterID3.GetInputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetInputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID3)316itkReinitializeLevelSetImageFilterID3.SetOutputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetOutputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID3)317itkReinitializeLevelSetImageFilterID3.GetOutputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetOutputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID3)318itkReinitializeLevelSetImageFilterID3.SetNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetNarrowBandwidth,None,itkReinitializeLevelSetImageFilterID3)319itkReinitializeLevelSetImageFilterID3.SetInputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_SetInputNarrowBand,None,itkReinitializeLevelSetImageFilterID3)320itkReinitializeLevelSetImageFilterID3.GetInputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetInputNarrowBand,None,itkReinitializeLevelSetImageFilterID3)321itkReinitializeLevelSetImageFilterID3.GetOutputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetOutputNarrowBand,None,itkReinitializeLevelSetImageFilterID3)322itkReinitializeLevelSetImageFilterID3.GetPointer = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_GetPointer,None,itkReinitializeLevelSetImageFilterID3)323itkReinitializeLevelSetImageFilterID3_swigregister = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_swigregister324itkReinitializeLevelSetImageFilterID3_swigregister(itkReinitializeLevelSetImageFilterID3)325def itkReinitializeLevelSetImageFilterID3___New_orig__():326 """itkReinitializeLevelSetImageFilterID3___New_orig__()"""327 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3___New_orig__()328def itkReinitializeLevelSetImageFilterID3_cast(*args):329 """itkReinitializeLevelSetImageFilterID3_cast(itkLightObject obj) -> itkReinitializeLevelSetImageFilterID3"""330 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterID3_cast(*args)331class itkReinitializeLevelSetImageFilterIF2(itkImageToImageFilterAPython.itkImageToImageFilterIF2IF2):332 """Proxy of C++ itkReinitializeLevelSetImageFilterIF2 class"""333 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')334 def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")335 __repr__ = _swig_repr336 SetDimension = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetDimension337 LevelSetDoubleAdditiveOperatorsCheck = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_LevelSetDoubleAdditiveOperatorsCheck338 LevelSetOStreamWritableCheck = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_LevelSetOStreamWritableCheck339 def __New_orig__():340 """__New_orig__()"""341 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2___New_orig__()342 __New_orig__ = staticmethod(__New_orig__)343 def SetLevelSetValue(self, *args):344 """SetLevelSetValue(self, double _arg)"""345 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetLevelSetValue(self, *args)346 def GetLevelSetValue(self):347 """GetLevelSetValue(self) -> double"""348 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetLevelSetValue(self)349 def SetNarrowBanding(self, *args):350 """SetNarrowBanding(self, bool _arg)"""351 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetNarrowBanding(self, *args)352 def GetNarrowBanding(self):353 """GetNarrowBanding(self) -> bool"""354 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetNarrowBanding(self)355 def NarrowBandingOn(self):356 """NarrowBandingOn(self)"""357 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_NarrowBandingOn(self)358 def NarrowBandingOff(self):359 """NarrowBandingOff(self)"""360 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_NarrowBandingOff(self)361 def SetInputNarrowBandwidth(self, *args):362 """SetInputNarrowBandwidth(self, double _arg)"""363 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetInputNarrowBandwidth(self, *args)364 def GetInputNarrowBandwidth(self):365 """GetInputNarrowBandwidth(self) -> double"""366 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetInputNarrowBandwidth(self)367 def SetOutputNarrowBandwidth(self, *args):368 """SetOutputNarrowBandwidth(self, double _arg)"""369 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetOutputNarrowBandwidth(self, *args)370 def GetOutputNarrowBandwidth(self):371 """GetOutputNarrowBandwidth(self) -> double"""372 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetOutputNarrowBandwidth(self)373 def SetNarrowBandwidth(self, *args):374 """SetNarrowBandwidth(self, double value)"""375 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetNarrowBandwidth(self, *args)376 def SetInputNarrowBand(self, *args):377 """SetInputNarrowBand(self, itkVectorContainerUILSNF2 ptr)"""378 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetInputNarrowBand(self, *args)379 def GetInputNarrowBand(self):380 """GetInputNarrowBand(self)"""381 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetInputNarrowBand(self)382 def GetOutputNarrowBand(self):383 """GetOutputNarrowBand(self)"""384 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetOutputNarrowBand(self)385 __swig_destroy__ = _itkReinitializeLevelSetImageFilterPython.delete_itkReinitializeLevelSetImageFilterIF2386 def cast(*args):387 """cast(itkLightObject obj) -> itkReinitializeLevelSetImageFilterIF2"""388 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_cast(*args)389 cast = staticmethod(cast)390 def GetPointer(self):391 """GetPointer(self) -> itkReinitializeLevelSetImageFilterIF2"""392 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetPointer(self)393 def New(*args, **kargs):394 """New() -> itkReinitializeLevelSetImageFilterIF2395 396 Create a new object of the class itkReinitializeLevelSetImageFilterIF2 and set the input and the parameters if some397 named or non-named arguments are passed to that method.398 399 New() tries to assign all the non named parameters to the input of the new objects - the400 first non named parameter in the first input, etc.401 402 The named parameters are used by calling the method with the same name prefixed by 'Set'.403 404 Ex:405 406 itkReinitializeLevelSetImageFilterIF2.New( reader, Threshold=10 ) 407 408 is (most of the time) equivalent to:409 410 obj = itkReinitializeLevelSetImageFilterIF2.New()411 obj.SetInput( 0, reader.GetOutput() )412 obj.SetThreshold( 10 )413 """414 obj = itkReinitializeLevelSetImageFilterIF2.__New_orig__()415 import itkTemplate416 itkTemplate.New(obj, *args, **kargs)417 return obj418 New = staticmethod(New)419itkReinitializeLevelSetImageFilterIF2.SetLevelSetValue = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetLevelSetValue,None,itkReinitializeLevelSetImageFilterIF2)420itkReinitializeLevelSetImageFilterIF2.GetLevelSetValue = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetLevelSetValue,None,itkReinitializeLevelSetImageFilterIF2)421itkReinitializeLevelSetImageFilterIF2.SetNarrowBanding = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetNarrowBanding,None,itkReinitializeLevelSetImageFilterIF2)422itkReinitializeLevelSetImageFilterIF2.GetNarrowBanding = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetNarrowBanding,None,itkReinitializeLevelSetImageFilterIF2)423itkReinitializeLevelSetImageFilterIF2.NarrowBandingOn = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_NarrowBandingOn,None,itkReinitializeLevelSetImageFilterIF2)424itkReinitializeLevelSetImageFilterIF2.NarrowBandingOff = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_NarrowBandingOff,None,itkReinitializeLevelSetImageFilterIF2)425itkReinitializeLevelSetImageFilterIF2.SetInputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetInputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF2)426itkReinitializeLevelSetImageFilterIF2.GetInputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetInputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF2)427itkReinitializeLevelSetImageFilterIF2.SetOutputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetOutputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF2)428itkReinitializeLevelSetImageFilterIF2.GetOutputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetOutputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF2)429itkReinitializeLevelSetImageFilterIF2.SetNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF2)430itkReinitializeLevelSetImageFilterIF2.SetInputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_SetInputNarrowBand,None,itkReinitializeLevelSetImageFilterIF2)431itkReinitializeLevelSetImageFilterIF2.GetInputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetInputNarrowBand,None,itkReinitializeLevelSetImageFilterIF2)432itkReinitializeLevelSetImageFilterIF2.GetOutputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetOutputNarrowBand,None,itkReinitializeLevelSetImageFilterIF2)433itkReinitializeLevelSetImageFilterIF2.GetPointer = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_GetPointer,None,itkReinitializeLevelSetImageFilterIF2)434itkReinitializeLevelSetImageFilterIF2_swigregister = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_swigregister435itkReinitializeLevelSetImageFilterIF2_swigregister(itkReinitializeLevelSetImageFilterIF2)436def itkReinitializeLevelSetImageFilterIF2___New_orig__():437 """itkReinitializeLevelSetImageFilterIF2___New_orig__()"""438 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2___New_orig__()439def itkReinitializeLevelSetImageFilterIF2_cast(*args):440 """itkReinitializeLevelSetImageFilterIF2_cast(itkLightObject obj) -> itkReinitializeLevelSetImageFilterIF2"""441 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF2_cast(*args)442class itkReinitializeLevelSetImageFilterIF3(itkImageToImageFilterAPython.itkImageToImageFilterIF3IF3):443 """Proxy of C++ itkReinitializeLevelSetImageFilterIF3 class"""444 thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')445 def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")446 __repr__ = _swig_repr447 SetDimension = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetDimension448 LevelSetDoubleAdditiveOperatorsCheck = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_LevelSetDoubleAdditiveOperatorsCheck449 LevelSetOStreamWritableCheck = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_LevelSetOStreamWritableCheck450 def __New_orig__():451 """__New_orig__()"""452 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3___New_orig__()453 __New_orig__ = staticmethod(__New_orig__)454 def SetLevelSetValue(self, *args):455 """SetLevelSetValue(self, double _arg)"""456 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetLevelSetValue(self, *args)457 def GetLevelSetValue(self):458 """GetLevelSetValue(self) -> double"""459 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetLevelSetValue(self)460 def SetNarrowBanding(self, *args):461 """SetNarrowBanding(self, bool _arg)"""462 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetNarrowBanding(self, *args)463 def GetNarrowBanding(self):464 """GetNarrowBanding(self) -> bool"""465 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetNarrowBanding(self)466 def NarrowBandingOn(self):467 """NarrowBandingOn(self)"""468 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_NarrowBandingOn(self)469 def NarrowBandingOff(self):470 """NarrowBandingOff(self)"""471 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_NarrowBandingOff(self)472 def SetInputNarrowBandwidth(self, *args):473 """SetInputNarrowBandwidth(self, double _arg)"""474 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetInputNarrowBandwidth(self, *args)475 def GetInputNarrowBandwidth(self):476 """GetInputNarrowBandwidth(self) -> double"""477 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetInputNarrowBandwidth(self)478 def SetOutputNarrowBandwidth(self, *args):479 """SetOutputNarrowBandwidth(self, double _arg)"""480 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetOutputNarrowBandwidth(self, *args)481 def GetOutputNarrowBandwidth(self):482 """GetOutputNarrowBandwidth(self) -> double"""483 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetOutputNarrowBandwidth(self)484 def SetNarrowBandwidth(self, *args):485 """SetNarrowBandwidth(self, double value)"""486 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetNarrowBandwidth(self, *args)487 def SetInputNarrowBand(self, *args):488 """SetInputNarrowBand(self, itkVectorContainerUILSNF3 ptr)"""489 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetInputNarrowBand(self, *args)490 def GetInputNarrowBand(self):491 """GetInputNarrowBand(self)"""492 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetInputNarrowBand(self)493 def GetOutputNarrowBand(self):494 """GetOutputNarrowBand(self)"""495 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetOutputNarrowBand(self)496 __swig_destroy__ = _itkReinitializeLevelSetImageFilterPython.delete_itkReinitializeLevelSetImageFilterIF3497 def cast(*args):498 """cast(itkLightObject obj) -> itkReinitializeLevelSetImageFilterIF3"""499 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_cast(*args)500 cast = staticmethod(cast)501 def GetPointer(self):502 """GetPointer(self) -> itkReinitializeLevelSetImageFilterIF3"""503 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetPointer(self)504 def New(*args, **kargs):505 """New() -> itkReinitializeLevelSetImageFilterIF3506 507 Create a new object of the class itkReinitializeLevelSetImageFilterIF3 and set the input and the parameters if some508 named or non-named arguments are passed to that method.509 510 New() tries to assign all the non named parameters to the input of the new objects - the511 first non named parameter in the first input, etc.512 513 The named parameters are used by calling the method with the same name prefixed by 'Set'.514 515 Ex:516 517 itkReinitializeLevelSetImageFilterIF3.New( reader, Threshold=10 ) 518 519 is (most of the time) equivalent to:520 521 obj = itkReinitializeLevelSetImageFilterIF3.New()522 obj.SetInput( 0, reader.GetOutput() )523 obj.SetThreshold( 10 )524 """525 obj = itkReinitializeLevelSetImageFilterIF3.__New_orig__()526 import itkTemplate527 itkTemplate.New(obj, *args, **kargs)528 return obj529 New = staticmethod(New)530itkReinitializeLevelSetImageFilterIF3.SetLevelSetValue = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetLevelSetValue,None,itkReinitializeLevelSetImageFilterIF3)531itkReinitializeLevelSetImageFilterIF3.GetLevelSetValue = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetLevelSetValue,None,itkReinitializeLevelSetImageFilterIF3)532itkReinitializeLevelSetImageFilterIF3.SetNarrowBanding = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetNarrowBanding,None,itkReinitializeLevelSetImageFilterIF3)533itkReinitializeLevelSetImageFilterIF3.GetNarrowBanding = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetNarrowBanding,None,itkReinitializeLevelSetImageFilterIF3)534itkReinitializeLevelSetImageFilterIF3.NarrowBandingOn = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_NarrowBandingOn,None,itkReinitializeLevelSetImageFilterIF3)535itkReinitializeLevelSetImageFilterIF3.NarrowBandingOff = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_NarrowBandingOff,None,itkReinitializeLevelSetImageFilterIF3)536itkReinitializeLevelSetImageFilterIF3.SetInputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetInputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF3)537itkReinitializeLevelSetImageFilterIF3.GetInputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetInputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF3)538itkReinitializeLevelSetImageFilterIF3.SetOutputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetOutputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF3)539itkReinitializeLevelSetImageFilterIF3.GetOutputNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetOutputNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF3)540itkReinitializeLevelSetImageFilterIF3.SetNarrowBandwidth = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetNarrowBandwidth,None,itkReinitializeLevelSetImageFilterIF3)541itkReinitializeLevelSetImageFilterIF3.SetInputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_SetInputNarrowBand,None,itkReinitializeLevelSetImageFilterIF3)542itkReinitializeLevelSetImageFilterIF3.GetInputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetInputNarrowBand,None,itkReinitializeLevelSetImageFilterIF3)543itkReinitializeLevelSetImageFilterIF3.GetOutputNarrowBand = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetOutputNarrowBand,None,itkReinitializeLevelSetImageFilterIF3)544itkReinitializeLevelSetImageFilterIF3.GetPointer = new_instancemethod(_itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_GetPointer,None,itkReinitializeLevelSetImageFilterIF3)545itkReinitializeLevelSetImageFilterIF3_swigregister = _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3_swigregister546itkReinitializeLevelSetImageFilterIF3_swigregister(itkReinitializeLevelSetImageFilterIF3)547def itkReinitializeLevelSetImageFilterIF3___New_orig__():548 """itkReinitializeLevelSetImageFilterIF3___New_orig__()"""549 return _itkReinitializeLevelSetImageFilterPython.itkReinitializeLevelSetImageFilterIF3___New_orig__()550def itkReinitializeLevelSetImageFilterIF3_cast(*args):551 """itkReinitializeLevelSetImageFilterIF3_cast(itkLightObject obj) -> itkReinitializeLevelSetImageFilterIF3"""...
LearningRateFunctions.py
Source:LearningRateFunctions.py
...50 self.onIterationEnd,51 self.onEpochEnd,52 alpha_zero)5354 def reinitialize(self):55 return5657 def onEpochEnd(self):58 return5960 def onIterationEnd(self):61 return6263 def updateLearningRate(self):64 return656667class StepDecay(LearningRateFunc):68 """ Multiplies learning rate every `epoch_freq` epochs69 with `decay_rate`.70 Typical values might be reducing the learning rate71 by a half every 5 epochs, or by 0.1 every 20 epochs or72 whenever the validation error stops improving73 multiply by 0.574 """75 # parent attributes:76 # learning_rate7778 # attributes:79 # alpha_zero # initial learning rate80 # decay_rate81 # num_epoch82 # epoch_freq8384 def __init__(self, alpha_zero, epoch_freq, decay_rate):85 super().__init__(self.reinitialize,86 self.onIterationEnd,87 self.onEpochEnd,88 alpha_zero)89 self.alpha_zero = alpha_zero90 self.epoch_freq = epoch_freq91 self.decay_rate = decay_rate92 self.reinitialize()9394 def reinitialize(self):95 self.num_epoch = self.epoch_freq96 self.learning_rate = self.alpha_zero9798 def onEpochEnd(self):99 self.num_epoch -= 1100 if self.num_epoch == 0:101 self.updateLearningRate()102 self.num_epoch = self.epoch_freq103104 def onIterationEnd(self):105 return106107 def updateLearningRate(self):108 """ num_epoch is zero-indexed and when equal to 0109 then learning rate is alpha zero.110 """111 self.learning_rate *= self.decay_rate112113114class OneOverT(LearningRateFunc):115 """ alpha = alpha_zero / (1 + decay_rate * num_iter) """116 # parent attributes:117 # learning_rate118119 # attributes:120 # alpha_zero # initial learning rate121 # decay_rate122 # num_iter123124 def __init__(self, alpha_zero, decay_rate):125 super().__init__(self.reinitialize,126 self.onIterationEnd,127 self.onEpochEnd,128 alpha_zero)129 self.alpha_zero = alpha_zero130 self.decay_rate = decay_rate131 self.reinitialize()132133 def reinitialize(self):134 self.num_iter = 0135 self.learning_rate = self.alpha_zero136137 def onEpochEnd(self):138 return139140 def onIterationEnd(self):141 self.num_iter += 1142 self.updateLearningRate()143144 def updateLearningRate(self):145 """ num_iter is zero-indexed and when equal to 0146 then learning rate is alpha zero.147 """148 self.learning_rate = self.alpha_zero \149 / (1. + self.decay_rate * self.num_iter)150151152class ExponentialDecayNumIter(LearningRateFunc):153 """ alpha = alpha_zero * exp(-decay_rate * iter_idx) """154 # parent attributes:155 # learning_rate156157 # attributes:158 # alpha_zero # initial learning rate159 # decay_rate160 # num_iter161162 def __init__(self, alpha_zero, decay_rate):163 super().__init__(self.reinitialize,164 self.onIterationEnd,165 self.onEpochEnd,166 alpha_zero)167 self.alpha_zero = alpha_zero168 self.decay_rate = decay_rate169 self.reinitialize()170171 def reinitialize(self):172 self.num_iter = 0173 self.learning_rate = self.alpha_zero174175 def onEpochEnd(self):176 return177178 def onIterationEnd(self):179 self.num_iter += 1180 self.updateLearningRate()181182 def updateLearningRate(self):183 """ num_iter is zero-indexed and when equal to 0184 then learning rate is alpha zero.185 """186 self.learning_rate = self.alpha_zero \187 * np.exp(-self.decay_rate * self.num_iter)188189190class ExponentialDecayNumEpochs(LearningRateFunc):191 """ alpha = alpha_zero * exp(-decay_rate * epoch_idx) """192 # parent attributes:193 # learning_rate194195 # attributes:196 # alpha_zero # initial learning rate197 # decay_rate198 # num_epoch199200 def __init__(self, alpha_zero, decay_rate):201 super().__init__(self.reinitialize,202 self.onIterationEnd,203 self.onEpochEnd,204 alpha_zero)205 self.alpha_zero = alpha_zero206 self.decay_rate = decay_rate207 self.reinitialize()208209 def reinitialize(self):210 self.num_epoch = 0211 self.learning_rate = self.alpha_zero212213 def onEpochEnd(self):214 self.num_epoch += 1215 self.updateLearningRate()216217 def onIterationEnd(self):218 return219220 def updateLearningRate(self):221 """ num_epoch is zero-indexed and when equal to 0222 then learning rate is alpha zero.223 """
...
DataBuffer.py
Source:DataBuffer.py
1import numpy as np2from .State import State3from typing import List, Tuple4class DataBuffer:5 """6 Keeps track of <size> latest states7 """8 # This list keeps track of the <size> latest states that the agent has9 # encountered10 buffer: List[State]11 # The number of states we're keeping track of12 size: int13 # Whether to reinitialize the buffer at the next iteration14 reinitialize_next: bool15 def __init__(self, size: int = 1):16 self.buffer = []17 self.size = size18 self.reinitialize_next = True19 def get_input_tensor(self, in_batch: bool = True) -> np.array:20 """21 :param in_batch:22 :return:23 """24 arr = np.array(self.buffer)25 if self.size == 1 or in_batch:26 return arr27 else:28 return arr.reshape((1,) + arr.shape)29 def get_input_shape(self) -> Tuple[int, int]:30 """31 Returns the shape of the buffer as a tuple32 :return: the shape of the buffer33 """34 return self.size, 335 def assign_to_buffer(self, state: State) -> None:36 """37 Adds <state> to the buffer38 :param state: the latest state observed by the agent39 :return: None40 """41 if isinstance(state, State):42 state = state.get_individual_tensor()43 if len(self.buffer) >= self.size:44 self.buffer.pop(0)45 self.buffer.append(state)46 def reinitialize_buffer(self, state: State):47 for _ in range(self.size):48 self.assign_to_buffer(state)49 self.set_reinitialize_next(False)50 def set_reinitialize_next(self, reinitialize: bool):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!