# What scheme of padding should I choose if my 1D data satisfy the periodical boundary condition under CWT?

If I adopt the periodic padding, can I avoid the edge effects for the periodic signal?

If I adopt the periodic padding, can I avoid the edge effects for the periodic signal?

Not necessarily. If your input length is N, then capturing every frequency from 0 to N//2 without boundary effects can require padding to up to 16*N.

That is the shortest length required for the largest scale wavelets to fully decay:

The top wavelet wraps on itself, which is a form of distortion, and changes convolution values. However, while it's still severe, periodic data indeed suffers the least from a lack of padding.

The minimal ideas with avoiding boundary effects is:

1. Left shall not draw from right
2. Wavelets fully decay
3. (optional) Convolutions are energy-preserving

The advantage with zero padding is requiring the least padding of any padding to avoid boundary effects (unless other padding forms a periodic boundary); here I use a boxcar as wavelet to denote its decay bounds for clarity, and use zero padding for both cases:

The disadvantage is the greatest loss of energy of any padding; easy to see with x16 padding, only 1/16th of the largest wavelet will multiply with non-zero values. There are other pros/cons.

Lastly: not padding an exactly periodic input will spare all boundary effects if and only if the wavelet fully decays. In the general case, I recommend reflect padding: it can also be made periodic, without forming periodic's energy discontinuity for aperiodic inputs: