---
title: "Read the residuals in deblending and difference images"
description: "Read ZOGY, scarlet and version-pinned Rubin documentation to distinguish source separation, image differences and detections."
canonical_url: "https://sandboxphysics.com/stories/stellar-photometry/reading-crowded-images/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/stellar-photometry/reading-crowded-images/"
last_modified: "2026-10-28"
---

[Measure starlight in a crowded sky](https://sandboxphysics.com/stories/stellar-photometry/)

AC02 · L4

# Read the residuals in deblending and difference images

Sandbox Physics · 2026-10-28

Open arXiv:1601.02655v2 by Zackay, Ofek and Gal-Yam, and arXiv:1802.10157v2 by Melchior and collaborators. One asks where the sky changed; the other asks whose light overlaps. Reading them through those different questions makes residual images easier to interpret.

## Before you begin

Use the preceding chapters on pixels, signal-to-noise and linear fitting. Convolution means placing and adding a light-spreading profile at each source. A Fourier transform represents an image using spatial wave patterns; the guide uses it only to orient the paper reading.

## Separate two questions before comparing methods

Deblending assigns overlapping light to sources within an image. Time differencing compares observations to find new, disappearing or changing emission. A steady neighbor can bias aperture photometry yet cancel in an ideal difference. A variable neighbor leaves a signal.

For every panel, identify whether it shows an observation, model, difference or filtered detection score. A visually small residual does not guarantee correct individual source fluxes. Several allocations can predict similar combined images.

## Distinguish the ZOGY difference from its detection score

In section III.1, mark the assumptions: registered images, known profiles, calibration and background, and independent, approximately Gaussian background-dominated noise. Section IV.1 ties optimality to those conditions.

Read section III.6 with two separate notes for the difference image and point-source detection statistic. The latter combines pixels using a source profile and needs its associated uncertainty. Section III.3 adds bright-source noise and other corrections. A residual near a bright star needs that treatment before interpretation as a new source.

Check sections VIII.1–VIII.4 for background, profile, sampling and registration. Figure 5 provides a real-image test. Use its caption to identify the processing in each panel and inspect structure near bright sources.

Reading: Zackay, Ofek & Gal-Yam (2016), Proper image subtraction, arXiv:1601.02655v2

## Derive a simple difference limit yourself

Take two background-subtracted observations with identical calibration and identical profiles. An unchanged sky should have zero mean after direct subtraction. If the two pixel noises are independent, their variances add. This check does not require the full Fourier method.

Now shift one image slightly to the right. A constant star produces a positive residual on one side and a negative one on the other. Reducing the shift reduces the pattern. Registration errors can leave a structured residual around a steady star.

$$
D_i=N_i-R_i,\qquad\mathbb E[D_i]=0,\qquad\operatorname{Var}(D_i)=v_{N,i}+v_{R,i}
$$

The special case assumes a static sky, identical calibration and profiles, and independent noise. It checks signs and units, without reproducing the complete paper algorithm.

## Use color as another source-separation clue

Turn to scarlet section 2 and figure 1. Each component has a spatial morphology and a list of band amplitudes; the observed prediction includes the relevant profile convolution. Color supplies information beyond a single blended image.

In section 2.3, note exactly where positivity, symmetry and monotonicity are imposed. Sections 2.4 and 2.5 address noise and profiles. Return to figure 1 and compare data, model and residuals for signs of a missing component.

The authors’ Core Concepts documentation distinguishes a component from an observation and a frame. Masked pixels can have zero weight, and observations can have different band profiles. The factorized model keeps one component’s spectrum constant across its spatial extent; strong color gradients make that assumption worth checking.

Reading: Melchior et al. (2018), scarlet, arXiv:1802.10157v2 · scarlet authors, Core Concepts

## Check the software after the paper

The pinned Rubin Science Pipelines w\_2026\_41 ip\_diffim overview describes Alard–Lupton kernel matching, several convolution modes and decorrelation options. A method paper and a software task with a similar purpose need not implement the same algorithm.

Save templates, science images, masks, variances, profiles, registration choices and software versions. Inject known changes and measure recovery against both brightness and neighbor distance. Test bright- and dark-background regions separately.

Reading: Rubin Science Pipelines w\_2026\_41, ip\_diffim overview

## Carry the reasoning to faint extended emission

A faint extended source spreads light across many pixels. A small shared background error accumulates over that area. Treating it as independent pixel noise and taking a square root underestimates the common bias.

For $n$ pixels sharing a sky error $\Delta B$, the total bias is $n\Delta B$. Independent-noise standard deviation generally grows only as $\sqrt n$. The different scaling explains why more area can expose calibration errors.

For the next result, record component assignments, background estimation, pixel correlations, the statistic used to display residuals and injected-source recovery. The output here is a reading route through fixed papers and products; a full-size science-pipeline reproduction would additionally require its calibrated images and execution record.

## Try the prediction

### [Read an example with known answers](https://sandboxphysics.com/labs/crowded-star-photometry/)

1. Bring the two stars together and name the separating information missing from a single-color image.
2. Use Subtract too much sky to predict how doubling aperture area changes the systematic error.
3. Read the saved injection output and distinguish known-position recovery from blind-survey completeness.

[Previous: Extract TESS brightness from twelve pixels](https://sandboxphysics.com/stories/stellar-photometry/tess-pixels/)

## Sources and calculation scope

1. [Zackay, Ofek & Gal-Yam (2016), Proper image subtraction, arXiv:1601.02655v2](https://arxiv.org/html/1601.02655v2)

   Read sections III.1, III.3, III.6, IV.1 and VIII.1–VIII.4; compare the difference image with its detection score. The guide reads the method, not a reproduced survey pipeline.

2. [Melchior et al. (2018), scarlet, arXiv:1802.10157v2](https://arxiv.org/abs/1802.10157v2)

   Section 2 and figure 1: multiband components, morphology constraints and residuals. Read alongside the authors’ documentation.

3. [scarlet authors, Core Concepts](https://pmelchior.github.io/scarlet/1-concepts.html)

   Components, observations and PSF convolution in the authors’ implementation; accessed 2026-10-28.

4. [Rubin Science Pipelines w\_2026\_41, ip\_diffim overview](https://pipelines.lsst.io/v/w_2026_41/modules/lsst.ip.diffim/overview_ipdiffim.html)

   Version-pinned subtraction tasks and Alard–Lupton kernel matching; prevents equating a historical paper with every current pipeline.
