def _validate_type_dwtsub(self, x): # check size if self.__validate_enums(x, WaveletSubband): return True elif not isdict(x) or len(x) != 3: return False elif not contains(x, "values", "min-length", "max-length"): return False elif not self.__validate_enums(x["values"], WaveletSubband): return False return True
def __validate_type_range(self, x, test_fn=None): # check size if not isdict(x) or len(x) > 3: return False elif not contains(x, "start", "stop"): return False elif len(x) == 3 and "step" not in x: return False elif test_fn and not all(map(test_fn, x.values())): return False return True
def _normalize_coerce_dwtsub(self, x): if isdict(x) and contains(x, "values", "min-length", "max-length"): combs = [] values, min_len, max_len = x["values"], x["min-length"], x[ "max-length"] values = list(map(WaveletSubband, values)) for i in range(min_len, max_len + 1): combs.extend(combinations(values, i)) return combs values = self._normalize_coerce_aslist(x) return [[WaveletSubband(v)] for v in values]
def _normalize_coerce_asrange(self, x): if isdict(x) and contains(x, "start", "stop"): return np.arange(**x) return self._normalize_coerce_aslist(x)
def __validate_enums(self, x, enum): values = enum_values(enum) if isarray(x): return contains(values, *x) return x in values