Skip to content

Commit

Permalink
Normalization for 1D
Browse files Browse the repository at this point in the history
  • Loading branch information
Takaya Uchida authored and Takaya Uchida committed Aug 28, 2023
1 parent c2546f7 commit 929504a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions xwavelet/wavelet.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def cwvlt(
dimensions will be transformed. If the inputs are dask arrays, the
arrays must not be chunked along these dimensions.
t0 : float
Length scale.
Time scale.
a : float
Amplitude of wavelet.
wtype : str
Expand Down Expand Up @@ -440,7 +440,10 @@ def wvlt_power_spectrum(
else:
C = 1.0

return np.abs(dawt) ** 2 * (dawt[s.dims[0]]) ** -1 * x0**2 / C
if len(dim) == 1:
return np.abs(dawt) ** 2 * x0 / C
elif len(dim) == 2:
return np.abs(dawt) ** 2 * (dawt[s.dims[0]]) ** -1 * x0**2 / C


def wvlt_cross_spectrum(
Expand Down Expand Up @@ -575,4 +578,7 @@ def wvlt_cross_spectrum(
else:
C = 1.0

return (dawt * np.conj(dawt1)).real * (dawt[s.dims[0]]) ** -1 * x0**2 / C
if len(dim) == 1:
return (dawt * np.conj(dawt1)).real * x0 / C
elif len(dim) == 2:
return (dawt * np.conj(dawt1)).real * (dawt[s.dims[0]]) ** -1 * x0**2 / C

0 comments on commit 929504a

Please sign in to comment.