Changeset 36375 for trunk/psphot/test/tap_psphot_galaxygrid.pro
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
trunk/psphot
- Property svn:mergeinfo changed
-
trunk/psphot/test/tap_psphot_galaxygrid.pro
r36086 r36375 30 30 $RefOptions = $RefOptions -nx 3000 -ny 3000 31 31 32 if (not($?PSFMODEL)) 33 $PSFMODEL = PS1_V1 34 end 35 36 macro reset.options 32 37 # options for the simulated images (using the refimage for the stars) 33 38 $FakeOptions = $BaseOptions 34 39 $FakeOptions = $FakeOptions -exptime 30.0 35 $FakeOptions = $FakeOptions -D PSF.MODEL PS_MODEL_GAUSS 40 # $FakeOptions = $FakeOptions -D PSF.MODEL PS_MODEL_GAUSS 41 $FakeOptions = $FakeOptions -D PSF.MODEL PS_MODEL_$PSFMODEL 36 42 $FakeOptions = $FakeOptions -nx 3000 -ny 3000 37 43 … … 69 75 $FakeConfig = $FakeConfig -Di GALAXY.GRID.DX 300 70 76 $FakeConfig = $FakeConfig -Di GALAXY.GRID.DY 300 77 end 78 79 if (not($?FakeConfig)) reset.options 71 80 72 81 list fwhm … … 75 84 1.2 76 85 1.5 86 end 87 88 if (not($?CONVOLVE_NSIGMA)) set CONVOLVE_NSIGMA = 5.0 89 90 # generate fake images and run psphot on them 91 macro mkexp.devexp.single 92 if ($0 != 5) 93 echo "USAGE: mkexp.devexp.single (basename) (type) (Rmajor) (fwhm)" 94 break 95 end 96 97 $basename = $1 98 $type = $2 99 $Rmajor = $3 100 $fwhm = $4 101 102 $Aratio = 1.0 103 104 $FakeConfig = -camera SIMTEST 105 $FakeConfig = $FakeConfig -recipe PPSIM STACKTEST.RUN 106 $FakeConfig = $FakeConfig -D PSASTRO:PSASTRO.CATDIR catdir.ref 107 $FakeConfig = $FakeConfig -Db STARS.FAKE F ; # only use stars from catdir.ref 108 $FakeConfig = $FakeConfig -Db MATCH.DENSITY F 109 $FakeConfig = $FakeConfig -Db PSF.CONVOLVE T 110 $FakeConfig = $FakeConfig -Db GALAXY.FAKE T ; # generate a "realistic" distribution of galaxies 111 $FakeConfig = $FakeConfig -Df GALAXY.MAG 17.0 112 $FakeConfig = $FakeConfig -Df GALAXY.GRID.MAG 14.5 113 $FakeConfig = $FakeConfig -Db GALAXY.GRID T ; # generate a grid of galaxies (constant mag) 114 $FakeConfig = $FakeConfig -Df GALAXY.THETA.MIN 0 115 $FakeConfig = $FakeConfig -Df GALAXY.THETA.MAX 180 116 $FakeConfig = $FakeConfig -Di GALAXY.GRID.DX 300 117 $FakeConfig = $FakeConfig -Di GALAXY.GRID.DY 300 118 $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MIN 1.0 119 $FakeConfig = $FakeConfig -Df GALAXY.INDEX.MAX 1.0 120 $FakeConfig = $FakeConfig -Df CONVOLVE.NSIGMA $CONVOLVE_NSIGMA 121 $BaseConfig = $FakeConfig 122 123 $FakeConfig = $BaseConfig 124 $FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MIN $Rmajor 125 $FakeConfig = $FakeConfig -Df GALAXY.RMAJOR.MAX $Rmajor 126 $FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MIN $Aratio 127 $FakeConfig = $FakeConfig -Df GALAXY.ARATIO.MAX $Aratio 128 129 mkexp $basename $fwhm $type 77 130 end 78 131 … … 272 325 label -x sequence -y "M_out| - M_in|" 273 326 resize 700 320 327 328 # check on magnitude 329 set dI = Iot_s - Iin_s 330 lim -n 4$1 n -1.0 1.0; clear; box; plot n dI 331 label -x sequence -y "I_out| - I_in|" 332 resize 700 320 333 end 334 335 macro grid.plot.stars 336 if ($0 != 2) 337 echo "USAGE: grid.plot.stars (version)" 338 break 339 end 340 # things to examine: theta, Rmajor, AR 341 342 # go.grid.check.devexp 343 344 # check on position 345 set dX = Xot_s - int(Xin_s) - 0.5 346 set dY = Yot_s - int(Yin_s) - 0.5 347 set ARin = rin_s / Rin_s 348 set dR = Rin_s - Rot_s 349 350 create n 0 dR[] 351 set dRf = dR / Rin_s 352 lim -n 1$1 n -0.5 0.5; clear; box; plot n dRf 353 label -x sequence -y "1 - R_out| / R_in|" 354 resize 700 320 355 356 # check on A.Ratio 357 set ARot = rot_s / Rot_s 358 # lim ARin ARot; clear; box; plot ARin ARot 359 set fAR = ARot / ARin 360 lim -n 2$1 n 0.5 1.5; clear; box; plot n fAR 361 label -x sequence -y "AR_out| / AR_in|" 362 resize 700 320 363 364 # check on magnitude 365 set dM = Mot_s - Min_s 366 lim -n 3$1 n -0.5 0.5; clear; box; plot n dM 367 label -x sequence -y "M_out| - M_in|" 368 resize 700 320 369 370 lim -n 4$1 n -1.5 1.5; clear; box; plot n dX 371 label -x sequence -y "X_out| - X_in|" 372 resize 700 320 373 374 lim -n 5$1 n -1.5 1.5; clear; box; plot n dY 375 label -x sequence -y "Y_out| - Y_in|" 376 resize 700 320 274 377 end 275 378 … … 487 590 end 488 591 592 if (not($?NSIGMA_CONV)) set NSIGMA_CONV = 5.0 593 489 594 # create a realistic distribution of fake stars, GAUSS PSF 490 595 macro fitexp … … 507 612 $psphotConfig = $psphotConfig -Db PSPHOT:SAVE.RESID T 508 613 $psphotConfig = $psphotConfig -D PSPHOT:EXTENDED_SOURCE_MODELS_SELECTION $fitModel 614 $psphotConfig = $psphotConfig -D PSPHOT:PSF_MODEL PS_MODEL_$PSFMODEL 615 616 $psphotConfig = $psphotConfig -Db PSPHOT:PSF.RESIDUALS F 617 $psphotConfig = $psphotConfig -Db PSPHOT:POISSON.ERRORS.PHOT.LMM F 618 $psphotConfig = $psphotConfig -Db PSPHOT:EXTENDED_SOURCE_FITS_POISSON F 619 $psphotConfig = $psphotConfig -Di PSPHOT:EXT_FIT_ITER 15 620 $psphotConfig = $psphotConfig -Df PSPHOT:PSF_FIT_RADIUS_SCALE 3.75 621 $psphotConfig = $psphotConfig -Df PSPHOT:EXT_FIT_NSIGMA_CONV $NSIGMA_CONV 509 622 510 623 # ppImage / psphot on the output … … 516 629 end 517 630 631 macro cmf.load.reset 632 $fields = X Y M T R r MT I 633 foreach field $fields 634 foreach set in ot 635 delete -q $field\$set\_s 636 end 637 end 638 639 delete -q min_S Min_S 640 end 641 518 642 macro cmf.load.concat 519 643 if ($0 != 4) 520 echo "USAGE: cmf.load.concat (dat) (cmf) ( type)"644 echo "USAGE: cmf.load.concat (dat) (cmf) (inType)" 521 645 break 522 646 end … … 525 649 read Xin_all 1 Yin_all 2 Fin_all 3 Type 4 Min_all 5 RmajIn_all 7 RminIn_all 8 ThetaIn_all 9 IndexIn_all 10 526 650 651 $TYPE_S = 83 652 $TYPE_D = 68 653 $TYPE_E = 69 654 if ("$3" == "SERSIC") 655 $InType = $TYPE_S 656 end 657 if ("$3" == "DEV") 658 $InType = $TYPE_D 659 set IndexIn_all = 0.125 + zero(Xin_all) 660 end 661 if ("$3" == "EXP") 662 $InType = $TYPE_E 663 set IndexIn_all = 0.5 + zero(Xin_all) 664 end 665 666 # select only the galaxies 527 667 subset Xin = Xin_all if (Type == 1) 528 668 subset Yin = Yin_all if (Type == 1) … … 539 679 subset IndexIn = IndexIn_all if (Type == 1) 540 680 541 $TYPE_S = 83542 $TYPE_D = 68543 $TYPE_E = 69544 if ("$3" == "SERSIC")545 $InType = $TYPE_S546 end547 if ("$3" == "DEV")548 $InType = $TYPE_D549 end550 if ("$3" == "EXP")551 $InType = $TYPE_E552 end553 554 681 data $2 555 682 556 683 break -auto off 684 output -err /dev/null 557 685 read -fits Chip.xfit X_EXT Y_EXT EXT_INST_MAG EXT_WIDTH_MAJ EXT_WIDTH_MIN EXT_THETA MODEL_TYPE EXT_PAR_07 558 686 $reread = not($STATUS) 687 output -err stderr 559 688 break -auto on 560 689 if ($reread) 561 690 read -fits Chip.xfit X_EXT Y_EXT EXT_INST_MAG EXT_WIDTH_MAJ EXT_WIDTH_MIN EXT_THETA MODEL_TYPE 562 set EXT_PAR_07 = (MODEL_TYPE:9 == 68)* 4 + (MODEL_TYPE:9 == 69)691 set EXT_PAR_07 = (MODEL_TYPE:9 == 68)*0.125 + (MODEL_TYPE:9 == 69)*0.5 563 692 end 564 693 … … 589 718 reindex rin_m = RminIn using index2 590 719 591 if ("$3" == "SERSIC") 592 reindex Iot_m = EXT_PAR_07 using index1 593 reindex Iin_m = IndexIn using index2 594 $fields = X Y M T R r MT I 595 else 596 $fields = X Y M T R r MT 597 end 720 reindex Iot_m = EXT_PAR_07 using index1 721 reindex Iin_m = IndexIn using index2 722 $fields = X Y M T R r MT I 598 723 599 724 foreach field $fields … … 605 730 concat min min_S 606 731 concat Min Min_S 732 end 733 734 macro cmf.load.stars.concat 735 if ($0 != 3) 736 echo "USAGE: cmf.load.concat (dat) (cmf)" 737 break 738 end 739 740 data $1 741 read Xin_all 1 Yin_all 2 Type 4 Min_all 5 RmajIn_all 7 RminIn_all 8 ThetaIn_all 9 IndexIn_all 10 742 743 subset Xin = Xin_all if (Type == 0) 744 subset Yin = Yin_all if (Type == 0) 745 subset Min = Min_all if (Type == 0) 746 subset RmajIn = RmajIn_all if (Type == 0) 747 subset RminIn = RminIn_all if (Type == 0) 748 subset IndexIn = IndexIn_all if (Type == 0) 749 subset Tin_rad = ThetaIn_all if (Type == 0) 750 set Tin = Tin_rad * 180 / 3.14159265 751 752 data $2 753 754 break -auto off 755 read -fits Chip.psf X_PSF Y_PSF PSF_INST_MAG PSF_MAJOR PSF_MINOR PSF_THETA 756 set PSF_THETA_ALT = PSF_THETA * (PSF_THETA >= 0.0) + (PSF_THETA + 3.14159265) * (PSF_THETA < 0.0) 757 set PSF_THETA = PSF_THETA_ALT * 180 / 3.14159265 758 759 match2d X_PSF Y_PSF Xin Yin 1.0 -index1 index1 -index2 index2 760 761 reindex Xot_m = X_PSF using index1 762 reindex Yot_m = Y_PSF using index1 763 764 reindex Xin_m = Xin using index2 765 reindex Yin_m = Yin using index2 766 767 reindex Mot_m = PSF_INST_MAG using index1 768 reindex Tot_m = PSF_THETA using index1 769 770 reindex Min_m = Min using index2 771 reindex Tin_m = Tin using index2 772 773 reindex Rot_m = PSF_MAJOR using index1 774 reindex rot_m = PSF_MINOR using index1 775 776 reindex Rin_m = RmajIn using index2 777 reindex rin_m = RminIn using index2 778 779 $fields = X Y M T R r 780 foreach field $fields 781 foreach set in ot 782 concat $field\$set\_m $field\$set\_s 783 end 784 end 607 785 end 608 786 … … 1078 1256 1079 1257 macro load.normdata 1080 if ($0 != 2)1081 echo "USAGE: load.normdata (file) "1258 if ($0 != 3) 1259 echo "USAGE: load.normdata (file) [clear/noclear]" 1082 1260 break 1083 1261 end … … 1090 1268 set dm = mg - Mg 1091 1269 set n = ramp(dm) 1092 lim n dm; clear; box; plot n dm 1270 if ("$2" == "clear") 1271 lim n dm; clear; box; 1272 end 1273 plot n dm 1093 1274 end 1094 1275 … … 1097 1278 exit 0 1098 1279 end 1280 1281 # note that t1 = original confi 1282 # t2 = no residuals 1283 # t3 = const weight PSF fit 1284 # t4 = const weight galaxy fits 1285 1286 macro run.radius.loop 1287 local radius Nrun 1288 1289 if (1) 1290 $Nrun = 0 1291 foreach radius 1.0 1.5 2.0 2.5 3.0 4.0 6.0 8.0 1292 mkexp.devexp.single tests.20131120/testrad.ps1v1.exp.$Nrun EXP $radius 1.0 1293 fitexp tests.20131120/testrad.ps1v1.exp.$Nrun tests.20131120/testrad.ps1v1.exp.$Nrun.t4b EXP_CONV 1294 $Nrun ++ 1295 end 1296 end 1297 1298 $Nrun = 0 1299 foreach radius 1.0 1.5 2.0 2.5 3.0 4.0 6.0 8.0 1300 cmf.load.concat tests.20131120/testrad.ps1v1.exp.$Nrun.dat tests.20131120/testrad.ps1v1.exp.$Nrun.t4b.cmf EXP 1301 echo -no-return $radius "" 1302 check.fit tests.20131120/testrad.ps1v1.exp.$Nrun.dat tests.20131120/testrad.ps1v1.exp.$Nrun.t4b.cmf EXP 1303 $Nrun ++ 1304 end 1305 1306 grid.plots.devexp a 1307 end 1308 1309 macro check.radius.loop 1310 if ($0 != 2) 1311 echo "USAGE: check.radius.loop (ext)" 1312 break 1313 end 1314 1315 # cmf.load.reset 1316 1317 local radius Nrun 1318 1319 $Nrun = 0 1320 foreach radius 1.0 1.5 2.0 2.5 3.0 4.0 6.0 8.0 1321 echo -no-return $radius "" 1322 check.fit tests.20131120/testrad.ps1v1.exp.$Nrun.dat tests.20131120/testrad.ps1v1.exp.$Nrun.$1.cmf EXP 1323 $Nrun ++ 1324 end 1325 1326 grid.plots.devexp a 1327 end 1328 1329 macro check.fit 1330 if ($0 != 4) 1331 echo "USAGE: check.fit (dat) (cmf) (type)" 1332 break 1333 end 1334 1335 cmf.load.concat $1 $2 $3 1336 set dM_m = Mot_m - Min_m 1337 vstat -q dM_m 1338 $mag_off = $MEDIAN 1339 set dR_m = Rot_m - Rin_m 1340 vstat -q dR_m 1341 $rad_off = $MEDIAN 1342 echo $mag_off $rad_off 1343 end 1344 1345 macro make.circles 1346 1347 delete Xo Yo Ro 1348 1349 for ix 0 16 1350 for iy $ix 16 1351 $r2 = $ix^2 + $iy^2 1352 if ($r2 > 15^2) continue 1353 concat $ix Xo 1354 concat $iy Yo 1355 concat $r2 Ro 1356 end 1357 end 1358 1359 sort Ro Xo Yo 1360 $Rold = -1 1361 $N = -1 1362 for i 0 Ro[] 1363 if (Ro[$i] != $Rold) 1364 $N ++ 1365 $Rold = Ro[$i] 1366 end 1367 if ((Xo[$i] == 0) && (Yo[$i] == 0)) 1368 fprintf "// center is 0,0" 1369 continue 1370 end 1371 if (Xo[$i] == 0) 1372 fprintf "ADD_AXIS (%3d, %2d) // r^2 = %3d" $N Yo[$i] Ro[$i] 1373 continue 1374 end 1375 if (Xo[$i] == Yo[$i]) 1376 fprintf "ADD_DIAG (%3d, %2d) // r^2 = %3d" $N Xo[$i] Ro[$i] 1377 continue 1378 end 1379 1380 fprintf "ADD_RAND (%3d, %2d, %2d) // r^2 = %3d" $N Xo[$i] Yo[$i] Ro[$i] 1381 end 1382 end 1383 1384 # EXP : tests.20131120/test.nsig 1385 # DEV : tests.20131120/test.dev 1386 1387 # run.convolve.loop tests.20131120/test.nsig tests.20131120/test.nsig EXP EXP_CONV 1388 # run.convolve.loop tests.20131120/test.dev tests.20131120/test.dev DEV DEV_CONV 1389 # run.convolve.loop tests.20131120/test.nsig tests.20131120/test.serexp EXP SER_CONV 1390 # run.convolve.loop tests.20131120/test.dev tests.20131120/test.serdev DEV SER_CONV 1391 1392 macro run.convolve.loop 1393 if ($0 != 5) 1394 echo "run.convolve.loop (inName) (fitName) (inType) (fitType)" 1395 break 1396 end 1397 1398 local radius 1399 $radius = 3.0 1400 cmf.load.reset 1401 1402 # foreach Cin 3 5 7 9 11 1403 foreach Cin 11 1404 $CONVOLVE_NSIGMA = $Cin 1405 sprintf nameIn %s.%02d $1 $Cin 1406 mkexp.devexp.single $nameIn $3 $radius 1.0 1407 foreach Cot 3 5 7 9 11 1408 $NSIGMA_CONV = $Cot 1409 sprintf nameOt %s.%02d.%02d $2 $Cin $Cot 1410 fitexp $nameIn $nameOt $4 1411 end 1412 end 1413 1414 # foreach Cin 3 5 7 9 11 1415 foreach Cin 11 1416 sprintf nameIn %s.%02d $1 $Cin 1417 foreach Cot 3 5 7 9 11 1418 sprintf nameOt %s.%02d.%02d $2 $Cin $Cot 1419 check.fit $nameIn.dat $nameOt.cmf 1420 end 1421 end 1422 grid.plots.devexp a 1423 end 1424 1425 macro check.convolve.loop 1426 if ($0 != 4) 1427 echo "run.convolve.loop (inName) (fitName) (inType)" 1428 break 1429 end 1430 1431 local radius 1432 $radius = 3.0 1433 cmf.load.reset 1434 1435 # foreach Cin 3 5 7 9 11 1436 foreach Cin 11 1437 sprintf nameIn %s.%02d $1 $Cin 1438 foreach Cot 3 5 7 9 11 1439 sprintf nameOt %s.%02d.%02d $2 $Cin $Cot 1440 echo -no-return $Cin $Cot " " 1441 check.fit $nameIn.dat $nameOt.cmf $3 1442 end 1443 end 1444 grid.plots.devexp a 1445 end
Note:
See TracChangeset
for help on using the changeset viewer.
