Skip to content

Visualization

kosh edited this page Feb 28, 2022 · 3 revisions

Visualize time series data.

Recurrence Plot

show_recurrence_plot

Create Recurrence Plot (RP) [] from time series data. This function displays the RP.
Find the distance D between two points on the orbit and draw according to the rule. The drawing rule uses the simplest one (simple_threshold).

This can be changed. The rule just takes a matrix and returns the matrix. *params and **kargs are the arguments to the rule.

from hundun.exploration import show_recurrence_plot

Parameters

  • u_seq
  • rule=simple_threshold
  • cmap=False,
  • path_save_plot=None
  • *params
  • **kargs

Returns

  • recurrence_plot: numpy.ndarray

Example

sample 1

Here is the simplest example.

from hundun.equations import Lorenz
from hundun.exploration import show_recurrence_plot

u_seq = Lorenz.get_u_seq(5000)
show_recurrence_plot(u_seq)

img:show_recurrence_plot

sample 2

Shows the function and result when the Rule is changed.

from hundun.equations import Lorenz
from hundun.exploration import show_recurrence_plot
import numpy as np


def new_threshold(ds, func):
    if (d_max:=np.max(ds))!=0:
        pv = func(ds/d_max)*255
        return np.uint8(pv)
    return ds

u_seq = Lorenz.get_u_seq(5000)
show_recurrence_plot(u_seq, cmap=True, rule=new_threshold, func=np.log)

img:show_recurrence_plot2

References

Recurrence Plots of Dynamical Systems

(1987) J.-P Eckmann and S. Oliffson Kamphorst and D Ruelle
DOI: 10.1209/0295-5075/4/9/004

calc_recurrence_plot

Unlike show_recurrence_plot, it returns only RP.

from hundun.exploration import calc_recurrence_plot

Parameters

  • u_seq
  • rule=simple_threshold
  • *params
  • **kargs

Returns

  • recurrence_plot: numpy.ndarray

simple_threshold

dev

When the distance D is above the threshold value theta, it is 255, and when it is less than that, it is 0.
It is implemented as follows.

def simple_threshold(ds, theta=0.5):
    if (d_max:=_np.max(ds))!=0:
        pv = (ds/d_max>theta)*255
        return pv
    return ds
from hundun.exploration import simple_threshold