17
17
from ._util import (
18
18
Wavelet ,
19
19
_as_wavelet ,
20
+ _deprecated_alias ,
20
21
_is_boundary_mode_supported ,
21
22
_is_dtype_supported ,
22
23
_unfold_axes ,
@@ -182,12 +183,13 @@ class MatrixWavedec(BaseMatrixWaveDec):
182
183
>>> coefficients = matrix_wavedec(data_torch)
183
184
"""
184
185
186
+ @_deprecated_alias (boundary = "boundary_orthogonalization" )
185
187
def __init__ (
186
188
self ,
187
189
wavelet : Union [Wavelet , str ],
188
190
level : Optional [int ] = None ,
189
191
axis : Optional [int ] = - 1 ,
190
- boundary : OrthogonalizeMethod = "qr" ,
192
+ boundary_orthogonalization : OrthogonalizeMethod = "qr" ,
191
193
odd_coeff_padding_mode : BoundaryMode = "zero" ,
192
194
) -> None :
193
195
"""Create a sparse matrix fast wavelet transform object.
@@ -202,8 +204,9 @@ def __init__(
202
204
None.
203
205
axis (int, optional): The axis we would like to transform.
204
206
Defaults to -1.
205
- boundary : The method used for boundary filter treatment,
206
- see :data:`ptwt.constants.OrthogonalizeMethod`. Defaults to 'qr'.
207
+ boundary_orthogonalization: The method used to orthogonalize
208
+ boundary filters, see :data:`ptwt.constants.OrthogonalizeMethod`.
209
+ Defaults to 'qr'.
207
210
odd_coeff_padding_mode: The constructed FWT matrices require inputs
208
211
with even lengths. Thus, any odd-length approximation coefficients
209
212
are padded to an even length using this mode,
@@ -217,8 +220,8 @@ def __init__(
217
220
"""
218
221
self .wavelet = _as_wavelet (wavelet )
219
222
self .level = level
220
- self .boundary = boundary
221
223
self .odd_coeff_padding_mode = odd_coeff_padding_mode
224
+ self .boundary_orthogonalization = boundary_orthogonalization
222
225
223
226
if isinstance (axis , int ):
224
227
self .axis = axis
@@ -231,7 +234,7 @@ def __init__(
231
234
self .padded = False
232
235
self .size_list : list [int ] = []
233
236
234
- if not _is_boundary_mode_supported (self .boundary ):
237
+ if not _is_boundary_mode_supported (self .boundary_orthogonalization ):
235
238
raise NotImplementedError
236
239
237
240
if self .wavelet .dec_len != self .wavelet .rec_len :
@@ -311,7 +314,7 @@ def _construct_analysis_matrices(
311
314
an = construct_boundary_a (
312
315
self .wavelet ,
313
316
curr_length ,
314
- boundary = self .boundary ,
317
+ boundary_orthogonalization = self .boundary_orthogonalization ,
315
318
device = device ,
316
319
dtype = dtype ,
317
320
)
@@ -402,11 +405,12 @@ def __call__(self, input_signal: torch.Tensor) -> list[torch.Tensor]:
402
405
return result_list
403
406
404
407
408
+ @_deprecated_alias (boundary = "boundary_orthogonalization" )
405
409
def construct_boundary_a (
406
410
wavelet : Union [Wavelet , str ],
407
411
length : int ,
408
412
device : Union [torch .device , str ] = "cpu" ,
409
- boundary : OrthogonalizeMethod = "qr" ,
413
+ boundary_orthogonalization : OrthogonalizeMethod = "qr" ,
410
414
dtype : torch .dtype = torch .float64 ,
411
415
) -> torch .Tensor :
412
416
"""Construct a boundary-wavelet filter 1d-analysis matrix.
@@ -415,8 +419,9 @@ def construct_boundary_a(
415
419
wavelet (Wavelet or str): A pywt wavelet compatible object or
416
420
the name of a pywt wavelet.
417
421
length (int): The number of entries in the input signal.
418
- boundary : The method used for boundary filter treatment,
419
- see :data:`ptwt.constants.OrthogonalizeMethod`. Defaults to 'qr'.
422
+ boundary_orthogonalization: The method used to orthogonalize
423
+ boundary filters, see :data:`ptwt.constants.OrthogonalizeMethod`.
424
+ Defaults to 'qr'.
420
425
device: Where to place the matrix. Choose cpu or cuda.
421
426
Defaults to cpu.
422
427
dtype: Choose float32 or float64.
@@ -426,15 +431,16 @@ def construct_boundary_a(
426
431
"""
427
432
wavelet = _as_wavelet (wavelet )
428
433
a_full = _construct_a (wavelet , length , dtype = dtype , device = device )
429
- a_orth = orthogonalize (a_full , wavelet .dec_len , method = boundary )
434
+ a_orth = orthogonalize (a_full , wavelet .dec_len , method = boundary_orthogonalization )
430
435
return a_orth
431
436
432
437
438
+ @_deprecated_alias (boundary = "boundary_orthogonalization" )
433
439
def construct_boundary_s (
434
440
wavelet : Union [Wavelet , str ],
435
441
length : int ,
436
442
device : Union [torch .device , str ] = "cpu" ,
437
- boundary : OrthogonalizeMethod = "qr" ,
443
+ boundary_orthogonalization : OrthogonalizeMethod = "qr" ,
438
444
dtype : torch .dtype = torch .float64 ,
439
445
) -> torch .Tensor :
440
446
"""Construct a boundary-wavelet filter 1d-synthesis matarix.
@@ -445,8 +451,9 @@ def construct_boundary_s(
445
451
length (int): The number of entries in the input signal.
446
452
device (torch.device): Where to place the matrix.
447
453
Choose cpu or cuda. Defaults to cpu.
448
- boundary : The method used for boundary filter treatment,
449
- see :data:`ptwt.constants.OrthogonalizeMethod`. Defaults to 'qr'.
454
+ boundary_orthogonalization: The method used to orthogonalize
455
+ boundary filters, see :data:`ptwt.constants.OrthogonalizeMethod`.
456
+ Defaults to 'qr'.
450
457
dtype: Choose torch.float32 or torch.float64.
451
458
Defaults to torch.float64.
452
459
@@ -455,7 +462,9 @@ def construct_boundary_s(
455
462
"""
456
463
wavelet = _as_wavelet (wavelet )
457
464
s_full = _construct_s (wavelet , length , dtype = dtype , device = device )
458
- s_orth = orthogonalize (s_full .transpose (1 , 0 ), wavelet .rec_len , method = boundary )
465
+ s_orth = orthogonalize (
466
+ s_full .transpose (1 , 0 ), wavelet .rec_len , method = boundary_orthogonalization
467
+ )
459
468
return s_orth .transpose (1 , 0 )
460
469
461
470
@@ -476,11 +485,12 @@ class MatrixWaverec(object):
476
485
>>> reconstruction = matrix_waverec(coefficients)
477
486
"""
478
487
488
+ @_deprecated_alias (boundary = "boundary_orthogonalization" )
479
489
def __init__ (
480
490
self ,
481
491
wavelet : Union [Wavelet , str ],
482
492
axis : int = - 1 ,
483
- boundary : OrthogonalizeMethod = "qr" ,
493
+ boundary_orthogonalization : OrthogonalizeMethod = "qr" ,
484
494
) -> None :
485
495
"""Create the inverse matrix-based fast wavelet transformation.
486
496
@@ -491,16 +501,17 @@ def __init__(
491
501
for possible choices.
492
502
axis (int): The axis transformed by the original decomposition
493
503
defaults to -1 or the last axis.
494
- boundary : The method used for boundary filter treatment,
495
- see :data:`ptwt.constants.OrthogonalizeMethod`. Defaults to 'qr'.
504
+ boundary_orthogonalization: The method used to orthogonalize
505
+ boundary filters, see :data:`ptwt.constants.OrthogonalizeMethod`.
506
+ Defaults to 'qr'.
496
507
497
508
Raises:
498
509
NotImplementedError: If the selected `boundary` mode is not supported.
499
510
ValueError: If the wavelet filters have different lengths or if
500
511
axis is not an integer.
501
512
"""
502
513
self .wavelet = _as_wavelet (wavelet )
503
- self .boundary = boundary
514
+ self .boundary_orthogonalization = boundary_orthogonalization
504
515
if isinstance (axis , int ):
505
516
self .axis = axis
506
517
else :
@@ -511,7 +522,7 @@ def __init__(
511
522
self .input_length : Optional [int ] = None
512
523
self .padded = False
513
524
514
- if not _is_boundary_mode_supported (self .boundary ):
525
+ if not _is_boundary_mode_supported (self .boundary_orthogonalization ):
515
526
raise NotImplementedError
516
527
517
528
if self .wavelet .dec_len != self .wavelet .rec_len :
@@ -591,7 +602,7 @@ def _construct_synthesis_matrices(
591
602
sn = construct_boundary_s (
592
603
self .wavelet ,
593
604
curr_length ,
594
- boundary = self .boundary ,
605
+ boundary_orthogonalization = self .boundary_orthogonalization ,
595
606
device = device ,
596
607
dtype = dtype ,
597
608
)
0 commit comments