-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from xdas-dev/dev
Version 0.2.1
- Loading branch information
Showing
22 changed files
with
629 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,7 @@ | |
:toctree: ../_autosummary | ||
fft | ||
ifft | ||
rfft | ||
irfft | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import numpy as np | ||
|
||
import xdas as xd | ||
import xdas.fft as xfft | ||
|
||
|
||
class TestRFFT: | ||
def test_with_non_dimensional(self): | ||
da = xd.synthetics.wavelet_wavefronts() | ||
da["latitude"] = ("distance", np.arange(da.sizes["distance"])) | ||
xfft.rfft(da) | ||
|
||
|
||
class TestInverseTransforms: | ||
def test_standard(self): | ||
expected = xd.synthetics.wavelet_wavefronts() | ||
result = xfft.ifft( | ||
xfft.fft(expected, dim={"time": "frequency"}), | ||
dim={"frequency": "time"}, | ||
) | ||
assert np.allclose(np.real(result).values, expected.values) | ||
assert np.allclose(np.imag(result).values, 0) | ||
for name in result.coords: | ||
if name == "time": | ||
ref = expected["time"].values | ||
ref = (ref - ref[0]) / np.timedelta64(1, "s") | ||
ref += result["time"][0].values | ||
assert np.allclose(result["time"].values, ref) | ||
else: | ||
assert result[name].equals(expected[name]) | ||
|
||
def test_real(self): | ||
expected = xd.synthetics.wavelet_wavefronts() | ||
result = xfft.irfft( | ||
xfft.rfft(expected, dim={"time": "frequency"}), | ||
expected.sizes["time"], | ||
dim={"frequency": "time"}, | ||
) | ||
assert np.allclose(result.values, expected.values) | ||
for name in result.coords: | ||
if name == "time": | ||
ref = expected["time"].values | ||
ref = (ref - ref[0]) / np.timedelta64(1, "s") | ||
ref += result["time"][0].values | ||
assert np.allclose(result["time"].values, ref) | ||
else: | ||
assert result[name].equals(expected[name]) |
Oops, something went wrong.