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:
- Geometric delay: Different path lengths through curved spacetime
- Gravitational potential delay (Shapiro delay): Different potential wells
Measuring these delays enables cosmological constraints, particularly on the Hubble constant :
where:
- is the time-delay distance (Mpc)
- is the image position
- is the lensing potential at image
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 onlychi2type 128→ time delays onlychi2type 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
0for 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:
Configuration:
- Fixed cosmology:
Dt value exact:(if is known) - Constrain :
Dt value flat:min,max step:dS(vary to measure )
Example (fixing for km/s/Mpc):
Dt 1919.0 exact:
Example (varying to measure ):
Dt 1919.0 flat:1000,3000 step:50.0
:::tip Measuring The posterior distribution of directly constrains via:
Use MCMC to sample the posterior, then convert to . :::
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):
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 individualt:value,erroruncertainties 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 (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
:::caution File Requirements
- Time delay column must increment uniformly: (tolerance: 1e-6)
- One reference image must still use Gaussian format:
t:0,0 - Do NOT mix
t:andtfile: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 from
tmicrofile: - Predicted delay:
:::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 .
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 ) 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
- Start with image-plane fit (Tutorial 2) → Get baseline mass model
- Add time-delay constraints:
chi2type img tmdDt 1919.0 flat:1000,3000 step:50.0
- Specify delays in
sourcesblock (uset:,tcovmatfile:, ortfile:) - Run MCMC to sample posterior:
glee.py mcmc configfile_img_tmd
- Check convergence:
glee.py chi2 -c img tmd -- configfile_img_tmd_mcmc_best
- Extract constraints from 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 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:
- Predicted delays within 1-2 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 : Mass model may not be well-constrained; check image-plane fit first
- Large posterior: Add external priors (e.g., velocity dispersion) to break mass-sheet degeneracy
- Microlensing mismatch: Ensure
tmicrofile:distributions are realistic (consult microlensing simulations) :::
Summary
| Feature | Syntax | Use Case |
|---|---|---|
| Gaussian delays | t:value,error | Simple, symmetric uncertainties |
| Correlated errors | t:value,error tcovmatfile:file.dat | Monitoring campaign covariances |
| Non-Gaussian | tfile:delay_dist.dat | Asymmetric or multi-modal posteriors |
| Microlensing | tmicrofile:micro_dist.dat + global flag | Marginalize over stellar microlensing |
| Time-delay distance | Dt value flat:min,max | Constrain |
| Reference image | t:0,0 | Required 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 (requires external constraints to break degeneracies) :::