Changeset 36325
- Timestamp:
- Nov 28, 2013, 1:25:15 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130904/psphot
- Files:
-
- 2 edited
-
src/psphotSourceFits.c (modified) (9 diffs)
-
test/tap_psphot_galaxygrid.pro (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130904/psphot/src/psphotSourceFits.c
r36318 r36325 653 653 if (TIMING) { t4 = psTimerMark ("psphotFitPCM"); } 654 654 655 //psphotPCMfitCheckSize (pcm, source, maskVal, psfSize);655 if (options.isInteractive) psphotPCMfitCheckSize (pcm, source, maskVal, psfSize); 656 656 // if (pcm->modelConv->nIter == fitOptions->nIter) { 657 657 // psphotPCMfitRetry (pcm, source, &options, maskVal, markVal, psfSize); … … 791 791 792 792 // 0.5 / n for (0.5, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 6.0) 793 float indexGuessInv[] = {1.00, 0.50, 0.333, 0.25, 1.666, 0.125, 0.10, 0.0833};793 float indexGuessInv[] = {1.00, 0.50, 0.333, 0.25, 0.166, 0.125, 0.10, 0.0833}; 794 794 float indexGuessR1q[] = {1.06, 1.19, 1.335, 1.48, 1.840, 2.290, 2.84, 3.5300}; 795 795 # define N_INDEX_GUESS_INV 8 … … 902 902 rMin = reffGuess[j] / indexGuessR1q[i]; 903 903 } 904 //fprintf (stderr, "%d | %f %f %f %f | %f %f %f %f", i, indexGuessInv[i], reffGuess[j], Io, Chisq, sMin, rMin, iMin, xMin);905 //fprintf (stderr, "\n");904 fprintf (stderr, "%d | %f %f %f %f | %f %f %f %f", i, indexGuessInv[i], reffGuess[j], Io, Chisq, sMin, rMin, iMin, xMin); 905 fprintf (stderr, "\n"); 906 906 } 907 907 } … … 1006 1006 psVector *Sidx = psVectorAllocEmpty (16, PS_TYPE_F32); 1007 1007 1008 PAR[PM_PAR_7] = indexGuessInv[nStart]; 1008 float Sm = NAN, Sp = NAN, So = NAN; 1009 if (nStart == 0) { 1010 Sm = indexGuessInv[nStart]; 1011 So = 0.5*(indexGuessInv[nStart + 1] + indexGuessInv[nStart]); 1012 Sp = indexGuessInv[nStart + 1]; 1013 } else if (nStart == N_INDEX_GUESS_INV - 1) { 1014 Sp = indexGuessInv[nStart]; 1015 So = 0.5*(indexGuessInv[nStart - 1] + indexGuessInv[nStart]); 1016 Sm = indexGuessInv[nStart - 1]; 1017 } else { 1018 Sm = 0.5*(indexGuessInv[nStart - 1] + indexGuessInv[nStart]); 1019 So = indexGuessInv[nStart]; 1020 Sp = 0.5*(indexGuessInv[nStart + 1] + indexGuessInv[nStart]); 1021 } 1022 1023 PAR[PM_PAR_7] = Sm; 1009 1024 pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize); 1010 1025 if (EXTRA_VERBOSE) fprintf (stderr, "%d >>> %d %f : %f - %f %f - %f %f %f - %f\n", source->id, model->nIter, model->chisqNorm, PAR[7], PAR[2], PAR[3], PAR[4], PAR[5], PAR[6], PAR[1]); … … 1012 1027 psVectorAppend (chi2, model->chisqNorm); 1013 1028 1014 PAR[PM_PAR_7] = (nStart < N_INDEX_GUESS_INV - 1) ? 0.5*(indexGuessInv[nStart + 1] + indexGuessInv[nStart]) : indexGuessInv[nStart - 1];1029 PAR[PM_PAR_7] = So; 1015 1030 pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize); 1016 1031 if (EXTRA_VERBOSE) fprintf (stderr, "%d >>> %d %f : %f - %f %f - %f %f %f - %f\n", source->id, model->nIter, model->chisqNorm, PAR[7], PAR[2], PAR[3], PAR[4], PAR[5], PAR[6], PAR[1]); … … 1018 1033 psVectorAppend (chi2, model->chisqNorm); 1019 1034 1020 PAR[PM_PAR_7] = (nStart > 0) ? 0.5*(indexGuessInv[nStart - 1] + indexGuessInv[nStart]) : indexGuessInv[nStart + 1];1035 PAR[PM_PAR_7] = Sp; 1021 1036 pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize); 1022 1037 if (EXTRA_VERBOSE) fprintf (stderr, "%d >>> %d %f : %f - %f %f - %f %f %f - %f\n", source->id, model->nIter, model->chisqNorm, PAR[7], PAR[2], PAR[3], PAR[4], PAR[5], PAR[6], PAR[1]); … … 1036 1051 float Smin = -0.5 * poly->coeff[1] / poly->coeff[2] / 100.0; 1037 1052 1038 // constrain Smin to be in a valid range (1.0 - 0.1, corresponding to 0.5 (Gauss) to 5.0 (slightly peakier than Dev) 1039 Smin = PS_MAX(PS_MIN(Smin, 1.0), 0.1); 1053 // constrain Smin to be in a valid range: allow the fitted range to go a bit beyond the 3 trial points, but no further 1054 float Smx = Sm - 0.25*(So - Sm); 1055 float Spx = Sp + 0.25*(Sp - So); 1056 Smin = PS_MAX(PS_MIN(Smin, Smx), Spx); 1040 1057 PAR[PM_PAR_7] = Smin; 1041 1058 … … 1249 1266 1250 1267 // loop over Reff, keeping the ARatio and Theta constant 1251 for (int j = - 20; j < 21; j++) {1252 1253 float dref = j * 0.0 2;1268 for (int j = -4; j <= 4; j++) { 1269 1270 float dref = j * 0.01; 1254 1271 1255 1272 psEllipseAxes guessAxes; … … 1306 1323 rMin = dref; 1307 1324 } 1308 fprintf (stderr, "%d | %f %f %f | %f %f %f\n", j, dref, Io, Chisq, rMin, iMin, xMin);1325 // fprintf (stderr, "%d | %f %f %f | %f %f %f\n", j, dref, Io, Chisq, rMin, iMin, xMin); 1309 1326 } 1310 1327 -
branches/eam_branches/ipp-20130904/psphot/test/tap_psphot_galaxygrid.pro
r36317 r36325 325 325 label -x sequence -y "M_out| - M_in|" 326 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 327 333 end 328 334 … … 624 630 625 631 macro cmf.load.reset 626 $fields = X Y M T R r MT 632 $fields = X Y M T R r MT I 627 633 foreach field $fields 628 634 foreach set in ot … … 636 642 macro cmf.load.concat 637 643 if ($0 != 4) 638 echo "USAGE: cmf.load.concat (dat) (cmf) ( type)"644 echo "USAGE: cmf.load.concat (dat) (cmf) (inType)" 639 645 break 640 646 end … … 643 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 644 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 645 667 subset Xin = Xin_all if (Type == 1) 646 668 subset Yin = Yin_all if (Type == 1) … … 657 679 subset IndexIn = IndexIn_all if (Type == 1) 658 680 659 $TYPE_S = 83660 $TYPE_D = 68661 $TYPE_E = 69662 if ("$3" == "SERSIC")663 $InType = $TYPE_S664 end665 if ("$3" == "DEV")666 $InType = $TYPE_D667 end668 if ("$3" == "EXP")669 $InType = $TYPE_E670 end671 672 681 data $2 673 682 … … 675 684 output -err /dev/null 676 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 686 $reread = not($STATUS) 677 687 output -err stderr 678 $reread = not($STATUS)679 688 break -auto on 680 689 if ($reread) 681 690 read -fits Chip.xfit X_EXT Y_EXT EXT_INST_MAG EXT_WIDTH_MAJ EXT_WIDTH_MIN EXT_THETA MODEL_TYPE 682 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 683 692 end 684 693 … … 709 718 reindex rin_m = RminIn using index2 710 719 711 # if ("$3" == "SERSIC") 712 reindex Iot_m = EXT_PAR_07 using index1 713 reindex Iin_m = IndexIn using index2 714 $fields = X Y M T R r MT I 715 # else 716 # $fields = X Y M T R r MT 717 # 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 718 723 719 724 foreach field $fields … … 1286 1291 foreach radius 1.0 1.5 2.0 2.5 3.0 4.0 6.0 8.0 1287 1292 mkexp.devexp.single tests.20131120/testrad.ps1v1.exp.$Nrun EXP $radius 1.0 1288 fitexp tests.20131120/testrad.ps1v1.exp.$Nrun tests.20131120/testrad.ps1v1.exp.$Nrun.t4 pEXP_CONV1293 fitexp tests.20131120/testrad.ps1v1.exp.$Nrun tests.20131120/testrad.ps1v1.exp.$Nrun.t4b EXP_CONV 1289 1294 $Nrun ++ 1290 1295 end … … 1293 1298 $Nrun = 0 1294 1299 foreach radius 1.0 1.5 2.0 2.5 3.0 4.0 6.0 8.0 1295 cmf.load.concat tests.20131120/testrad.ps1v1.exp.$Nrun.dat tests.20131120/testrad.ps1v1.exp.$Nrun.t4p.cmf EXP 1296 set dM_m = Mot_m - Min_m 1297 vstat -q dM_m 1298 $mag_off = $MEDIAN 1299 set dR_m = Rot_m - Rin_m 1300 vstat -q dR_m 1301 $rad_off = $MEDIAN 1302 echo $radius $mag_off $rad_off 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 1303 $Nrun ++ 1304 1304 end … … 1319 1319 $Nrun = 0 1320 1320 foreach radius 1.0 1.5 2.0 2.5 3.0 4.0 6.0 8.0 1321 cmf.load.concat tests.20131120/testrad.ps1v1.exp.$Nrun.dat tests.20131120/testrad.ps1v1.exp.$Nrun.$1.cmf EXP 1322 set dM_m = Mot_m - Min_m 1323 vstat -q dM_m 1324 $mag_off = $MEDIAN 1325 set dR_m = Rot_m - Rin_m 1326 vstat -q dR_m 1327 $rad_off = $MEDIAN 1328 echo $radius $mag_off $rad_off 1321 echo -no-return $radius "" 1322 check.fit tests.20131120/testrad.ps1v1.exp.$Nrun.dat tests.20131120/testrad.ps1v1.exp.$Nrun.$1.cmf EXP 1329 1323 $Nrun ++ 1330 1324 end … … 1388 1382 end 1389 1383 1390 macro check.convolve.loop 1391 if ($0 != 2) 1392 echo "check.convolve.loop (intype)" 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)" 1393 1395 break 1394 1396 end 1395 1397 1396 1398 local radius 1397 1398 1399 $radius = 3.0 1399 1400 1400 cmf.load.reset 1401 1402 # foreach Cin 3 5 7 9 111403 foreach Cin 111404 sprintf nameIn tests.20131120/test.nsig.%02d $Cin1405 foreach Cot 3 5 7 9 111406 sprintf nameOt tests.20131120/test.serdev.%02d.%02d $Cin $Cot1407 echo -no-return $Cin $Cot " "1408 check.fit $nameIn.dat $nameOt.cmf $11409 end1410 end1411 grid.plots.devexp a1412 end1413 1414 macro run.convolve.loop1415 local radius1416 1417 $radius = 3.01418 1401 1419 1402 # foreach Cin 3 5 7 9 11 1420 1403 foreach Cin 11 1421 1404 $CONVOLVE_NSIGMA = $Cin 1422 sprintf nameIn tests.20131120/test.nsig.%02d$Cin1423 # mkexp.devexp.single $nameIn EXP$radius 1.01405 sprintf nameIn %s.%02d $1 $Cin 1406 mkexp.devexp.single $nameIn $3 $radius 1.0 1424 1407 foreach Cot 3 5 7 9 11 1425 1408 $NSIGMA_CONV = $Cot 1426 sprintf nameOt tests.20131120/test.nsig.x.%02d.%02d$Cin $Cot1427 fitexp $nameIn $nameOt EXP_CONV1409 sprintf nameOt %s.%02d.%02d $2 $Cin $Cot 1410 fitexp $nameIn $nameOt $4 1428 1411 end 1429 1412 end … … 1431 1414 # foreach Cin 3 5 7 9 11 1432 1415 foreach Cin 11 1433 sprintf nameIn tests.20131120/test.nsig.%02d$Cin1416 sprintf nameIn %s.%02d $1 $Cin 1434 1417 foreach Cot 3 5 7 9 11 1435 sprintf nameOt tests.20131120/test.nsig.x.%02d.%02d$Cin $Cot1418 sprintf nameOt %s.%02d.%02d $2 $Cin $Cot 1436 1419 check.fit $nameIn.dat $nameOt.cmf 1437 1420 end … … 1440 1423 end 1441 1424 1442 macro run.convolve.loop.dev 1425 macro check.convolve.loop 1426 if ($0 != 4) 1427 echo "run.convolve.loop (inName) (fitName) (inType)" 1428 break 1429 end 1430 1443 1431 local radius 1444 1445 1432 $radius = 3.0 1446 1447 foreach Cin 11 1448 $CONVOLVE_NSIGMA = $Cin 1449 sprintf nameIn tests.20131120/test.dev.%02d $Cin 1450 mkexp.devexp.single $nameIn DEV $radius 1.0 1451 foreach Cot 3 5 7 9 11 1452 $NSIGMA_CONV = $Cot 1453 sprintf nameOt tests.20131120/test.dev.%02d.%02d $Cin $Cot 1454 fitexp $nameIn $nameOt DEV_CONV 1455 end 1456 end 1433 cmf.load.reset 1457 1434 1458 1435 # foreach Cin 3 5 7 9 11 1459 1436 foreach Cin 11 1460 sprintf nameIn tests.20131120/test.dev.%02d$Cin1437 sprintf nameIn %s.%02d $1 $Cin 1461 1438 foreach Cot 3 5 7 9 11 1462 sprintf nameOt tests.20131120/test.dev.%02d.%02d $Cin $Cot 1463 check.fit $nameIn.dat $nameOt.cmf DEV 1439 sprintf nameOt %s.%02d.%02d $2 $Cin $Cot 1440 echo -no-return $Cin $Cot " " 1441 check.fit $nameIn.dat $nameOt.cmf $3 1464 1442 end 1465 1443 end 1466 1444 grid.plots.devexp a 1467 1445 end 1468 1469 macro run.convolve.loop.serexp1470 local radius1471 1472 $radius = 3.01473 1474 foreach Cin 111475 $CONVOLVE_NSIGMA = $Cin1476 sprintf nameIn tests.20131120/test.nsig.%02d $Cin1477 foreach Cot 3 5 7 9 111478 $NSIGMA_CONV = $Cot1479 sprintf nameOt tests.20131120/test.serexp.%02d.%02d $Cin $Cot1480 fitexp $nameIn $nameOt SER_CONV1481 end1482 end1483 1484 # foreach Cin 3 5 7 9 111485 foreach Cin 111486 sprintf nameIn tests.20131120/test.nsig.%02d $Cin1487 foreach Cot 3 5 7 9 111488 sprintf nameOt tests.20131120/test.serexp.%02d.%02d $Cin $Cot1489 check.fit $nameIn.dat $nameOt.cmf EXP1490 end1491 end1492 grid.plots.devexp a1493 end1494 1495 1496 macro run.convolve.loop.serdev1497 local radius1498 1499 $radius = 3.01500 1501 cmf.load.reset1502 1503 foreach Cin 111504 $CONVOLVE_NSIGMA = $Cin1505 sprintf nameIn tests.20131120/test.dev.%02d $Cin1506 foreach Cot 3 5 7 9 111507 $NSIGMA_CONV = $Cot1508 sprintf nameOt tests.20131120/test.serdev.%02d.%02d $Cin $Cot1509 fitexp $nameIn $nameOt SER_CONV1510 end1511 end1512 1513 # foreach Cin 3 5 7 9 111514 foreach Cin 111515 sprintf nameIn tests.20131120/test.dev.%02d $Cin1516 foreach Cot 3 5 7 9 111517 sprintf nameOt tests.20131120/test.serdev.%02d.%02d $Cin $Cot1518 check.fit $nameIn.dat $nameOt.cmf DEV1519 end1520 end1521 grid.plots.devexp a1522 end1523
Note:
See TracChangeset
for help on using the changeset viewer.
