Simulating a Newtonian telescope with Chroma to debug flat-field artifacts

December 5, 2026

Categories: Astrophotography Physics Programming

In my last astrophotography post, I mentioned upgrading my Sky-Watcher Quattro 200P (8" f/4 Newtonian) to a monochrome ZWO ASI2600MM-Pro with a 7-position 2" filter wheel and Antlia LRGB + 4.5 nm narrowband filters, and grumbled a bit about the mechanical quirks of a fast, budget Newtonian. Narrowband imaging hides a lot of sins because the sky background is dark and you’re usually only fighting faint gradients. Broadband LRGB from a Bortle 7/8 backyard is far less forgiving.

Once I started shooting deep broadband luminance stacks and calibrating them with flats and standard linear background extraction (BGE), a weird, persistent artifact started showing up in the stretched background: a faint, subtly embossed ring (darker along one arc and brighter along the opposite arc) noticeably offset upward from the center of the frame. It wasn’t a dust mote, it didn’t behave like a normal radial vignetting mismatch, and it survived careful collimation.

A stretched broadband luminance stack of M77 and NGC 1055 after flat calibration and linear background extraction. Look at the background: a large, subtly embossed circular ring (dark along the left arc, bright along the right) clearly offset upward from the center of the frame.

A stretched broadband luminance stack of M77 and NGC 1055 after flat calibration and linear background extraction. Look at the background: a large, subtly embossed circular ring (dark along the left arc, bright along the right) clearly offset upward from the center of the frame.

Normally this is the point where astrophotographers start throwing money at the problem: replacing the focuser, re-flocking the tube, re-spacing the coma corrector, or taking flats in six different ways on a hunch. Instead, I realized I already had a hammer for this exact kind of nail: Chroma, the GPU-accelerated optical photon Monte Carlo engine I worked on back in my neutrino physics days. If I could modernize Chroma for imaging optics and build a faithful 3D model of my entire telescope and camera train, I wouldn’t have to guess what caused the shape. I could just trace a billion photons through candidate misalignments and stray-light paths on my RTX 3090 and see which physical mechanism actually reproduced the signature.

The result is telescope_sim, backed by a modernized Chroma 0.7 fork (chroma). Here’s an overview of what had to change in Chroma, what telescope_sim can now do, and how iterating through simulated flat fields finally nailed down the culprit.

Chroma: from Neutrino Detectors to Backyard Telescopes

When I last wrote about Chroma and its GDML importer, its job was propagating scintillation and Cherenkov photons inside massive neutrino detectors like SNO+ and DUNE. Neutrino detectors and imaging telescopes are both optical transport problems, so Chroma already had a great foundation: CUDA ray-triangle intersection, wavelength-dependent refractive indices, bulk absorption/scattering, coherent linear ss/pp Fresnel reflection/refraction, and dichroic surfaces.

However, a neutrino detector doesn’t care if a mirror is tessellated into flat triangles or if a photon is off by 20 microns, and it certainly doesn’t care about 4.5 nm interference filters. An f/4 imaging Newtonian with 3.76 μ\mum pixels cares deeply about all of those things. To make Chroma viable for telescope engineering (and to run cleanly on a modern 2026 Python 3.14 / NumPy 2 / CUDA 13 stack without requiring Geant4 or CERN ROOT), I made several core upgrades in Chroma 0.6 and 0.7:

Smooth surface normals on curved meshes

Chroma represents everything as triangle meshes. For a flat baffle or a 12-inch PMT envelope, flat triangle normals are totally fine. For an 800 mm f/4 parabolic primary mirror or an 8-surface coma corrector, flat facets shatter a star’s focus into a polygon of triangle-sized reflections.

I added optional per-vertex (or per-triangle-corner) normals to Chroma’s Mesh class, rotated them during Geometry.flatten(), uploaded them into GPUGeometry, and updated the CUDA fill_state kernel to barycentrically interpolate the surface normal at the exact hit point (with grazing-angle safety and a zero-normal fallback for flat mechanical parts). Along the way, I also fixed a subtle curved-mesh edge case where a ray grazing a triangle seam could register a spurious double-hit from the wrong medium side. With smooth normals enabled, an 800 mm f/4 paraboloid focuses on-axis parallel rays to an RMS spot radius of 0.09 μ\mum – effectively exact geometric optics on a triangle mesh.

Throughput: persistent kernels, SAH BVH, Philox RNG, and GPU sources

Diagnosing 1-2% flat-field calibration residuals across a 2D sensor requires massive photon statistics (tens of millions to over a billion photons per configuration), otherwise Monte Carlo shot noise drowns out the signal. To get there on a single RTX 3090, Chroma 0.6/0.7 gained:

Fine wavelength grids and interference filter optics

Chroma’s legacy default wavelength table used 5 nm bins, which completely smears out a 4.5 nm narrowband Hα\alpha, OIII, or SII filter. Simulation now accepts an arbitrary wavelength grid (e.g., 0.5 nm steps across a narrowband passband), and transmissive SURFACE_DICHROIC surfaces now perform pure Snell refraction without double-counting uncoated Fresnel reflection. That lets us model broadband anti-reflection (BBAR) coatings and dielectric interference filters accurately, including out-of-band reflection (the source of bright-star filter halos) and the angle-of-incidence blue-shift in a fast f/4 cone:

λeff(θ)=λ01−sin⁡2θneff2. \lambda_{\text{eff}}(\theta) = \lambda_0 \sqrt{1 - \frac{\sin^2\theta}{n_{\text{eff}}^2}}.

Lightweight GPU path attribution and deterministic 3D replay

Recording full 3D ray trajectories for 100 million photons would instantly blow past GPU memory. Instead, I added a lightweight PathAttribution mode directly into Chroma’s propagation kernel. As each photon bounces through the geometry, the GPU tracks its bounce count, flags whether it ever touched a non-nominal surface, records both the first and last stray/ghost solid it interacted with, and stores the 3D world coordinates (stray_pos) of the scatter event.

Because every photon is driven by the stateless Philox RNG, once a high-statistics run finishes and you spot an interesting ghost or stray-light patch on the sensor, you can pass those exact photon IDs back to Simulation.replay_tracks() with photon_tracking=True to reconstruct their full 3D trajectories on demand.

Building telescope_sim: a digital twin of the Quattro 200P

With Chroma upgraded, I built telescope_sim as a modular optical and mechanical analyzer on top of it. Every component is generated parametrically in local coordinates (Chroma’s native mm / ns / nm units) and placed into a composable OpticalTrain.

Engineering cutaway of the full Sky-Watcher Quattro 200P imaging train (51 solids, 134,138 triangles) with Chroma-traced rays: 12-inch velvet-flocked lens hood, baffled OTA, 200 mm f/4 parabolic primary, 70 mm offset secondary on machined 2.5 mm spider vanes, 2-inch focuser, 4-element coma corrector, 17.5 mm flocked M48 spacer, ZWO 7x2-inch EFW, and ASI2600MM-Pro on an Ogma Z’Tilter.

Engineering cutaway of the full Sky-Watcher Quattro 200P imaging train (51 solids, 134,138 triangles) with Chroma-traced rays: 12-inch velvet-flocked lens hood, baffled OTA, 200 mm f/4 parabolic primary, 70 mm offset secondary on machined 2.5 mm spider vanes, 2-inch focuser, 4-element coma corrector, 17.5 mm flocked M48 spacer, ZWO 7x2-inch EFW, and ASI2600MM-Pro on an Ogma Z’Tilter.

The reference model matches my actual rig down to the mechanical clearances and glass thicknesses:

Crucially, every mechanical degree of freedom (focuser travel, coma corrector insertion, backfocus spacing, active filter slot, sensor tilt, mirror tilts, and imaging-train tilt) is parameterized per simulation:

from telescope_sim.instruments import Quattro200PConfig, build_quattro200p

cfg = Quattro200PConfig.with_imaging_train(
    active_filter="L",          # L, R, G, B, SII, Ha, OIII, or open
    include_lens_hood=True,     # 12" velvet-flocked lens hood
    tube_interior="flocking",   # matte_black, flocking, or ideal_absorber
)
train = build_quattro200p(cfg, build_bvh=True)

Optical verification: spot diagrams, wave-optics PSFs, and starfields

Before trusting the simulation to diagnose subtle flat-field artifacts, I verified that it reproduces textbook optical physics across the board.

First, geometric aberrations: an uncorrected f/4 paraboloid is razor-sharp on-axis (0.09 µm RMS), but classic Newtonian coma (Lt=3θf/16F2L_t = 3\theta f / 16 F^2) blows up to 40.4 μ\mum RMS at the corner of an APS-C sensor, which is over 10 pixels wide. Adding the 4-element Sellmeier coma corrector collapses that APS-C corner spot down to 5.7 μ\mum RMS (a ~7× reduction) across 486-656 nm, while auto_focus=True automatically compensates the ~1.26 mm paraxial glass focus shift from the 2 mm filter and 2 mm camera window.

Polychromatic spot diagrams (486 nm, 550 nm, 656 nm) comparing the bare f/4 Quattro 200P against the 4-element coma corrector out to the APS-C corner (0.95 deg / 13.3 mm).

Polychromatic spot diagrams (486 nm, 550 nm, 656 nm) comparing the bare f/4 Quattro 200P against the 4-element coma corrector out to the APS-C corner (0.95 deg / 13.3 mm).

Pure geometric raytracing can’t produce Airy rings or spider diffraction spikes, so telescope_sim also bridges into physical optics. By tracing a dense pupil grid through the exact 3D Chroma geometry, it extracts the transmitted exit-pupil mask A(x,y)A(x,y) (capturing the offset secondary shadow, 4-vane spider, and primary mirror clips) and integrates the wavefront optical path difference W(x,y)W(x,y) via sparse least squares before taking a padded 2D FFT.

Wave-optics diffraction PSFs computed from the exact 3D Chroma exit pupil and wavefront OPD: on-axis Airy rings + 4-vane spider spikes + subtle 6-fold clip flares, atmospheric seeing convolution, and an off-axis comatic fan.

Wave-optics diffraction PSFs computed from the exact 3D Chroma exit pupil and wavefront OPD: on-axis Airy rings + 4-vane spider spikes + subtle 6-fold clip flares, atmospheric seeing convolution, and an off-axis comatic fan.

Combining the GPU Monte Carlo star-field raytracer with that broadband 3D diffraction kernel produces realistic APS-C starfields that export directly to stretched PNGs or 32-bit FITS files.

Simulated 5-million-photon APS-C starfield through the coma-corrected Quattro 200P convolved with the broadband 3D wave-optics PSF, with a 5x5 mm ROI zoom on the brightest star.

Simulated 5-million-photon APS-C starfield through the coma-corrected Quattro 200P convolved with the broadband 3D wave-optics PSF, with a 5x5 mm ROI zoom on the brightest star.

Stray-light origin mapping and mitigation

Where Chroma’s new PathAttribution really shines is diagnosing unwanted light. If you illuminate an unmitigated baseline OTA (no lens hood, no baffles, matte-black paint) with an off-axis 3°-35° sky ring, the simulation immediately plots the 3D scatter coordinates on the tube wall opposite the focuser and replays the exact ray trajectories that sneak past the secondary into the camera.

3D physical stray-light origin map and deterministic Philox-replayed ray tracks for an unmitigated OTA under off-axis sky illumination, pinpointing the matte-black tube wall opposite the focuser.

3D physical stray-light origin map and deterministic Philox-replayed ray tracks for an unmitigated OTA under off-axis sky illumination, pinpointing the matte-black tube wall opposite the focuser.

Toggling hardware upgrades in Quattro200PConfig quantifies what actually pays off: adding the 12" flocked lens hood, 6 knife-edge baffles, and velvet tube flocking cuts off-axis stray flux by 23.2×, while broadband AR coatings and blackened lens edges cut bright-star optical ghost flux by 26.6×. Even after BBAR coatings are added, first→last ghost-pair attribution identifies the exact residual ghost cavities (efw_filter_L -> corrector_l4_nsk16 at 27.8% of remaining ghosts, camera_window -> efw_filter_L at 27.1%).

Quantifying physical hardware mitigations in software: off-axis sky stray light drops 23.2x with flocking, baffles, and the 12-inch hood; bright-star optical ghosts drop 26.6x with BBAR coatings and blackened lens edges.

Quantifying physical hardware mitigations in software: off-axis sky stray light drops 23.2x with flocking, baffles, and the 12-inch hood; bright-star optical ghosts drop 26.6x with BBAR coatings and blackened lens edges.

Zeroing in on the LRGB flat-field artifact

With the digital twin verified, it was time to go hunting for the real-world LRGB calibration artifact.

Step 1: Mapping the nominal flat field and its vignetting “knees”

First, I simulated a very high-statistics nominal L-filter flat field using a true 2π2\pi Lambertian flat panel at the front of the 12" lens hood (using 3-stratum importance sampling to resolve both direct imaging light and wide-angle stray light simultaneously).

Across the APS-C sensor, the bare Quattro 200P OTA illuminates the corners (r = 13.6 mm) to 87.0% of center; adding the 4-element coma corrector and ZWO 7×2" EFW trims corner illumination to 74.2%, right in line with my real flats. More importantly, plotting the deviation from an ideal unobscured f/4 (cos⁡4θ\cos^4\theta) profile and its radial slope dI/dr\mathrm{d}I/\mathrm{d}r exposes sharp vignetting knees, the exact radii where individual mechanical apertures start clipping the f/4 light cone:

Direct-light vignetting relative to an ideal f/4 system and its radial slope dI/dr, clearly revealing the sharp vignetting knees from the coma corrector front lip/L1 (~4.3-4.8 mm) and the 70 mm secondary (~6.0 mm).

Direct-light vignetting relative to an ideal f/4 system and its radial slope dI/dr, clearly revealing the sharp vignetting knees from the coma corrector front lip/L1 (~4.3-4.8 mm) and the 70 mm secondary (~6.0 mm).

That sharp transition around r ≈ 4.8 mm turned out to be the key to everything that followed.

Step 2: Sweeping candidate pathologies

Next, I systematically perturbed the telescope, one mechanical or optical error at a time, and divided each perturbed flat by the nominal flat (Perturbed / Nominal - 1) to see what a flat-calibration mismatch actually looks like on the sensor. I also decomposed each 2D ratio map into azimuthal Fourier modes: m=0m=0 (pure circular ring), m=1m=1 (one-sided dipole gradient), and m=2m=2 (quadrupole).

Normalized 2D ratio maps (Perturbed / Nominal - 1) across six candidate flat-field pathologies: 0.5 mm lateral shift, 3-arcmin primary tilt, +2 mm secondary Z-offset (re-collimated and raw), +2 mm axial focuser shift, and indirect-light mismatch between a 2pi flat panel and the direct night sky.

Normalized 2D ratio maps (Perturbed / Nominal - 1) across six candidate flat-field pathologies: 0.5 mm lateral shift, 3-arcmin primary tilt, +2 mm secondary Z-offset (re-collimated and raw), +2 mm axial focuser shift, and indirect-light mismatch between a 2pi flat panel and the direct night sky.

This sweep immediately ruled out several tempting explanations:

Something had to combine two ingredients: a static offset of the illumination core, and a dynamic mismatch between the flats and the lights.

Step 3: Explaining the offset – a statically unsquared focuser

On a Newtonian, we obsess over collimating the primary and secondary mirrors with a laser or Cheshire until the on-axis ray hits dead center on the sensor. What’s easy to forget is that collimation does not square the focuser tube to the OTA.

If the focuser base is tilted by even 0.5°-1.0° relative to the tube wall, you can still achieve textbook axial collimation by tilting the secondary and primary mirrors to match. The on-axis star hits (u, v) = (0, 0) just fine. However, because the focuser drawtube and coma corrector barrel are now tilted relative to the converging cone from the primary/secondary, the unvignetted illumination core is statically shifted off sensor center, and the vignetting knees on opposite sides of the sensor become asymmetric.

A collimated 0.50 deg unsquared focuser baseline: even with perfect on-axis collimation, the 95% illumination core is statically shifted by -1.36 mm (-363 pixels) and the +u / -u vignetting knees split asymmetrically.

A collimated 0.50 deg unsquared focuser baseline: even with perfect on-axis collimation, the 95% illumination core is statically shifted by -1.36 mm (-363 pixels) and the +u / -u vignetting knees split asymmetrically.

A 0.50° unsquared focuser shifts the 95% illumination centroid by -1.36 mm (-363 pixels); a 1.00° tilt shifts it by roughly 2.0 mm (~530 pixels). That immediately explained why the center of the artifact in my real LRGB stacks was never at the center of the sensor!

Step 4: Explaining the embossed ring – gravitational sag (and linear BGE)

Now put a heavy mono camera, 7×2" filter wheel, and 4-element coma corrector hanging off that stock 2" focuser. When you take flats pointing at the zenith (or at a different hour angle than your target), the imaging train sags slightly in the focuser or compression ring by a fraction of a degree, say 0.10° to 0.50° (6’ to 30’).

Because the flat-field illumination profile has a flat plateau inside the r ≈ 4.8 mm coma-corrector vignetting knee and a steep falloff outside it, shifting that profile slightly via tilt and dividing by the un-sagged flat produces an S-curve across the sensor: nearly flat inside the core, sloping down on one side and up on the other outside the knee.

Here is the kicker: in astrophotography pre-processing, the very next thing you do to a calibrated frame is run linear Background Extraction (BGE) (degree-1 plane subtraction) to remove the sky gradient. What happens when you subtract a straight tilted plane from an S-curve? The linear plane overshoots one shoulder of the r ≈ 4.8 mm knee and undershoots the other, leaving behind a textbook embossed bright-dark ring right at the coma corrector vignetting knee, centered on the statically offset illumination core!

To see this crystal clear without Monte Carlo noise, I cranked Chroma up to 1.2 billion photons per tilt angle on a collimated 1.00° upward-unsquared focuser baseline:

High-statistics simulation (1.2 billion photons per case) of gravitational imaging-train tilt (0.10 deg to 1.00 deg) on a collimated 1.00 deg upward-unsquared focuser baseline. Top: raw flat-calibrated ratio. Middle: after linear BGE (grayscale astro-stretch), revealing the offset embossed ring right at the r = 4.8 mm coma-corrector vignetting knee (orange circle = offset core; cyan = sensor center). Bottom: 1D cut showing how subtracting a linear plane from the S-curve sculpts the bright/dark ring.

High-statistics simulation (1.2 billion photons per case) of gravitational imaging-train tilt (0.10 deg to 1.00 deg) on a collimated 1.00 deg upward-unsquared focuser baseline. Top: raw flat-calibrated ratio. Middle: after linear BGE (grayscale astro-stretch), revealing the offset embossed ring right at the r = 4.8 mm coma-corrector vignetting knee (orange circle = offset core; cyan = sensor center). Bottom: 1D cut showing how subtracting a linear plane from the S-curve sculpts the bright/dark ring.

Even a tiny 0.25° (15 arcminute) sag, which corresponds to just ~0.4 mm of lateral shift at the front of the coma corrector, carves out a 2.44% peak-to-valley embossed ring after linear BGE, growing to 3.73% at 0.50° and 5.98% at 1.00°. Compare the grayscale post-BGE panels above directly against the real M77 / NGC 1055 luminance stack at the top of the post: the upward-shifted center, the circular scale matching the r ≈ 4.8 mm coma-corrector vignetting knee, and the dark-on-one-side / bright-on-the-other embossed rim are an unmistakable match. In a heavily stretched Bortle 7/8 luminance stack, a 2-3% background residual sticks out like a sore thumb.

Step 5: Checking the other suspect – asymmetric stray light on the hood lip

Before declaring victory on gravitational sag alone, I wanted to test one more realistic backyard culprit: asymmetric illumination from a distant street light clipping one side of the front inner lip of the 12" lens hood. When you divide a frame containing an additive, one-sided stray-light crescent by a multiplicative flat field, and then hit it with linear BGE, what does that look like?

I simulated a collimated beam at 72° off-axis grazing the opposite rim of the 12" hood (+x, -x, and +y sides), importance-sampled its Lambertian scatter into the OTA, calibrated the result with the same 0.50° unsquared-focuser flat, and put it side-by-side with +0.25° gravitational sag:

Asymmetric stray light from a distant street light clipping the +x, -x, or +y front inner lip of the 12-inch lens hood (3% mean stray-to-flat ratio), calibrated by the 0.50 deg unsquared-focuser flat and run through linear BGE, compared side-by-side with +0.25 deg gravitational sag (right column).

Asymmetric stray light from a distant street light clipping the +x, -x, or +y front inner lip of the 12-inch lens hood (3% mean stray-to-flat ratio), calibrated by the 0.50 deg unsquared-focuser flat and run through linear BGE, compared side-by-side with +0.25 deg gravitational sag (right column).

Fascinatingly, asymmetric hood-lip illumination also interacts with the offset vignetting knee under linear BGE to produce a bright/dark crescent-and-ring pattern (7%-10% P-V at a 3% mean stray level), though with a much stronger one-sided lobe outside the core compared to the cleaner, symmetric embossing of pure focuser sag. In a real backyard session where the telescope tracks past neighborhood lights and the stock focuser sags slightly across the sky, both mechanisms can contribute, and both inherit their offset center from the statically unsquared focuser tube.

Wrapping up

What started as annoyance over a weird background ring in my LRGB stacks turned into one of the most fun physics-and-software projects I’ve done in a while. Updating Chroma to 0.7 with smooth normals, fine wavelength grids, interference coatings, path attribution, and billion-photon throughput turned it into a genuinely capable optical engineering tool for amateur telescopes.

More practically, telescope_sim gave me a concrete mechanical checklist instead of guesswork:

  1. Square the focuser tube to the OTA before collimating, so the unvignetted coma-corrector core actually sits at the center of the IMX571 sensor.
  2. Eliminate or match imaging-train sag between lights and flats – whether by locking down the compression ring, taking flats at a matching tube elevation, or finally biting the bullet on a stiffer threaded focuser.
  3. Watch for asymmetric light clipping the front of the dew shield when shooting broadband near street lights, since flat-field division plus linear BGE will happily turn a one-sided stray crescent into a ring-like background artifact.

If you’re interested in poking at the optical models, trying out your own Newtonian or corrector tweaks, or running the flat-field scripts yourself, both telescope_sim and chroma are up on GitHub.

>> Home