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

Function _fix_coeffs

pywt/_multidim.py:193–216  ·  view source on GitHub ↗
(coeffs)

Source from the content-addressed store, hash-verified

191
192
193def _fix_coeffs(coeffs):
194 missing_keys = [k for k, v in coeffs.items() if v is None]
195 if missing_keys:
196 raise ValueError(
197 "The following detail coefficients were set to None:\n"
198 f"{missing_keys}\n"
199 "For multilevel transforms, rather than setting\n"
200 "\tcoeffs[key] = None\n"
201 "use\n"
202 "\tcoeffs[key] = np.zeros_like(coeffs[key])\n")
203
204 invalid_keys = [k for k, v in coeffs.items() if
205 not set(k) <= set('ad')]
206 if invalid_keys:
207 raise ValueError(
208 "The following invalid keys were found in the detail "
209 f"coefficient dictionary: {invalid_keys}.")
210
211 key_lengths = [len(k) for k in coeffs]
212 if len(np.unique(key_lengths)) > 1:
213 raise ValueError(
214 "All detail coefficient names must have equal length.")
215
216 return {k: np.asarray(v) for k, v in coeffs.items()}
217
218
219def idwtn(coeffs, wavelet, mode='symmetric', axes=None):

Callers 1

idwtnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected