Changeset 38939
- Timestamp:
- Oct 22, 2015, 5:55:02 AM (11 years ago)
- Location:
- trunk/ippToPsps
- Files:
-
- 3 edited
-
jython/stackbatch.py (modified) (12 diffs)
-
jython/testCode.py (modified) (1 diff)
-
test/mkgpc1data.dvo (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/stackbatch.py
r38906 r38939 382 382 383 383 sqlLine.group("a."+filter+"infoFlag3", "b.flags") 384 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND b.imageID = " + str(imageID) + " and a." + filter + "ippDetectID=b.ippDetectID")384 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID)) 385 385 386 386 try: self.scratchDb.execute(sql) … … 445 445 self.logger.infoPair("no stack data for filter" , filter) 446 446 continue 447 448 imageID = self.imageIDs[filter] 449 self.logger.infoPair("selecting imageID", imageID) 447 450 448 451 header = self.headerSet[filter] … … 511 514 # sqlLine.group("a."+filter+"airmass", "b.airmass") 512 515 513 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID") 516 # match to the detections from the specific image 517 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID)) 514 518 515 519 try: … … 580 584 self.deleteRowsWithNoStackData(tablename) 581 585 self.tablesToExport.append(tablename) 582 583 584 586 585 587 # gippdetectic … … 593 595 # ghalfLightRad 594 596 595 596 597 598 599 600 601 602 597 # currently, none of the fields defined by the table are generated 603 598 … … 647 642 header = self.headerSet[filter] 648 643 644 imageID = self.imageIDs[filter] 645 self.logger.infoPair("selecting imageID", imageID) 646 649 647 # model calibrated magnitude = instrumental magnitude + 2.5*log10(exptime) + ZP (added below from dvoDetectionTable) 650 648 magtime = "%.5f" % (2.5*math.log10(float(header['EXPTIME']))) … … 704 702 sqlLine = sqlUtility("UPDATE " + tablename + " AS a, " + self.scratchDb.dvoDetectionTable + " as b SET") 705 703 sqlLine.group("a." + filter + model + "Mag", "a." + filter + model + "Mag + b.zp") 706 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID" + " AND b.imageID = " + str(self.imageIDs[filter])) 704 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID)) 705 707 706 try: 708 707 self.scratchDb.execute(sql) … … 815 814 header = self.headerSet[filter] 816 815 816 imageID = self.imageIDs[filter] 817 self.logger.infoPair("selecting imageID", imageID) 818 817 819 # PETRO_MAG is instrumental + 2.5log(exptime) + FPA.ZP 818 820 # we want to apply the DVO zero point, so remove FPA.ZP: … … 847 849 sqlLine = sqlUtility("UPDATE " + tablename + " AS a, " + self.scratchDb.dvoDetectionTable + " as b SET") 848 850 sqlLine.group("a." + filter + "petMag", "a." + filter + "petMag + b.zp") 849 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID ")851 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID)) 850 852 851 853 try: self.scratchDb.execute(sql) … … 933 935 self.logger.infoPair("no stack data for filter" , filter) 934 936 return True 937 938 imageID = self.imageIDs[filter] 939 self.logger.infoPair("selecting imageID", imageID) 935 940 936 941 minRadius = 1 … … 1032 1037 sqlLine.group(field + "Err", field + "err" + " * b.zpFactor") 1033 1038 sqlLine.group(field + "Std", field + "Std" + " * b.zpFactor") 1034 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(self.imageIDs[filter]) ) 1039 1040 sql = sqlLine.makeEquals("WHERE a.objID = b.objID AND a." + filter + "ippDetectID = b.ippDetectID AND b.imageID = " + str(imageID)) 1041 1035 1042 try: self.scratchDb.execute(sql) 1036 1043 except: … … 1222 1229 raise 1223 1230 1224 # ok, now fill g/r/i/z/yippDetectID using objID and detectID and im ge ID1231 # ok, now fill g/r/i/z/yippDetectID using objID and detectID and image ID 1225 1232 1226 1233 for filter in self.filters: -
trunk/ippToPsps/jython/testCode.py
r37246 r38939 20 20 def run(self): 21 21 22 # tables = stilts.treads(fileName) 23 22 24 for x in range(0, 8): 23 25 for y in range(0, 8): -
trunk/ippToPsps/test/mkgpc1data.dvo
r38932 r38939 19 19 # imagedata describes the full fake exposure set. the fields are 20 20 list imagedata 21 # exp_id stk_id filebase M_off date time warpfile 22 1 1 $OUTDIR/test.01 0.000 2010/01/01 01:00:00 $OUTDIR/warp.01 23 2 1 $OUTDIR/test.02 -0.025 2010/01/01 02:00:00 $OUTDIR/warp.02 24 3 1 $OUTDIR/test.03 0.025 2010/01/01 03:00:00 $OUTDIR/warp.03 25 4 1 $OUTDIR/test.04 0.010 2010/01/01 04:00:00 $OUTDIR/warp.04 26 5 2 $OUTDIR/test.05 0.000 2010/01/01 05:00:00 $OUTDIR/warp.05 27 6 2 $OUTDIR/test.06 -0.025 2010/01/01 06:00:00 $OUTDIR/warp.06 28 7 2 $OUTDIR/test.07 0.025 2010/01/01 07:00:00 $OUTDIR/warp.07 29 8 2 $OUTDIR/test.08 0.010 2010/01/01 08:00:00 $OUTDIR/warp.08 30 9 3 $OUTDIR/test.09 0.000 2010/01/01 09:00:00 $OUTDIR/warp.09 31 10 3 $OUTDIR/test.10 -0.025 2010/01/01 10:00:00 $OUTDIR/warp.10 32 11 3 $OUTDIR/test.11 0.025 2010/01/01 11:00:00 $OUTDIR/warp.11 33 12 3 $OUTDIR/test.12 0.010 2010/01/01 12:00:00 $OUTDIR/warp.12 21 # exp_id stk_id filebase M_off date time warpfile filter 22 1 1 $OUTDIR/test.01 0.000 2010/01/01 01:00:00 $OUTDIR/warp.01 g 23 2 1 $OUTDIR/test.02 -0.025 2010/01/01 02:00:00 $OUTDIR/warp.02 g 24 3 1 $OUTDIR/test.03 0.025 2010/01/01 03:00:00 $OUTDIR/warp.03 g 25 4 1 $OUTDIR/test.04 0.010 2010/01/01 04:00:00 $OUTDIR/warp.04 g 26 # 5 2 $OUTDIR/test.05 0.000 2010/01/01 05:00:00 $OUTDIR/warp.05 g 27 # 6 2 $OUTDIR/test.06 -0.025 2010/01/01 06:00:00 $OUTDIR/warp.06 g 28 # 7 2 $OUTDIR/test.07 0.025 2010/01/01 07:00:00 $OUTDIR/warp.07 g 29 # 8 2 $OUTDIR/test.08 0.010 2010/01/01 08:00:00 $OUTDIR/warp.08 g 30 # 9 3 $OUTDIR/test.09 0.000 2010/01/01 09:00:00 $OUTDIR/warp.09 g 31 # 10 3 $OUTDIR/test.10 -0.025 2010/01/01 10:00:00 $OUTDIR/warp.10 g 32 # 11 3 $OUTDIR/test.11 0.025 2010/01/01 11:00:00 $OUTDIR/warp.11 g 33 # 12 3 $OUTDIR/test.12 0.010 2010/01/01 12:00:00 $OUTDIR/warp.12 g 34 13 4 $OUTDIR/test.13 -0.025 2010/01/02 01:00:00 $OUTDIR/warp.13 r 35 14 4 $OUTDIR/test.14 0.025 2010/01/02 02:00:00 $OUTDIR/warp.14 r 36 15 4 $OUTDIR/test.15 0.010 2010/01/02 03:00:00 $OUTDIR/warp.15 r 37 16 4 $OUTDIR/test.16 0.000 2010/01/02 04:00:00 $OUTDIR/warp.16 r 38 # 17 5 $OUTDIR/test.17 -0.025 2010/01/02 05:00:00 $OUTDIR/warp.17 r 39 # 18 5 $OUTDIR/test.18 0.025 2010/01/02 06:00:00 $OUTDIR/warp.18 r 40 # 19 5 $OUTDIR/test.19 0.010 2010/01/02 07:00:00 $OUTDIR/warp.19 r 41 # 20 5 $OUTDIR/test.20 0.000 2010/01/02 08:00:00 $OUTDIR/warp.20 r 42 # 21 6 $OUTDIR/test.21 -0.025 2010/01/02 09:00:00 $OUTDIR/warp.21 r 43 # 22 6 $OUTDIR/test.22 0.025 2010/01/02 10:00:00 $OUTDIR/warp.22 r 44 # 23 6 $OUTDIR/test.23 0.010 2010/01/02 11:00:00 $OUTDIR/warp.23 r 45 # 24 6 $OUTDIR/test.24 -0.020 2010/01/02 12:00:00 $OUTDIR/warp.24 r 34 46 end 35 47 36 48 list stackdata 37 # stk_id filename M_off 38 1 $OUTDIR/stack.01 0.010 39 2 $OUTDIR/stack.02 0.020 40 3 $OUTDIR/stack.03 0.030 49 # stk_id sky_id filename M_off filter 50 1 1 $OUTDIR/stack.01 0.010 g 51 # 2 2 $OUTDIR/stack.02 0.020 g 52 # 3 3 $OUTDIR/stack.03 0.030 g 53 4 1 $OUTDIR/stack.04 0.025 r 54 # 5 2 $OUTDIR/stack.05 0.035 r 55 # 6 3 $OUTDIR/stack.06 0.045 r 41 56 end 42 57 43 58 macro mkfull 44 59 init.db 45 mkcatdir.cam PS1_V5 PS1_V560 # mkcatdir.cam PS1_V5 PS1_V5 46 61 mkcatdir.stk PS1_V5 PS1_V5 47 mkcatdir.wrp PS1_V5_Lensing PS1_V562 # mkcatdir.wrp PS1_V5_Lensing PS1_V5 48 63 insert.stack.set 49 64 end … … 96 111 $cmffile = $word:2\.smf 97 112 $offset = $word:3 98 99 113 sprintf myDATE "%s" $word:4 100 114 sprintf myTIME "%s" $word:5 115 $filter = $word:7 116 101 117 echo ctimes -abs $myDATE,$myTIME -var mjd 102 118 ctimes -abs $myDATE,$myTIME -var mjd … … 114 130 mcreate dummy 0 0 115 131 keyword dummy MJD-OBS -wf $mjd 116 keyword dummy FILTERID -w r.00000132 keyword dummy FILTERID -w $filter.00000 117 133 keyword dummy EXPTIME -wf 1.0 118 134 … … 152 168 153 169 mkinput $offset $rawfile 154 echo mkcmf -photcode SIMTEST. r.Chip -no-noise -append $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 0155 exec mkcmf -photcode SIMTEST. r.Chip -no-noise -append $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 0170 echo mkcmf -photcode SIMTEST.$filter.Chip -no-noise -append $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 0 171 exec mkcmf -photcode SIMTEST.$filter.Chip -no-noise -append $rawfile $cmffile -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 0 156 172 157 173 if ($i == 3) … … 210 226 mkdir $OUTDIR 211 227 212 local i catdir RA DEC ID rawfile cmffile offset228 local i catdir RA DEC stkID skyID rawfile cmffile offset 213 229 $catdir = $OUTDIR/catdir.stk 214 230 exec rm -rf $catdir … … 219 235 for i 0 $stackdata:n 220 236 list word -split $stackdata:$i 221 $ID = $word:0 222 $rawfile = $word:1\.txt 223 $cmffile = $word:1\.cmf 224 $offset = $word:2 237 $stkID = $word:0 238 $skyID = $word:1 239 $rawfile = $word:2\.txt 240 $cmffile = $word:2\.cmf 241 $offset = $word:3 242 $filter = $word:4 225 243 226 244 ## this is not generating photcodes recognized as stack by relphot 227 245 228 246 mkinput $offset $rawfile 229 echo mkcmf -stack -photcode SIMTEST. r.SkyChip $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $ID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL230 exec mkcmf -stack -photcode SIMTEST. r.SkyChip $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $ID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL247 echo mkcmf -stack -photcode SIMTEST.$filter.SkyChip $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL 248 exec mkcmf -stack -photcode SIMTEST.$filter.SkyChip $rawfile $cmffile -extroot SkyChip -date 2008/1/1 -time $i\:00:00 -mjd 54466.0 -radec $RA $DEC -type $1 -imageID $stkID -sourceID 1 -tess_id $TESS_ID -skycell $SKYCELL 231 249 232 250 # add some required header keywords: 233 exec echo "HIERARCH FPA.ZP = 25. / Magnitude zero point" > tmp.hdr 234 exec fits_insert $cmffile tmp.hdr 235 236 echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 237 exec addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass 238 end 239 240 echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update 241 exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update 251 # exec echo "HIERARCH FPA.ZP = {25.+$offset} / Magnitude zero point" > tmp.hdr 252 # exec fits_insert $cmffile tmp.hdr 253 254 echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -D ZERO_POINT_OPTION CHIP_HEADER 255 exec addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -D ZERO_POINT_OPTION CHIP_HEADER 256 end 257 258 # echo relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update 259 # exec relphot -D CATDIR $catdir -region 8 12 18 22 -images g,r,i,z,y -update 260 261 echo relphot -D CATDIR $catdir -region 8 12 18 22 -averages -update 262 exec relphot -D CATDIR $catdir -region 8 12 18 22 -averages -update 242 263 243 264 if ($PARALLEL) … … 287 308 $cmffile = $word:6\.cmf 288 309 $offset = $word:3 289 290 310 sprintf myDATE "%s" $word:4 291 311 sprintf myTIME "%s" $word:5 312 $filter = $word:7 313 292 314 echo ctimes -abs $myDATE,$myTIME -var mjd 293 315 ctimes -abs $myDATE,$myTIME -var mjd … … 296 318 297 319 mkinput $offset $rawfile 298 echo mkcmf -forcedwarp -photcode SIMTEST. r.ForcedWarp $rawfile $cmffile -extroot SkyChip -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 2 -tess_id $TESS_ID -skycell $SKYCELL -bad-psfqf-frac $BAD_PSFQF_FRAC299 exec mkcmf -forcedwarp -photcode SIMTEST. r.ForcedWarp $rawfile $cmffile -extroot SkyChip -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 2 -tess_id $TESS_ID -skycell $SKYCELL -bad-psfqf-frac $BAD_PSFQF_FRAC320 echo mkcmf -forcedwarp -photcode SIMTEST.$filter.ForcedWarp $rawfile $cmffile -extroot SkyChip -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 2 -tess_id $TESS_ID -skycell $SKYCELL -bad-psfqf-frac $BAD_PSFQF_FRAC 321 exec mkcmf -forcedwarp -photcode SIMTEST.$filter.ForcedWarp $rawfile $cmffile -extroot SkyChip -date $myDATE -time $myTIME -mjd $mjd -radec $RA $DEC -type $1 -imageID $ID -sourceID 2 -tess_id $TESS_ID -skycell $SKYCELL -bad-psfqf-frac $BAD_PSFQF_FRAC 300 322 301 323 echo addstar -D SKY_DEPTH 4 -D CATDIR $catdir -D CAMERA simtest $cmffile -D CATFORMAT $2 -quick-airmass -xrad … … 383 405 # this inserts a single stack, adding the exposures associated with this stack 384 406 macro insert.stack 385 if ($0 != 3)386 echo "USAGE: insert.stack ( ID) (stkfile)"387 break 388 end 389 390 local i stkID expID expfile wrpfile stkfile407 if ($0 != 5) 408 echo "USAGE: insert.stack (stkID) (skyID) (stkfile) (filter)" 409 break 410 end 411 412 local i stkID skyID expID expfile wrpfile stkfile filter 391 413 392 $stkID = $1 393 $stkfile = $2 394 395 dbinsert stackRun (stack_id, skycell_id, filter, software_ver) values ($stkID, $SKYCELL, "g.00000", "37500") 414 $stkID = $1 415 $skyID = $2 416 $stkfile = $3 417 $filter = $4 418 419 $skycalID = $stkID + 20 420 421 dbinsert stackRun (stack_id, skycell_id, filter, software_ver) values ($stkID, $SKYCELL, "$filter.00000", "37500") 396 422 397 423 # we have a single fullForceRun for each stack, so we can match fullForceRun ids to stackRun ids 398 dbinsert fullForceRun (ff_id, skycal_id) values ($stkID, $s tkID)424 dbinsert fullForceRun (ff_id, skycal_id) values ($stkID, $skycalID) 399 425 400 426 $TIMEFORMAT = mjd … … 429 455 430 456 dbinsert stackSumSkyfile (stack_id, mjd_obs) values ($stkID, $mjd) 431 dbinsert skycalRun (sky_id, skycal_id, stack_id) values ($s tkID, $stkID, $stkID)432 dbinsert skycalResult (skycal_id, path_base) values ($s tkID, "$stkfile")457 dbinsert skycalRun (sky_id, skycal_id, stack_id) values ($skyID, $skycalID, $stkID) 458 dbinsert skycalResult (skycal_id, path_base) values ($skycalID, "$stkfile") 433 459 434 dbinsert addRun (stage, state, stage_id, minidvodb_name) values ("skycal", "full", $s tkID, "catdir.stk")460 dbinsert addRun (stage, state, stage_id, minidvodb_name) values ("skycal", "full", $skycalID, "catdir.stk") 435 461 end 436 462 … … 438 464 macro insert.stack.set 439 465 440 local i 466 local i stkID skyID cmffile filter 441 467 442 468 for i 0 $stackdata:n 443 469 list word -split $stackdata:$i 444 $ID = $word:0 445 $cmffile = $word:1 446 insert.stack $ID $cmffile 470 $stkID = $word:0 471 $skyID = $word:1 472 $cmffile = $word:2 473 $filter = $word:4 474 insert.stack $stkID $skyID $cmffile $filter 447 475 end 448 476
Note:
See TracChangeset
for help on using the changeset viewer.
