显示标签为“astro”的博文。显示所有博文
显示标签为“astro”的博文。显示所有博文

2014年8月6日星期三

【SDSS】SQL search through SDSS website

This is just a note from my work.

SDSS search website:
      http://www.sdss3.org/dr10/
      http://classic.sdss.org/dr7/
  DR10包括DR8和DR9, 但是DR7以及之前的结果都需要在DR7里面搜索。
(1) search particular objects
  http://data.sdss3.org/bulkSpectra/
(2) search objects with certain criterion
  http://skyservice.pha.jhu.edu/casjobs/default.aspx


********************************************************************************
          DR10
********************************************************************************
commands
search at website http://skyserver.sdss3.org/CasJobs/MyDB.aspx or from individual sites.
********************************************************************************
http://skyserver.sdss3.org/dr10/en/help/docs/realquery.aspx
-- a) Finding galaxies by their emission lines:
-- This query selects galaxy spectra with high internal reddening,
-- as measured by the standard Balmer decrement technique. It
-- makes use of the galSpec tables for the measurements of
-- galaxy lines. In this case we use galSpecLine, which has
-- emission line measurements.

SELECT
s.specObjID, s.plate, s.fiberid, s.mjd, s.z, s.zwarning,
g.h_beta_flux, g.h_beta_flux_err,
g.h_alpha_flux, g.h_alpha_flux_err,
g.oiii_5007_flux, g.oiii_5007_flux_err,
g.oiii_5007_eqw
FROM GalSpecLine AS g
  JOIN SpecObj AS s ON s.specobjid = g.specobjid
WHERE
  --h_alpha_flux > h_alpha_flux_err*5
  --AND h_beta_flux > h_beta_flux_err*5
  --AND h_beta_flux_err > 0
  --AND h_alpha_flux > 10.*h_beta_flux
  oiii_5007_flux > oiii_5007_flux_err*5
  AND oiii_5007_eqw > 600.
  AND s.class = 'GALAXY'
  AND s.zwarning = 0

********************************************************************************
          DR7
********************************************************************************
http://cas.sdss.org/dr7/en/tools/search/sql.asp

SELECT
G.objId, S.plate, S.fiberID, S.mjd, S.z,  L1.ew,L1.ewerr, L2.ew,L2.ewerr,L1.ew*L1.continuum,L1.ewerr*L1.continuum

FROM Galaxy as G
   JOIN SpecObj as S ON G.objId=S.bestObjId
   JOIN SpecLine as hL1 ON S.specObjId=L1.specObjId
   JOIN SpecLine as L2 ON S.specObjId=L2.specObjId  
   JOIN SpecLine as Lb ON S.specObjId=Lb.specObjId
WHERE
     L1.LineId = 5008
     and L1.ew > 1000.
     and L1.ew/L1.ewerr > 3.
     and L2.LineId =6565
     and Lb.LineId =4863
     --and log10( (L1.ew*L1.continuum)/(Lb.ew*Lb.continuum) ) < 0.75


********************************************************************************
********************************************************************************
Check image:
   http://cas.sdss.org/dr7/en/tools/chart/list.asp
   http://skyserver.sdss3.org/public/en/tools/chart/listinfo.aspx

********************************************************************************
# Example script for looking at BOSS spectra and redshift fits via Python.
#
# Written by Adam S. Bolton, University of Utah, Oct. 2009
#

# Imports:
import numpy as n
import pyfits as pf
import matplotlib as mpl
mpl.use('TkAgg')
mpl.interactive(True)
from matplotlib import pyplot as p

# Set topdir:
topdir = '/data/BOSS/spectro/redux/v5_5_12/'

# Pick your plate/mjd and read the data:
plate = '3621'
mjd = '55104'
spfile = topdir + plate + '/spPlate-' + plate + '-' + mjd + '.fits'
zbfile = topdir + plate + '/spZbest-' + plate + '-' + mjd + '.fits'
hdulist = pf.open(spfile)
c0 = hdulist[0].header['coeff0']
c1 = hdulist[0].header['coeff1']
npix = hdulist[0].header['naxis1']
wave = 10.**(c0 + c1 * n.arange(npix))
# Following commented-out bit was needed for some of the early redux:
#bzero = hdulist[0].header['bzero']
bunit = hdulist[0].header['bunit']
flux = hdulist[0].data
ivar = hdulist[1].data
hdulist.close()
hdulist = 0
hdulist = pf.open(zbfile)
synflux = hdulist[2].data
zstruc = hdulist[1].data
hdulist.close()
hdulist = 0

i = 499
# Set starting fiber point (above), then copy and paste
# the following repeatedly to loop over spectra:
i+=1
# Following commented-out bit was needed for some of the early redux:
#p.plot(wave, (flux[i,:]-bzero) * (ivar[i,:] > 0), 'k', hold=False)
p.plot(wave, flux[i,:] * (ivar[i,:] > 0), 'k', hold=False)
p.plot(wave, synflux[i,:], 'g', hold=True)
p.xlabel('Angstroms')
p.ylabel(bunit)
p.title(zstruc[i].field('class') + ', z = ' + str(zstruc[i].field('z')))




********************************************************************************
  SDSS get the images and the spectra
********************************************************************************
One example from Peter Erwin:   http://www.mpe.mpg.de/~erwin/code/telarchive/
# This is the URL of the SDSS images ( from astroML)
http://www.astroml.org/sklearn_tutorial/auto_examples/plot_sdss_images.html
url = ("http://casjobs.sdss.org/ImgCutoutDR7/"
           "getjpeg.aspx?ra=%.8f&dec=%.8f&scale=%.2f&width=%i&height=%i"
           % (RA, DEC, scale, width, height))
However, this link does not work now. Please use :
SDSS_URL = ('http://skyservice.pha.jhu.edu/DR7/ImgCutout/getjpeg.aspx?'
            'ra=%(RA).8f&dec=%(DEC).8f&scale=%(scale).2f&width=%(width)i&height=%(height)i&opt=&query=')

# This is the URL of the sdss fits spectra (from astroML)
FITS_FILENAME = 'spSpec-%(mjd)05i-%(plate)04i-%(fiber)03i.fit'
SDSS_URL = ('http://das.sdss.org/spectro/1d_26/%(plate)04i/1d/spSpec-%(mjd)05i-%(plate)04i-%(fiber)03i.fit')



********************************************************************************
  DR7   about the spectra files 
********************************************************************************
http://classic.sdss.org/dr7/products/spectra/read_spSpec.html
The spSpec file's header contains several parameters such as object identification and coordinates, observing information, spectral classification, redshift, etc..
The fits image contains a 4x(roughly 4000) image whose
  first row is the spectrum,
  second the continuum subtracted spectrum,
  third the error,
  forth a bitmask.
  fifth ?   sky light ?
Notice that the wavelength vector is not contained in the image, but must be generated from parameters in the header.
SDSS spectra are binned in constant Log(Λ ) and the wavelength can be obtained from the header parameters COEFF0 and COEFF1 (or alternatively CRVAL1 and CD1_1) as follows:

lambda = 10**(COEFF0 + COEFF1*i), where i denotes the (zero indexed) pixel number.

Six binary tables are included, most importantly,
 HDU 2 which contains a table of gaussian fits to line positions,
 HDU 3 which contains a table on line index parameters. Also included, but of less general interest, are:
 HDU 1 which contains line parameters used in the emission-line redshift determination;
 HDU 3 which contains information on emission-line redshifts;
 HDU 4 which contains a table of cross-correlation redshifts with all the templates, and
 HDU 6 which has additional mask information as well as the spectral resolution as a function of wavelength.

2014年6月17日星期二

Luminosity Fuction


Usually, people use Schechter parameterization to show the luminosity functions.

From WIKI:

Schechter luminosity function[edit]

The Schechter luminosity function provides a parametric description of the space density of galaxies as a function of their luminosity. The form of the function is
n(x) \  \mathrm{d}x = \phi^* x^a \mathrm{e}^{-x} \mathrm{d}x,
where x = L/L^*, and L^* is a characteristic galaxy luminosity where the power-law form of the function cuts off. The parameter \,\!\phi^* has units of number density and provides the normalization. The galaxy luminosity function may have different parameters for different populations and environments; it is not a universal function. One measurement from field galaxies is a=-1.25,\ \phi^* = 1.2 \times 10^{-3} h^3 \mathrm{Mpc}^{-3}.[2]
It is often more convenient to rewrite the Schechter function in terms of magnitudes, rather than luminosities. In this case, the Schechter function becomes:
 n(M) \ \mathrm{d}M = 0.4 \ \ln 10 \ \phi^*  [ 10^{ -0.4 ( M - M^* ) } ]^{ \alpha + 1}  \exp [ -10^{ -0.4 ( M - M^* ) } ] \ \mathrm{d}M .
Note that because the magnitude system is logarithmic, the power law has logarithmic slope  \alpha + 1 . This is why a Schechter function with  \alpha = -1  is said to be flat.

Notice, in the papers, people use a instead of a+1.



Some reference:

(1) In python. you can calculate the n(M) using the parameters of z=1.5 from Oesch et al. 2010
(2) More star formation may occur in even lower-mass galaxies having higher EWHα and that dominate the UV luminosity function at z 2 (Fumagalli et al. 2012; Alavi et al. 2013). 
Fumagalli et al. 2012   Hα Equivalent Widths from the 3D-HST Survey: Evolution with Redshift and Dependence on Stellar Mass 
Alavi et al. 2013   Ultra-faint Ultraviolet Galaxies at z ~ 2 behind the Lensing Cluster A1689: The Luminosity Function, Dust Extinction, and Star Formation Rate Density









1
2
3
4
5
 phi = -2.64 # normalization
 M = -19.82 # the standard luminosity
 a = -1.46 # slope
 X= M  # the luminosity you want to calculate
10**phi*(np.log(10)/2.5) * ((10**(-0.4*(X-M)))**(a)) * np.e**(-10**(-0.4*(X-M)))

2014年5月13日星期二

Lensing shear


Weak lensing enables the direct study of mass in the universe. Lensing, weak or strong, provides a more direct probe of mass than other methods which rely on astrophysical assumptions (e.g. hydrostatic equilibrium in a galaxy cluster) or proxies (e.g. the galaxy distribution), and can potentially access a more redshift- independent sample of structures than can methods which depend on emitted light with its r2 falloff. But strong lensing can be applied only to the centers of very dense mass concentrations. Weak lensing, in contrast, can be applied to the vast majority of the universe. It provides a direct probe of most areas of already-known mass concentrations, and a way to discover and study new mass concentrations which could potentially be dark. With sources covering a broad redshift range, it also has the potential to probe structure along the line of sight.

Weak gravitational lensing can be described as a linear transformation between unlensed coordinates (xu, yu; with the origin at the center of the distant light source) and the lensed coordinates in which we observe galax- ies (xl, yl; with the origin at the center of the observed image), 
Note that any symmetric 2×2 matrix can be written in the form 
Wrong? From: http://mwhite.berkeley.edu/Lensing/SantaFe04.pdf
How to understand the three parameters (r1, r2, k)?
   For the meaning of r and k, you can understand in this way. Keep the r1 in the equation, and if r1>0, the observed x will be enlarged by a factor of r1 with y shrunk by a factor of r1. Thus the observed shape of the source will looks like be elongated in x axis. For the other two parameters, you can think in the same way.

a positive (negative) γ1 results in an image being stretched along the x (y) axis direction 


   The convergence κ represents an isotropic magnification, and the shear γ represents a stretching in the direction φ. They are both related to physical properties of the lens as linear combinations of derivatives of the deflection angle. However, κ can be interpreted very simply as the projected mass density Σ divided by the critical density Σcrit, while γ has no such straight- forward interpretation. In fact, γ is nonlocal: its value at a given position on the sky depends on the mass distribution everywhere, not simply at that position. 

The surface brightness is unchanged after lensing!
this is a consequence of the fact that the lens equation is a gradient map. Magnification changes only angular sizes and shapes on the sky. Thus a constant surface brightness sheet stays a constant brightness sheet when lensed 

%There are only two free parameters!
%The r = sqrt(r1**2+r2**2) is called the cosmic shear. In

Weak lensing dominate the lensing field!
The region with strong lensing is quite limited, however, the weak lensed region is several factors larger and can help us to determine the total mass of galaxies.

What is reduced shear? why?
In some cases, the size of  galaxies is not available, so we cannot detect the size changes to determine the convergence parameter.
   The convergence κ de- scribes a change in apparent size for lensed objects: areas of the sky for which κ is positive have apparent changes in area (at fixed surface brightness) that make lensed images appear larger and brighter than if they were unlensed, and a modified galaxy density.
   In these cases, we use reduced shear, g1 = γ1/(1 κ) and g2 = γ2/(1 κ) to include the influence of k to the parameter of r. If sources with intrinsically circular isophotes (contours of equal brightness) could be identified, the observed sources (post-lensing) would have elliptical isophotes that we can characterize by their minor-to-major axis ratio b/a and the orientation of the major axis φ. For |g| < 1, these directly yield a value of the reduced shear


What is the challenge?
    It is hard to make the shear measurement even we have utilized statistic methods. I list some problems in the work.

   Variable PSFs: For a summary of some common methods of PSF estimation and interpolation, see Kitching et al. (2013)

   Realistic galaxy morphologies: 20% galaxies can be perfectly fit by simple galaxy models. nearly half can be fit by them, but with additional substructure clearly evident. 30% are true “irregulars” that cannot be fit by simple models at all.
   Combination of multiple exposures
 
  


Reference:

Gravitational lensing: an astrophysical tool 

THE THIRD GRAVITATIONAL LENSING ACCURACY TESTING (GREAT3) CHALLENGE HANDBOOK 

2014年5月12日星期一

【relation】mass-metallicity relation for galaxies

From Erb's PPT (http://www2.astro.psu.edu/~caryl/a597/Bin_metallicity.pdf)


The simple interpretation for the mass- dependence is a metal loss via galactic winds, where galaxies with shallow potential well have more efficient outflows.

The scatter observed in the MZ relation is correlated with other physical properties. These correlations provide clues to the origin of the MZ relation. 
Deeper targeted surveys have extended the mass-metallicity relation to red- shifts of 1 (Savaglio et al. 2005), 2 (Erb et al. 2006), and 3 (Maiolino et al. 2008), and show that for a given stellar mass, galaxies have lower metallicities at increasing redshifts. [Christensen et al. 2014. He use the relation to obtain the mass of DLA galaxies using the DLA metallicity and DLA galaxy impact parameters.]

Zahid et al. 2014 defined the "turnover mass" in the mass-Z relation, and found that the "turnover mass" revolves with redshift from local to z~1.6.

I list some paper about the relation and will give a simple review for this relations sometime.
     CHEMICAL EVOLUTION OF THE ISM IN NEARBY GALAXIES

4.2. The Metallicity-Luminosity Relationship
The Universal Relation of Galactic Chemical Evolution: The Origin of the Mass-Metallicity Relation (Zahid 2014)

The MZ relation was first observed in a small sample of nearby galaxies by Lequeux et al. (1979). They showed that galaxy metallicity increases with stellar mass. Sub- sequently, Tremonti et al. (2004) measure the MZ rela- tion of 50, 000 star-forming galaxies in the local Uni- verse. They find a tight MZ relation (0.1 dex scatter) extending over three orders of magnitude in stellar mass. 

2014年5月10日星期六

【image】Bad Pixel Mask using DS9 Region Files

The basic idea to create the mask image is simple. Firstly, you need to define the bad pixels with ds9 region like box and polygon (one can only use these two type regions only usually). Usually,  there is two main steps to realize the idea.
(1) convert the ds9 region to a uniform format. Both the box and polygon regions can be treated as polygons.
an example of an image mask. The green outline is the polygon drawn into SAOimage DS9. [FROM the website of galfit]


(2) solve the PIP (point in polygon) problems (http://en.wikipedia.org/wiki/Point_in_polygon) and mask all the points in the polygon. I attached one useful python script to get rid of the PIP problem.
  If you want to make two loops in python to find all the inside points, you may find the speed is too low! Please avoid to use 'For' in python. The fast way is to use the exist program in numpymatplotlib.nxutils.points_inside_pol as following:

import numpy as np
from matplotlib.nxutils import points_inside_poly

nx, ny = 10, 10
poly_verts = [(1,1), (5,1), (5,9),(3,2),(1,1)]

# Create vertex coordinates for each grid cell...
# (<0,0> is at the top left of the grid in this system)
x, y = np.meshgrid(np.arange(nx), np.arange(ny))
x, y = x.flatten(), y.flatten()

points = np.vstack((x,y)).T

grid = points_inside_poly(points, poly_verts)
grid = grid.reshape((ny,nx))

print grid
[From: http://stackoverflow.com/questions/3654289/scipy-create-2d-polygon-mask]

(3) save your masked array !

=======================================================================

Python script to decide whether the point is inside the polygon.


def point_in_poly(x,y,poly):
    '''
    Decide whether the point is inside the polygon.
    '''
    n = len(poly)
    inside = False

    p1x,p1y = poly[0]
    for i in range(n+1):
        p2x,p2y = poly[i % n]
        if y > min(p1y,p2y):
            if y <= max(p1y,p2y):
                if x <= max(p1x,p2x):
                    if p1y != p2y:
                        xints = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x
                    if p1x == p2x or x <= xints:
                        inside = not inside
        p1x,p1y = p2x,p2y

    return inside    


=======================================================================

Two example to realize the idea:

(1) A copy from here ( http://www.cfht.hawaii.edu/~chyan/wircam/badpix/badpix.html)
The program "wircampolyregion" and other IDL programs are attached in the end of the website.

(2) Another way and program is mentioned in GALFIT (http://users.obs.carnegiescience.edu/peng/work/galfit/MASKING.html).

=======================================================================

5. IDL Source Code

; NAME:
;       MASKREGION
; PURPOSE:
;       Produce a new bad pixel mask based on an exist one and ds9 region file 
;
; CALLING SEQUENCE:
;       MASKREGION, BADPIX = badpix, REGION = ds9.reg, NEWBADPIX= newbadpix
;
; INPUTS:
;       BADPIX    -  string scalar, the name of the original bad pixel mask.
;       REGION    -  DS9 region file, only polygon and box allowed.
;       NEWBADPIX -  string scalar, the new bad pixel mask.
;
;
; REVISION HISTORY:
;       initial version   Chi-hung Yan   March 2007
;-



PRO RDWIRCAMCUBE, file, im
    im=fltarr(2048,2048,4)
    for i=0,3 do begin
        im[*,*,i]=mrdfits(file,i+1)
    endfor
END


PRO MASKPOLYREGION, im, ext, x, y
    ind=polyfillv(x,y,2048,2048)
    tim=im[*,*,ext-1]
    tim[ind]=!values.f_nan
    im[*,*,ext-1]=tim[*,*]
END

PRO WRWIRCAMCUBE, im, fits, new
    main_hd=headfits(fits,exten=0)
    mwrfits, 3,new , main_hd, /create
    for i=1,4 do begin
        hdr = headfits(fits, exten=i)
        mwrfits,im[*,*,i-1],new,hdr
    endfor
END


PRO MASKREGION, badpix=badpix, region=region, newbadpix=newbadpix
    file=region
    fits=badpix    
        
    ; Read image        
    rdwircamcube,fits,im
        
        
    spawn,"wircampolyregion "+file+" /tmp/region.txt"
    readcol,"/tmp/region.txt",id,ext,x,y
    n=0
    
    xx=fltarr(1)
     yy=fltarr(1)
    for i=0,n_elements(x)-1 do begin
        if i eq 0 then begin
            temp=id[i]
        endif else begin
            temp=id[i-1]
        endelse
        
        if i eq 0 then begin
            xx=x[i]
            yy=y[i]
        endif else if id[i] eq temp then begin
            xx=[xx,x[i]]
            yy=[yy,y[i]]
        endif else begin
            maskpolyregion,im,ext[i-1],xx,yy
            xx=x[i]
            yy=y[i]
            n=n+1
        endelse
        
    end
    spawn,'rm -rf /tmp/region.txt'
    wrwircamcube, im, fits, newbadpix
    
END

6. Perl Script


#! /usr/bin/perl 
#----------------------------------------------------------------------------
#                             wircampolyregion
#----------------------------------------------------------------------------
# Contents: This script parse the ds9 region file into better format.  The out
#                out file can be easily used for IDL program.
#----------------------------------------------------------------------------
# Part of:     WIRcam C pipeline                               
# From:        ASIAA                    
# Author:      Chi-hung Yan(chyan@asiaa.sinica.edu.tw)                       
#----------------------------------------------------------------------------

use warnings;
use strict;

# Define global variable
our $SCRIPT_NAME = 'wircampolyregion';

sub trim {
   my $string=$_;
   for ($string) {
       s/^\s+//;
       s/\s+$//;
    }
   return $string;
}

# This finction is used to return program usage.
sub usage(){

print<<EOF
 USAGE: $SCRIPT_NAME <ds9.reg> <output.txt>


 EXAMPLES:
  $SCRIPT_NAME ds9.reg output.txt

EOF
}

if(@ARGV == 0 || @ARGV != 2){
   usage();
   exit 0;
}

my $file = $ARGV[0];
my $i=0;
my $j=0;
my $ext;
my $reg=0;

open(OUT,">$ARGV[1]");
open(FILE,$file);
while(<FILE>){
    if (/^# tile/){
        my @chip=split(" ",$_);
        $ext = $chip[2];
    }
    if (/^polygon/){
        $reg=$reg+1;
        my @word=split(/[\(\)]/,$_);
        my @coord=split(",",$word[1]);
        my $n=@coord/2;
        for ($i=0;$i<$n;$i++){
            printf(OUT "%d %d %7.2f %7.2f\n",$reg,$ext,$coord[2*$i],$coord[2*$i+1]);
        }    
    }
    if (/^box/){
        $reg=$reg+1;
        my @word=split(/[\(\)]/,$_);
        my @para=split(",",$word[1]);
        printf("$word[1]\n");
         printf(OUT "%d %d %7.2f %7.2f\n",$reg,$ext,$para[0]-$para[2]/2,$para[1]-$para[3]/2);
         printf(OUT "%d %d %7.2f %7.2f\n",$reg,$ext,$para[0]+$para[2]/2,$para[1]-$para[3]/2);
         printf(OUT "%d %d %7.2f %7.2f\n",$reg,$ext,$para[0]+$para[2]/2,$para[1]+$para[3]/2);
         printf(OUT "%d %d %7.2f %7.2f\n",$reg,$ext,$para[0]-$para[2]/2,$para[1]+$para[3]/2);
    }    


}

close(OUT);

2014年5月7日星期三

【HST, IRAC】make good photometry for IRAC image with HST high resolution image

This note keeps some tips of my work, so it may be hard for you to understand the details. You can give me emails to if you have difficult to make iraf photometry for faint objects.

How to make photometry?

   .... add soon



Be careful!

*) In galfit parameter file,
    Using a convolution box size larger than the image to make sure all the flux of bright objects in included.
    Resampling the psf to make sure the PSF fine-sampling factor is an integer value.
    The ellipticity is defined different in Sextractor which is "#ELLIPTICITY = 1-B_IMAGE/A_IMAGE".

How to improve the photometry?

Some steps for check
*) clip a large region for HST and IRAC images to check whether there is extended bright objects nearby.
*) for some objects, you can fake an object close to the target, and galfit them in the mean time. If  there is some bias about the magnitude, you should check your route.

Some improvement for galfit
*) Include all objects with HST magnitude brighter than 1 sigma IRAC detection limiting. 
*) Delete objects that are not detected in IRAC, and combine objects that are too close to be separated in IRAC image. Delete objects which are too close to the 
*) make sersic model for object larger than 1 IRAC pixel and estimate the position angle (the position angle are not define as the same in Sextractor and galfit, image1).
*) fixed all the positions, but release the position for quite bright or sersic model. fixed the ELLIPTICITY in sersic model.
*) release the postion of all object in the last run.
*) after complete the fit for ch1, then apply the same parameters for ch2. 


still not resoloved!!
*) The shift between IRAC and HST images, also between ch1 and ch2 IRAC images.
*) if the number of free parameters is larger than ??
*) which psf should be used?  one lose the information for the larger radius, the other is not so accurate.
*) galfit magnitude vs aperture photometry magnitude?
*) how to define whether one object is detected?
    the chi^2 improvement ?

Image1. Position angle



How to describe the results?

  Undetected
       too faint
       bright contaminated
  detected
       no other contamination
       bright galaxy nearby. give a flag to such candidates.
       faint galaxy in that cannot separated with the target.
         

2014年3月13日星期四

Sextractor【2】MAP_WEIGHT and HOW it works.

The parameters are only breifly mentioned in the manual of Sextractor. However, you should be careful if you really want to change the paramters.

(1) Choose a right type of WEIGHT_TYPE
MAP_RMS is the most safe way to use weight image. It is the map showing the rms (you can call it error or variance.). Sextractor will select pixels with value higher than threshold*rms as a source (the value I mentioned here is background subtracted and smoothed). The error are also calculated based on the counts of object and the rms value.
MAP_WEIGHT is not the same as define in Multidrizzle or somewhere else. It can be a flat map, a exposure map. The Sextractor will convert it to rms map whatever your input is. What is most important and often missed is that it will scale the weight image according to the rms measure from the background. I think it just multiplies the rms value which is show in the output78.5964 in the following output.
(M+D) Background: 0          RMS: 78.5964    / Threshold: 78.5964 
So the weight image is used to tell which part of the image is more important than other parts. The arbitrary value is meaningless. The program will scale it and only use the related values!
MAP_VAR In the manual, "The data are converted to variance units (by defi- nition variance 1/weight), and scaled as for MAP VAR" However,  I have not used it! 
BACKGROUND The program will created a rms map based on the background measure my the program. This method are really not good. If you want to do real science, you should not choose it.
None Then every part of the image will be treated as the same weight, which means the regions which are not observed and are set to value 0 will also be treated as other region. The errors of objects in the corner will also be under-estimated. Notice that even you have set the MAP_WEIGHT, the overall errors are also probably under-estimated, because the rms is calculate from the image and the information of read noises and dark noises are missed.

(2) Detect and measure with different weight map.
People usually know that in dual model, we can define the MAP_TYPE to the detection image and measurement image separately. We can also set this in one image run.
"

All the weighting options listed in §7.1 can be applied separately to detection and measurement images (§3), — even if some combinations may not always make sense. For instance, the following set of configuration lines:
WEIGHT_IMAGE rms.fits,weight.fits 
WEIGHT_TYPE MAP_RMS,MAP_WEIGHT
will load the FITS file rms.fits and use it as an RMS map for adjusting the detection threshold and CLEANing, while the weight.fits weight map will only be used for scaling the error estimates on measurements. This can be done in single- as well as in dual-image mode (§3). WEIGHT IMAGEs can be ignored for BACKGROUND WEIGHT TYPEs. 
"

(3) Created you own weight and rms image.
The details will come later, you can check my other blog and also give me an email.




   

2014年3月12日星期三

Sextractor【1】The size measurement

Usually, we need to run sextractor for several bands with one detection image, which is called dual mode. But when you check the FWHM which is the half light radius for faint galaxies, you may find something different. How do these values come from? Does Sextractor use the same aperture for all bands?


The FWHM of one object in C1226 ( one cluster in CLASH)
The object is not detected in ACS/uvis bands and F775W F814W band, thus the size is only the largest radius of the source region which can be checked in segmentation map.
The object are clearly detected in F105W, so the size measured in F105W could be the most accuracy. The size in other bands are smaller due to the weak detection in these bands.

size measured by myself

Spectrum of this object
images of 16 bands
# photometry for this object

#a1423 nir  833    x    y         ra        dec
f225w           f275w           f336w           f390w        
f435w           f475w           f606w           f625w        
f775w           f814w          f850lp           f105w        
f110w           f125w           f140w           f160w           redshift

c1226   1 1388 2543 2764 186.754096  33.545302
99.0000 99.0000  99.0000 99.0000  29.2562 2.1399  99.0000 99.0000
27.1057 0.1604  27.2714 0.1534  27.2058 0.0910  26.8436 0.1355
27.3479 0.2488  27.2449 0.0892  27.6370 0.4182  26.9311 0.1483
26.5273 0.0706  26.1972 0.0958  26.4933 0.0874  26.9528 0.1281   1.7550

You can see that while the size is as large as the segmentation map, the object will be either not detected or deblend for bad pixels.


size 为何不同
有些波段的流量偏低,甚至无探测,导致sex测量的size不准。没有探测的时候,size将会设置成定值,即segmentation的大小。



Here I add another example:




# photometry for this object

#a1423 nir  833    x    y         ra        dec
f225w           f275w           f336w           f390w        
f435w           f475w           f606w           f625w        
f775w           f814w          f850lp           f105w        
f110w           f125w           f140w           f160w           redshift

c1226   1 2101 2303 2233 186.759314  33.535719  99.0000 99.0000  
30.7607 8.0779  27.8950 0.5042  28.3753 0.4528  27.1087 0.1303  
27.2161 0.1204  27.4034 0.0910  27.6560 0.2317  27.5740 0.2553  
27.9762 0.1456  27.2453 0.2345  27.3148 0.1553  27.2221 0.1081  
26.9002 0.1156  27.0465 0.1132  27.7699 0.2222   1.7550