correlation_lags(in1_len, in2_len, mode='full')
Cross-correlation for continuous functions $f$ and $g$ is defined as:
$$\left ( f\star g \right )\left ( \tau \right ) \triangleq \int_{t_0}^{t_0 +T} \overline{f\left ( t \right )}g\left ( t+\tau \right )dt$$Where $\tau$ is defined as the displacement, also known as the lag.
Cross correlation for discrete functions $f$ and $g$ is defined as:
$$\left ( f\star g \right )\left [ n \right ] \triangleq \sum_{-\infty}^{\infty} \overline{f\left [ m \right ]}g\left [ m+n \right ]$$Where $n$ is the lag.
First input size.
Second input size.
A string indicating the size of the output. See the documentation correlate
for more information.
Returns an array containing cross-correlation lag/displacement indices. Indices can be indexed with the np.argmax of the correlation to return the lag/displacement.
Calculates the lag / displacement indices array for 1D cross-correlation.
correlate
Compute the N-dimensional cross-correlation.
Cross-correlation of a signal with its time-delayed self.
>>> from scipy import signalSee :
... from numpy.random import default_rng
... rng = default_rng()
... x = rng.standard_normal(1000)
... y = np.concatenate([rng.standard_normal(100), x])
... correlation = signal.correlate(x, y, mode="full")
... lags = signal.correlation_lags(x.size, y.size, mode="full")
... lag = lags[np.argmax(correlation)]
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.signal._signaltools.correlation_lags
scipy.signal._signaltools.correlate
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them