Skip to content

Implement observables API and autocorrelation time computation#28

Draft
RadiatedMonkey wants to merge 3 commits into
masterfrom
autocorrelation-time
Draft

Implement observables API and autocorrelation time computation#28
RadiatedMonkey wants to merge 3 commits into
masterfrom
autocorrelation-time

Conversation

@RadiatedMonkey

@RadiatedMonkey RadiatedMonkey commented Feb 25, 2026

Copy link
Copy Markdown
Owner

Implements the new observables API and automatically computes autocorrelation times for observables.

An observable can be created by implementing the Observable trait for a struct. This struct can then be added to the system using the SystemBuilder::with\_observable function. The code makes use of a compile time HList to store the observables which means there is no runtime dynamic dispatch involved.

After the system has thermalised, the system will measure all observables on every sweep. This information is then used to compute the autocorrelation time for each observables using the FFT method. This method works as follows:

Collect all observables into a time series and then subtract the mean of the *entire* series from each entry to normalise it. We then double the list in size, filling the remainder with zeroes. After this we take the Fast Fourier Transform of this list and multiply the last by its conjugate. We then take the inverse FFT of this list to obtain the autocorrelation.

To get the (integrated) autocorrelation time we finally divide the whole list by the first element and compute

$$\\tau = \\frac{1}{2} + \\sum\_{i = 1}^N \\rho(i)$$

This autocorrelation time tells us how many sweeps to discard between measurements.

To determine N we use the Madras-Sokal window method. This method reduces the noise that is introduced by higher frequencies. For this we choose some W such that

$$W = c \\tau\_{\\text{int}} (W)$$

for c approximately 5. This W is found by starting with W = 1 and incrementing until the condition is satisfied. Once the autocorrelation times are established, measurements will only be taken every 2 autocorrelation times for each observable.

While the simulation is running, we then recompute the autocorrelation times periodically.

Closes #9
Closes #8

@RadiatedMonkey RadiatedMonkey added this to the Scalar Yukawa Theory milestone Feb 25, 2026
@RadiatedMonkey RadiatedMonkey added feature New feature or request data Data collection, processing and measurements labels Feb 25, 2026
@RadiatedMonkey RadiatedMonkey self-assigned this Feb 25, 2026
@github-project-automation github-project-automation Bot moved this to Planned in LQFT Feb 25, 2026
@RadiatedMonkey RadiatedMonkey moved this from Planned to In Progress in LQFT Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Data collection, processing and measurements feature New feature or request

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Compute autocorrelation times Create Observable trait for implementing measurements

1 participant