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

Method _reconstruct

pywt/_wavelet_packets.py:512–542  ·  view source on GitHub ↗
(self, update)

Source from the content-addressed store, hash-verified

510 self._get_node(self.LH), self._get_node(self.HH))
511
512 def _reconstruct(self, update):
513 data_ll, data_lh, data_hl, data_hh = None, None, None, None
514
515 node_ll, node_lh, node_hl, node_hh =\
516 self._get_node(self.LL), self._get_node(self.LH),\
517 self._get_node(self.HL), self._get_node(self.HH)
518
519 if node_ll is not None:
520 data_ll = node_ll.reconstruct()
521 if node_lh is not None:
522 data_lh = node_lh.reconstruct()
523 if node_hl is not None:
524 data_hl = node_hl.reconstruct()
525 if node_hh is not None:
526 data_hh = node_hh.reconstruct()
527
528 if (data_ll is None and data_lh is None and
529 data_hl is None and data_hh is None):
530 raise ValueError(
531 "Tree is missing data - all subnodes of `%s` node "
532 "are None. Cannot reconstruct node." % self.path
533 )
534 else:
535 coeffs = data_ll, (data_hl, data_lh, data_hh)
536 rec = idwt2(coeffs, self.wavelet, self.mode, axes=self.axes)
537 if self._data_shape is not None and (
538 rec.shape != self._data_shape):
539 rec = rec[tuple([slice(sz) for sz in self._data_shape])]
540 if update:
541 self.data = rec
542 return rec
543
544 def expand_2d_path(self, path):
545 expanded_paths = {

Callers

nothing calls this directly

Calls 3

idwt2Function · 0.85
_get_nodeMethod · 0.45
reconstructMethod · 0.45

Tested by

no test coverage detected