Keep reading
You are hereRecompute matched circles in a toy three-torus
The shape of space · Reading path
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.
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.jsonThe flag -I keeps Python from loading modules from the current folder or your environment, so the run uses only the standard library.
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 , the comoving distance to the last-scattering surface, so the sphere we see has radius 1. The box edge is = boxSide. Angles are in degrees. Temperatures are in units of the signal's standard deviation on the sphere, so noiseRatio is , the inverse of the signal-to-noise ratio .
The script places 3000 Gaussian bumps of width 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 . The Lab instead samples a periodic Fourier field, so its individual scores come from a different sky.
The four runs are wrapped-box with , near-the-limit with , larger-than-the-view with , and noisy-sky, which repeats wrapped-box with noise at twice the signal.
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.
The list predictedPairs has one entry for each pair of images closer than 2. For there are nine: three with separation and radius , six with separation and radius . These radii come from .
For each pair the script samples 64 points on the circle around and the same 64 physical points moved by , which lie on the circle around . Without noise, statisticAtZeroShift is 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 for noise at half the signal, and the output records that prediction as css1998Equation5. The nine noisy values average .
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 , against for independent samples. Adjacent samples can share the same spot. With the best shift selected for each pair, bestOverShifts.percentile99 is , the fourth-largest of 300 scores in this run.
| Run | Box edge | True pairs | True best scores | False 1 percent level |
|---|---|---|---|---|
| wrapped-box | 9 | to | ||
| near-the-limit | 3 | , , | ||
| larger-than-the-view | 0 | none | ||
| noisy-sky | 9 | to |
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.
In larger-than-the-view, there are no clone pairs within two sphere radii, so predictedPairs is empty. The strongest random pair still scores . A high score can occur even when geometry predicts no matched circles.
In noisy-sky the expected score at the correct shift is . Maximising over shifts gives scores from to . Two of the nine, at and , exceed the reference of .
In near-the-limit, all three predicted circles have radius . Two scores exceed the run's reference value of , and one, at , 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 to 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.
The scores use four decimal places. At half-signal noise, the three box sizes give 99th percentiles of , and . 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.
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.
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.
You are hereRecompute matched circles in a toy three-torus
The shape of space · Reading path