MegaCam Direct Imaging Exposure Time Calculator (DIET)

The basics:


Table of contents:


The calculator



Click on this figure to launch the calculator.


Quick MegaCam photometric performance table

Filter u*g'r'i'z'
Modal image quality (PSF fitting) 0.85"0.75"0.69"0.63"0.63"
Point source in dark sky - MagAB 25.025.524.924.423.5
Point source in grey sky - MagAB 24.325.124.724.423.5
Field galaxy in dark sky - MagAB 24.625.024.423.923.0
Field galaxy in grey sky - MagAB 23.824.624.223.923.0
Transition from AB to Vega magnitude system (mag) -.346+.092-.171-.401-.554

This table summarizes the camera performance at SNR=10 (the specific metric is explained in this page) for a 1 hour exposure under modal seeing conditions (2003 to 2009 statistics) with an airmass of 1.2 (an important difference in sky brightness for the i' and z' filters vs. zenith). 1.2 is the standard airmass data tend to be collected at CFHT. Those are AB instrumental magnitudes (MegaCam natural magnitudes). Doubling the exposure times leads to a gain of +0.4 on the limiting magnitude [+2.5log10(sqrt(2))]. Obtaining 0.1" better image quality leads to a gain of +0.15 on the limiting magnitude for point sources [+2.5log10(NewIQ/OldIQ)]. Based on the profiles adopted for stars and galaxies for this calculator, the difference in depth at a given SNR between those two classes amounts to 0.5 magnitude.


1. How DIET works

DIET calculates the exposure time required to reach a given signal-to-noise ratio in various observing conditions (source type, magnitude, filter, seeing, sky background, airmass). DIET is based on signal-to-noise estimations (Flux/Noise) over an optimal aperture specific to the type of source considered, the delivered image quality on the image, and the sky background.

DIET's computations are based on camera performance derived from the characterization of the instrument. The observing conditions (sky brightness, camera zero points, ...) are the values given in the "General Summary" table.

DIET was calibrated and tested using single raw images from the camera. Be aware that it does not reflect the realities of the observing world to account for the segmentation of the global time budget within several dithered exposures as well as the inevitable fluctuations of the parameters (image quality, sky background) between exposures. MegaCam is used in the vast majority of the science programs with dithering patterns and stacking procedures implying ressampling in most cases which all work towards reducing the depth of the final integration (the commonly use median estimator will cause for example a typical lost of ~0.2 mag. over the average estimator). Also CFHT's QSO validation schemes often relax by up to 15% the requirements for the observing program (image quality, sky background, sky absorption), also all working towards reducing the the depth of the final integration. It is up to the user to account for this when preparing the time proposal - it is advised to add 0.2 magnitude to the desired depth when using DIET if you are planning to stack dithered exposures.

Doubling the exposure time leads to a gain of +0.4 on the limiting magnitude [+2.5log10(sqrt(2))] while a step of 0.1" better image quality leads to a gain of +0.15 on the limiting magnitude for point sources [+2.5log10(NewIQ/OldIQ)] and a factor of two-third lower for field galaxies (+0.1 mag.)

The interactive graphical interface allows the user to experiment with some custom parameters. This iterative process can be time consuming for a single set of parameters: it is recommended to use the keyword "Range" for both parameters "Seeing" and "Sky" to obtain small tables exploring the domain of input conditions.

The magnitude system in DIET for MegaCam is AB. The following link (courtesy of D. Patton) provides information on the various magnitude systems and ways to go from one to another: http://www.astro.utoronto.ca/~patton/astro/mags.html.


2. Information on how DIET computes exposure times vs. magnitudes and SNRs

The following paragraphs propose a tutorial on the magnitude and signal to noise calculation schemes used in DIET.

2.1 Object types

There are two classes of seeing dominated profiles (small sources) considered in DIET:
    • Point sources: stars, QSOs and distant compact galaxies
    • Extended sources: sub-compact and bulge dominated galaxies

2.2 Objects profiles

As provided in Iraf's Imexamine function, a Moffat function is used to fit all the profiles:

I = Ic (1 + (r / alpha)^2)^(-beta) [1]

where Ic is the peak value, r is the radius, and the parameters are alpha, and beta. The alpha value is equal to half the FWHM of the object which is the seeing for seeing dominated profiles, and the object width at half maximum for larger sources. The beta parameter defines the profile type, i.e. how much energy is distributed in the wings of the profile. Based on matching DIET results to MegaCam raw data (no ressampling), the optimal value for seeing dominated profiles is 3.0 for point sources and 2.3 for field galaxies (extended sources).

2.3 Exposure time and SNR computation

Equation [1] can be integrated over the profile and the flux within an aperture of r=R is: (Mathematica integration)

F(R) = (Pi Ic alpha^2)/(1 - beta) ( (1 + (R / alpha)^2)^(-beta + 1) - 1) [2]

If R is infinite, the flux represents the total flux received from the object:

F(total) = (Pi Ic alpha^2)/(beta - 1) [3]

Equation [2] becomes:

F(R) = F(total) ( 1 - (1 + (R / alpha)^2)^(-beta + 1)) [4]

And F(total) can be computed simply from the magnitude equation, considering flux in electrons per second (Fe):

MagAB = Zero - k(a - 1) - 2.5log10 (Fe) [5]

With Zero the zero photometric point in electron per second, k the airmass term, a the airmass and Fe the total flux in electrons generated per second by the object of magnitude MagAB.

Fe = 10^((Zero - MagAB - k(a - 1)) / 2.5) [6]

Integrated over the exposure time Texp, we have:

F(total) = Fe Texp [7]

Now let us compute the signal to noise ratio over the aperture of radius R (flux considered in electrons):

SNR = F(R) / ( sqrt( F(R) + n Pi R^2 (Se Texp + noiseccd^2)) ) [8]

Where Se is the flux in electrons per second and per pixel coming from the sky background and noiseccd is the CCD readout noise. Pi*R^2 represents the circular area of integration of the profile. Since the sky background to be subtracted from underneath the object is more often than not totally noise-free due to some modelling problem or crowding, the factor n is introduced. n can range from 1 for a perfect sky subtraction to 2 for a 1-1 pixel type subtraction. n could be higher than 2 actually in some crowded fields when some earby object flux is subtracted to the object itself. In DIET, based on real data, a value of n=1.5 is used for point sources and extended sources.

Now solving the quadratic equation from [8] for Texp, one gets:

Texp = ( -b + sqrt (b^2 - 4 a c) ) / 2 a [9]
a = Fe^2, b = -SNR^2 (Fe + n Pi R^2 Se), c = -SNR^2 n Pi R^2 noiseccd^2

2.4 Optimal radius of flux integration for SNR measurement

Maximizing the SNR over R for point spread functions, the relationship Ropt = 2.8 * alpha is obtained (which corresponds to a 2.2 arcsec aperture for a 0.8 arcsec seeing). This results in measuring 98% of the flux within the aperture. To integrate 98% of the flux for the galaxies which carry more weight in their wings, the relation becomes Ropt = 4.3 * alpha (which corresponds to a 3.4 arcsec aperture for a 0.8 arcsec seeing).

By picking a radius for both cases that lead to the integration of 98% of the light, the difference (in theory) in magnitude between the total magnitude and the magnitude within the aperture is 0.02 magnitude. A small amount which can be ignored when comparing the DIET results to real data.

2.5 Direct relation between the SNR and the error on the magnitude

Let us consider a simplified expression of the magnitude vs. flux measurement: m = -2.5 log(f). The error Em on m can be written Em = |dm/df| Ef where Ef is the error on f. Since |dm/df| = (1 / f)(2.5 / ln(10)), one gets Em = 1.09 (1 / (f / Ef)). Since SNR = f / Ef, the final relation is:

SNR = 1.09 / Em [10]

Where SNR is the signal to noise ratio on the object and Em the error on the magnitude on that object. For example, a error in magnitude of 0.1 mag gives a SNR of ~10, say a ~10% error. This SNR metric is also known as the "n-sigma" metric.

When using a source extraction software like SExtractor (the most commonly used tool today for large images) the error on the magnitude is estimated within the defined aperture. SExtractor derives the variance of the background (should it be sky background and/or detector read noise) regardless of its level. Hence it assumes the image is not affected by a convolution and/or resampling. In that regard, all the testing of DIET was done directly on raw data, knowing that further pre-processing and processing should increase the detection performance and the quality of the photometry.

2.6 Relation between SNR and photometry quality

    • SNR = 5 : Detection - Photometry error = 25%
    • SNR = 7 : Fair detection - Photometry error = 15%
    • SNR = 15 : Good detection - Photometry error = 7%
    • SNR = 25 : Quality photometry - Photometry error = 4%
    • SNR = 100 : High quality photometry - Photometry error = 1%


3. Examples of MegaCam photometric performance and image samples

3.1 Camera and site characteristics used in DIET

Magnitude system AB
Instrumental magnitude equation MagAB = Zp[e-/sec] - 2.5log(Flux[ADU])
-2.5log(Gain[e-/ADU]) + 2.5log(ExpTime)
- k(airmass - 1)
Filters u*, g', r', i', z'
Zero points (e-/sec), ref. CCD00 g=1.62 e-/ADU 25.77, 26.96, 26.47, 26.24, 25.30
Airmass term 0.350, 0.150, 0.100, 0.040, 0.030
Dark sky brightness @ zenith (e-/pix/sec) 0.580, 3.340, 4.170, 8.350, 8.350
Grey sky brightness @ zenith (e-/pix/sec) 2.340, 6.680, 6.260, 8.350, 8.350
Bright sky brightness @ zenith (e-/pix/sec) 9.350, 13.36, 9.390, 8.350, 8.350
Sky brightness airmass dependency offset (e-/airmass) 0.340, 0.340, 2.460, 11.60, 11.90
Transition from AB to Vega magnitude system (mag) -.976, +.007, -.164, -.400, -.533
Pixel scale (arcsec / pixel) 0.187
Read noise (e- / pixel) 5

3.2 Practical example: point sources in a non crowded environment

The following example is based on the CCD13 originating from the image ID=712976o, a r' 300 seconds exposure taken at 1.08 airmass presenting an image quality of 0.62" (MOFFAT fit) and a sky background of 3.5 electron per pixel and per second (bias subtracted data only). The gain of the CCD is 1.7 electron per ADU, and the photometric zero point is 32.02 (in ADU units).

The following stars (see table) from the frame 712976o were part of the set used to compare DIET predictions with SExtractor measurements. First the diameter for the aperture photometry extraction must be obtained from DIET: run DIET with the 0.6" seeing explicit case (not Range) and you will be given "SNR di=9.0pix" in the general parameters feedback in the result area. The SExtractor configuration file is then set with PHOT_APERTURES=9.0 with the following other parameters set to their respective values too: SEEING_FWHM (0.62), GAIN (1.7), MAG_ZEROPOINT (32.02). The total magnitude (MAG_AUTO) must be obtained from the generated catalog and the error on the magnitude in the optimal aperture (MAGERR_APER) is converted to a signal-to-noise ratio with the formula [10]. These two values are then entered in the DIET input fields (also setting the precise sky background value in e-/pix/sec). The granulation of the seeing parameter may be a bit limitative but taking values on both sides should give a fairly good idea of the performance (the following examples were obtained in command line mode where a precise seeing value of 0.62" can be entered).

Star Xpox,Ypox Mag. (MAG_AUTO) SNR over optimal aperture (8.7px) DIET output
A 1135,1814 21.12 101.6 271
B 1946,1864 22.75 28.7 339
C 996,1791 23.20 17.3 276
D 1132,1669 23.43 14.8 304
E 946,1864 24.41 6.2 316

The computed exposure times are in good agreement with the actual integration of 300 seconds.



Figure 1. Profile and Moffat fit of star "A". Note that the optimal radius adopted by DIET is 4.5 pixels where the flux in the wings of the PSF levels out and gets dominated by the sky background.

3.4 Practical example: field and nearby galaxies

This second example originates from the image ID=707909o, a r' 360 seconds exposure taken at 1.27 airmass presenting an image quality of 0.71" (MOFFAT fit) and a sky background of 4.7 electron per pixel per second (bias subtracted data only). The gain of the CCD is 1.7 electron per ADU (this is a raw frame corrected only for the overscan), and the photometric zero point is 32.16 (in ADU units).

The following galaxies from the frame 707909o were part of the set used to compare DIET predictions with SExtractor measurements. First the diameter for the aperture photometry extraction must be obtained from DIET: run DIET with the 0.7" seeing explicit case (not Range), you will be given "SNR di=16.1pix" for the "Field Galaxy" case in the general parameters feedback in the result area. The SExtractor configuration file is then set with PHOT_APERTURES to 16.1 with the following other parameters set to their proper value: SEEING_FWHM (0.71), GAIN (1.7), MAG_ZEROPOINT (32.16). The procedure then follows the same logic as in the point source cases. The results are presented in the following table:

Galaxy Xpox,Ypox Mag. (MAG_AUTO) SNR over optimal aperture (16.1px) DIET output
A 1174,2486 19.72 191.2 310
B 1354,2637 21.03 68.1 363
C 1249,2588 21.98 28.7 352
D 1128,2458 22.14 25.1 359

The computed exposure times are in good agreement with the actual integration of 360 seconds.



Figure 2. Profile and Moffat fit of the nearby galaxy "D". The plot ends just at the radius of the aperture used to integrate the flux (8px) as the profile is indeed leveling out to the sky background.


4. How to compare DIET results with your way of computing SNRs

First retrieve the two images used to generate the previous examples:

Star field: 712976o13O.fits
Galaxy field: 707909o13O.fits

Then run your usual source extraction tool to compute magnitudes and errors and compare it for the objects depicted above. Their Xpos,Ypos coordinates originate from these files. The zero points and other image specifications are provided in the above sections.


5. How to optimally fragment the total exposure time

To efficiently remove the cosmic rays and cosmetic defaults of the mosaic (gaps between the CCDs, bad columns), a minimum of 4 dithered exposures per field is required, though 5 is recommended to obtain a more uniform SNR across the gap areas.

Each exposure should however be in sky photon noise regime such that when exposures are later added together, the expected signal to noise ratio will be obtained (i.e. grows as square root of cumulated exposure time). The readout noise is low on MegaCam and is quickly dominated in the broad band filters by the sky photon noise. Taking a typical readout noise of 5 electrons, and using the darker sky brightness (dark time, 1.0 airmass), the minimum exposure time to use in order for the readout noise to be dominated by a factor of 10 by the sky background photon noise (that is: 10 * 5^2 = 250 electrons) is:

  • u* band: 5 mn
  • g' band: 80 sec
  • r' band: 70 sec
  • i' band: 35 sec
  • z' band: 36 sec

The saturation level should also be a consideration: exposing too long will indeed save a couple of minutes by skipping some readouts but will result in high sky background and several objects reaching saturation. Typically, the following exposure times are a good compromise to achieve low overheads while keeping the signal in a reasonable range:

  • u* band: 10 mn (to limit the impact of the atmospheric refraction)
  • g' band: 12 mn
  • r' band: 12 mn
  • i' band: 10 mn
  • z' band: 10 mn

One should consider that taking exposures as short as possible would result in a massive amount of data difficult to handle. In the end, it has to be a compromise between having at least 5 exposures all longer than the minimal time to reach sky photon noise dominated regime and equal or shorter than the recommended exposure times from this last table.