core.rqa_res.RQARes

core.rqa_res.RQARes(
    time,
    value,
    time_name=None,
    time_unit=None,
    value_name=None,
    value_unit=None,
    series=None,
    label=None,
    m=None,
    tau=None,
    eps=None,
    eigenmap=None,
    w_size=None,
    w_incre=None,
)

Class for storing the result of various RQA techniques

Methods

Name Description
confidence_fill_plot Function for plotting rqa results with confidence bounds
confidence_smooth_plot Function for plotting rqa results with confidence bounds
lerm_transitions Detect transitions using LERM Fisher Information threshold crossings
plot_eigenmaps Plot Laplacian eigenmaps coloured by time group
plot_eigenmaps_FI Plot Laplacian eigenmaps as a function of Fisher Information in 3D
smooth Function to perform block smoothing on your RQA result

confidence_fill_plot

core.rqa_res.RQARes.confidence_fill_plot(
    ax=None,
    line_color=None,
    fill_color=None,
    fill_alpha=None,
    transition_interval=None,
    xlabel=None,
    ylabel=None,
    marker=None,
    markersize=None,
    linestyle=None,
    linewidth=None,
    alpha=None,
    label=None,
    title=None,
    zorder=None,
    plot_kwargs=None,
    ci_kwargs=None,
    background_series=None,
    background_kwargs=None,
    legend=True,
    lgd_kwargs=None,
)

Function for plotting rqa results with confidence bounds

Parameters

ax : matplotlib.axes object = None

Axes to plot on, if None new plot will be generated

line_color : (str, tuple) = None

String or rgb tuple to use for line color

fill_color : (str, tuple) = None

String or rgb tuple to use for fill color in between lines

fill_alpha : float = None

Transparency of the fill, default is .1

transition_interval : (list, tuple) = None

Upper and lower bound for the transition interval

marker : str = None

e.g., ‘o’ for dots See matplotlib.markers <https://matplotlib.org/stable/api/markers_api.html>_ for details

markersize : float = None

the size of the marker

linestyle : str = None

e.g., ‘–’ for dashed line See matplotlib.linestyles <https://matplotlib.org/stable/gallery/lines_bars_and_markers/linestyles.html>_ for details

linewidth : float = None

the width of the line

alpha : float = None

Transparency of the line

label : str = None

the label for the line

xlabel : str = None

the label for the x-axis

ylabel : str = None

the label for the y-axis

title : str = None

the title for the figure

zorder : int = None

The default drawing order for all lines on the plot

plot_kwargs : dict = None

Key word arguments for the main plot, see `pyleoclim.Series.plot https://pyleoclim-util.readthedocs.io/en/latest/core/api.html#series-pyleoclim-series_ for details

ci_kwargs : dict = None

Key word arguments for calculating the confidence interval. Only to be used if transition_interval is not passed. See ammonyte.utils.sampling.confidence_interval for details

background_series : pyleoclim.Series = None

Optional to pass a different series that will be plotted behind the main series plot

background_kwargs : dict = None

Key word arguments for the background plot. If none are passed, the color of the main plot will be re-used and alpha will be set to .2

legend : bool; {True,False} = True

Whether or not to plot the legend

lgd_kwargs : dict = None

Returns

fig : matplotlib.figure

The figure object from matplotlib. See matplotlib.pyplot.figure <https://matplotlib.org/stable/api/figure_api.html>_ for details.

ax : matplotlib.axis

The axis object from matplotlib. See matplotlib.axes <https://matplotlib.org/stable/api/axes_api.html>_ for details.

See Also

ammonyte.utils.sampling.confidence_interval

confidence_smooth_plot

core.rqa_res.RQARes.confidence_smooth_plot(
    block_size,
    figsize=(12, 8),
    ax=None,
    transition_interval=None,
    color=None,
    label=None,
    xlabel=None,
    ylabel=None,
    title=None,
    ci_kwargs=None,
    background_series=None,
    background_kwargs=None,
    hline_kwargs=None,
    ci_plot_kwargs=None,
    legend=True,
    lgd_kwargs=None,
)

Function for plotting rqa results with confidence bounds

Parameters

block_size : int

Size of smoothing block to use.

figsize : tuple = (12, 8)

Size of the figure. Default is (12, 8).

ax : matplotlib.axes.Axes = None

Axes to plot on. If None, a new figure will be generated.

transition_interval : (list, tuple) = None

Upper and lower bound for the transition interval

color : (str, tuple) = None

String or rgb tuple to use for marker color

label : str = None

the label for the Fisher Information

xlabel : str = None

the label for the x-axis

ylabel : str = None

the label for the y-axis

title : str = None

the title for the figure

background_series : pyleoclim.Series = None

Optional to pass a different series that will be plotted behind the main series plot

background_kwargs : dict = None

Key word arguments for the background plot. If none are passed, the color of the main plot will be re-used and alpha will be set to .2

hline_kwargs : dict = None

Key word arguments for the Fisher Information statistic plot. Passed to matplotlib.axes.Axes.hlines.

ci_plot_kwargs : dict = None

Key word arguments for the confidence interval plot. Passed to matplotlib.axes.Axes.fill_between.

legend : bool; {True,False} = True

Whether or not to plot the legend

lgd_kwargs : dict = None

Key word arguments for the legend. Passed to matplotlib.axes.Axes.legend.

Returns

fig : matplotlib.figure

The figure object from matplotlib. See matplotlib.pyplot.figure <https://matplotlib.org/stable/api/figure_api.html>_ for details.

ax : matplotlib.axis

The axis object from matplotlib. See matplotlib.axes <https://matplotlib.org/stable/api/axes_api.html>_ for details.

See Also

ammonyte.utils.sampling.confidence_interval

matplotlib.axes.Axes.hlines

matplotlib.axes.Axes.fill_between

lerm_transitions

core.rqa_res.RQARes.lerm_transitions(
    transition_interval=None,
    upper=95,
    lower=5,
    w=50,
    n_samples=10000,
)

Detect transitions using LERM Fisher Information threshold crossings

This method should be applied to a Fisher Information series (RQARes object) obtained from LERM analysis, typically after smoothing.

Parameters

transition_interval : tuple = None

(upper_bound, lower_bound) for detecting transitions. If None, automatically computes via bootstrapping.

upper : int = 95

Upper percentile for confidence interval. Default is 95 Only used if transition_interval is None.

lower : int = 5

Lower percentile for confidence interval. Default is 5 Only used if transition_interval is None.

w : int = 50

Bootstrap sample size. Default is 50

n_samples : int = 10000

Number of bootstrap samples. Default is 10000

Returns

: DeterministicTransitions

Object containing detected transitions with plotting methods

Examples

Complete LERM workflow:

.. jupyter-execute::

import os, ammonyte as amt

# Load data
ngrip = amt.Series.from_csv(os.path.join(os.path.dirname(amt.__file__), 'data', 'NGRIP.csv'))

# LERM analysis
NGRIP_td = amt.TimeEmbeddedSeries(ngrip, m=11)
NGRIP_epsilon = NGRIP_td.find_epsilon(eps=1, target_density=0.05)
NGRIP_rm = NGRIP_epsilon['Output']
NGRIP_lp = NGRIP_rm.laplacian_eigenmaps(w_size=20, w_incre=4)
NGRIP_lp_smooth = amt.utils.fisher.smooth_series(NGRIP_lp, block_size=3)

# Detect transitions
transitions = NGRIP_lp_smooth.lerm_transitions()
print(transitions)
transitions.plot()

Custom confidence bounds:

.. jupyter-execute::

transitions = NGRIP_lp_smooth.lerm_transitions(
    transition_interval=(0.025, 0.010)
)

plot_eigenmaps

core.rqa_res.RQARes.plot_eigenmaps(
    groups,
    axes,
    figsize=(12, 12),
    cmap='viridis',
    cmap_kwargs=None,
    ax=None,
    title=None,
)

Plot Laplacian eigenmaps coloured by time group

Displays a 2D scatter plot of two eigenvector axes from the Laplacian eigenmaps, colour-coded by the time groups provided. Useful for visually identifying distinct dynamical regimes or state-space structures in the data.

Only works when the RQARes has been created via RecurrenceMatrix.laplacian_eigenmaps.

Parameters

groups : list of list or tuple; (start, stop)

List of (start, stop) time pairs defining the groups for colour coding. Should be ordered in time.

axes : list or tuple

Indices of the eigenvector axes to plot. Must be of length 2.

figsize : list or tuple = (12, 12)

Size of the figure. Default is (12, 12).

cmap : str or list = 'viridis'

Colour map for coding groups by time. Either the name of a matplotlib colour map or a list of colours. Default is ‘viridis’.

cmap_kwargs : dict = None

Keyword arguments passed to ax.figure.colorbar.

ax : matplotlib.axes.Axes = None

Axes object to plot on. If None, a new figure is created.

title : str = None

Title for the plot. If None, auto-generated from the object label.

Returns

fig : matplotlib.figure.Figure

The figure object from matplotlib. See matplotlib.pyplot.figure <https://matplotlib.org/stable/api/figure_api.html>_ for details.

ax : matplotlib.axes.Axes

The axis object from matplotlib. See matplotlib.axes <https://matplotlib.org/stable/api/axes_api.html>_ for details.

See Also

ammonyte.RecurrenceMatrix.laplacian_eigenmaps

plot_eigenmaps_FI

core.rqa_res.RQARes.plot_eigenmaps_FI(
    groups,
    axes,
    block_smooth=True,
    cmap='viridis',
    cmap_kwargs=None,
    figsize=(18, 12),
    ax=None,
    FI_axis_lims=None,
    scale=(1, 1, 1),
    title=None,
)

Plot Laplacian eigenmaps as a function of Fisher Information in 3D

Displays a 3D scatter plot with Fisher Information on one axis and two eigenvector axes on the others, colour-coded by the time groups provided. Useful for inspecting how dynamical regimes relate to Fisher Information values.

Only works when the RQARes has been created via RecurrenceMatrix.laplacian_eigenmaps.

Parameters

groups : list of list or tuple; (start, stop)

List of (start, stop) time pairs used for block smoothing and colour coding.

axes : list or tuple

Indices of the eigenvector axes to plot against Fisher Information. Must be of length 2.

block_smooth : bool; {True,False} = True

Whether to calculate and display the block mean of Fisher Information. Default is True.

cmap : str or list = 'viridis'

Colour map for coding groups by time. Either the name of a matplotlib colour map or a list of colours. Default is ‘viridis’.

cmap_kwargs : dict = None

Keyword arguments passed to ax.figure.colorbar.

figsize : list or tuple = (18, 12)

Size of the figure. Default is (18, 12).

ax : matplotlib.axes.Axes = None

Axes object to plot on. Must use projection=‘3d’ if passed. If None, a new 3D figure is created.

FI_axis_lims : list or tuple = None

(min, max) boundaries for the Fisher Information axis.

scale : tuple = (1, 1, 1)

(x, y, z) scaling factors to stretch or compress the 3D axes independently. Default is (1, 1, 1).

title : str = None

Title for the plot.

Returns

fig : matplotlib.figure.Figure

The figure object from matplotlib. See matplotlib.pyplot.figure <https://matplotlib.org/stable/api/figure_api.html>_ for details.

ax : matplotlib.axes.Axes

The axis object from matplotlib. See matplotlib.axes <https://matplotlib.org/stable/api/axes_api.html>_ for details.

See Also

ammonyte.RecurrenceMatrix.laplacian_eigenmaps

ammonyte.RQARes.plot_eigenmaps

smooth

core.rqa_res.RQARes.smooth(block_size)

Function to perform block smoothing on your RQA result

Parameters

block_size : int

Number of points to include in each block

Returns

smoothed_series : ammonyte.RQARes

Smoothed version of your original RQARes object

See Also

ammonyte.utils.fisher.smooth_series