# Calculation of `teff`¶

This section provides more detailed information on the calculation of effective exposure time `teff`.

`teff` for an exposure is defined to be the length of time one would need to expose under conditions of
clear, dark skies at zenith with the PSF size equal to the historical median value at zenith for the
particular filter in order to achieve the same signal/noise ratio for a sky-limited point source as in the
actual exposure. For DES, `teff` is normalized by the actual exposure time; thus, teff=1 means that the
effective exposure time is the same as the actual exposure time, teff < 1 means that the achieved S/N is
low due to conditions being poor.

In equations, `teff` ~ 10^(--2*cloudmag/2.5) * 10^(--skymag/2.5) / FWHM^2

where cloudmag = 0 for clear skies, skymag = 0 for sky brightness at nominal dark sky value,
FWHM = 1 at normal historical value.

Note that the measured psf, sky, and flux are not corrected to zenith; thus, to achieve `teff=1` at high
airmass, one must have exceptionally good observing conditions.

Nominal wavelengths for each filter are as follows:

 Filter Wavelength (microns) `u` 0.385 `g` 0.48 `VR` 0.64 `r` 0.74 `i` 0.78 `z` 0.92 `Y` 1.00

Dark Sky at Zenith. Note that these will vary slightly as the
telescope throughput changes (e.g., dust on mirror), but correction
are not included in the code.

 Filter Sky (ADU/sec/pixel) `u` 2.0 `g` 1.05 `VR` 7.07 `r` 2.66 `i` 7.87 `z` 16.51 `Y` 14.56

The median seeing in the `i` band at zenith is taken to be 0.90 arcsec.
The median seeing at other wavelengths is assumed to scale as
`(wave/wave_i)^{-0.2}`

`teff` for each component is computed as follows:

 PSF: `teff = (fwhm_0/fwhm)^2` SKY: `teff = (sky_0/sky)` CLOUDS: `teff = 10^{-2.*(cloud-0.2)/2.5}`

Here, `fwhm_0` and `sky_0` are the nominal values for the particular filter. The total `teff` is the
product of all three values, with the caveat that `teff` for clouds can never be > 1. A constant 0.2 is
subtracted from the measured cloudiness as a safety margin to account for the fact that the standard star
catalogs are not very reliable and can be off by up to 0.2 mag.

Cloudiness is computed as follows. First, for a given star, the total flux in ADU is computed by fitting
a `sech^2` function (which closely matches a Moffat `beta=3.5` profile). An instrumental magnitude is
defined as `mag_inst = -2.5 log10(flux/exptime) + 26`. No corrections are made for extinction; objects
observed at high airmass in the g band will always appear to have a bit of "cloudiness". An intermediate
"`magoff`" is computed as `magoff = mag_inst - mag_std`, where `mag_std` is the standard star magnitude
taken from the NOMAD or APASS catalogs. An offset is then applied to `magoff` to derive a reduced
magnitude difference, which is the `cloud` parameter.

The particular standard star bandpass and offsets depend on the filter and catalog. The equations used
are here:

#NOMAD - data from 2013 Sep 8,11,12,18,19,22,23,27 Oct 2,3,9,10,11,12 (magoff)
#Use median correction to magoff

 g = B + 1.39 +/- 0.18 VR = V*+ 0.53 +/- 0.17 r = V*+ 0.93 +/- 0.17 i = J + 2.53 +/- 0.15 z = J + 2.51 +/- 0.08 Y = J + 3.53 +/- 0.04 V* = (2*B + J)/3.

#APASS - same data

 g = g' + 1.16 +/- 0.05 VR = r' + 0.11 +/- 0.06 r = r' + 0.71 +/- 0.06 i = i' + 0.91 +/- 0.08 z = i' + 1.39 +/- 0.13 Y = i' + 2.48 +/- 0.08

NOMAD B band data include an additional correction that depends on declination.