Radio dishes ride the turning Earth to image a hidden galaxy, then CLEAN it.
Every pair of dishes measures one Fourier component of the sky at a spatial frequency set by their separation as seen from the source. As the Earth turns, each of the hundreds of baselines sweeps an exact ellipse across the uv-plane, and the image of a hidden double-lobed radio galaxy, the inverse 2D FFT of the visibilities sampled so far, sharpens from streaks into jets and filamentary lobes over 12 hours. One complex inverse FFT returns both the dirty image and the dirty beam, because both spectra are Hermitian. Then Hogbom CLEAN repeatedly finds the brightest residual, subtracts a shifted copy of the beam, and restores the components with a Gaussian fitted to the beam's main lobe, peeling the sidelobes away live. Compare a Y array, a spiral, a ring and an east-west line, and finally peek at the true sky the array never saw.
Try it. Drag dishes to reshape the array and the coverage and image update instantly; click the map to add a dish, right-click or Shift-click to remove one. Keys 1 to 5 or the left and right arrows switch arrays, up and down change the source declination, Space replays the 12-hour track, C runs CLEAN, D shows the dirty image, T toggles the true sky (a click on the image runs CLEAN, then toggles it too), and R swaps in a new hidden galaxy.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a radio interferometer simulator with JavaScript and the HTML canvas element: a handful of dishes that use the Earth's rotation to image a hidden radio source. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens, and has three panels: dish layout, uv-plane, and image.
- Make a 64 x 64 "true sky" array: a bright point in the middle and two blurry Gaussian blobs on either side, like a radio galaxy.
- Write a small radix-2 FFT yourself and take the 2D Fourier transform of the sky once. These are the visibilities.
- Place about 8 dishes at random. For every pair, take the east and north separation. Sweep an hour angle H from -6 to +6 hours and compute u = sin(H) X + cos(H) Y and v = -sin(dec) cos(H) X + sin(dec) sin(H) Y + cos(dec) Z, where X = -north sin(lat), Y = east, Z = north cos(lat). Mark (u, v) and (-u, -v) in a sampling mask and draw them as dots.
- Every frame, multiply the visibilities by the mask, inverse FFT, and draw the real part as the dirty image with a hot color map. Watch it sharpen as the tracks grow.
Once that works, make it beautiful:
- Let me drag dishes and recompute the whole 12-hour coverage instantly.
- Show the dirty beam (the inverse FFT of the mask alone) in a small inset.
- Add a CLEAN button: repeatedly find the brightest pixel in the residual, subtract a small fraction of the beam centered there, and add a small Gaussian to a model image. Animate it a few dozen steps per frame.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a declination slider that flattens the ellipses, preset array shapes like a Y or a ring, or adding thermal noise to the visibilities.