CCD data reduction

From MediaWiki

(Difference between revisions)
Jump to: navigation, search
m (Created page with '= Basic reduction = filter="L" ls bias*[0-9].fit > bias.list ls dark600s-00*fit > dark600s.list ls dark*5sec*fit > dark5s.list ls flat*${filter}.fit > flat${filter}.li…')
m
Line 14: Line 14:
   sed s/^/objbdf/g ${filter}.list > objbdf${filter}.list
   sed s/^/objbdf/g ${filter}.list > objbdf${filter}.list
 +
  # Basic data reduction
   # cat reduce.cl
   # cat reduce.cl
   imcombine @bias.list master_bias comb=med  
   imcombine @bias.list master_bias comb=med  
Line 23: Line 24:
   imarith @bflatFILTER.list - dc_5s @bdflatB.list
   imarith @bflatFILTER.list - dc_5s @bdflatB.list
   imstat @bdflatFILTER.list fields="image,mode" > normFILTER.txt
   imstat @bdflatFILTER.list fields="image,mode" > normFILTER.txt
-
 
+
   # sed 's/FILTER/'${filter}'/g'  reduce.cl > do.cl
-
   sed 's/FILTER/'${filter}'/g'  reduce.cl > do.cl
+
-
 
+
   cl < do.cl
   cl < do.cl
-
 
+
   # while read line; do echo $line | awk '! /^#/{print "imarith "$1" / "$2,"n"$1}'; done < norm${filter}.txt > doflatnorm.cl
-
   while read line; do echo $line | awk '! /^#/{print "imarith "$1" / "$2,"n"$1}'; done < norm${filter}.txt > doflatnorm.cl
+
-
 
+
   cl < doflatnorm.cl
   cl < doflatnorm.cl
-
   echo "imcomb n@bdflat${filter}.list master_flat_${filter} comb=med" > do.cl
+
   # echo "imcomb n@bdflat${filter}.list master_flat_${filter} comb=med" > do.cl
   cl < do.cl
   cl < do.cl
 +
 
 +
  # BPM creation and header modification
   # cat bpmask.cl
   # cat bpmask.cl
   imstat dc_300s field="image,mean,stddev" for- > hot.txt
   imstat dc_300s field="image,mean,stddev" for- > hot.txt
Line 44: Line 43:
   imexpr "max(a,b)" bpmFILTER.pl a=hotFILTER.pl b=coldFILTER.pl
   imexpr "max(a,b)" bpmFILTER.pl a=hotFILTER.pl b=coldFILTER.pl
   hedit @bdfFILTER.list BPM bpmFILTER.pl add+ ver-  
   hedit @bdfFILTER.list BPM bpmFILTER.pl add+ ver-  
-
    
+
   # sed 's/FILTER/'${filter}'/g'  bpm.cl > dobpm.cl
-
  sed 's/FILTER/'${filter}'/g'  bpm.cl > dobpm.cl
+
   cl < dobpm.cl
   cl < dobpm.cl
    
    
-
 
+
  # Object masks creation
   nproto
   nproto
   objmask @bdfFILTER.list @objbdfFILTER.list masks="!BPM" hsig=2 lsig=2  
   objmask @bdfFILTER.list @objbdfFILTER.list masks="!BPM" hsig=2 lsig=2  
   #Astrometry:
   #Astrometry:
-
   gethead OBJCTRA @bdfb.list > name_ra.txt
+
   # gethead OBJCTRA @bdfb.list > name_ra.txt
-
   gethead OBJCTDEC @bdfb.list | awk '{print $2,$3,$4}' > dec.txt
+
   # gethead OBJCTDEC @bdfb.list | awk '{print $2,$3,$4}' > dec.txt
-
   paste -d" " name_ra.txt dec.txt | awk '{print $1,($2+$3/60+$4/3600)*15,$5+$6/60+$7/3600}' > astrometry.txt
+
   # paste -d" " name_ra.txt dec.txt | awk '{print $1,($2+$3/60+$4/3600)*15,$5+$6/60+$7/3600}' > astrometry.txt
-
 
+
   # cat komanda.sh
-
  @maxwell:
+
-
   cat komanda.sh
+
   solve-field img --ra imagera --dec imagedec --radius 0.2 --scale-units arcsecperpix --scale-low 0.38 --scale-high 0.40 --crpix-center --wcs img.wcs  
   solve-field img --ra imagera --dec imagedec --radius 0.2 --scale-units arcsecperpix --scale-low 0.38 --scale-high 0.40 --crpix-center --wcs img.wcs  
-
 
+
   #while read line; do img=$(echo $line | awk '{print $1}'); imagera=$(echo $line | awk '{print $2}'); imagedec=$(echo $line | awk '{print $3}'); sed -e 's/img/'$img'/g' -e 's/imagera/'${imagera}'/g' -e 's/imagedec/'${imagedec}'/g' komanda.sh; done < astrometry.txt > doAstrometry.sh  
-
   while read line; do img=$(echo $line | awk '{print $1}'); imagera=$(echo $line | awk '{print $2}'); imagedec=$(echo $line | awk '{print $3}'); sed -e 's/img/'$img'/g' -e 's/imagera/'${imagera}'/g' -e 's/imagedec/'${imagedec}'/g' komanda.sh; done < astrometry.txt > doAstrometry.sh  
+
   # /bin/bash doAstrometry.sh
-
   /bin/bash doAstrometry.sh
+
   #ls *wcs > wcsFILTER.list
-
   ls *wcs > wcsFILTER.list
+
-
 
+
   wcscopy @bdfFILTER.list @wcsFILTER.list ver-
   wcscopy @bdfFILTER.list @wcsFILTER.list ver-
    
    
 +
  # Creation of super sky flat, normalization to each individual image median background and final stacking
   # cat stat.cl
   # cat stat.cl
   real mini
   real mini
Line 77: Line 72:
   imdelete("nosky",yes)
   imdelete("nosky",yes)
-
   while read line; do img=$(echo $line | awk '{print $1}'); msk="obj"${img%.*}.pl; rsky="norm"${img}; cat stat.cl | sed -e 's/img/'${img}'/g' -e 's/msk/'${msk}'/g'  -e 's/norm/'${rsky}'/g'; done < bdf${filter}.list >  bla.cl
+
   # while read line; do img=$(echo $line | awk '{print $1}'); msk="obj"${img%.*}.pl; rsky="norm"${img}; cat stat.cl | sed -e 's/img/'${img}'/g' -e 's/msk/'${msk}'/g'  -e 's/norm/'${rsky}'/g'; done < bdf${filter}.list >  bla.cl
   cl < bla.cl > med_values.txt
   cl < bla.cl > med_values.txt
-
   ls normbdf*fit > norm.list
+
   # ls normbdf*fit > norm.list
-
   awk '{print "imarith norm.fits * "$2," n"$1}' med_values.txt > donorm.cl
+
   # awk '{print "imarith norm.fits * "$2," n"$1}' med_values.txt > donorm.cl
-
   awk '{print "imarith",$1,"-","n"$1,"s"$1}' med_values.txt > do.cl
+
   # awk '{print "imarith",$1,"-","n"$1,"s"$1}' med_values.txt > do.cl
      
      
-
  imcomb n@bdfFILTER.list final.fits comb=med offset="wcs"
+
  imcomb n@bdfFILTER.list final.fits comb=med offset="wcs"

Revision as of 08:11, 5 November 2019

Basic reduction

 filter="L"
 ls bias*[0-9].fit > bias.list
 ls dark600s-00*fit > dark600s.list
 ls dark*5sec*fit > dark5s.list
 ls flat*${filter}.fit > flat${filter}.list
 sed s/^/b/g flat${filter}.list > bflat${filter}.list
 sed s/^/bd/g flat${filter}.list > bdflat${filter}.list
 ls ngc*fit > ${filter}.list > ${filter}.list
 sed s/^/b/g ${filter}.list > b${filter}.list
 sed s/^/bd/g ${filter}.list > bd${filter}.list
 sed s/^/bdf/g ${filter}.list > bdf${filter}.list
 sed s/^/objbdf/g ${filter}.list > objbdf${filter}.list
 # Basic data reduction
 # cat reduce.cl
 imcombine @bias.list master_bias comb=med 
 imarith @dark600s.list - master_bias b@dark600s.list
 imcombine b@dark600s.list master_dark_600s comb=med 
 imarith master_dark_600s / 36 dc_5s
 imarith master_dark_600s * 0.5 dc_300s
 imarith @flatFILTER.list - master_bias @bflatB.list
 imarith @bflatFILTER.list - dc_5s @bdflatB.list
 imstat @bdflatFILTER.list fields="image,mode" > normFILTER.txt
 # sed 's/FILTER/'${filter}'/g'  reduce.cl > do.cl
 cl < do.cl
 # while read line; do echo $line | awk '! /^#/{print "imarith "$1" / "$2,"n"$1}'; done < norm${filter}.txt > doflatnorm.cl
 cl < doflatnorm.cl
 # echo "imcomb n@bdflat${filter}.list master_flat_${filter} comb=med" > do.cl
 cl < do.cl
 
 # BPM creation and header modification
 # cat bpmask.cl
 imstat dc_300s field="image,mean,stddev" for- > hot.txt
 imstat master_flat_FILTER fields="image,mean" for- > cold.txt
 cl < bpmask.cl
 # awk -v filter="L" '{print "imexpr \"((a > b) ? 1 : 0)\" hot"filter".pl a="$1" b="($2+3.*$3)*0.75}' hot.txt > hot.cl
 # awk -v filter="L" '{print "imexpr \"((a < b) ? 1 : 0)\" cold"filter".pl a="$1" b="$2*0.9}' cold.txt > cold.cl
 cl < hot.cl
 cl < cold.cl
 # cat bpm.cl
 imexpr "max(a,b)" bpmFILTER.pl a=hotFILTER.pl b=coldFILTER.pl
 hedit @bdfFILTER.list BPM bpmFILTER.pl add+ ver- 
 # sed 's/FILTER/'${filter}'/g'  bpm.cl > dobpm.cl
 cl < dobpm.cl
 
 # Object masks creation
 nproto
 objmask @bdfFILTER.list @objbdfFILTER.list masks="!BPM" hsig=2 lsig=2 
 #Astrometry:
 # gethead OBJCTRA @bdfb.list > name_ra.txt
 # gethead OBJCTDEC @bdfb.list | awk '{print $2,$3,$4}' > dec.txt
 # paste -d" " name_ra.txt dec.txt | awk '{print $1,($2+$3/60+$4/3600)*15,$5+$6/60+$7/3600}' > astrometry.txt
 # cat komanda.sh
 solve-field img --ra imagera --dec imagedec --radius 0.2 --scale-units arcsecperpix --scale-low 0.38 --scale-high 0.40 --crpix-center --wcs img.wcs 
  #while read line; do img=$(echo $line | awk '{print $1}'); imagera=$(echo $line | awk '{print $2}'); imagedec=$(echo $line | awk '{print $3}'); sed -e 's/img/'$img'/g' -e 's/imagera/'${imagera}'/g' -e 's/imagedec/'${imagedec}'/g' komanda.sh; done < astrometry.txt > doAstrometry.sh 
  # /bin/bash doAstrometry.sh
  #ls *wcs > wcsFILTER.list
  wcscopy @bdfFILTER.list @wcsFILTER.list ver-
  
  # Creation of super sky flat, normalization to each individual image median background and final stacking
  # cat stat.cl
  real mini
  real sky
  imstat("img",fields="min",lower=INDEF,upper=INDEF,for-) | scanf("%g", mini)
  imcalc(input="img,msk",output="nosky",equals="if(im2==0.) then im1 else "//mini-0.001.,ver-)
  imstat("nosky",fields="midpt",lower=mini-0.001,upper=INDEF,for-) | scanf("%g", sky)
  print("img"," ",sky)
  imarith("img","/",sky,"norm")
  imdelete("nosky",yes)
  # while read line; do img=$(echo $line | awk '{print $1}'); msk="obj"${img%.*}.pl; rsky="norm"${img}; cat stat.cl | sed -e 's/img/'${img}'/g' -e 's/msk/'${msk}'/g'  -e 's/norm/'${rsky}'/g'; done < bdf${filter}.list >  bla.cl
  cl < bla.cl > med_values.txt
  # ls normbdf*fit > norm.list
  # awk '{print "imarith norm.fits * "$2," n"$1}' med_values.txt > donorm.cl
  # awk '{print "imarith",$1,"-","n"$1,"s"$1}' med_values.txt > do.cl
   
  imcomb n@bdfFILTER.list final.fits comb=med offset="wcs"
Personal tools