# Understanding how to calculate Spatio-Temporal Correlation Function evolution

### Problem and Question

I am doing a research project and I haven't taken any statistical mechanics before so I am confused about some core aspects of my research.

Currently, I have an image time series of pixel intensity values and I am trying to perform an animation of the Generalized Spatiotemporal Correlation Function (STICS) defined as $$r(\zeta, \eta, \tau) = \frac{\langle\langle \delta i(x,y,t) \delta i (x + \zeta, y + \eta, t + \tau\rangle_{xy} \rangle_t}{\langle i\rangle_t \langle i \rangle_{t + \tau}}, \tag{1}$$ where $$\zeta$$ and $$\eta$$ are spatial lag variables that represent shifts of the image in $$x–y$$ space for calculation of spatial correlation $$\langle \cdot \rangle_{xy}$$, whereas $$t$$ is a temporal lag variable representing shifts in time in the $$x–y–t$$ image series for calculation of the temporal correlation $$\langle \cdot \rangle_t$$. The angular brackets in the denominator simply represent calculation of a mean intensity with $$\delta i(x,y,t) = i (x,y,t) - \langle i \rangle. \tag{2}$$

Now, say I have $$n$$ images each with a pixel grid with intensity values, which I obtain from a Python simulation. Such as

What would be a procedure to generate an animation of Equation $$(1)$$ , a correlation function temporal evolution, in order to get something like

### What I have done

I was able to generate the images simulations and to store the values intensity fluctuation pixel values of $$(2)$$ conveniently, but I am stuck on understanding how and what to do with $$(1)$$. Particularly, I can't comprehend the numerator of $$(1)$$. From online search, the brackets seem to represent expected values? One online reference defines this angular bracket as $$\langle A \rangle = \frac{1}{N} \sum_{i = 1}^{N} A_i,$$ but I don't see how this applies in my case, given that I have 3 dimensions. Can someone explain, by giving a short example, on how to get one frame of the correlation function temporal evolution (as in the picture above), using computations from $$(1)$$ in conjunction with my time series of $$n$$ images? Or any other tips for that matter?

• Are you using numpy arrays? It sounds like using the np.mean function may be what you are looking for, as it is able to work on multidimensional arrays. Commented Oct 31, 2022 at 9:04