-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #173.
- Loading branch information
Showing
3 changed files
with
47 additions
and
1 deletion.
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
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,37 @@ | ||
# This file is part of pyunicorn. | ||
# Copyright (C) 2008--2023 Jonathan F. Donges and pyunicorn authors | ||
# URL: <http://www.pik-potsdam.de/members/donges/software> | ||
# License: BSD (3-clause) | ||
# | ||
# Please acknowledge and cite the use of this software and its authors | ||
# when results are used in publications or published elsewhere. | ||
# | ||
# You can use the following reference: | ||
# J.F. Donges, J. Heitzig, B. Beronov, M. Wiedermann, J. Runge, Q.-Y. Feng, | ||
# L. Tupikina, V. Stolbova, R.V. Donner, N. Marwan, H.A. Dijkstra, | ||
# and J. Kurths, "Unified functional network and nonlinear time series analysis | ||
# for complex systems science: The pyunicorn package" | ||
|
||
""" | ||
Simple tests for the JointRecurrencePlot class. | ||
""" | ||
|
||
import numpy as np | ||
|
||
import pytest | ||
|
||
from pyunicorn.timeseries import JointRecurrencePlot | ||
from pyunicorn.funcnet import CouplingAnalysis | ||
|
||
|
||
@pytest.mark.parametrize("met", ["supremum", "euclidean", "manhattan"]) | ||
@pytest.mark.parametrize("n", [2, 10, 50]) | ||
def test_recurrence(met: str, n: int): | ||
ts = CouplingAnalysis.test_data()[:n, 0] | ||
jrp = JointRecurrencePlot(ts, ts, threshold=(.1, .1), metric=(met, met)) | ||
dist = { | ||
i: jrp.distance_matrix(getattr(jrp, f"{i}_embedded"), metric=met) | ||
for i in "xy"} | ||
assert all(d.shape == (n, n) for d in dist.values()) | ||
assert np.allclose(*dist.values()) | ||
assert jrp.recurrence_matrix().shape == (n, n) |