---
title: "Recompute an observed echo in NGC 5548"
description: "Download a portable Python analysis, fetch the exact AGN Watch light curves, and compare observed lags, resampling and conditional response fits."
canonical_url: "https://sandboxphysics.com/stories/agn-reverberation/recomputing-an-observed-reverberation-lag/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/agn-reverberation/recomputing-an-observed-reverberation-lag/"
last_modified: "2026-11-15"
---

L3 · Method guide

# Recompute an observed echo in NGC 5548

Sandbox Physics · 2026-11-15

You can recover an approximately twenty-day optical emission-line lag from actual NGC 5548 observations with a short Python analysis. Download the analysis below, retrieve the exact AGN Watch light curves, and examine how the answer changes with the sampling and response assumptions.

## Get the analysis and identify the observations

[Download the portable tutorial ZIP](https://sandboxphysics.com/astronomy/ac52/agn-reverberation-tutorial.zip). It contains the analysis, fixed settings, expected results and source identities. The original observational files are fetched from AGN Watch on the first run; they are not redistributed in the ZIP. The analysis code uses Python’s standard library. Its MIT licence covers our code, not the external observations.

Open the [AGN Watch archive](https://www.asc.ohio-state.edu/astronomy/agnwatch/n5548/lcv/) and locate the original optical continuum and hydrogen-beta line light curves. The exact files are c5100.dat and hbeta.dat. The archive labels the continuum revised on 15 August 2003. That file contains 1548 rows; the earlier 2002 paper describes 1530 continuum measurements. Matching a file name alone would miss this difference.

The first column is Julian Date minus 2400000. The second is flux, and the third is its quoted error. Continuum units are $10^{-15}\,\mathrm{erg\,s^{-1}\,cm^{-2}\,\mathring{A}^{-1}}$; integrated line units are $10^{-13}\,\mathrm{erg\,s^{-1}\,cm^{-2}}$. The archive says host starlight and the narrow line component have not been removed. These are observed fluxes, not the synthetic driver used by the Lab.

## Run from an empty output directory

Save the ZIP as agn-reverberation-tutorial.zip and run:

```
python3 -m zipfile -e agn-reverberation-tutorial.zip .
cd observed-reverberation
python3 -B replay.py --out recomputed
```

The first command extracts the archive; the script then downloads and checks both original files before selecting the season. A source-byte mismatch stops the run. If the archive is unavailable, use the exact files downloaded earlier and pass --source-dir followed by their directory. A changed upstream file must be investigated, not accepted by replacing the expected checksum.

The portable settings select the inclusive interval $47509\leq \mathrm{JD}-2400000\leq47809$. There are 125 continuum points and 132 line points in this 1989 season. Read input.json for the original URLs, byte counts, SHA256 digests and analysis choices.

## Read the correlation before reading its maximum

Positive lag means the line follows the continuum. The symmetric ICCF evaluates two interpolation directions and averages their correlations. It uses linear interpolation inside the observed range, never extrapolation. Each direction requires at least eight overlapping pairs. The lag grid runs from minus forty to sixty observer-frame days at quarter-day spacing. The baseline calculation does not impose a maximum interpolation gap.

The maximum is at $21.5\,\mathrm{d}$, with correlation coefficient about $0.877274$. The centroid uses only the contiguous region around that principal peak above eighty percent of its height. Here that region runs from $8.25$ to $31.0\,\mathrm{d}$, and the correlation-weighted centroid is $19.669497497\,\mathrm{d}$.

![Derived correlation of the real 1989 NGC 5548 light curves peaks at twenty-one and a half observer days; shading marks the centroid selection.](https://sandboxphysics.com/astronomy/ac52/figures/observed-lag.en.svg)

Derived analysis of the selected real AGN Watch observations. The curve is the symmetric interpolated correlation; the shaded band marks the contiguous threshold region used for this centroid. Its width is not a lag confidence interval.

The centroid interval is a set of selected grid points, not an uncertainty interval. With source redshift $z_{\rm cos}=0.0167$, divide by $1+z_{\rm cos}$ to get $19.346412410\,\mathrm{d}$ in the source rest frame.

For comparison, [Peterson and collaborators’ 2002 paper](https://arxiv.org/pdf/astro-ph/0208064v1), Section 3.2 and Table 8, gives an observer-frame first-season centroid of $19.73^{+2.03}_{-1.40}\,\mathrm{d}$ and peak of $21.5\,\mathrm{d}$. The portable analysis recovers the scale and peak, not every published digit. Its exact archived bytes, lag grid and estimator are declared separately.

## Perturb the measured fluxes and observing nights

The full run makes 400 seeded flux-randomization/random-subset-selection realizations. It samples the observing epochs with replacement. An epoch selected several times is kept once, with its error reduced by the square root of that multiplicity, then perturbed with Gaussian noise. The two curves are sampled independently. This follows the modified approach described in [Peterson and collaborators, 2004, Appendix A](https://arxiv.org/pdf/astro-ph/0407299v1).

The frozen run accepts all 400 realizations, with zero failed summaries and zero peaks at the lag-grid endpoints. Observer-frame centroid percentiles sixteen, fifty and eighty-four are $18.2493$, $20.0717$ and $21.5587\,\mathrm{d}$. The corresponding rest-frame values are $17.9496$, $19.7420$ and $21.2046\,\mathrm{d}$. These finite-sample percentiles describe the chosen procedure; they are not a posterior, a detection significance or a calibrated coverage statement.

Notice that the median resampled centroid differs from the original-data centroid. They are summaries of different calculations. Keep both labels when reporting them.

## Try a different portion of the season

The saved results also repeat the correlation over the first and last 180-day windows. Their centroids are about $21.6459$ and $15.7200\,\mathrm{d}$. Rejecting interpolation across gaps longer than ten days in the full season gives about $20.8586\,\mathrm{d}$. The windows overlap, so these are sensitivity checks, not independent measurements.

A lag that changes under those choices can reflect sampling, changing variability structure or a changing physical response. The tests do not separate those causes. They show why the complete correlation and chosen dates belong beside the reported number.

## Compare three restricted response models

The script fits an amplitude and constant background for a delta response and for top-hat responses ten and thirty days wide. All three use the same 115 line observations, interpolate the observed continuum, and scan causal mean delays on a one-day grid. The top-hat integrals use forty midpoint samples.

| Response width | Best mean delay | Chi-square |
| --- | --- | --- |
| Zero days | Twenty-two days | 180.517 |
| Ten days | Twenty-one days | 137.007 |
| Thirty days | Twenty-one days | 157.509 |

Each comparison has 112 residual degrees of freedom, counting the scanned delay and two fitted coefficients. Only the line-flux errors enter the objective. Continuum interpolation uncertainty is omitted, so the ranking is conditional on that simplification. A lower value among these three responses does not select a unique gas geometry.

## Keep the outputs that explain the answer

The recomputed directory contains analysis.json, the selected-season CSV files, iccf.csv and conditional-response-fits.csv. Compare the full-run results with expected.json using the supplied numeric tolerances. The --quick option skips resampling and the frozen full-result comparison, so it is an exploration mode.

Before reusing the analysis, record the source hashes, date window, lag sign, interpolation rule, threshold, frame and resampling convention. To infer a black-hole mass you would additionally need an appropriately defined line width and geometric factor. This integrated-light-curve exercise supplies the timing step.

## Sources

[AGN Watch optical archive](https://www.asc.ohio-state.edu/astronomy/agnwatch/n5548/lcv/), original optical section, file formats, revision label and contamination notes.

[Peterson and collaborators, arXiv:astro-ph/0208064v1](https://arxiv.org/pdf/astro-ph/0208064v1), Section 2.1, Section 3.2 and Table 8. These source definitions and selected results were read; the whole historical observing campaign was not reprocessed.

[Peterson and collaborators, arXiv:astro-ph/0407299v1](https://arxiv.org/pdf/astro-ph/0407299v1), Section 4 and Appendix A, for the modified resampling method. The paper’s complete database analysis was not reproduced.

## Try the prediction

### [Use a known response to understand an observed lag](https://sandboxphysics.com/labs/agn-reverberation/)

1. In the Lab, predict how radial spread smooths a flash and compare the resulting light curves.
2. In the downloaded tutorial, recompute the AGN Watch correlation and inspect its complete peak.
3. Explain why fitting a short light curve cannot select a unique three-dimensional gas geometry.

## Keep reading

Measure a black hole with light echoes · Reading path

### Measure a black hole with light echoes

1. [Article **How a black hole can be measured with an echo**](https://sandboxphysics.com/stories/agn-reverberation/why-gas-echoes-around-black-holes/)
2. [Article **Find the extra distance travelled by an echo**](https://sandboxphysics.com/stories/agn-reverberation/light-travel-time-and-delay-surfaces/)
3. [Article **Turn an orbiting ring into a velocity–delay map**](https://sandboxphysics.com/stories/agn-reverberation/velocity-delay-maps-and-keplerian-motion/)
4. [Article **Measure a lag before turning it into a mass**](https://sandboxphysics.com/stories/agn-reverberation/measuring-lags-and-virial-products/)
5. [You are here **Recompute an observed echo in NGC 5548**](https://sandboxphysics.com/stories/agn-reverberation/recomputing-an-observed-reverberation-lag/)
6. [Article **Read a velocity–delay map as an inference from changing spectra**](https://sandboxphysics.com/stories/agn-reverberation/reading-velocity-resolved-reverberation/)

### Related reading

1. [Article **How a black hole can be measured with an echo**](https://sandboxphysics.com/stories/agn-reverberation/why-gas-echoes-around-black-holes/)
