MCPcopy Create free account
hub / github.com/PyWavelets/pywt / walk

Method walk

pywt/_wavelet_packets.py:358–383  ·  view source on GitHub ↗

Traverses the decomposition tree and calls ``func(node, *args, **kwargs)`` on every node. If `func` returns True, descending to subnodes will continue. Parameters ---------- func : callable Callable accepting `BaseNode` as the first param

(self, func, args=(), kwargs=None, decompose=True)

Source from the content-addressed store, hash-verified

356 return result
357
358 def walk(self, func, args=(), kwargs=None, decompose=True):
359 """
360 Traverses the decomposition tree and calls
361 ``func(node, *args, **kwargs)`` on every node. If `func` returns True,
362 descending to subnodes will continue.
363
364 Parameters
365 ----------
366 func : callable
367 Callable accepting `BaseNode` as the first param and
368 optional positional and keyword arguments
369 args :
370 func params
371 kwargs :
372 func keyword params
373 decompose : bool, optional
374 If True (default), the method will also try to decompose the tree
375 up to the `maximum level <BaseNode.maxlevel>`.
376 """
377 if kwargs is None:
378 kwargs = {}
379 if func(self, *args, **kwargs) and self.level < self.maxlevel:
380 for part in self.PARTS:
381 subnode = self.get_subnode(part, decompose)
382 if subnode is not None:
383 subnode.walk(func, args, kwargs, decompose)
384
385 def walk_depth(self, func, args=(), kwargs=None, decompose=True):
386 """

Callers 4

get_leaf_nodesMethod · 0.95
get_levelMethod · 0.80
get_levelMethod · 0.80
get_levelMethod · 0.80

Calls 1

get_subnodeMethod · 0.95

Tested by

no test coverage detected