Skip to main content

Tutorial 4: Time Delays

:::info Migrated from Old Wiki This tutorial was created from content in the old GLEE wiki. Content should be double-checked for accuracy. :::

:::tip Prerequisite Before working with time delays, complete Tutorial 2: Image Plane Positions to have a well-converged mass model. :::

Introduction

Gravitationally lensed quasars show time delays between multiple images due to:

  1. Geometric delay: Different path lengths through curved spacetime
  2. Gravitational potential delay (Shapiro delay): Different potential wells

Measuring these delays enables cosmological constraints, particularly on the Hubble constant H0H_0:

ΔtijDΔtc[12θiθj2(ψiψj)]\Delta t_{ij} \propto \frac{D_{\Delta t}}{c} \left[ \frac{1}{2}|\vec{\theta}_i - \vec{\theta}_j|^2 - (\psi_i - \psi_j) \right]

where:

  • DΔt=(1+zd)DdDsDdsD_{\Delta t} = (1+z_d) \frac{D_d D_s}{D_{ds}} is the time-delay distance (Mpc)
  • θi\vec{\theta}_i is the image position
  • ψi\psi_i is the lensing potential at image ii

Time delays are typically measured via light curve monitoring campaigns (e.g., COSMOGRAIL, H0LiCOW).


Enabling Time-Delay Fitting

To incorporate time-delay constraints, add chi2type tmd (or numerically: chi2type 128):

chi2type img tmd

This combines image-plane positions (img) with time-delay measurements (tmd).

:::note Chi2 Type Combinations

  • chi2type 2 → image positions only
  • chi2type 128 → time delays only
  • chi2type 130 → image positions + time delays (recommended)

The keyword syntax (img, tmd) is preferred over numbers. :::


Specifying Time Delays

Method 1: Gaussian Uncertainties (Simplest)

For time delays with symmetric Gaussian errors:

sources 1
Dds/Ds 1.0 exact:
Dt 1919.0 flat:0,4000 step:100.0
source weighted
srcx 3.640 exact:
srcy 3.706 exact:
4
4.670 3.962 error:0.004 t:33.2,1.4
3.957 4.074 error:0.004 t:33.2,1e+06
2.479 2.701 error:0.004 t:0,0
4.589 2.422 error:0.004 t:58.7,2.4

Syntax: t:value,error

  • value: Time delay in days (relative to reference image)
  • error: 1-sigma uncertainty (days)

Reference image: t:0,0 (zero delay, zero error). Must have exactly ONE reference per system.

:::caution Reference Image Selection

  • Set delay to 0 for the reference image
  • For other images with unmeasured delays, use large error: t:value,1e+06 (effectively unconstrained)
  • GLEE has not been thoroughly tested with non-zero reference delays :::

Time-Delay Distance (Dt)

In single-plane lensing, GLEE needs the time-delay distance to predict delays:

DΔt=(1+zd)DdDsDds[Mpc]D_{\Delta t} = (1+z_d) \frac{D_d D_s}{D_{ds}} \quad [\text{Mpc}]

Configuration:

  • Fixed cosmology: Dt value exact: (if H0H_0 is known)
  • Constrain H0H_0: Dt value flat:min,max step:dS (vary to measure H0H_0)

Example (fixing DΔtD_{\Delta t} for H0=70H_0 = 70 km/s/Mpc):

Dt 1919.0 exact:

Example (varying to measure H0H_0):

Dt 1919.0 flat:1000,3000 step:50.0

:::tip Measuring H0H_0 The posterior distribution of DΔtD_{\Delta t} directly constrains H0H_0 via:

H0=cDΔt(1+zd)DdDsDdsH_0 = \frac{c}{D_{\Delta t}} (1+z_d) \frac{D_d D_s}{D_{ds}}

Use MCMC to sample the DΔtD_{\Delta t} posterior, then convert to H0H_0. :::


Method 2: Correlated Uncertainties

If time-delay errors are correlated (common in monitoring campaigns), provide a covariance matrix:

4.670 3.962 error:0.004 t:33.2,1.4 tcovmatfile:tdcov_inverse.dat
3.957 4.074 error:0.004 t:33.2,1e+06
2.479 2.701 error:0.004 t:0,0
4.589 2.422 error:0.004 t:58.7,2.4

File format: tdcov_inverse.dat is the inverse covariance matrix (precision matrix):

C1=Cov[Δt]1\mathbf{C}^{-1} = \mathbf{Cov}[\Delta t]^{-1}

Dimensions: (N-1) × (N-1), where N = number of images with delays (excluding reference)

Example (3×3 matrix for 4 images, 1 reference, 3 measured delays):

0.5102040816 0.0000000000 0.0000000000
0.0000000000 1.0000000e-12 0.0000000000
0.0000000000 0.0000000000 0.1736111111

Order: Rows/columns correspond to image order in config file (excluding reference).

:::warning Covariance Notes

  • tcovmatfile: can appear on any image line (GLEE will find it), but specify it only once
  • When tcovmatfile: is provided, the individual t:value,error uncertainties are ignored (only values are used)
  • Matrix must be symmetric and positive definite :::

Method 3: Non-Analytic Distributions

If time-delay probability distributions are non-Gaussian (e.g., from deconvolution methods), use tfile::

4.670 3.962 error:0.004 tfile:tdelay_im1.dat
3.957 4.074 error:0.004 tfile:tdelay_im2.dat
2.479 2.701 error:0.004 t:0,0
4.589 2.422 error:0.004 tfile:tdelay_im4.dat

File format (tdelay_im1.dat):

  • Two columns (NO header)
  • Column 1: Time delay values (must increase by constant increment)
  • Column 2: Probability density P(Δt)P(\Delta t) (need not be normalized)

Example:

-5.0 0.001
-4.9 0.003
-4.8 0.010
...
33.2 0.150 # Peak at measured value
...
70.0 0.001

Chi-squared: GLEE approximates χtmd22lnP(Δtpred)\chi^2_{\text{tmd}} \approx -2 \ln P(\Delta t_{\text{pred}})

:::caution File Requirements

  • Time delay column must increment uniformly: Δti+1Δti=const\Delta t_{i+1} - \Delta t_i = \text{const} (tolerance: 1e-6)
  • One reference image must still use Gaussian format: t:0,0
  • Do NOT mix t: and tfile: for the same image :::

Microlensing Time Delays (Advanced)

Microlensing by stars in the lens galaxy can introduce stochastic time delays (~days to weeks). To marginalize over microlensing:

Step 1: Provide Microlensing Probability Distributions

4.670 3.962 error:0.004 t:33.2,1.4 tmicrofile:tmicro_im1.dat
3.957 4.074 error:0.004 t:33.2,1e+06 tmicrofile:tmicro_im2.dat
2.479 2.701 error:0.004 t:0,0 tmicrofile:tmicro_ref.dat
4.589 2.422 error:0.004 t:58.7,2.4 tmicrofile:tmicro_im4.dat

File format: Same as tfile: (two columns: microlensing delay, probability)

Step 2: Enable Microlensing in Chi2

At the top of your config file:

microlens_time_delay_in_chi2 yes

How it works:

  • At each MCMC step, GLEE randomly samples Δtmicro,i\Delta t_{\text{micro},i} from tmicrofile:
  • Predicted delay: Δtpred,i=Δtgeom+pot,i+Δtmicro,i\Delta t_{\text{pred},i} = \Delta t_{\text{geom+pot},i} + \Delta t_{\text{micro},i}

:::danger Critical Requirement Each image must have a UNIQUE microlensing file. If two images share the same file (name or content), GLEE will draw the same random values → incorrect cancellation of Δtmicro,iΔtmicro,j\Delta t_{\text{micro},i} - \Delta t_{\text{micro},j}.

Solution: Generate independent realizations for each image, even if distributions are similar. :::

:::note Discretization GLEE samples from the discrete values in column 1 of tmicrofile:. Use fine discretization (small dΔtd\Delta t) for smooth sampling. :::


Advanced Options

Predicted Delay Positions

Specify whether to compute predicted delays at observed or predicted image positions:

time_delay_chi2_positions observed_image_positions

or

time_delay_chi2_positions predicted_image_positions

Default: observed_image_positions

Use case:

  • observed_image_positions → More physically motivated (delays measured at observed locations)
  • predicted_image_positions → Useful for testing model-predicted image configurations

:::note Source Position In single-plane lensing, the source position for delay calculation is determined by the source option (weighted, parameter, etc.). In multiplane lensing, GLEE ray-traces from each observed image position to get (potentially different) source positions. :::


Workflow: Adding Time Delays to a Model

  1. Start with image-plane fit (Tutorial 2) → Get baseline mass model
  2. Add time-delay constraints:
    chi2type img tmd
    Dt 1919.0 flat:1000,3000 step:50.0
  3. Specify delays in sources block (use t:, tcovmatfile:, or tfile:)
  4. Run MCMC to sample posterior:
    glee.py mcmc configfile_img_tmd
  5. Check convergence:
    glee.py chi2 -c img tmd -- configfile_img_tmd_mcmc_best
  6. Extract H0H_0 constraints from DΔtD_{\Delta t} posterior distribution

:::tip H0LiCOW Approach For Hubble constant measurements:

  • Combine lens model (this tutorial) with external line-of-sight mass distribution
  • Marginalize over mass-sheet degeneracy using kinematics
  • Report H0H_0 with full systematic error budget

See Suyu et al. (2013), Bonvin et al. (2017), and H0LiCOW collaboration papers. :::


Checking Time-Delay Chi2

After optimization, verify the time-delay fit quality:

glee.py chi2 -c tmd -- configfile_img_tmd_mcmc_best

Good fit indicators:

  • χtmd2/dof1\chi^2_{\text{tmd}} / \text{dof} \lesssim 1
  • Predicted delays within 1-2σ\sigma of observed values

Diagnostics:

glee.py analyse configfile_img_tmd_mcmc_best

This outputs predicted vs. observed delays for each image.

:::warning Common Issues

  • Poor χtmd2\chi^2_{\text{tmd}}: Mass model may not be well-constrained; check image-plane fit first
  • Large DΔtD_{\Delta t} posterior: Add external priors (e.g., velocity dispersion) to break mass-sheet degeneracy
  • Microlensing mismatch: Ensure tmicrofile: distributions are realistic (consult microlensing simulations) :::

Summary

FeatureSyntaxUse Case
Gaussian delayst:value,errorSimple, symmetric uncertainties
Correlated errorst:value,error tcovmatfile:file.datMonitoring campaign covariances
Non-Gaussiantfile:delay_dist.datAsymmetric or multi-modal posteriors
Microlensingtmicrofile:micro_dist.dat + global flagMarginalize over stellar microlensing
Time-delay distanceDt value flat:min,maxConstrain H0H_0
Reference imaget:0,0Required for all systems with delays

:::tip Next Steps

  • Combine with extended source reconstruction (Tutorial 3) for full surface brightness + time-delay modeling
  • Explore multiplane lensing (Tutorial 5) for line-of-sight structures
  • Use time delays to measure H0H_0 (requires external constraints to break degeneracies) :::