Comments (4)
Hey @astrolitterbox / Simona,
thank you for reaching out with your problem!
Just for clearity, your input arrays are classical python or numpy arrays right? When you say you have shape (561, 2) arrays, that would mean an array of 561 arrays with length 2, in which the first entry is the timepoint and the second is your measurement. As far as i know, joint recurrence plot would consider your timepoints as part of a 2d data field then.
Therefore i would suggest converting your arrays into two (561, ) arrays, omitting the timepoints, as they are the same for both series. Please try to convert x and y in this way:
x_new = x[ : , 1]
y_new = y[ : , 1]
Then feed them to the method and let me know if that helped.
from pyunicorn.
Hi @zugnachpankow! Thank you so much for your quick response. Indeed, the arrays should have been flipped. I've tried doing that before.
Unfortunately, having 1D Numpy arrays does not change the result:
(150,)
(150,)
Calculating recurrence plot at fixed threshold...
Calculating the supremum distance matrix...
Calculating joint recurrence plot at fixed threshold...
[[1 1]
[1 1]]
Here's a cleaned-up script that produces it: https://gist.github.com/astrolitterbox/54cdbcaf02f15e39d919078332397646
Many thanks for your help!
from pyunicorn.
Another class inheritance problem? @ntfrgl please help:
As described above, for two timeseries of length N
, JointRecurrencePlot
should produce a recurrence matrix of shape (N, N)
, but will end up with a matrix of shape (2, 2)
irrespective of the input timeseries (see minimal example below).
In the example case, the recurrence matrix is calculated in JointRecurrencePlot.set_fixed_threshold()
, which will call RecurrencePlot.distance_matrix()
, which will call RecurrencePlot.supremum_distance_matrix()
.
The latter is fine, as with jrp = JointRecurrencePlot()
, manually calling RecurrencePlot.supremum_distance_matrix(jrp)
will produce a correctly shaped (50,50)
-matrix.
Instead, manually calling RecurrencePlot.distance_matrix(jrp, jrp.x_embedded, metric="supremum")
will produce a (2,2)
shaped matrix (see below). Why?
Is there a problem with initialising a RecurrencePlot
from an empty array in JointRecurrencePlot.__init__()
maybe?
minimal example:
from pyunicorn.timeseries import JointRecurrencePlot
from pyunicorn.funcnet import CouplingAnalysis
# test timeseries of length N = 50
ts = CouplingAnalysis.test_data()[:50,0]
# create JointRecurrencePlot
jrp = JointRecurrencePlot(ts, ts, threshold=(.1,.1))
# compare input and output shapes
print(f"Timeseries shape: {ts.shape}")
print(f"Recurrence Matrix shape: {jrp.recurrence_matrix().shape} <-- this is not right!\n")
# directly call parent class methods for comparison
print(f"the matrix calculation itself is ok:\
{RecurrencePlot.supremum_distance_matrix(jrp, jrp.x_embedded).shape}")
print(f"but its not retrieved correctly: \
{RecurrencePlot.distance_matrix(jrp, jrp.x_embedded, metric='supremum').shape}")
output:
Calculating recurrence plot at fixed threshold...
Calculating the supremum distance matrix...
Calculating joint recurrence plot at fixed threshold...
Timeseries shape: (50,)
Recurrence Matrix shape: (2, 2) <-- this is not right!
Calculating the supremum distance matrix...
the matrix calculation itself is ok: (50, 50)
but its not retrieved correctly: (2, 2)
from pyunicorn.
@ntfrgl, thanks for fixing and for providing a test that sets a good example!
from pyunicorn.
Related Issues (20)
- LINT: few remaining refactor and warning flags to be resolved HOT 2
- Tests failing with `Unable to lock file`
- pip install pyunicorn error:error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 HOT 1
- LINT: disabled `pylint` flags should be re-enabled where possible, or disabled locally HOT 5
- Replace: `progressbar` -> `tqdm`
- MAINT: add `cython-lint` to test suite
- MAINT: review funcionality and use of `CouplingAnalysis.get_nearest_neighbors()` and add a specific test
- ENH: Theiler window option for diagonal RQA measures in `RecurrencePlot` HOT 2
- CI: set up Travis CI for macOS and Windows builds
- MAINT: drop `climate.MapPlots` in favour of `climate.CartopyPlots` HOT 2
- ENH: Remove old examples folder
- `Network.nsi_local_clustering()` might encounter divide by zero when `typical_weight` is given HOT 1
- module 'numpy' has no attribute 'int' HOT 1
- Failed building wheel for pyunicorn while installing HOT 4
- Printing `ClimateData` object throws `KeyError` from `h5netcdf` HOT 2
- Add `typical_weight` argument for all n.s.i. measures to enable their "corrected" versions
- numpy module not found during installation (Win10) HOT 1
- DOC: Add EventSeriesClimateNetwork to API documentation HOT 1
- ModuleNotFoundError from pip install (version 0.6.1) HOT 2
- Complete implementation of new caching system, and extend
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyunicorn.