Changeset 33134
- Timestamp:
- Jan 23, 2012, 12:09:04 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/addstar/test/relphot.flatcorr.dvo
r33132 r33134 16 16 input tap.dvo 17 17 18 macro test.all 19 test.relphot PS1_DEV_0 PS1_V1 20 test.relphot PS1_DEV_1 PS1_V1 21 test.relphot PS1_V1 PS1_V1 22 test.relphot PS1_V2 PS1_V1 23 test.relphot PS1_DEV_0 PS1_V2 24 test.relphot PS1_DEV_1 PS1_V2 25 test.relphot PS1_V1 PS1_V2 26 test.relphot PS1_V2 PS1_V2 27 end 28 29 list offset 30 0.000 31 -0.025 32 0.025 33 0.010 18 # set various global variables 19 macro init 20 $RA_CENTER = 10.0 21 $DEC_CENTER = 20.0 22 $PLATE_SCALE = 0.25 23 $NSEASON = 3 24 $NFILTER = 3 25 $NCHIP_X = 2 26 $NCHIP_Y = 2 27 $NCELL_X = 2 28 $NCELL_Y = 2 29 $CHIP_DX = 1000 30 $CHIP_DY = 1000 34 31 end 35 32 … … 49 46 50 47 for i 0 $offset:n 51 mkinput $offset:$i48 mkinput test.in.txt $offset:$i 52 49 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC -type $1 53 50 exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 … … 71 68 end 72 69 70 macro mksequence 71 if ($0 != 2) 72 echo "mksequence (fileroot)" 73 break 74 end 75 76 local i 77 78 # we have defined a set of images by mjd and zero point 79 for i 0 mjd[] 80 mkexposure $1.$i $RA_CENTER $DEC_CENTER zpt[$i] mjd[$i] g 81 end 82 end 83 84 macro mkexposure 85 if ($0 != 7) 86 echo "mkexposure (fileroot) (ra) (dec) (zpt) (mjd) (filter)" 87 break 88 end 89 90 local ix iy date time datetime ra dec ROOT RAo DECo ZPT MJD FILTER 91 92 $ROOT = $1 93 $RAo = $2 94 $DECo = $3 95 $ZPT = $4 96 $MJD = $5 97 $FILTER = $6 98 99 $TIMEFORMAT = mjd 100 $TIMEREF = 0.0 101 102 # XX ctimes -ref $MJD -var datetime 103 # XX substr $datetime 0 10 date 104 # XX substr $datetime 11 8 time 105 106 for ix 0 $NCHIP_X 107 for iy 0 $NCHIP_Y 108 $dx = $CHIP_DX * $PLATE_SCALE * ($ix - 0.5*$NCHIP_X + 0.5) 109 $dy = $CHIP_DY * $PLATE_SCALE * ($iy - 0.5*$NCHIP_Y + 0.5) 110 $ra = $RAo - $dx / 3600.0 / dcos($DECo) 111 $dec = $DECo - $dy / 3600.0 112 mkinput test.in.txt $ra $dec $ZPT 113 114 # make a GPC1-style chip 115 # XX exec mkcmf test.in.txt $ROOT.$ix.$iy.cmf -date $date -time $time -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy 116 # XX echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf -date $date -time $time -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy 117 118 exec mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy 119 echo mkcmf test.in.txt $ROOT.$ix.$iy.cmf -mjd $MJD -radec $ra $dec -type PS1_V2 -coords -photcode GPC1.$FILTER.XY$ix\$iy 120 end 121 end 122 end 123 73 124 # make a simple input file for mkcmf 74 125 macro mkinput 126 if ($0 != 5) 127 echo "mkinput (filename) (ra) (dec) (zpt)" 128 break 129 end 130 131 # chip coordinate of the stars 132 set stars_X = (stars_ra - $2) * 3600.0 * dcos($3) / $PLATE_SCALE 133 set stars_Y = (stars_dec - $3) * 3600.0 / $PLATE_SCALE 134 set stars_M = (stars_mag - $4) 135 136 set valid = (stars_X > 0) && (stars_X < $CHIP_DX) && (stars_Y > 0) && (stars_Y < $CHIP_DX) 137 subset stars_x = stars_X if valid 138 subset stars_y = stars_Y if valid 139 subset stars_m = stars_M if valid 140 subset stars_r = stars_ra if valid 141 subset stars_d = stars_dec if valid 142 subset stars_mr = stars_mag if valid 143 144 set cell_x = stars_x / ($CHIP_DX / $NCELL_X) 145 set cell_y = stars_y / ($CHIP_DX / $NCELL_X) 146 147 # eddie says: M_real = M_inst + zpt + ff_offset 148 # thus, stars_mi = stars_mag - zpt - ff_offset = stars_m - offset 149 for i 0 stars_mi[] 150 $nx = cell_x[$i] 151 $ny = cell_y[$i] 152 $offset = cell_off[$nx][$ny] 153 stars_mi[$i] = stars_m[$i] - $offset 154 end 155 156 write -f "%10.6f %10.6f %7.3f %6.1f %6.1f %7.3f" $1 stars_r stars_d stars_mr stars_x stars_y stars_mi 157 end 158 159 # generate a set of stars with raw RA, DEC, MAG values to use for all of the output cmf files 160 macro mkstars 75 161 if ($0 != 2) 76 echo "mkinput (offset)" 77 break 78 end 79 80 exec rm -f test.in.txt 81 82 local i j 83 output test.in.txt 84 for i 10 1024 100 85 for j 10 1024 100 86 fprintf " %6.1f %6.1f %7.3f" $i $j {-15.0 + $1 + 2.5*($i + $j)/1000.0} 87 end 88 end 89 output stdout 162 echo "USAGE: mkstars (Nstars)" 163 break 164 end 165 166 local RA_RANGE DEC_RANGE 167 168 # the images are oriented along N-S, E-W lines 169 170 # size of region of interest in linear arcseconds 171 $RA_RANGE = 1.25 * $CHIP_DX * $NCHIP_X * $PLATE_SCALE 172 $DEC_RANGE = 1.25 * $CHIP_DY * $NCHIP_Y * $PLATE_SCALE 173 174 create tmp 0 $1 175 set stars_ra = $RA_CENTER + $RA_RANGE * (rnd(tmp) - 0.5) / 3600 / dcos ($DEC_CENTER) 176 set stars_dec = $DEC_CENTER + $DEC_RANGE * (rnd(tmp) - 0.5) / 3600 177 set stars_mag = 15.0 + 4.0 * rnd(tmp) 90 178 end 91 179 … … 94 182 95 183 mcreate phu 0 0 96 keyword phu NSEASON -wd 3 97 keyword phu NFILTER -wd 3 98 keyword phu NCHIP_X -wd 2 99 keyword phu NCHIP_y -wd 2 100 keyword phu NCELL_X -wd 2 101 keyword phu NCELL_Y -wd 2 102 keyword phu CHIP_DX -wd 1000 103 keyword phu CHIP_DY -wd 1000 184 keyword phu NSEASON -wd $NSEASON 185 keyword phu NFILTER -wd $NFILTER 186 keyword phu NCHIP_X -wd $NCHIP_X 187 keyword phu NCHIP_y -wd $NCHIP_Y 188 keyword phu NCELL_X -wd $NCELL_X 189 keyword phu NCELL_Y -wd $NCELL_Y 190 keyword phu CHIP_DX -wd $CHIP_DX 191 keyword phu CHIP_DY -wd $CHIP_DY 192 193 # define the season boundaries 104 194 keyword phu TS0_0000 -wf 55000.0 105 195 keyword phu TS1_0000 -wf 55010.0 … … 109 199 keyword phu TS1_0002 -wf 55030.0 110 200 111 create imageID 1 10 201 # create 9 exposures, 3 per season 202 create imageID 0 9 112 203 set zpt = imageID*0.0050 - 0.0025 113 204 set mjd = zero(zpt) … … 124 215 mjd[8] = 55025.03 125 216 126 create chip_off 0 4 127 chip_off[0] = 0.01 128 chip_off[1] = -0.01 129 chip_off[2] = 0.02 130 chip_off[3] = -0.02 131 132 # concat the chip_off vector NSEASON times 217 # create a single flat-field correction map for a single chip 218 mcreate cell_off 2 2 219 cell_off[0][0] = 0.01 220 cell_off[1][0] = -0.01 221 cell_off[0][1] = 0.02 222 cell_off[1][1] = -0.02 223 224 # in the correction table, we have an image of the full exposure 225 # (NCHIP_X x NCHIP_Y) for each season, unwrapped as a single linear 226 # vector (with the last two missing -- how is that hard wired?) 227 228 local ix iy ixc iyc ns 229 230 # unroll the chip & cell level corrections into a single vector for a single image 231 delete -q image_offset 232 for iy 0 $NCHIP_Y 233 for iyc 0 $NCELL_Y 234 for ix 0 $NCHIP_X 235 for ixc 0 $NCELL_X 236 concat cell_off[$ixc][$iyc] image_offset 237 end 238 end 239 end 240 end 241 242 # generate the full set of corrections for a single filter 133 243 delete -q offset 134 concat chip_off offset135 concat chip_offoffset136 concat chip_off offset244 for ns 0 $NSEASON 245 concat image_offset offset 246 end 137 247 138 248 set mjd_obs = mjd … … 140 250 set resid = 0.02*rnd(zpt) - 0.01 141 251 142 delete flatcorr143 dimenup offset flatcorr { 2*2*3} 1252 delete -q flatcorr 253 dimenup offset flatcorr {$NSEASON*$NCHIP_X*$NCHIP_Y*$NCELL_X*$NCELL_Y} 1 144 254 145 255 wd phu testzpt.fits
Note:
See TracChangeset
for help on using the changeset viewer.
