Skip to main content
Sandbox Physics
The shape of space

Recompute matched circles in a toy three-torus

Sandbox Physics ·

Run a standard-library Python script to predict circle pairs in four synthetic skies. Compare the predicted matches with 300 random pairs per sky. The tutorial uses the 1998 circle statistic and illustrates the role of a false level. Planck calibrates its full search on a separate simulated-sky ensemble.

Read the chapter on telling a real match from a lucky one first. It derives every formula used below.

Get the three files

Download the script, the saved inputs and the expected output into one empty folder. The script imports only json, math, random and sys. The expected output was produced with Python 3.9.6 and reproduced with Python 3.14.3. The two runs agree in every number and differ only in the recorded version string. A run takes about 20 seconds on a laptop.

From that folder, run:

python3 -I recompute_matched_circles.py tutorial-inputs.json my-output.json

The flag -I keeps Python from loading modules from the current folder or your environment, so the run uses only the standard library.

Read the inputs and their units

The inputs file holds four runs. Each sets the same quantities:

{"boxSide": 1.2, "bumpWidth": 0.08, "bumpCount": 3000, "seed": 86, "noiseRatio": 0.5, "circleSamples": 64, "falsePairTrials": 300, "falsePairRadiiDegrees": [10, 20, 30, 40, 50, 60, 70, 80]}

Lengths are in units of χrec\chi_{\mathrm{rec}}, the comoving distance to the last-scattering surface, so the sphere we see has radius 1. The box edge is LL = boxSide. Angles are in degrees. Temperatures are in units of the signal's standard deviation on the sphere, so noiseRatio is σn/σs\sigma_n/\sigma_s, the inverse of the signal-to-noise ratio ξ\xi.

The script places 3000 Gaussian bumps of width ss in the box with random positions and weights. It keeps the images within reach of the sphere and truncates each bump at four widths. The untruncated model has an expected correlation proportional to the sum over images of Gaussian terms of the form e−r2/4s2e^{-r^2/4s^2}. The Lab instead samples a periodic Fourier field, so its individual scores come from a different sky.

The four runs are wrapped-box with L=1.2L = 1.2, near-the-limit with L=1.93L = 1.93, larger-than-the-view with L=2.2L = 2.2, and noisy-sky, which repeats wrapped-box with noise at twice the signal.

Step 1: check that the box really wraps

Open my-output.json at runs, then wrapped-box. The periodicityDifference value compares two points separated by one box edge. It rounds to zero at the script's 12-decimal precision. A measurable difference prompts a check of the image list and coordinate wrapping.

Step 2: score the predicted pairs

The list predictedPairs has one entry for each pair of images ±g\pm\mathbf{g} closer than 2. For L=1.2L = 1.2 there are nine: three with separation 1.21.2 and radius 53.13∘53.13^\circ, six with separation 1.69711.6971 and radius 31.948∘31.948^\circ. These radii come from cos⁡α=∣g∣/2\cos\alpha = |\mathbf{g}|/2.

For each pair the script samples 64 points on the circle around g^\hat{\mathbf{g}} and the same 64 physical points moved by −g-\mathbf{g}, which lie on the circle around −g^-\hat{\mathbf{g}}. Without noise, statisticAtZeroShift is 1.01.0 for all nine, and bestShiftSamples is 0. The two circles carry identical temperatures, point by point. If you see a best shift other than zero here, the two circles were sampled with different starting directions.

The value noisyStatisticAtZeroShift adds independent noise to each circle. Equation 5 of the 1998 paper predicts ξ2/(1+ξ2)=0.8\xi^2/(1+\xi^2) = 0.8 for noise at half the signal, and the output records that prediction as css1998Equation5. The nine noisy values average 0.7950.795.

Step 3: build the false-pair threshold

The falsePairs block samples 300 back-to-back pairs on random axes. Each trial draws a radius from the eight values between 10 and 80 degrees and uses the same noise as the predicted pairs. It reports the fixed-shift score and the maximum over shifts. This estimates a percentile across pairs from one sky.

At a fixed shift, singleShift.standardDeviation is 0.1970.197, against 1/65=0.1241/\sqrt{65} = 0.124 for independent samples. Adjacent samples can share the same spot. With the best shift selected for each pair, bestOverShifts.percentile99 is 0.6740.674, the fourth-largest of 300 scores in this run.

Table 5.1 True pairs against the 1 percent false level, best rotation, as saved in the expected output.
RunBox edgeTrue pairsTrue best scoresFalse 1 percent level
wrapped-box1.21.290.690.69 to 0.880.880.6740.674
near-the-limit1.931.9330.7250.725, 0.7720.772, 0.8890.8890.7450.745
larger-than-the-view2.22.20none0.7080.708
noisy-sky1.21.290.270.27 to 0.510.510.4310.431

In wrapped-box all nine predicted pairs exceed that realization's pair-wise reference value. The procedure scores predicted locations and random locations on the same sky. A survey detection would need the maximum across the whole search on many null skies.

Four ways the test fails

In larger-than-the-view, there are no clone pairs within two sphere radii, so predictedPairs is empty. The strongest random pair still scores 0.7710.771. A high score can occur even when geometry predicts no matched circles.

In noisy-sky the expected score at the correct shift is 0.20.2. Maximising over shifts gives scores from 0.26530.2653 to 0.51210.5121. Two of the nine, at 0.43230.4323 and 0.51210.5121, exceed the reference of 0.43130.4313.

In near-the-limit, all three predicted circles have radius 15.2∘15.2^\circ. Two scores exceed the run's reference value of 0.7450.745, and one, at 0.7250.725, falls below it. The reference still pools all eight random radii, so it gives a pooled reference across radii.

With one trace reversed relative to the predicted ordering, mirroredBestStatistic still ranges from 0.470.47 to 0.890.89 in wrapped-box. Those comparisons use the noiseless profiles. A smooth temperature pattern can align for part of the circle after a shift, so specify the predicted ordering and match the search freedom in the control trials.

Errors and what the numbers can support

The scores use four decimal places. At half-signal noise, the three box sizes give 99th percentiles of 0.6740.674, 0.7080.708 and 0.7450.745. These runs change the sky and geometry, so their differences cannot serve as an uncertainty estimate for a single percentile. Planck estimates a false-detection level with one search per simulated map.

The noise model adds independent Gaussian noise to every sample. Real maps have noise that varies across the sky, regions removed by a Galactic mask, and contributions from gas velocity and from changing gravitational potentials that differ between the two paths. None of those is in this script, so its results describe how the method behaves.

Compare with the Lab

Choose a preset in the Lab and select Save sky record. Compare its predicted-pair count and radii with predictedPairs at the same box edge, allowing for rounding. The Lab's Fourier field and the tutorial's Gaussian bumps generate different temperature patterns. To compare how noise changes a match, keep the Lab box and seed fixed.

A checklist for any circle search

  1. Confirm the periodicity of the simulated sky before scoring anything.
  2. Write down the predicted radii and centres from the geometry before looking at scores.
  3. Score false pairs with the same sampling, noise and search freedom as the real search.
  4. Quote the false level with the number of simulations behind it.
  5. Test small circles separately, because their false level is higher.
  6. Fix the orientation the topology predicts before taking the best rotation.

Sources: Cornish, Spergel and Starkman 1998, equations 5, 6 and 8, Planck 2015 results XVIII, sections 4.2 and 5.1.1, COMPACT collaboration preprint on noise sources for the circle signal.

Export the Lab record and compare the circle count and radii with a script run at the same box edge.

Sources

  1. Cornish, Spergel and Starkman 1998, equations 5, 6 and 8
  2. Planck 2015 results XVIII, sections 4.2 and 5.1.1
  3. COMPACT collaboration preprint on noise sources for the circle signal

Keep reading

What this page links to directly

See this series on the content map →

The shape of space · Reading path

From a flat box to matched circles and Planck limits

  1. ArticleCan a flat universe be finite?
  2. ArticleHow the three-torus makes flat space finite
  3. ArticleWhy a small universe draws circles on the sky
  4. ArticleTelling a real circle match from a lucky one
  5. You are hereRecompute matched circles in a toy three-torus
  6. ArticleHow to read Planck's cosmic topology limits
Something broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy