SIMPLE Imaging and
(Academia Sinica Institute of Astronomy and Astrophysics)
SIMPLE-WIRCAM version: 1.3
Document version: 2.0
bug report and feedback: whwang at asiaa. sinica. edu. tw
Imaging and Mosaicking Pipeline (SIMPLE) is an IDL based system
designed for galactic/extragalactic imaging where there are no extended
objects (i.e., blank fields). It generates reasonably good
photometry. It is also capable of making large mosaics of many
sensor areas, while still maintaining the astrometry
accuracy. SIMPLE can be used on different data after simple
particular distribution (SIMPLE-WIRCAM) is optimized for WIRCAM
on the CFHT. Detailed
descriptions about the algorithms used in SIMPLE can be found in this document.
package requires the most recent version of the IDL Astronomy User's Library,
the package SExtractor,
match, and funpack:
- SExtractor will be called
from command line via the "sex" command. Please make sure this command is available. Please also modify the file sexfind.default in the pipeline directory to tell it the correct paths for your SExtractor installation.
- The program match will be called via "./match-0.31/match," meaning that the 0.13 version of match should be installed in a directory called "match-0.13" under where the pipeline is (./).
- The binary file (for your plateform) of funpack can be directly downloaded from its website and put in the pipeline directory. CFITSIO is no longer needed in this version of SIMPLE.
Recent x86 and SPARC
GHz speeds are all
fast enough. However, this package uses lot of memory to speed up
the processing. At least 2 GB of RAM is recommended for basic
reduction. For making large mosaics and cleanly removing cosmic
rays, more than 4 GB of RAM and thus a 64 bit system are required.
Flat Field and Background Subtraction
Sky flat is
generated from median-combining the dithered images. By masking detected
with a better treatment to frame-to-frame fluctuation of sky
background, artifacts caused by bright objects is minimized. Furthermore, each image has its own flat-field image, created from other images (except itself) in the dither sequence.
is also possible to use dome flat or twilight
flat. The standard background subtraction in SIMPLE-WIRCAM is to
subtract a smooth surface.
However, SIMPLE-WIRCAM is also equipped with median sky background
subtraction as an option.
Distortion Correction and Absolute Astrometry
are warped and resampled to project onto a sky plane with sub-pixel
accuracy. Distortion correction uses all detected objects in the
dithered images, and does
not rely on any external information. This is important for
since its small FOV does not always have enough cataloged stars
uniformly distributed across the FOV, especially at high galactic
latitude. Absolute astrometry is obtained by comparing the image with a reference catalog (can be from NOMAD or SDSS or 2MASS), and only a
relatively small number of objects are required. For data taken
under <0".4 seeing and with a dense source catalog of good
accuracy, the final astrometric
across one WIRCAM FOV can be as good as 0".08 rms relative
input catalog. Throughout the
reduction, astrometry in the header follows the FITS standard described
in Calabretta & Creisen (2002, A&A, 395, 1077).
are usually calibrated with 2MASS stars in the FOV (see 3.1.2).
photometry is consistent with independently reduced Subaru
photometry across 200 arcmin2 in the
The current version does not keep records of saturated pixels, so
aperture photometry on bright stars are not reliable. The current
version has functions for handling data taken under
specify the coordinate system (projection center on the sky, rotation
angle, and plate scale) for the reduced/combined images. A
tangential projection is adopted, but other projections can be
implemented by the users easily. Images
with the same coordinate system can easily be combined to form
larger mosaics accurately. The final size of the mosaic is only
limited by available RAM. Exposure time on each pixel is always
traced and recorded so the map can be deepened or widened easily.
1.5 Cosmic Ray Removal
Two methods are
provided for cosmic ray removal. The brightest
and most obvious cosmic ray hits are removed from individual exposures
with a sigma filter of 5x5 pixels. Fainter cosmic ray hits are
removed by applying a sigma filter to pixels that have the same sky
position in a dither set.
1.6 Image Weighting
Basic image weighting in SIMPLE-WIRCAM is to weight each image
according to its exposure time. An optional weighting method is
provided to weight each pixel
according to sky transparency (cloud extinction and airmass effect),
pixel quantum efficiency, sky brightness, and exposure time.
highlights the main procedures in this package that are required to
complete a full reduction, several procedures that may need some manual
tweak, and other useful procedures. Please see the
explanations in the procedure files for details.
procedure in SIMPLE-WIRCAM is reduce_wircam.
It deals with images within a dither set from the same chip. It
produces a flattened, sky subtracted, defringed, cosmic ray removed,
and distortion and astrometrically corrected mosaic image, as well as
an exposure time map. The reduced images and the exposure time
maps can be used later to form large mosaics. This procedure is
controlled by several keywords that need to be provided in the IDL
command line, and by external parameters that are stored in an ASCII
parameter file (APF). An example of APF is provided as the file HDFN.para under the pipeline directory.
derives the sensitivity offset between the two
chips. It is recommended to run this procedure at least once per
observing run, although the chip offset does not
change significantly from run to run. See field #9 in the APF
When there are
enough objects in an image with known photometry, this procedure can be
used to calibrate the image with the existing photometric
catalog. This is integrated into the standard pipeline reduce_wircam
and the mosaicking function mosaic_wide,
but can be also used as a standalone function.
Images reduced by reduce_wircam
can be combined to form large mosaics or deeper images with mosaic_wide.
In order to make the images combinable by mosaic_wide, they have to have
the same WCS. This is achieved by using identical
projection parameters in fields #4 through #7 in the APF of reduce_wircam. Photometric
calibration can be applied at this stage, using an existing photometric
catalog (most likely
It handles images taken under non-photometric conditions.
SIMPLE-WIRCAM uses Jy (or
linear units) as the default zero point. For example, a zero
1 uJy per data unit corresponds to 23.9 magnitude in AB system.
This is the
subroutine called by the main procedure that reads in a set
of dithered WIRCAM images. In the past, this procedure was sometimes useful for trouble shooting. In the current version of SIMPLE, it can be just considered as a hidden subroutine.
pipeline starts with compressed raw data provided by CFHT. fz2fits_wircam
is the first procedure in the pipeline, to uncompress the raw
data. Many processes in the pipeline rely
particular format and information generated by fz2fits_wircam
So please let fz2fits_wircam
help you and do not uncompress the files by yourself. Despite the name fz2fits, it also deals with gzipped WIRCAM data. In earlier versions, it requires the installation of CFITSIO to deal with the RICE compression adopted by CFHT. Now the users can just download the funpack
binary to the pipeline directory without worrying about CFITSIO.
This procedure can
generate a simple observing log. It may help you to decide what
files should be grouped together and feed to the main procedure.
tells you the accuracy of astrometry in a FITS image, useful for
compares fluxes of detected objects in two FITS images, useful for
If there are
satellite tracks, this procedure can remove them from the raw image.
3. Reduction Steps and Trouble Shooting
necessary preparation, the reduction can be subdivided into two
major steps: reduction of the target images, and combining multiple
reduced images into
large mosaic. An example script for a set of standard reduction
provided in the file script.example.
If successfully executed, the example script should generate an image
Below I describe some details and the associated trouble shooting.
3.1.1 Astrometric Reference Catalog
In order to
obtain absolute astrometry, one needs to prepare a reference catalog
contains enough objects with good astrometry. This can be a NOMAD catalog (or
provides minimum astrometric accuracies and numbers of stars. The
procedure recompile_nomad.pro can be
used to convert a NOMAD catalog into the required format. See recompile_nomad.pro for details.
Additional to NOMAD, another good source is SDSS. Indeed, users
can use any source catalog (2MASS, Chandra, VLA, Spitzer, another deep
ground-based image that has good astrometry, or whatever) and SIMPLE
will force the reduced image to match the provided catalog with high
accuracies. (This also means that if the provided catalog is
problematic, the results of the reduction will also be
problematic.) In general, on average more than 10
WIRCAM chip are required for OK astrometry calibration. As many as 1000 per chip will not hurt. It is also important to
make sure the distribution of the sources in the reference catalog is
uniform as possible. See fit_distortion.pro
for the format of the reference catalog.
3.1.2 Photometric Reference Catalog
photometry, one needs to provide a photometric catalog
that contains a sufficient number of stars with known fluxes in the
field of view of the observations. Usually, this is the 2MASS catalog. See
for the format of this catalog. Note that the useful magnitude
range in 2MASS could be very small. In the 2MASS bright end, the
WIRCAM can be nonlinear or even saturated. In the faint end, the
2MASS magnitude is biased by selection effect. My experience
shows that the useful magnitude range is 14--16 (Vega) for J and
12.5--14.5 for Ks. The users may want to double check this by
By the way, SIMPLE
does not like magnitudes. The reference catalog should use linear
units for flux (e.g., uJy or Jy) instead of magnitude. See explainations in calibrate.pro.
In the example directory HDFN/CATALOG, the procedure recat_2mass.pro
shows how I convert a 2MASS catalog to the flux calibration catalog
required by SIMPLE.
3.1.3 Reduction Parameter
preparation will be an ASCII file that stores the reduction
parameters (the APF), such as coordinate system, methods of
background subtraction, treatment of cosmic ray, and many others.
The filenames of the astrometric and photometric reference catalogs
mentioned above will be entered in the APT. An example and
explanations are provided in the file HDFN.para.
Note that if you wish to combine images from different reductions to
form a big mosaic, the astrometry related fields (4 through 7) should
be kept identical in all reductions.
3.1.4 File List
have to be ASCII files that tell the reduction
program what files to process. The reduction procedure is
designed to process images taken by the same chip within one dither
sequence at once. A file list contains the filenames of the first
exposure and the last
exposure, and reduce_wircam
reduces all files between these two at once, chip by chip. See read_wircam.pro
for more details about the file list. Example file lists are
provided under the directory lists.
The procedure summary_wircam
(§2.7) may help
you preparing the file lists.
When preparing the
file lists, it is highly recommended to only reduce sequences of images
taken within ~0.5 hr together. This is because the color of the
near-IR sky varies with time and usually only images taken within ~0.5 hr have
sufficiently similar background color. Keeping each reduction
sequence shorter than 0.5 hr helps to get good flat field and
background subtraction. For example, the actual observation may
contain one 50-minute dither sequence of 20 exposures. In this
case, it is better to prepare two file lists, each containing only 10
expousres, and execute reduce_wircam
on each of the file list.
Once the above
preparations are done, reducing the images should be
fairly easy and automatic, using the main procedure reduce_wircam (§2.1). Examples
are provided in the script script.example. Occasionally
there are errors. The common problems at this
stage are: wrong astrometry, imperfect background subtraction,
and crosstalk. It is always good to set the keyword individual=1
in the main procedure and this should help
the diagnosis in most cases. (You can remove the unwanted files
later.) Below describes each case.
On the other hand, if the dither sequence is too short, it may not contain enough number (> 5 is highly recommanded) of exposures to generate good sky flats. In such a case, one may want to consider using dome flat or twilight flat.
3.1.5 Chip Sensitivity
optional. There is a weight keyword
in the main reduction routine reduce_wircam.pro.
This keyword allows the users to weight each pixel according to its
quantum efficiency (and other factors such as sky brightness). To
derive the relative QE of the four chips (the relative QE of the pixels
will be taken care by the flat field), put 0 in field 9 in the APF, and
reduce a set of dithered
images on all four chips. (The results of the reduction is not
needed and can be deleted later.) Then use the procedure chip_offset (§2.2) to derive the
sensitivity offset of the four chips, and put back the chip offset
filename in field 9 in the
Note that the users
can still turn on the weight keyword
without measuring the relative sensitivity
four chips. In this case, data from the four chips will be
weighted equally. This does not affect flux
3.2.1 Problem in Astrometry
Calibration and Mosaicking
The final step
is to put all single-chip, SIMPLy reduced images together, to form a
deeper mosaic image, using the procedure mosaic_wide
(§2.3). To achieve this, there are two requirements.
First, all images to be combined have to have identical world
coordinate systems, including center of projection, platescale, and
rotation. This can be done by keeping fields 4 through 7
APF throughout the SIMPLE reduction. Second, the zeropoint
difference between the images have to
be taken into account. This is done automatically by mosaic_wide if you can provide
it the zeropoint of each image through the flux_conv
keyword. If the images are already calibrated in the main
reduction stage (see 3.1.2), then there is no need to worry about this
How do we know
there is a problem in astrometry? During the
reduction, the main procedure will tell you what is the rms astrometry
error relative to the reference catalog. It is a function of
seeing and brightness of
objects in the field, as well as the quality of the astrometry reference catalog. Usually the error should be well within 0.5
sometimes around 0.5 pixel if the seeing is bad or the quality of the
reference catalog is not too great. Any rms error larger than
that indicates something might be wrong in
astrometry. If the reduced image is warped into a very strange
shape, something is definitely wrong. (This is rare now.) You can also write the
reference catalog into a ds9 reg file and overlay the catalog objects
on the reduced image in ds9. (This could be done with the
provided with this package. See details therein.) If the
catalog objects do not match the objects in the reduced images,
something is wrong.
In a few cases,
astrometry problems are caused by the low quality of
the reference catalog, such as not having enough stars. This can
be solved by decreasing the degree of fitting in determining the
absolute astrometry, by setting the keyword fit_order=2 or
(default is 3)
One should try this first.
There may be
other problems. Always use the individual=1 keyword in the main
procedure and look at the reduction of individual exposures.
Chance is that you will spot a problem there.
3.2.2 Imperfect Background Subtraction
will see residual background in the reduced image, especially around
corners. Set individual=1 to inspect
individual images and identify the frames with background subtraction
problems. Then use the keyword more_bg_subtract
in the main procedure to specify these frames and to perform a more
aggressive background subtraction. This should
give you a very flat image background. This will also produce
artifacts on very bright and saturated stars. (Who care about
these stars anyway?) The real caveat is, the entire package is
designed to reduce images that only contain faint galaxies. So
are the background subtraction routines. The more_bg_subtract
is very aggressive and is very likely to produce inaccurate photometry
on large galaxies (larger than ~5"). This will be a
problem for observations of low-redshift clusters, for example.
For high-redshift blank-field imaging, there is less to worry about. Anyway, the suggestion is to use this keyword only if you really feel it is necessary. There are cases where the background look really bad in a few exposures. This can be caused by some rapid varying sky condition. The more_bg_subtract keyword may help to reduce the problem, but I would suggest to just leave out these images (remove their raw files).
3.2.3 Crosstalk (xtalk)
have xtalk between each of the readout channels, on data taken before
early 2008. Set dxtalk=1
(default) in the reduction routine will remove xtalk quite
cleanly. The de-xtalk feature in SIMPLE removes the 32-channel
xtalk and guidebox xtalk. It only removes the 8-channel xtalk if
a list of bright stars (that produce observable 8-channel features in
deep integrations) is provided in field 14 in the APF. If the
8-channel xtalk features appear in very deep integrations, more
aggressive de-xtalk can be used by setting dxtalk=2 or
even 3. This usually removes xtalk cleanly even in images as deep
as ~30 hr. Recent (post-2009) WIRCAM images are relatively clean in xtalk.
When publishing data processed by SIMPLE, please refer to the paper Wang et al. (2010, ApJS, 187, 251).
4. Changes in v1.3
Major changes in v1.3 are astrometry and flat fielding. The new version is much more robust and more accurate in astrometry. Failure in astrometry occurs much less often, although when there is a failure, it is quite difficult to correct. In the past, a flat field image is generated by median-combining all images in a dither sequence. In this version, N flat field images are generated for a dither sequence of N exposures. Each image has its own flat field image, created by median-combining all the other images in the dither sequence. This reduces the sysmatics in the photometry of faint objects. There are minor changes in v1.3 throughout the pipeline, all contributing to its robustness.
5. Limits and
Possible Future Improvements
version of SIMPLE-WIRCAM
tangential projection for the reduced maps. However,
it should be fairly easy to include other kinds of projection, if
procedure is specifically designed for WIRCAM in many ways.
However, many SIMPLE subroutines are written as
general as possible. It is possible to modify this package for
other near-IR mosaic cameras. With appropriate treatment for flat
fielding and defringing, I believe it can be used on CCD cameras as
well. SIMPLE has not been tested for cameras with large
distortions, such as the SuprimeCam on Subaru. This will be the
next SIMPLE development.
SIMPLE cannot drizzle images. A drizzle function can be
easily written for SIMPLE but I do not feel a need for this. If I
do receive considerable amount of request from users, I may provide
this function in the future.