goofi v3.0.0

DetrendedFluctuation

DFA exponent: how far a signal remembers its own past.

Explore this node in the cookbook →

DetrendedFluctuation py
data
exponent
Type name
signal:DetrendedFluctuation
Plane
signal
Tags
analysis
Language
python
Tier
in-process
Bundle
complexity
Source
node-bundles/complexity/detrended_fluctuation.py
Availability
available

Slots

SlotDirectionType
datainputARRAY
exponentoutputARRAY

Parameters

This node declares no parameters of its own.

Source

The current source of this node, as it stands in the goofi repository at node-bundles/complexity/detrended_fluctuation.py.

node-bundles/complexity/detrended_fluctuation.py
"""DetrendedFluctuation — the DFA exponent, from antropy.

Says how a signal's fluctuation grows with the window it is measured over: near 0.5 is noise with
no memory, near 1.0 is long-range correlated, above 1.5 is a random walk. The last axis is time and
is consumed; every axis before it survives.
"""

import antropy
import numpy as np
import goofi


class DetrendedFluctuation(goofi.Node):
    """DFA exponent: how far a signal remembers its own past."""

    TAGS = ["analysis"]
    INPUTS = {"data": goofi.InputSlot(goofi.DataType.ARRAY, required=True)}
    OUTPUTS = {"exponent": goofi.DataType.ARRAY}

    def process(self, data):
        out = np.apply_along_axis(
            antropy.detrended_fluctuation, -1, np.asarray(data.data, dtype=np.float64)
        )
        return out.astype(np.float32), data.drop_axis(-1)

← All nodes