Ccd mosaic
From MediaWiki
Montage
Download at: http://montage.ipac.caltech.edu/docs/download.html
Simple script called mosaic.sh:
#!/bin/bash mkdir rawdirFILTER projdirFILTER diffdirFILTER corrdirFILTER finalFILTER cd rawdirFILTER/ ln -s ../IMAGES . cd .. mImgtbl rawdirFILTER imagesFILTER.tbl mMakeHdr imagesFILTER.tbl templateFILTER.hdr mProjExec -p rawdirFILTER imagesFILTER.tbl templateFILTER.hdr projdirFILTER statsFILTER.tbl mImgtbl projdirFILTER imagesFILTER.tbl mAdd -p projdirFILTER imagesFILTER.tbl templateFILTER.hdr finalFILTER/uncorrectedFILTER.fits mViewer -ct 1 -gray finalFILTER/uncorrectedFILTER.fits -1s max gaussian-log -out finalFILTER/uncorrectedFILTER.png mOverlaps imagesFILTER.tbl diffsFILTER.tbl mDiffExec -p projdirFILTER diffsFILTER.tbl templateFILTER.hdr diffdirFILTER mFitExec diffsFILTER.tbl fitsFILTER.tbl diffdirFILTER mBgModel imagesFILTER.tbl fitsFILTER.tbl correctionsFILTER.tbl mBgExec -p projdirFILTER imagesFILTER.tbl correctionsFILTER.tbl corrdirFILTER mAdd -p corrdirFILTER imagesFILTER.tbl templateFILTER.hdr finalFILTER/mosaicFILTER.fits mViewer -ct 1 -gray finalFILTER/mosaicFILTER.fits -1s max gaussian-log -out finalFILTER.png
Then simply if images are called images* and FILTER is B:
sed -e 's/FILTER/B/g' -e 's/IMAGES/images*.fit/g' mosaic.sh > mosaicB.sh
And start the script with:
/bin/bash mosaicB.sh
It will take a while ...
MSCRED
Great tutorial at: http://www.ifa.hawaii.edu/~rgal/science/lfcred/lfc_red.html
The steps are the following:
- Create object list
ls images*.fit > img.list
- Create BPM
- Create COLD bad pixel map:
imstat master_flat field=midpt #lower=0.9*midpt imexpr " (a < lower) ? 1 : 0" coldV.pl a=master_flat
- Create HOT pixel map:
imstat dark_current_ofthesameexposure.fits # upper = 0.75*mean + 3*stdev imexpr "(a > upper) ? 1 : 0" hot.pl a=dark_current_ofthesameexposure.fits
- Final BPM mask = HOT and COLD
imexpr "max(a,b)" bpm.pl a=cold.pl b=hot.pl
- Add BPM to the header of each image:
hedit @image.list BPM bpm.pl add+ ver-
- Create satellite-trail masks:
Display the image (img01) and with imexam find min,ymin,xmax,ymax and save it to a file img01.satin #In terminal: sat-b-gone -g 2 img01.satin img01.satout # terminal program you can find at http://www.ifa.hawaii.edu/~rgal/science/lfcred/sat-b-gon #In iraf text2mask img01.satout img01_sat.pl 2048 2048 # where 2048 x 2048 are image dimensions imexpr "max(a,b)" bpmimg01.pl a=bpm.pl b=img01_sat.pl hedit img01.fit BPM bpmimg01.pl add+ ver-
- Create object masks:
set masktype = pl nproto !sed -e 's/^/mask_/g' -e 's/.fit/.pl/g' img.list > mask.list objmask @img.list @mask.list masks="!BPM" hsigma=10 lsigma=5 minpix=40 ngrow=5 # Check if all objects are found in mask_images*.fit images, if not change hsigma and lsigma and eventually minpix.
- Find the background in the part of the images (the same part-it's easiest) - replace [xmin:xmax,ymin:ymax] with coordinates of some rectangular region without objects:
## In terminal awk '{print "iterstat",$1"[xmin:xmax,ymin:ymax] print+ ver-"}' img.list > goiter.cl ## In IRAF stsdas hst_calib nicmos cl < goiter.cl > iterout.txt !sed 's/=/ /g' iterout.txt | awk '{print $9}' > foo ## In terminal paste b.list fooB > boundariesB echo "mscred" > gomos.cl # Change below the ref_image.fit to your reference image: should be the same for all observations on every night in all filters used awk '{print "mscimage",$1,"mos_"$1," wcssour=\"image\" reference=\"ref_image.fit\" interpo=\"sinc17\" boundary=\"constant\" constant="$2}' boundaries >> gomos.cl # In IRAF # Before we run the script gomos.cl, we must set parameters of the mscimage task correctly:
epar mscimage PACKAGE = mscred TASK = mscimage input = List of input mosaic exposures output = List of output images (format = image) Output format (image|mef) (pixmask= yes) Create pixel mask? (verbose= yes) Verbose output? # Output WCS parameters (wcssour= image) Output WCS source (image|parameters) (referen= referenceimage.fit) Reference image (ra = INDEF) RA of tangent point (hours) (dec = INDEF) DEC of tangent point (degrees) (scale = INDEF) Scale (arcsec/pixel) (rotatio= INDEF) Rotation of DEC from N to E (degrees) # Resampling parmeters (blank = 0.) Blank value (interpo= sinc17) Interpolant for data (minterp= linear) Interpolant for mask (boundar= constant) Boundary extension (constan= 0.) Constant boundary extension value (fluxcon= no) Preserve flux per unit area? (ntrim = 7) Edge trim in each extension (nxblock= 2100) X dimension of working block size in pixels (nyblock= 4200) Y dimension of working block size in pixels # Geometric mapping parameters (interac= no) Fit mapping interactively? (nx = 10) Number of x grid points (ny = 20) Number of y grid points (fitgeom= general) Fitting geometry (xxorder= 4) Order of x fit in x (xyorder= 4) Order of x fit in y (xxterms= half) X fit cross terms type (yxorder= 4) Order of y fit in x (yyorder= 4) Order of y fit in y (yxterms= half) Y fit cross terms type (fd_in = ) (fd_ext = ) (fd_coor= ) (mode = ql) # The reference image referenceimage.fit must be the same for all observations on diff nights, from diff filters! # Now, we can run the script:
cl < gomos.cl
- Fit 2D surfaces to the images and correct them for these gradients:
## In terminal ls mos_images*.fit > skysubin.list sed s/.fit/out.fit/g skysubin.list > skysubout.list ## In IRAF mscskysub @skysubin.list @skysubout.list 2 2 xmed=300 ymed=300 median_per=50 lower=3 upper=3 regions="mask" mask="BPM"
- Finally, stack the images:
## In IRAF !ls mos_images*fit_bpm.pl > bpm.list mscstack @skysubout.list msc.fit bpmask=@bpm.list comb=ave reject=avsigclip masktype=goodvalue maskvalue=0 scale=exposure \ zero=median statsec=[xmin:xmax,ymin:ymax] lthresh=100 hthresh=60000 rdnoise=12.5 gain=1.25 # These images may be of different exposure time, thus the scale keyword is set to exposure.