2014年1月29日星期三

Sextractor【0】Something You want to [MUST] know about SEXTRACTOR

FIRST, Sextractor is a quite powerful tool. If you want to make detections, please use it !  If  you have never used it, please have a try. As a graduated  student with the major of Glaxies and AGN, it is necessary to learn this software. Although I spent a lot of time in this software, I found it worth. Here I will give you my experience.
[More information will be added in the future!]


Simple Example:
Dual model
  sex -c configfile detection.fits,detection.fits
You may need several files which you can find in the configure file.

Tips:
Use the check images, especially the segmentation image and the aperture image which will be useful!
Set the gain to CCDGAIN * exposure_time, if  you use images in units of counts/s


















Some Formula:

Error:
    FLUX_ERR = sqrt( (A*sig^2) + F/g)
where A is the object area, sig is the background RMS (? I think it is estimated from the local background! After a test, I find that the error are the total flux from the MAP_RMS image.) , F is the total flux, and g is the gain (You can see why you need to set the gain to gain*exptime when you use unit of counts/s. Because you need conserve the unit!). The following can be find in ~ Page 36 of the User's Mnual.










Correcting for correlate noise when using MultiDrizzle images
Regardless of how you run SExtractor, the errors will be incorrect if the images have been MultiDrizzle'd. For details on this, see Casertano et al. 2000. If you have run MultiDrizzle with pixfrac p and scale s, then you should calculate a correction factor
sqrt(F_A) = (s/p)(1-(s/3p)) if s<p
sqrt(F_A) = 1 - p/(3s)      if s>p
NOTE: Here, s is the multiplicative factor applied to the original image pixel scale. For ACS, if your output drizzled image has 0.03" pixels, then s=0.6. For instance, for HAGGLES, p=0.9 and s=0.6, so √FA=0.51852. This correction factor needs to be applied to the background noise estimate generated by SExtractor (output to the screen at runtime as the RMS), and therefore to the flux and magnitude errors that are output.
Find the explanation in the handbook or from Casertano 2000
       

FLUX_ERR_CORRECT = sqrt( ((A*sig^2)/F_A) + FLUX/GAIN )
MAG_ERR_CORRECT = FLUX_ERR_CORRECT/FLUX * 2.5/ln(10)






IMPORTANT NOTE REGARDING WEIGHT AND RMS MAPS
Although the mathematical relationship between a weight map and an rms map is simply
      weight = 1/(rms^2)    
(check the sextractor book for the explanation)
________________________________________________________________
However, I found 
      rms = 1/sqrt(weight) * std(weight)   ---- Wrong!
Sometimes someone chooses weight/exptime other then weight, then
      rms = 1/sqrt(weight/exptime) * std(weight/exptime)  ---- Wrong! 
Here the std(weight) is the standard deviation for the whole weight image. This means if you choose a larger grid to store the image and set the edges of weight images to value 0, then the rms values will be underestimated. This will affect the detection threshold you set in the configure file. You may need to set a higher detection threshold.   ---- Wrong!
________________________________________________________________
Weight images is calculated from rms images in Multidrizzle. You can find this in the handbook (Check here)

Where D and B are the counts per pixel (in DN) due to the dark current and background, respectively, averaged over the entire image. t is the exposure time in seconds, g is the gain of the detector (users should be aware of the units of their image and use the appropriate gain value), and  is the readnoise in DN/pixel. The quantity f represents the inverse flat field, corresponding to the way in which the HST pipeline flats are defined.

However, notice that the weight maps are different in Multidrizzle and Sextractor. So you 'd better use MAP_RMS instead. I still do not figure out how to convert these between these two softwares.  
SExtractor does NOT treat these two map types by just converting one to the other using this relation! Instead, it does the following:
  • MAP_RMS: The image is assumed to be in units of absolute standard deviations, in ADU/pixel [which is what we have if we take 1/sqrt(weightmap) ]
  • MAP_WEIGHT: Assumed to be in units of RELATIVE weights. Data are CONVERTED to variance, using var=1/weight AND scaling to internal, low-resolution absolute variance map built from science image. This is not the case in MultiDrizzle data, and in fact is a misuse of the term "weight map". Be careful if you use MAP_WEIGHT for Sextractor, and you should set gain correctly if you really want.
Want to know more about weight image? 
Check here (the basic explanation from http://www.astromatic.net/) and  here (the detail explanation from DrizzlePac).


Parameter


BACKPHOTO_THICK

    The exact limits of the background "rectangular annulus" are defined as follow.
First of all, a box is defined by the limits in x and y of the isophotal boundaries (at the detection level) of the object. This box is then grown symmetrically on both axes by 50%. This sets the inner boundaries of the background annulus. Simply add BACKPHOTO_THICK more pixels on both sides of each axis and you obtain the outer limits of the background annulus.
EXAMPLE:
    My object's center is defined at x=0, y=0, and its isophotal detection boundaries are defined by x=20 and y=20 (giving a total diameter of 40 pixels for my object). The radius of my object is increased by 50% giving an inner radius of the rectangular annulus of 30 pix.
    Then, the if BACKPHOTO_THICK is, say, 40 pix, the outer radius of the annulus is 70 pix (as measured from the center of the object) making the total area defined by this annulus: (70*70)-(30*30)=4000 pixels sqaured.
(From Here)

BACK_FILTERSIZE
BACK_FILTERSIZE is used before BACK_SIZE is. It is used in the smoothing that goes on "to get rid of the deviations resulting from bright or extended objects."

BACK_SIZEBACK_SIZE contributes to the background map by using "a bi-cubic-spline interpolation over all the areas of size BACK_SIZE." SExtrator for Dummies recommends setting BACK_SIZE larger than the average size of the objects in your image. (From Here)

DETECT_THRESH 1.5
will set the detection threshold at 1.5σ above the LOCAL background.
the standard deviation quoted here is that of the unFILTERed image, at the pixel scale.

DETECT MINAREA [1-5]
In most cases it is therefore recommended to keep DETECT MINAREA at a small value, typically 1 to 5 pixels, and let DETECT THRESH and the filter define SExtractor’s sensitivity.


Details about the route and the relatio with these parameters:
BACK_FILTERSIZE   BACK_SIZE  BACKPHOTO_THICK  RMS MAPS

(1) The program substract the filtered smoothed backgound from the whole image based on the BACK_FILTERSIZE   BACK_SIZE parameter. The background and be checked with CATALOG TYPE BACKGROUND. 
(2) Source detection based on the RMS MAPS and the DETECT_THRESH.
(3) Substract the local background based on the parameters  BACKPHOTO_THICK, Calculate the flux and magnitude. The errors are also calculated in the same region based on the RMS MAPS.
FWHM_IMAGE

   I made a simple test and compared SE measurments with those given by IRAF's imexam task.
FWHM's of extended and stellar objects are overestimated by SE relative to those computed using imexam by factor of ~20%.
   An 'imexam' does iterative gaussian profile fitting. How about SE? Which 'object pixels' are used to calculated FWHM and how it is done?

There are currently 2 ways to measure the FWHM of a source in SExtractor. Both are rather imperfect.
     FWHM_IMAGE derives the FWHM from the isophotal area of the object at half maximum.
     FLUX_RADIUS estimates the radius of the circle centered on the barycenter that encloses about half of the total flux. For a Gaussian profile, this is equal to 1/2 FWHM. But with most images on astronomical images it will be slightly higher.








Making a Flag Image
You can make a complex flag image that uses different values to denote different exposure levels. The below example just sets a binary flag value for areas that are very underexposed (flag=1 if bad).
cl> median ACSJ160449+432050_F814W_wht.fits med_foo.fits 7 7 boundary=nearest
Examine the image, and find the data value below which you wish to flag (say, 500).
cl> stsdas
cl> toolbox
cl> imgtools
cl> imcalc med_foo.fits flag_foo.fits "if im1 .lt. 500. then 1 else 0"
cl> boxcar flag_foo.fits box_foo.fits 7 7  boundary=nearest
cl imcalc box_foo.fits ACSJ160449+432050_F814W_flag.fits "if im1 .gt. 0.2 then 1 else 0" pixtype=int
It is important to set the output pixel type to "int" in the last step - SExtractor expects flag images to contain only integers.






Other sites for the discussion about Sextractor:

Useful Things that I Always Forget

没有评论:

发表评论