Changeset 35421 for branches/eam_branches/ipp-20130419
- Timestamp:
- Apr 19, 2013, 4:45:57 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130419
- Files:
-
- 1 deleted
- 67 edited
- 6 copied
-
. (modified) (1 prop)
-
ippconfig (modified) (1 prop)
-
ippconfig/dvo.photcodes (modified) (2 diffs)
-
ippconfig/gpc1/psphot.config (modified) (1 prop)
-
ippconfig/recipes/filerules-mef.mdc (modified) (1 diff)
-
ippconfig/recipes/filerules-simple.mdc (modified) (1 diff)
-
ippconfig/recipes/filerules-split.mdc (modified) (1 diff)
-
ippconfig/recipes/ppSub.config (modified) (1 prop)
-
ippconfig/recipes/psphot.config (modified) (1 diff, 1 prop)
-
ippconfig/recipes/reductionClasses.mdc (modified) (1 prop)
-
ppImage/src (modified) (1 prop)
-
ppImage/src/ppImageParseCamera.c (modified) (1 diff)
-
ppStack/src/ppStackCamera.c (modified) (2 diffs)
-
psLib/src/math/psEllipse.c (modified) (1 diff)
-
psModules (modified) (1 prop)
-
psModules/src/astrom/pmAstrometryUtils.c (modified) (4 diffs)
-
psModules/src/camera/pmFPAMaskWeight.c (modified) (1 diff)
-
psModules/src/camera/pmFPAfileDefine.c (modified) (16 diffs)
-
psModules/src/camera/pmFPAfileDefine.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_DEV.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_DEV.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_EXP.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_EXP.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_GAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_GAUSS.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_PGAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_PGAUSS.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_PS1_V1.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_PS1_V1.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_QGAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_QGAUSS.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_RGAUSS.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_RGAUSS.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_SERSIC.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_SERSIC.h (modified) (1 diff)
-
psModules/src/objects/models/pmModel_TRAIL.c (modified) (4 diffs)
-
psModules/src/objects/models/pmModel_TRAIL.h (modified) (1 diff)
-
psModules/src/objects/pmModelFuncs.h (modified) (1 diff)
-
psModules/src/objects/pmPSF.c (modified) (2 diffs)
-
psModules/src/objects/pmPSFtryFitEXT.c (modified) (1 diff)
-
psModules/src/objects/pmSourceFitModel.c (modified) (4 diffs)
-
psModules/src/objects/pmSourceFitPCM.c (modified) (1 diff)
-
psModules/src/objects/pmSourceIO.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceMoments.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceSky.c (modified) (1 diff)
-
psModules/src/objects/pmSourceUtils.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceUtils.h (modified) (1 diff)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/models/pmModel_STRAIL.c (modified) (1 diff)
-
psphot/src/models/pmModel_TEST1.c (modified) (1 diff)
-
psphot/src/psphotExtendedSourceFits.c (modified) (6 diffs)
-
psphot/src/psphotFakeSources.c (modified) (1 diff)
-
psphot/src/psphotMakeResiduals.c (modified) (1 diff)
-
psphot/src/psphotModelTestArguments.c (modified) (2 diffs)
-
psphot/src/psphotModelTestReadout.c (modified) (10 diffs)
-
psphot/src/psphotSetThreads.c (modified) (1 diff)
-
psphot/src/psphotSourceFits.c (modified) (4 diffs)
-
psphot/src/psphotStackImageLoop.c (modified) (1 prop)
-
pswarp/doc/notes.20130406.txt (copied) (copied from branches/eam_branches/ipp-20130307/pswarp/doc/notes.20130406.txt )
-
pswarp/src/Makefile.am (modified) (1 diff)
-
pswarp/src/pswarp.c (modified) (3 diffs)
-
pswarp/src/pswarp.h (modified) (2 diffs)
-
pswarp/src/pswarpArguments.c (modified) (3 diffs)
-
pswarp/src/pswarpCleanup.c (copied) (copied from branches/eam_branches/ipp-20130307/pswarp/src/pswarpCleanup.c )
-
pswarp/src/pswarpDefine.c (modified) (4 diffs)
-
pswarp/src/pswarpDefineBackground.c (copied) (copied from branches/eam_branches/ipp-20130307/pswarp/src/pswarpDefineBackground.c )
-
pswarp/src/pswarpDefineSkycell.c (modified) (2 diffs)
-
pswarp/src/pswarpExit.c (deleted)
-
pswarp/src/pswarpExitCode.c (copied) (copied from branches/eam_branches/ipp-20130307/pswarp/src/pswarpExitCode.c )
-
pswarp/src/pswarpLoop.c (modified) (11 diffs)
-
pswarp/src/pswarpLoopBackground.c (copied) (copied from branches/eam_branches/ipp-20130307/pswarp/src/pswarpLoopBackground.c )
-
pswarp/src/pswarpParseCamera.c (modified) (5 diffs)
-
pswarp/src/pswarpStatsFile.c (copied) (copied from branches/eam_branches/ipp-20130307/pswarp/src/pswarpStatsFile.c )
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130419
-
branches/eam_branches/ipp-20130419/ippconfig
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippconfig (added) merged: 35323,35350,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/ippconfig/dvo.photcodes
r35209 r35421 165 165 3004 SYNTH.z ref 0.000 0.000 0.000 - - 0.0000 0 4 nan 0.000 2.000 0.600 0x0000 0x0000 0x0000 0x0000 166 166 3005 SYNTH.y ref 0.000 0.000 0.000 - - 0.0000 0 5 nan 0.000 2.000 0.600 0x0000 0x0000 0x0000 0x0000 167 3006 SYNTH.w ref 0.000 0.000 0.000 - - 0.0000 0 9 nan 0.000 2.000 0.600 0x0000 0x0000 0x0000 0x0000 167 168 168 169 100 MEGACAM.u.00 dep 25.280 -0.350 0.000 - - 0.0000 0 - 0.000 0.000 1.000 0.000 0x0000 0x3888 0x0000 0x0000 … … 836 837 10475 GPC1.y.XY75 dep 23.320 -0.073 0.000 - - 0.0000 0 5 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 837 838 10476 GPC1.y.XY76 dep 23.320 -0.073 0.000 - - 0.0000 0 5 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 838 10501 GPC1.w.XY01 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88839 10502 GPC1.w.XY02 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88840 10503 GPC1.w.XY03 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88841 10504 GPC1.w.XY04 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88842 10505 GPC1.w.XY05 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88843 10506 GPC1.w.XY06 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88844 10510 GPC1.w.XY10 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88845 10511 GPC1.w.XY11 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88846 10512 GPC1.w.XY12 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88847 10513 GPC1.w.XY13 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88848 10514 GPC1.w.XY14 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88849 10515 GPC1.w.XY15 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88850 10516 GPC1.w.XY16 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88851 10517 GPC1.w.XY17 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88852 10520 GPC1.w.XY20 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88853 10521 GPC1.w.XY21 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88854 10522 GPC1.w.XY22 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88855 10523 GPC1.w.XY23 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88856 10524 GPC1.w.XY24 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88857 10525 GPC1.w.XY25 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88858 10526 GPC1.w.XY26 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88859 10527 GPC1.w.XY27 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88860 10530 GPC1.w.XY30 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88861 10531 GPC1.w.XY31 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88862 10532 GPC1.w.XY32 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88863 10533 GPC1.w.XY33 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88864 10534 GPC1.w.XY34 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88865 10535 GPC1.w.XY35 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88866 10536 GPC1.w.XY36 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88867 10537 GPC1.w.XY37 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88868 10540 GPC1.w.XY40 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88869 10541 GPC1.w.XY41 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88870 10542 GPC1.w.XY42 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88871 10543 GPC1.w.XY43 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88872 10544 GPC1.w.XY44 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88873 10545 GPC1.w.XY45 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88874 10546 GPC1.w.XY46 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88875 10547 GPC1.w.XY47 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88876 10550 GPC1.w.XY50 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88877 10551 GPC1.w.XY51 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88878 10552 GPC1.w.XY52 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88879 10553 GPC1.w.XY53 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88880 10554 GPC1.w.XY54 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88881 10555 GPC1.w.XY55 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88882 10556 GPC1.w.XY56 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88883 10557 GPC1.w.XY57 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88884 10560 GPC1.w.XY60 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88885 10561 GPC1.w.XY61 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88886 10562 GPC1.w.XY62 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88887 10563 GPC1.w.XY63 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88888 10564 GPC1.w.XY64 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88889 10565 GPC1.w.XY65 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88890 10566 GPC1.w.XY66 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88891 10567 GPC1.w.XY67 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88892 10571 GPC1.w.XY71 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88893 10572 GPC1.w.XY72 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88894 10573 GPC1.w.XY73 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88895 10574 GPC1.w.XY74 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88896 10575 GPC1.w.XY75 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88897 10576 GPC1.w.XY76 dep 2 5.000 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88839 10501 GPC1.w.XY01 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 840 10502 GPC1.w.XY02 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 841 10503 GPC1.w.XY03 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 842 10504 GPC1.w.XY04 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 843 10505 GPC1.w.XY05 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 844 10506 GPC1.w.XY06 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 845 10510 GPC1.w.XY10 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 846 10511 GPC1.w.XY11 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 847 10512 GPC1.w.XY12 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 848 10513 GPC1.w.XY13 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 849 10514 GPC1.w.XY14 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 850 10515 GPC1.w.XY15 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 851 10516 GPC1.w.XY16 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 852 10517 GPC1.w.XY17 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 853 10520 GPC1.w.XY20 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 854 10521 GPC1.w.XY21 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 855 10522 GPC1.w.XY22 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 856 10523 GPC1.w.XY23 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 857 10524 GPC1.w.XY24 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 858 10525 GPC1.w.XY25 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 859 10526 GPC1.w.XY26 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 860 10527 GPC1.w.XY27 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 861 10530 GPC1.w.XY30 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 862 10531 GPC1.w.XY31 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 863 10532 GPC1.w.XY32 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 864 10533 GPC1.w.XY33 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 865 10534 GPC1.w.XY34 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 866 10535 GPC1.w.XY35 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 867 10536 GPC1.w.XY36 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 868 10537 GPC1.w.XY37 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 869 10540 GPC1.w.XY40 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 870 10541 GPC1.w.XY41 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 871 10542 GPC1.w.XY42 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 872 10543 GPC1.w.XY43 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 873 10544 GPC1.w.XY44 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 874 10545 GPC1.w.XY45 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 875 10546 GPC1.w.XY46 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 876 10547 GPC1.w.XY47 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 877 10550 GPC1.w.XY50 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 878 10551 GPC1.w.XY51 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 879 10552 GPC1.w.XY52 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 880 10553 GPC1.w.XY53 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 881 10554 GPC1.w.XY54 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 882 10555 GPC1.w.XY55 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 883 10556 GPC1.w.XY56 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 884 10557 GPC1.w.XY57 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 885 10560 GPC1.w.XY60 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 886 10561 GPC1.w.XY61 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 887 10562 GPC1.w.XY62 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 888 10563 GPC1.w.XY63 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 889 10564 GPC1.w.XY64 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 890 10565 GPC1.w.XY65 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 891 10566 GPC1.w.XY66 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 892 10567 GPC1.w.XY67 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 893 10571 GPC1.w.XY71 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 894 10572 GPC1.w.XY72 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 895 10573 GPC1.w.XY73 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 896 10574 GPC1.w.XY74 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 897 10575 GPC1.w.XY75 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 898 10576 GPC1.w.XY76 dep 26.060 0.000 0.000 - - 0.0000 0 9 0.015 0.000 1.000 0.000 0x0000 0x0000 0xe0440130 0x1003bc88 898 899 11000 GPC1.g.SkyChip dep 25.000 0.000 0.000 - - 0.0000 0 1 0.000 0.000 0.000 0.000 0x0000 0x0000 0x0000 0x0000 899 900 11100 GPC1.r.SkyChip dep 25.000 0.000 0.000 - - 0.0000 0 2 0.000 0.000 0.000 0.000 0x0000 0x0000 0x0000 0x0000 -
branches/eam_branches/ipp-20130419/ippconfig/gpc1/psphot.config
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippconfig/gpc1/psphot.config (added) merged: 35350,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/ippconfig/recipes/filerules-mef.mdc
r35081 r35421 118 118 PSWARP.VARIANCE INPUT @FILES CHIP VARIANCE 119 119 PSWARP.MASK INPUT @FILES CHIP MASK 120 PSWARP.SKYCELL INPUT @FILES CHIP IMAGE121 PSWARP.ASTROM INPUT @FILES CHIP CMF122 PSWARP.BKGMODEL INPUT @FILES CHIPIMAGE120 PSWARP.SKYCELL INPUT @FILES CHIP WCS 121 PSWARP.ASTROM INPUT @FILES CHIP WCS 122 PSWARP.BKGMODEL INPUT @FILES CHIP IMAGE 123 123 124 124 ## files used by ppsub -
branches/eam_branches/ipp-20130419/ippconfig/recipes/filerules-simple.mdc
r35081 r35421 88 88 PSWARP.VARIANCE INPUT @FILES FPA VARIANCE 89 89 PSWARP.MASK INPUT @FILES FPA MASK 90 PSWARP.SKYCELL INPUT @FILES FPA IMAGE91 PSWARP.ASTROM INPUT @FILES FPA CMF90 PSWARP.SKYCELL INPUT @FILES FPA WCS 91 PSWARP.ASTROM INPUT @FILES FPA WCS 92 92 PSWARP.BKGMODEL INPUT @FILES CHIP IMAGE 93 93 -
branches/eam_branches/ipp-20130419/ippconfig/recipes/filerules-split.mdc
r35116 r35421 106 106 PSWARP.VARIANCE INPUT @FILES CHIP VARIANCE 107 107 PSWARP.MASK INPUT @FILES CHIP MASK 108 PSWARP.SKYCELL INPUT @FILES FPA IMAGE 109 PSWARP.ASTROM INPUT @FILES CHIP CMF 108 PSWARP.SKYCELL INPUT @FILES CHIP WCS 109 PSWARP.ASTROM INPUT @FILES CHIP WCS 110 #PSWARP.SKYCELL INPUT @FILES CHIP CMF 111 #PSWARP.ASTROM INPUT @FILES CHIP CMF 110 112 PSWARP.BKGMODEL INPUT @FILES CHIP IMAGE 111 113 -
branches/eam_branches/ipp-20130419/ippconfig/recipes/ppSub.config
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippconfig/recipes/ppSub.config (added) merged: 35350,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/ippconfig/recipes/psphot.config
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippconfig/recipes/psphot.config (added) merged: 35323,35350,35413
r35239 r35421 317 317 TEST_FIT_X F32 NAN 318 318 TEST_FIT_Y F32 NAN 319 TEST_FIT_CONVOLVED BOOL FALSE 319 320 320 321 TEST_FIT_PAR0 F32 NAN - Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/ippconfig/recipes/reductionClasses.mdc
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ippconfig/recipes/reductionClasses.mdc (added) merged: 35350,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/ppImage/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/ppImage/src (added) merged: 35350,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/ppImage/src/ppImageParseCamera.c
r35081 r35421 22 22 ppImageOptions *options = ppImageOptionsParse(config); 23 23 24 // parse the header to extract out whether this OTA has video cells.25 // CZW: 2012-05-01 I'm somewhat ashamed of what needs to be done to get to the header. There has to be a simpler way, right?26 /* pmFPAview *view = pmFPAviewAlloc(0);// View for level of interest */27 /* pmChip *chip; // Chip from FPA */28 /* while ((chip = pmFPAviewNextChip(view, input->fpa, 1)) != NULL) { */29 /* if (!chip->process || !chip->file_exists) { */30 /* continue; */31 /* } */32 /* /\* if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { *\/ */33 /* /\* continue; *\/ */34 /* /\* } *\/ */35 /* psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */36 /* if (psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE")) { */37 /* psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */38 /* char *Vptr = strchr(psMetadataLookupStr(NULL,chip->hdu->header,"CELLMODE"),'V'); */39 /* if (Vptr) { */40 /* options->hasVideo = true; */41 /* psWarning("VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); */42 /* } */43 /* } */44 /* } */45 /* pmFPAviewReset(view); */46 /* psFree(view); */47 48 24 // the following are defined from the argument list, if given, 49 25 // otherwise they revert to the config information -
branches/eam_branches/ipp-20130419/ppStack/src/ppStackCamera.c
r35167 r35421 47 47 } 48 48 bool convolve = psMetadataLookupBool(NULL, recipe, "CONVOLVE"); // Convolve images before stack? 49 bool doBackground = psMetadataLookupBool(NULL, recipe, "BACKGROUND.MODEL"); 50 // fprintf(stderr,"ppSC: %d\n",doBackground); 49 51 50 psArray *runImages = pmFPAfileDefineMultipleFromRun(&status, NULL, config, 52 51 "PPSTACK.INPUT"); // Input images from previous run … … 218 217 219 218 // Grab bkgmodel information here 220 221 // if (doBackground) { 222 if ((!bkgmodel) || (strlen(bkgmodel) == 0)) { 223 // We have no background models. 224 // fprintf(stderr,"No backgrounds specified, resettting recipe value.\n"); 225 doBackground = false; 226 psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, 227 "Do photometry on stacked image?", false); 228 219 if ((!bkgmodel) || (strlen(bkgmodel) == 0)) { 220 // We have no background models. 221 psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Do photometry on stacked image?", false); 222 } else { 223 pmFPAfile *inputBKG = defineFile(config,NULL,"PPSTACK.INPUT.BKGMODEL",bkgmodel, PM_FPA_FILE_IMAGE); 224 if (!inputBKG) { 225 psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Do photometry on stacked image?", false); 226 227 #if (0) 228 psError(psErrorCodeLast(), false, 229 "Unable to define file from bkgmodel %d (%s)",i,bkgmodel); 230 return(false); 231 #endif 229 232 } 230 else { 231 pmFPAfile *inputBKG = defineFile(config,NULL,"PPSTACK.INPUT.BKGMODEL",bkgmodel, 232 PM_FPA_FILE_IMAGE); 233 if (!inputBKG) { 234 // We failed to generate an pmFPAfile, so disable the background construction and continue. 235 // fprintf(stderr,"No backgrounds specified, resettting recipe value.\n"); 236 doBackground = false; 237 psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, 238 "Do photometry on stacked image?", false); 239 240 #if (0) 241 psError(psErrorCodeLast(), false, 242 "Unable to define file from bkgmodel %d (%s)",i,bkgmodel); 243 return(false); 244 #endif 245 } 246 }// End bkgmodel 247 // } 248 249 250 251 233 } // End bkgmodel 252 234 i++; 253 235 } -
branches/eam_branches/ipp-20130419/psLib/src/math/psEllipse.c
r34257 r35421 155 155 156 156 // ellipse rotation (major, minor, theta) -> (sx, sy, sxy) 157 // theta is postive rotation of major axis away from x-axis 157 158 psEllipseShape psEllipseAxesToShape(psEllipseAxes axes) 158 159 { -
branches/eam_branches/ipp-20130419/psModules
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/psModules (added) merged: 35321,35341,35343,35348,35350,35375-35376,35379,35381,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/psModules/src/astrom/pmAstrometryUtils.c
r24096 r35421 23 23 #include "pmAstrometryUtils.h" 24 24 25 // this is used by the test output block 26 static int Nout = 0; 27 25 28 // given a 2D transformation -- L(x,y),M(x,y) -- find the coordinates x,y 26 29 // for which L,M = 0,0. tol is the allowed error on x,y. … … 33 36 double Xo = (trans->y->coeff[0][0]*trans->x->coeff[0][1] - trans->x->coeff[0][0]*trans->y->coeff[0][1])/R; 34 37 double Yo = (trans->x->coeff[0][0]*trans->y->coeff[1][0] - trans->y->coeff[0][0]*trans->x->coeff[1][0])/R; 38 39 if (0) { 40 // this is a test output block, not used in normal operations 41 char filename[64]; 42 snprintf (filename, 64, "trans.%03d.md", Nout); 43 FILE *f = fopen (filename, "w"); 44 45 psMetadata *md = psMetadataAlloc(); 46 47 psPolynomial2DtoMetadata (md, trans->x, "X"); 48 psPolynomial2DtoMetadata (md, trans->y, "Y"); 49 psMetadataConfigPrint (f, md); 50 psFree (md); 51 fclose (f); 52 Nout ++; 53 } 35 54 36 55 // iterate to actual solution: requires small non-linear terms … … 52 71 for (int i = 0; (dPos > tol) && (i < 20); i++) { 53 72 // NOTE: order for Alpha is: [y][x] 73 // original Alpha->data.F32[1][0] = psPolynomial2DEval (XdY, Xo, Yo); 74 // original Alpha->data.F32[0][1] = psPolynomial2DEval (YdX, Xo, Yo); 54 75 Alpha->data.F32[0][0] = psPolynomial2DEval (XdX, Xo, Yo); 55 Alpha->data.F32[ 1][0] = psPolynomial2DEval (XdY, Xo, Yo);56 Alpha->data.F32[ 0][1] = psPolynomial2DEval (YdX, Xo, Yo);76 Alpha->data.F32[0][1] = psPolynomial2DEval (XdY, Xo, Yo); 77 Alpha->data.F32[1][0] = psPolynomial2DEval (YdX, Xo, Yo); 57 78 Alpha->data.F32[1][1] = psPolynomial2DEval (YdY, Xo, Yo); 58 79 59 Beta->data.F32[0] = psPolynomial2DEval (trans->x, Xo, Yo);60 Beta->data.F32[1] = psPolynomial2DEval (trans->y, Xo, Yo);80 Beta->data.F32[0] = -1.0 * psPolynomial2DEval (trans->x, Xo, Yo); 81 Beta->data.F32[1] = -1.0 * psPolynomial2DEval (trans->y, Xo, Yo); 61 82 62 83 if (!psMatrixGJSolve (Alpha, Beta)) { … … 71 92 } 72 93 73 Xo -= Beta->data.F32[0];74 Yo -= Beta->data.F32[1];94 Xo += Beta->data.F32[0]; 95 Yo += Beta->data.F32[1]; 75 96 dPos = hypot(Beta->data.F32[0], Beta->data.F32[1]); 76 97 psTrace ("psastro", 5, "i: %d, Xo,Yo : %f %f dX, dY: %f %f dPos: %f\n", i, Xo, Yo, Beta->data.F32[0], Beta->data.F32[1], dPos); 77 98 } 78 99 psFree (Alpha); -
branches/eam_branches/ipp-20130419/psModules/src/camera/pmFPAMaskWeight.c
r35038 r35421 301 301 psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section 302 302 if (!mdok || psRegionIsNaN(*trimsec)) { 303 psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set --- unable to set variance.\n"); 304 return false; 303 // if trimsec is not defined, use the full image 304 trimsec = psRegionAlloc(0,0,0,0); 305 // psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set --- unable to set variance.\n"); 306 // return false; 305 307 } 306 308 -
branches/eam_branches/ipp-20130419/psModules/src/camera/pmFPAfileDefine.c
r34085 r35421 446 446 } 447 447 448 // given a filename, convert to UNIX namespace and read the PHU 449 psMetadata *readPHUfromFilename (char *filename, pmConfig *config) { 450 451 // Need to generate an FPA 452 psString realName = pmConfigConvertFilename(filename, config, false, false); 453 if (!realName) { 454 psError(psErrorCodeLast(), false, "Failed to convert file name %s", filename); 455 return NULL; 456 } 457 458 // load the header of the first image 459 // EXTWORD (fits->extword) is not relevant to the PHU 460 psFits *fits = psFitsOpen(realName, "r"); // FITS file 461 if (!fits) { 462 psError(psErrorCodeLast(), false, "Failed to open file %s", realName); 463 psFree(realName); 464 return NULL; 465 } 466 467 psMetadata *phu = psFitsReadHeader (NULL, fits); // Primary header 468 if (!phu) { 469 psError(psErrorCodeLast(), false, "Failed to read file header %s", realName); 470 psFree(realName); 471 return NULL; 472 } 473 474 if (!psFitsClose(fits)) { 475 psError(psErrorCodeLast(), false, "Failed to close file %s", realName); 476 psFree(realName); 477 psFree(phu); 478 return NULL; 479 } 480 481 return phu; 482 } 483 484 // this this function wants to return: 485 // pmFPA, PHU, fileLevel, outConfig 486 // camera, cameraName, formatName 487 typedef struct { 488 pmFPA *fpa; 489 psMetadata *phu; 490 psMetadata *format; 491 pmFPALevel fileLevel; 492 psString cameraName; 493 psString formatName; 494 } pmFPAfromFilenameOutput; 495 496 // for the given filename, read PHU and determine camera format; build an FPA for the file 497 bool pmFPAfromFilename (pmFPAfromFilenameOutput *output, pmConfig **outConfig, pmConfig *sysConfig, char *filename){ 498 499 // Need to generate an FPA 500 psMetadata *phu = readPHUfromFilename (filename, sysConfig); 501 if (!phu) { 502 psError(psErrorCodeLast(), false, "Failed to read PHU for %s", filename); 503 return false; 504 } 505 506 // if we expect the loaded FPA to differ in configuration from the current system configuration 507 // generate an output config for this FPA 508 pmConfig *config = NULL; 509 if (outConfig) { 510 config = pmConfigAlloc(); 511 config->user = psMemIncrRefCounter(sysConfig->user); 512 config->system = psMemIncrRefCounter(sysConfig->system); 513 514 psFree (config->files); 515 config->files = psMemIncrRefCounter(sysConfig->files); 516 psFree (config->arguments); 517 config->arguments = psMemIncrRefCounter(sysConfig->arguments); 518 519 *outConfig = config; 520 } else { 521 config = sysConfig; 522 } 523 524 // values which are returned to calling function 525 psString formatName = NULL; // Name of camera format 526 psString cameraName = NULL; // Name of camera 527 psMetadata *camera = NULL; // Camera configuration 528 529 // Determine the current format from the header; determine camera if not specified already. 530 psMetadata *format = pmConfigCameraFormatFromHeader(&camera, &cameraName, &formatName, config, phu, true); 531 if (!format) { 532 psError(psErrorCodeLast(), false, "Failed to determine camera format for %s", filename); 533 psFree(camera); 534 psFree(formatName); 535 psFree(phu); 536 return false; 537 } 538 539 pmFPALevel fileLevel = pmFPAPHULevel(format); 540 if (fileLevel == PM_FPA_LEVEL_NONE) { 541 psError(PM_ERR_CONFIG, true, "Unable to determine file level for %s", filename); 542 psFree(camera); 543 psFree(formatName); 544 psFree(phu); 545 return false; 546 } 547 548 // build the template fpa, set up the basic view 549 // we supply the metaCamera name (if NULL, baseCamera name is used) 550 pmFPA *fpa = pmFPAConstruct(camera, cameraName); 551 psFree(camera); 552 553 if (!fpa) { 554 psError(psErrorCodeLast(), false, "Failed to construct FPA from %s", filename); 555 psFree(formatName); 556 psFree(format); 557 psFree(phu); 558 return NULL; 559 } 560 561 output->fpa = fpa; 562 output->phu = phu; 563 output->format = format; 564 output->fileLevel = fileLevel; 565 output->cameraName = cameraName; 566 output->formatName = formatName; 567 568 return true; 569 570 } 448 571 449 572 /// Define a file from an array of filenames 450 static pmFPAfile *fpaFileDefineFromArray(pmConfig *config, // Configuration 573 static pmFPAfile *fpaFileDefineFromArray(pmConfig **outConfig, // output configuration 574 pmConfig *sysConfig, // global configuration 451 575 pmFPAfile *bind, // File to bind to, or NULL 452 576 const char *name, // Name of file … … 454 578 ) 455 579 { 456 PS_ASSERT_PTR_NON_NULL( config, NULL);580 PS_ASSERT_PTR_NON_NULL(sysConfig, NULL); 457 581 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 458 582 … … 463 587 pmFPALevel fileLevel = PM_FPA_LEVEL_NONE; // Level for files 464 588 psMetadata *phu = NULL; // Primary header 589 465 590 if (bind) { 466 591 // Use the FPA we're binding to … … 468 593 fileLevel = bind->fileLevel; 469 594 } else { 470 // Need to generate an FPA 471 psString realName = pmConfigConvertFilename(filenames->data[0], config, false, false); 472 if (!realName) { 473 psError(psErrorCodeLast(), false, "Failed to convert file name %s", (char *)filenames->data[0]); 474 return NULL; 475 } 476 477 // load the header of the first image 478 // EXTWORD (fits->extword) is not relevant to the PHU 479 psFits *fits = psFitsOpen(realName, "r"); // FITS file 480 if (!fits) { 481 psError(psErrorCodeLast(), false, "Failed to open file %s", realName); 482 psFree(realName); 483 return NULL; 484 } 485 phu = psFitsReadHeader (NULL, fits); // Primary header 486 if (!phu) { 487 psError(psErrorCodeLast(), false, "Failed to read file header %s", realName); 488 psFree(realName); 489 return NULL; 490 } 491 if (!psFitsClose(fits)) { 492 psError(psErrorCodeLast(), false, "Failed to close file %s", realName); 493 psFree(realName); 494 return NULL; 495 } 496 497 // Determine the current format from the header; determine camera if not specified already. 498 psMetadata *camera = NULL; // Camera configuration 499 format = pmConfigCameraFormatFromHeader(&camera, &cameraName, &formatName, config, phu, true); 500 if (!format) { 501 psError(psErrorCodeLast(), false, "Failed to determine camera format for %s", realName); 502 psFree(camera); 503 psFree(formatName); 504 psFree(realName); 505 psFree(phu); 506 return NULL; 507 } 508 509 fileLevel = pmFPAPHULevel(format); 510 if (fileLevel == PM_FPA_LEVEL_NONE) { 511 psError(PM_ERR_CONFIG, true, "Unable to determine file level for %s", realName); 512 psFree(camera); 513 psFree(formatName); 514 psFree(realName); 515 psFree(phu); 516 return NULL; 517 } 518 519 // build the template fpa, set up the basic view 520 // XXX do we want this to be the baseCamera name or the metaCamera name? 521 fpa = pmFPAConstruct(camera, cameraName); 522 psFree(camera); 523 if (!fpa) { 524 psError(psErrorCodeLast(), false, "Failed to construct FPA from %s", realName); 525 psFree(formatName); 526 psFree(realName); 527 psFree(format); 528 psFree(phu); 529 return NULL; 530 } 531 psFree(realName); 532 } 595 pmFPAfromFilenameOutput output; 596 if (!pmFPAfromFilename (&output, outConfig, sysConfig, filenames->data[0])) { 597 return NULL; 598 } 599 fpa = output.fpa; 600 phu = output.phu; 601 format = output.format; 602 fileLevel = output.fileLevel; 603 cameraName = output.cameraName; 604 formatName = output.formatName; 605 } 606 607 pmConfig *config = outConfig ? *outConfig : sysConfig; 533 608 534 609 // load the given filerule (from config->camera) and bind it to the fpa … … 561 636 // Check that the file corresponds to the same camera and format 562 637 if (!phu) { 563 psString realName = pmConfigConvertFilename(filenames->data[i], config, false, false);564 if (! realName) {565 psError(psErrorCodeLast(), false, "Failed to convert file name %s", (char*)filenames->data[i]);638 phu = readPHUfromFilename (filenames->data[i], config); 639 if (!phu) { 640 psError(psErrorCodeLast(), false, "Failed to read PHU for %s", (char *)filenames->data[i]); 566 641 return NULL; 567 642 } 568 psFits *fits = psFitsOpen(realName, "r"); // FITS file569 if (!fits) {570 psError(psErrorCodeLast(), false, "Failed to open file %s", realName);571 psFree(realName);572 return NULL;573 }574 phu = psFitsReadHeader(NULL, fits);575 if (!psFitsClose(fits)) {576 psError(psErrorCodeLast(), false, "Failed to close file %s", realName);577 psFree(realName);578 return NULL;579 }580 if (!phu) {581 psError(psErrorCodeLast(), false, "Failed to read file header %s", realName);582 psFree(realName);583 return NULL;584 }585 psFree(realName);586 643 } 587 644 … … 651 708 } 652 709 653 654 pmFPAfile *pmFPAfileDefineFromArgs(bool *success, pmConfig *config, 655 const char *filename, const char *argname) 710 // find the file associated with the argname & generate a pmFPAfile for it based on the filerule 711 pmFPAfile *pmFPAfileDefineFromArgs(bool *success, pmConfig *config, const char *filename, const char *argname) 656 712 { 657 713 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 676 732 } 677 733 678 pmFPAfile *file = fpaFileDefineFromArray( config, NULL, filename, filenames); // File of interest734 pmFPAfile *file = fpaFileDefineFromArray(NULL, config, NULL, filename, filenames); // File of interest 679 735 680 736 if (success) { … … 685 741 } 686 742 687 pmFPAfile *pmFPAfileBindFromArgs(bool *success, pmFPAfile *input, pmConfig *config, 688 const char *filename, const char *argname)743 // find the file associated with the argname & bind it to the given pmFPAfile for it based on the filerule 744 pmFPAfile *pmFPAfileBindFromArgs(bool *success, pmFPAfile *input, pmConfig *config, const char *filename, const char *argname) 689 745 { 690 746 PS_ASSERT_PTR_NON_NULL(input, NULL); … … 710 766 } 711 767 712 pmFPAfile *file = fpaFileDefineFromArray( config, input, filename, filenames); // File of interest768 pmFPAfile *file = fpaFileDefineFromArray(NULL, config, input, filename, filenames); // File of interest 713 769 714 770 if (success) { … … 719 775 } 720 776 721 pmFPAfile *pmFPAfileDefineSingleFromArgs(bool *success, pmConfig *config, const char *filename, 722 const char *argname, int entry)777 // find the specific file associated with the argname & generate a pmFPAfile for it based on the filerule 778 pmFPAfile *pmFPAfileDefineSingleFromArgs(bool *success, pmConfig *config, const char *filename, const char *argname, int entry) 723 779 { 724 780 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 746 802 psArray *single = psArrayAlloc(1); // Array of single filename of interest 747 803 single->data[0] = psMemIncrRefCounter(filenames->data[entry]); 748 pmFPAfile *file = fpaFileDefineFromArray( config, NULL, filename, single); // File of interest804 pmFPAfile *file = fpaFileDefineFromArray(NULL, config, NULL, filename, single); // File of interest 749 805 psFree(single); 750 806 … … 756 812 } 757 813 814 // find the file in the config list & generate a pmFPAfile for it based on the filerule 758 815 pmFPAfile *pmFPAfileDefineFromRun(bool *success, pmFPAfile *bind, pmConfig *config, const char *filename) 759 816 { … … 769 826 } 770 827 771 pmFPAfile *file = fpaFileDefineFromArray( config, bind, filename, filenames); // File of interest828 pmFPAfile *file = fpaFileDefineFromArray(NULL, config, bind, filename, filenames); // File of interest 772 829 psFree(filenames); 773 830 … … 779 836 } 780 837 838 // find the files in the config list & generate an array of pmFPAfiles for them based on the filerule 781 839 psArray *pmFPAfileDefineMultipleFromRun(bool *success, psArray *bind, pmConfig *config, const char *filename) 782 840 { … … 808 866 dummy->data[0] = files->data[i]; 809 867 pmFPAfile *bindFile = bind ? bind->data[i] : NULL; // File to which to bind 810 files->data[i] = psMemIncrRefCounter(fpaFileDefineFromArray( config, bindFile, filename, dummy));868 files->data[i] = psMemIncrRefCounter(fpaFileDefineFromArray(NULL, config, bindFile, filename, dummy)); 811 869 if (!files->data[i]) { 812 870 psError(psErrorCodeLast(), false, "Unable to define file %s %d", filename, i); … … 823 881 824 882 return files; 883 } 884 885 // find the file associated with the argname & generate a pmFPAfile for it based on the filerule 886 pmFPAfile *pmFPAfileDefineNewConfig(bool *success, pmConfig **outConfig, pmConfig *sysConfig, const char *filename, const char *argname) 887 { 888 PS_ASSERT_PTR_NON_NULL(outConfig, NULL); 889 PS_ASSERT_PTR_NON_NULL(sysConfig, NULL); 890 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 891 PS_ASSERT_STRING_NON_EMPTY(argname, NULL); 892 893 // Search the argument data for the named fileset (argname) 894 bool status; // Status of MD lookup 895 psArray *filenames = psMetadataLookupPtr(&status, sysConfig->arguments, argname); // Filenames for file 896 if (!status) { 897 if (success) { 898 *success = true; 899 } 900 return NULL; 901 } 902 if (filenames->n == 0) { 903 psError(PM_ERR_CONFIG, true, "No files in array in %s in arguments", argname); 904 if (success) { 905 *success = false; 906 } 907 return NULL; 908 } 909 910 pmFPAfile *file = fpaFileDefineFromArray(outConfig, sysConfig, NULL, filename, filenames); // File of interest 911 912 if (success) { 913 *success = file ? true : false; 914 } 915 916 return file; 825 917 } 826 918 -
branches/eam_branches/ipp-20130419/psModules/src/camera/pmFPAfileDefine.h
r27657 r35421 81 81 const char *filename ///< Name of file 82 82 ); 83 84 // find the file associated with the argname & generate a pmFPAfile for it based on the filerule 85 pmFPAfile *pmFPAfileDefineNewConfig( 86 bool *success, ///< Found files? 87 pmConfig **outConfig, ///< output configuration for this file 88 pmConfig *sysConfig, ///< existing system config info 89 const char *filename, ///< name of filerule 90 const char *argname ///< argument entry 91 ); 92 83 93 84 94 // look for the given argname on the argument list. find the give filename from the file rules -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_DEV.c
r34403 r35421 295 295 // make an initial guess for parameters 296 296 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 297 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )297 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 298 298 { 299 299 psF32 *PAR = model->params->data.F32; -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_DEV.h
r29004 r35421 5 5 psF32 pmModelFunc_DEV(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_DEV(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_DEV(pmModel *model, pmSource *source );7 bool pmModelGuess_DEV(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_DEV(const psVector *params); 9 9 psF64 pmModelRadius_DEV(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_EXP.c
r34403 r35421 287 287 // make an initial guess for parameters 288 288 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 289 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )289 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 290 290 { 291 291 psF32 *PAR = model->params->data.F32; -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_EXP.h
r29004 r35421 5 5 psF32 pmModelFunc_EXP(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_EXP(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_EXP(pmModel *model, pmSource *source );7 bool pmModelGuess_EXP(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_EXP(const psVector *params); 9 9 psF64 pmModelRadius_EXP(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_GAUSS.c
r34403 r35421 192 192 // make an initial guess for parameters 193 193 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 194 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )194 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 195 195 { 196 196 psF32 *PAR = model->params->data.F32; -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_GAUSS.h
r25738 r35421 5 5 psF32 pmModelFunc_GAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_GAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_GAUSS(pmModel *model, pmSource *source );7 bool pmModelGuess_GAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_GAUSS(const psVector *params); 9 9 psF64 pmModelRadius_GAUSS(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_PGAUSS.c
r34403 r35421 193 193 // make an initial guess for parameters 194 194 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 195 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )195 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 196 196 { 197 197 psF32 *PAR = model->params->data.F32; -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_PGAUSS.h
r25738 r35421 5 5 psF32 pmModelFunc_PGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_PGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source );7 bool pmModelGuess_PGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_PGAUSS(const psVector *params); 9 9 psF64 pmModelRadius_PGAUSS(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_PS1_V1.c
r34403 r35421 212 212 // make an initial guess for parameters 213 213 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 214 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )214 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 215 215 { 216 216 psF32 *PAR = model->params->data.F32; -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_PS1_V1.h
r25738 r35421 5 5 psF32 pmModelFunc_PS1_V1(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_PS1_V1(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source );7 bool pmModelGuess_PS1_V1(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_PS1_V1(const psVector *params); 9 9 psF64 pmModelRadius_PS1_V1(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_QGAUSS.c
r34403 r35421 213 213 // make an initial guess for parameters 214 214 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 215 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )215 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 216 216 { 217 217 psF32 *PAR = model->params->data.F32; -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_QGAUSS.h
r25738 r35421 5 5 psF32 pmModelFunc_QGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_QGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source );7 bool pmModelGuess_QGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_QGAUSS(const psVector *params); 9 9 psF64 pmModelRadius_QGAUSS(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_RGAUSS.c
r34403 r35421 202 202 // make an initial guess for parameters 203 203 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 204 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )204 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 205 205 { 206 206 psF32 *PAR = model->params->data.F32; -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_RGAUSS.h
r25738 r35421 5 5 psF32 pmModelFunc_RGAUSS(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_RGAUSS(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source );7 bool pmModelGuess_RGAUSS(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_RGAUSS(const psVector *params); 9 9 psF64 pmModelRadius_RGAUSS(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_SERSIC.c
r34403 r35421 307 307 // make an initial guess for parameters 308 308 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 309 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )309 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 310 310 { 311 311 pmMoments *moments = source->moments; -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_SERSIC.h
r25738 r35421 5 5 psF32 pmModelFunc_SERSIC(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_SERSIC(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_SERSIC(pmModel *model, pmSource *source );7 bool pmModelGuess_SERSIC(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_SERSIC(const psVector *params); 9 9 psF64 pmModelRadius_SERSIC(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_TRAIL.c
r35215 r35421 168 168 dPAR[PM_PAR_THETA] = PAR[PM_PAR_I0] * dPdT; 169 169 dPAR[PM_PAR_SIGMA] = 0; // we don't actually allow this to vary, so we do not need to calculate it 170 171 for (int i = 0; i < 7; i++) { 172 if (isnan(dPAR[i])) { 173 fprintf (stderr, "*"); 174 } 175 } 176 } 177 if (isnan(f)) { 178 fprintf (stderr, "!"); 170 179 } 171 180 return(f); … … 228 237 } 229 238 239 # define NA 21 240 # define NR 21 241 static float flux[NA][NR]; 242 static float npix[NA][NR]; 243 244 bool pmTrailGetAngle (float *To, float *Io, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal, float sigma) { 245 246 float Xo, Yo; 247 if (!pmModelSetPosition(&Xo, &Yo, source)) return false; 248 249 psImage *image = source->pixels; 250 psImage *mask = source->maskObj; 251 psF32 **imData = image->data.F32; 252 psImageMaskType **mkData = mask->data.PS_TYPE_IMAGE_MASK_DATA; 253 254 // do a loop over the pixels, generating (dX,dY) dot (cos(theta),sin(theta)) 255 int dP; 256 int dX = Xo - mask->col0; 257 dP = mask->numCols - dX; 258 int DX = PS_MAX(dP, dX); 259 int NX = mask->numCols; 260 261 int dY = Yo - mask->row0; 262 dP = mask->numRows - dY; 263 int DY = PS_MAX(dP, dY); 264 int NY = mask->numRows; 265 266 // just hard wire this for now... 267 float radius = 10.0; 268 float radius2 = PS_SQR(radius); 269 270 // we have an array of Angles x Radii 271 float dT = M_PI / NA; 272 for (int na = 0; na < NA; na++) { 273 memset (flux[na], 0, NR*sizeof(float)); 274 memset (npix[na], 0, NR*sizeof(float)); 275 } 276 277 // we skip any pixels [real or virtual] outside of the specified radius (nominally the aperture radius) 278 // ix and iy track pixels relative to the centroid 279 for (int ix = -DX; ix < DX + 1; ix++) { 280 if (ix > radius) continue; 281 int mx = ix + dX; 282 for (int iy = -DY; iy < DY + 1; iy++) { 283 if (iy > radius) continue; 284 if (ix*ix + iy*iy > radius2) continue; 285 int my = iy + dY; 286 287 // include count only the unmasked pixels within the image area 288 if (mx < 0) continue; 289 if (my < 0) continue; 290 if (mx >= NX) continue; 291 if (my >= NY) continue; 292 293 // count pixels which are masked only with bad pixels 294 if (mkData[my][mx] & maskVal)continue; 295 296 // we have defined NA to be 21 297 int na = 0; 298 for (float angle = 0.0; na < NA; angle += dT, na ++) { 299 300 // XXX optimization : pre-compute the angle sines and cosines 301 float Rad = (ix * cos(angle)) + (iy * sin(angle)); 302 int nr = PS_MAX (PS_MIN (NR, Rad + 0.5*NR), 0); 303 304 flux[na][nr] += imData[my][mx]; 305 npix[na][nr] ++; 306 } 307 } 308 } 309 310 // generate a psf model (with integral of 1.0) 311 float Ao = 1.0 / sqrt(2*M_PI) / sigma; 312 float psf[NR]; 313 for (int nr = 0; nr < NR; nr++) { 314 psf[nr] = Ao*exp(-0.5*PS_SQR((nr - 0.5*NR)/sigma)); 315 } 316 317 float fangle[NA]; 318 for (int na = 0; na < NA; na++) { 319 float fpsf = 0.0; 320 for (int nr = 0; nr < NR; nr++) { 321 fpsf += psf[nr]*flux[na][nr]; 322 } 323 fangle[na] = fpsf; 324 // fprintf (stderr, "fpsf: %f, theta = %f\n", fpsf, PS_DEG_RAD*dT*na); 325 } 326 327 float peak = fangle[0]; 328 int pbin = 0; 329 for (int na = 0; na < NA; na++) { 330 if (fangle[na] > peak) { 331 peak = fangle[na]; 332 pbin = na; 333 } 334 } 335 336 // result is peak, pbin -> angle 337 *To = dT * pbin; 338 *Io = peak * Ao; 339 340 return true; 341 } 342 230 343 // make an initial guess for parameters 231 344 // 0.5 PIX: moments and peaks are in pixel coords, thus so are model parameters 232 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )345 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 233 346 { 234 347 psF32 *PAR = model->params->data.F32; … … 260 373 //else { size = psfAxes.major; } 261 374 375 float theta, peak; 376 pmTrailGetAngle (&theta, &peak, source, maskVal, markVal, psfAxes.major); 377 262 378 // axes.major is a sigma in the major direction; scale to 263 379 PAR[PM_PAR_LENGTH] = 1.5*2.35*size; // a tophat of length L has L = 1.5 * 2.35 * sigma … … 266 382 267 383 // set the model normalization 268 if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 269 return false; 270 } 384 // if (!pmModelSetNorm(&PAR[PM_PAR_I0], source)) { 385 // return false; 386 // } 387 PAR[PM_PAR_I0] = peak; 271 388 272 389 // set the model position -
branches/eam_branches/ipp-20130419/psModules/src/objects/models/pmModel_TRAIL.h
r34259 r35421 5 5 psF32 pmModelFunc_TRAIL(psVector *deriv, const psVector *params, const psVector *pixcoord); 6 6 bool pmModelLimits_TRAIL(psMinConstraintMode mode, int nParam, float *params, float *beta); 7 bool pmModelGuess_TRAIL(pmModel *model, pmSource *source );7 bool pmModelGuess_TRAIL(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 8 8 psF64 pmModelFlux_TRAIL(const psVector *params); 9 9 psF64 pmModelRadius_TRAIL(const psVector *params, psF64 flux); -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmModelFuncs.h
r34259 r35421 107 107 // This function provides the model guess parameters based on the details of 108 108 // the given source. 109 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source );109 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal); 110 110 111 111 // This function constructs the PSF model for the given source based on the -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmPSF.c
r34403 r35421 350 350 shape.sx = modelPar[PM_PAR_SXX]; 351 351 shape.sy = modelPar[PM_PAR_SYY]; 352 shape.sxy = modelPar[PM_PAR_SXY]; 352 shape.sxy = modelPar[PM_PAR_SXY] / 2.0; 353 // XXX I *think* dividing by 2.0 is the right direction, but this 354 // needs to be checked with a real test 353 355 } else { 354 356 shape.sx = modelPar[PM_PAR_SXX] / M_SQRT2; … … 392 394 modelPar[PM_PAR_SXX] = shape.sx; 393 395 modelPar[PM_PAR_SYY] = shape.sy; 394 modelPar[PM_PAR_SXY] = shape.sxy; 396 modelPar[PM_PAR_SXY] = shape.sxy; // XXX NEED factor of 2 here for correct angle conversion 395 397 } else { 396 398 modelPar[PM_PAR_SXX] = shape.sx * M_SQRT2; -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmPSFtryFitEXT.c
r34403 r35421 83 83 } 84 84 85 source->modelEXT = pmSourceModelGuess (source, options->type );85 source->modelEXT = pmSourceModelGuess (source, options->type, maskVal, markVal); 86 86 if (source->modelEXT == NULL) { 87 87 psTrace ("psModules.objects", 4, "masking %d (%d,%d) : failed to generate model guess\n", i, source->peak->x, source->peak->y); -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceFitModel.c
r34403 r35421 75 75 PS_ASSERT_PTR_NON_NULL(source->pixels, false); 76 76 PS_ASSERT_PTR_NON_NULL(source->maskObj, false); 77 PS_ASSERT_PTR_NON_NULL(source->variance, false); 77 78 // XXX if variance is NULL, use pixels instead (wrong, but not badly wrong) 79 // PS_ASSERT_PTR_NON_NULL(source->variance, false); 78 80 79 81 psBool fitStatus = true; … … 93 95 float Xo = model->params->data.F32[PM_PAR_XPOS]; 94 96 float Yo = model->params->data.F32[PM_PAR_YPOS]; 97 98 // if variance is NULL, we pretend pixels == variance 99 float **vWgt = source->variance ? source->variance->data.F32 : source->pixels->data.F32; 95 100 96 101 // fill in the coordinate and value entries … … 103 108 } 104 109 // skip zero-variance points 105 if ( source->variance->data.F32[i][j] == 0) {110 if (vWgt[i][j] == 0) { 106 111 continue; 107 112 } 108 113 // skip nan values in image 109 114 if (!isfinite(source->pixels->data.F32[i][j])) { 115 fprintf (stderr, "WARNING: unmasked nan in image : %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal); 110 116 continue; 111 117 } 112 118 113 119 // skip nan values in image 114 if (!isfinite( source->variance->data.F32[i][j])) {115 fprintf (stderr, " impossible!%x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal);120 if (!isfinite(vWgt[i][j])) { 121 fprintf (stderr, "WARNING: unmasked nan in variance : %x vs %x\n", source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j], maskVal); 116 122 continue; 117 123 } … … 140 146 // source sky variance 141 147 if (options->poissonErrors) { 142 yErr->data.F32[nPix] = 1.0 / source->variance->data.F32[i][j];148 yErr->data.F32[nPix] = 1.0 / vWgt[i][j]; 143 149 } else { 144 150 yErr->data.F32[nPix] = 1.0 / options->weight; -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceFitPCM.c
r34403 r35421 145 145 bool pmSourceModelGuessPCM (pmPCMdata *pcm, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) { 146 146 147 if (!pcm->modelConv->modelGuess(pcm->modelConv, source)) {147 if (!pcm->modelConv->modelGuess(pcm->modelConv, source, maskVal, markVal)) { 148 148 return false; 149 149 } -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceIO.c
r34720 r35421 980 980 return false; 981 981 } 982 982 983 // if this is not TRUE, the output files only contain the psf measurements. 983 984 bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "EXTENDED_SOURCE_ANALYSIS"); … … 1005 1006 hdu->header = psFitsReadHeader (NULL, file->fits); 1006 1007 } 1008 1009 // "WCS" is CMF without detected objects 1010 if (file->type == PM_FPA_FILE_WCS) { 1011 psTrace("psModules.objects", 6, "read CMF table from %s : %s : %s", file->filename, headname, dataname); 1012 psFree (headname); 1013 psFree (dataname); 1014 psFree (deteffname); 1015 break; 1016 } 1017 1018 // EXTDATA is the PSF data associated with this image header 1007 1019 1008 1020 // we need to find the corresponding table EXTNAME. -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceMoments.c
r34403 r35421 151 151 152 152 float *vPix = source->pixels->data.F32[row]; 153 float *vWgt = source->variance ->data.F32[row];153 float *vWgt = source->variance ? source->variance->data.F32[row] : source->pixels->data.F32[row]; 154 154 155 155 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; … … 266 266 267 267 float **vPix = source->pixels->data.F32; 268 float **vWgt = source->variance ->data.F32;269 psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;268 float **vWgt = source->variance ? source->variance->data.F32 : source->pixels->data.F32; 269 psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA; 270 270 271 271 float RF = 0.0; … … 467 467 468 468 float *vPix = source->pixels->data.F32[row]; 469 float *vWgt = source->variance ->data.F32[row];469 float *vWgt = source->variance ? source->variance->data.F32[row] : source->pixels->data.F32[row]; 470 470 471 471 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceSky.c
r34403 r35421 122 122 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 123 123 PS_ASSERT_PTR_NON_NULL(source, false); 124 PS_ASSERT_IMAGE_NON_NULL(source->variance, false);125 124 PS_ASSERT_IMAGE_NON_NULL(source->maskObj, false); 126 125 PS_ASSERT_PTR_NON_NULL(source->peak, false); 127 126 PS_ASSERT_INT_POSITIVE(Radius, false); 127 128 if (source->variance == NULL) { 129 // XXX this is needed so psphotCheckRadiusPSF has a real value 130 source->moments->dSky = 1.0; 131 return true; 132 } 128 133 129 134 // maskVal is used to test for rejected pixels, and must include markVal -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceUtils.c
r34403 r35421 46 46 47 47 /****************************************************************************** 48 pmSourceModelGuess(source, model ): This function allocates a new49 pmModel structure based on the given modelType specified in the argument list. 50 The corresponding pmModelGuess function is returned, and used to51 supply the values of theparams array in the pmModel structure.48 pmSourceModelGuess(source, model, maskVal, markVal): This function allocates a new 49 pmModel structure based on the given modelType specified in the argument list. The 50 corresponding pmModelGuess function is returned, and used to supply the values of the 51 params array in the pmModel structure. 52 52 53 53 XXX: Many parameters are based on the src->moments structure, which is in … … 55 55 functions will be in image, not subImage coords. Remember this. 56 56 *****************************************************************************/ 57 pmModel *pmSourceModelGuess(pmSource *source, 58 pmModelType modelType) 57 pmModel *pmSourceModelGuess(pmSource *source, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) 59 58 { 60 59 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); … … 65 64 pmModel *model = pmModelAlloc(modelType); 66 65 67 if (!model->modelGuess(model, source )) {66 if (!model->modelGuess(model, source, maskVal, markVal)) { 68 67 psFree (model); 69 68 return NULL; -
branches/eam_branches/ipp-20130419/psModules/src/objects/pmSourceUtils.h
r31451 r35421 27 27 pmModel *pmSourceModelGuess( 28 28 pmSource *source, ///< The input pmSource 29 pmModelType model ///< The type of model to be created. 29 pmModelType model, ///< The type of model to be created. 30 psImageMaskType maskVal, 31 psImageMaskType markVal 30 32 ); 31 33 -
branches/eam_branches/ipp-20130419/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/psphot (added) merged: 35322,35350,35377,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/psphot/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/psphot/src (added) merged: 35322,35350,35377,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/psphot/src/models/pmModel_STRAIL.c
r31154 r35421 475 475 476 476 //fixed I think...no good way of guessing as far as I can tell 477 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )477 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 478 478 { 479 479 pmMoments *Smoments = source->moments; -
branches/eam_branches/ipp-20130419/psphot/src/models/pmModel_TEST1.c
r31154 r35421 123 123 124 124 // make an initial guess for parameters 125 bool PM_MODEL_GUESS (pmModel *model, pmSource *source )125 bool PM_MODEL_GUESS (pmModel *model, pmSource *source, psImageMaskType maskVal, psImageMaskType markVal) 126 126 { 127 127 pmMoments *moments = source->moments; -
branches/eam_branches/ipp-20130419/psphot/src/psphotExtendedSourceFits.c
r34404 r35421 90 90 assert (markVal); 91 91 92 // source fitting parameters for extended source fits 93 int fitIter = psMetadataLookupS32(&status, recipe, "EXT_FIT_ITER"); // Max number of fit iterations 94 assert (status && fitIter > 0); 95 96 float fitMinTol = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MIN_TOL"); // Fit tolerance 97 if (!status || !isfinite(fitMinTol) || fitMinTol <= 0) { 98 fitMinTol = psMetadataLookupF32 (&status, recipe, "PSF_FIT_TOL"); // Fit tolerance 99 if (!status || !isfinite(fitMinTol) || fitMinTol <= 0) { 100 psAbort("PSF_FIT_MIN_TOL (and PSF_FIT_TOL) not defined or positive"); 101 } 102 } 103 104 float fitMaxTol = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MAX_TOL"); // Fit tolerance 105 if (!status || !isfinite(fitMaxTol) || fitMaxTol <= 0) { 106 fitMaxTol = 1.0; 107 } 108 92 109 // maskVal is used to test for rejected pixels, and must include markVal 93 110 maskVal |= markVal; … … 181 198 182 199 PS_ARRAY_ADD_SCALAR(job->args, psfSize, PS_TYPE_S32); 200 PS_ARRAY_ADD_SCALAR(job->args, fitIter, PS_TYPE_S32); 201 PS_ARRAY_ADD_SCALAR(job->args, fitMinTol, PS_TYPE_F32); 202 PS_ARRAY_ADD_SCALAR(job->args, fitMaxTol, PS_TYPE_F32); 203 183 204 PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); 184 205 PS_ARRAY_ADD_SCALAR(job->args, markVal, PS_TYPE_IMAGE_MASK); … … 293 314 psRegion *region = job->args->data[4]; 294 315 int psfSize = PS_SCALAR_VALUE(job->args->data[5],S32); 295 psImageMaskType maskVal = PS_SCALAR_VALUE(job->args->data[6],PS_TYPE_IMAGE_MASK_DATA); 296 psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[7],PS_TYPE_IMAGE_MASK_DATA); 316 int fitIter = PS_SCALAR_VALUE(job->args->data[6],S32); 317 float fitMinTol = PS_SCALAR_VALUE(job->args->data[7],F32); 318 float fitMaxTol = PS_SCALAR_VALUE(job->args->data[8],F32); 319 psImageMaskType maskVal = PS_SCALAR_VALUE(job->args->data[9],PS_TYPE_IMAGE_MASK_DATA); 320 psImageMaskType markVal = PS_SCALAR_VALUE(job->args->data[10],PS_TYPE_IMAGE_MASK_DATA); 297 321 298 322 // Define source fitting parameters for extended source fits … … 301 325 fitOptions->saveCovariance = true; // XXX make this a user option? 302 326 fitOptions->covarFactor = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix 303 304 // XXX for now, use the defaults for the rest: 305 // fitOptions->nIter = fitIter; 306 // fitOptions->tol = fitTol; 307 // fitOptions->poissonErrors = poisson; 308 // fitOptions->weight = PS_SQR(skySig); 327 fitOptions->nIter = fitIter; 328 fitOptions->minTol = fitMinTol; 329 fitOptions->maxTol = fitMaxTol; 309 330 310 331 // choose the sources of interest … … 335 356 // set the fit radius based on the first radial moment (also sets the mask pixels) 336 357 psphotSetRadiusMomentsExact(&fitRadius, &windowRadius, readout, source, markVal); // NOTE : 6 allocs 358 359 // XXX WATCH OUT HERE!! 360 // fitRadius = 30; 337 361 338 362 // UPDATE : we have changed the moments calculation. There is now an iteration within … … 498 522 499 523 // change the value of a scalar on the array (wrap this and put it in psArray.h) 500 scalar = job->args->data[ 8];524 scalar = job->args->data[11]; 501 525 scalar->data.S32 = Next; 502 526 503 scalar = job->args->data[ 9];527 scalar = job->args->data[12]; 504 528 scalar->data.S32 = Nconvolve; 505 529 506 scalar = job->args->data[1 0];530 scalar = job->args->data[13]; 507 531 scalar->data.S32 = NconvolvePass; 508 532 509 scalar = job->args->data[1 1];533 scalar = job->args->data[14]; 510 534 scalar->data.S32 = Nplain; 511 535 512 scalar = job->args->data[1 2];536 scalar = job->args->data[15]; 513 537 scalar->data.S32 = NplainPass; 514 538 515 scalar = job->args->data[1 3];539 scalar = job->args->data[16]; 516 540 scalar->data.S32 = Nfaint; 517 541 518 scalar = job->args->data[1 4];542 scalar = job->args->data[17]; 519 543 scalar->data.S32 = Nfail; 520 544 -
branches/eam_branches/ipp-20130419/psphot/src/psphotFakeSources.c
r19881 r35421 24 24 25 25 pmModelType modelType = pmModelClassGetType ("PS_MODEL_QGAUSS"); 26 source->modelPSF = pmSourceModelGuess (source, modelType );26 source->modelPSF = pmSourceModelGuess (source, modelType, 0, 0); 27 27 sources->data[i] = source; 28 28 } -
branches/eam_branches/ipp-20130419/psphot/src/psphotMakeResiduals.c
r34086 r35421 105 105 if (model == NULL) continue; // model must be defined 106 106 107 psImage *image = psImageCopy (NULL, source->pixels,PS_TYPE_F32);108 psImage * variance = psImageCopy (NULL, source->variance, PS_TYPE_F32);109 psImage * mask = psImageCopy (NULL, source->maskView, PS_TYPE_IMAGE_MASK);107 psImage *image = psImageCopy (NULL, source->pixels, PS_TYPE_F32); 108 psImage *mask = psImageCopy (NULL, source->maskView ? source->maskView : source->maskObj, PS_TYPE_IMAGE_MASK); 109 psImage *variance = psImageCopy (NULL, source->variance ? source->variance : source->pixels, PS_TYPE_F32); 110 110 pmModelSub (image, mask, model, PM_MODEL_OP_FUNC, maskVal); 111 111 -
branches/eam_branches/ipp-20130419/psphot/src/psphotModelTestArguments.c
r32348 r35421 151 151 } 152 152 153 // chip selection is used to limit chips to be processed 154 if ((N = psArgumentGet (argc, argv, "-moments-radius"))) { 155 psArgumentRemove (N, &argc, argv); 156 psMetadataAddBool (config->arguments, PS_LIST_TAIL, "TEST_MOMENTS_RADIUS", PS_DATA_BOOL, "", true); 157 } 158 153 159 // if these command-line options are supplied, load the file name lists into config->arguments 154 160 // override any configuration-specified source for these files … … 160 166 pmConfigFileSetsMD (config->arguments, &argc, argv, "SRC", "-src", "-srclist"); 161 167 pmConfigFileSetsMD (config->arguments, &argc, argv, "SRCTEXT", "-srctext", "-srctextlist"); 168 169 pmConfigFileSetsMD (config->arguments, &argc, argv, "PSPHOT.PSF", "-psf", "-psflist"); 162 170 163 171 if (argc == 1) { -
branches/eam_branches/ipp-20130419/psphot/src/psphotModelTestReadout.c
r32348 r35421 5 5 6 6 bool status; 7 8 psTimerStart ("modelTest"); 7 9 8 10 pmModelClassSetLimits(PM_MODEL_LIMITS_LAX); … … 41 43 } 42 44 45 // load the psf model, if suppled. FWHM_MAJ,FWHM_MIN,etc are determined and saved on 46 // readout->analysis. NOTE: this function currently only loads from PSPHOT.PSF.LOAD 47 if (!psphotLoadPSF (config, view, filerule)) { // ??? need to supply 2 ? 48 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 49 return psphotReadoutCleanup (config, view, filerule); 50 } 51 43 52 float MIN_KRON_RADIUS = 5.0; 44 53 … … 53 62 // maskVal is used to test for rejected pixels, and must include markVal 54 63 maskVal |= markVal; 64 65 // what fraction of the PSF is used? (radius in pixels : 2 -> 5x5 box) 66 int psfSize = psMetadataLookupS32 (&status, recipe, "PCM_BOX_SIZE"); 67 assert (status); 55 68 56 69 // find the currently selected readout … … 84 97 85 98 // define the source of interest 86 float xObj = psMetadataLookupF32 (&status, recipe, "TEST_FIT_X");99 float xObj = psMetadataLookupF32 (&status, recipe, "TEST_FIT_X"); 87 100 float yObj = psMetadataLookupF32 (&status, recipe, "TEST_FIT_Y"); 88 101 if (!isfinite(xObj) || !isfinite(yObj)) psAbort ("object position is not defined"); … … 99 112 source->type = PM_SOURCE_TYPE_EXTENDED; 100 113 114 bool TEST_FIT_CONVOLVED = psMetadataLookupBool (&status, recipe, "TEST_FIT_CONVOLVED"); 115 101 116 // find the local sky 102 117 status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal); 103 118 if (!status) psAbort("pmSourceLocalSky error"); 104 119 105 { 120 bool testMomentsRadius = psMetadataLookupBool (&status, config->arguments, "TEST_MOMENTS_RADIUS"); 121 if (testMomentsRadius) { 106 122 // XXX I want to test an iterative aperture for brighter sources 107 123 float radius = mRADIUS; … … 109 125 110 126 // get the source moments 111 status = pmSourceMoments (source, radius, 0. 0, 0.0, MIN_KRON_RADIUS, maskVal);127 status = pmSourceMoments (source, radius, 0.25*radius, 0.0, MIN_KRON_RADIUS, maskVal); 112 128 if (!status) psAbort("psSourceMoments error"); 113 129 … … 121 137 122 138 // get the source moments 123 status = pmSourceMoments (source, mRADIUS, 0. 0, 0.0, MIN_KRON_RADIUS, maskVal);139 status = pmSourceMoments (source, mRADIUS, 0.25*mRADIUS, 0.0, MIN_KRON_RADIUS, maskVal); 124 140 if (!status) psAbort("psSourceMoments error"); 125 141 … … 135 151 fprintf (stderr, "axes: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor); 136 152 153 pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF"); 154 if (psf) { 155 // set PSF parameters for this model (apply 2D shape model to coordinates Xo, Yo) 156 source->peak->rawFlux = source->moments->Peak; 157 float Io = source->moments->Peak; 158 source->modelPSF = pmModelFromPSFforXY(psf, xObj, yObj, Io); 159 } 160 137 161 // get the initial model parameter guess 138 pmModel *model = pmSourceModelGuess (source, modelType );162 pmModel *model = pmSourceModelGuess (source, modelType, maskVal, markVal); 139 163 source->modelEXT = model; 140 164 … … 159 183 fprintf (stderr, "peak: %f @ (%f, %f)\n", source->moments->Sum*area, (double)source->peak->x, (double)source->peak->y); 160 184 161 // list model input shape 162 psEllipseShape shape; 163 shape.sx = 1.4 / model->params->data.F32[4]; 164 shape.sy = 1.4 / model->params->data.F32[5]; 165 shape.sxy = model->params->data.F32[6]; 166 axes = psEllipseShapeToAxes (shape, 20.0); 167 168 fprintf (stderr, "guess: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor); 185 if (modelType == pmModelClassGetType("PS_MODEL_TRAIL")) { 186 fprintf (stderr, "guess: %f @ (%f, %f)\n", params[6]*180/M_PI, params[4], params[5]); 187 } else { 188 // list model input shape 189 psEllipseShape shape; 190 shape.sx = 1.4 / model->params->data.F32[4]; 191 shape.sy = 1.4 / model->params->data.F32[5]; 192 shape.sxy = model->params->data.F32[6]; 193 axes = psEllipseShapeToAxes (shape, 20.0); 194 fprintf (stderr, "guess: %f @ (%f, %f)\n", axes.theta*180/M_PI, axes.major, axes.minor); 195 } 169 196 170 197 fprintf (stderr, "input parameters: \n"); … … 190 217 fitOptions->covarFactor = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix 191 218 192 status = pmSourceFitModel (source, model, fitOptions, maskVal); 219 if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) { 220 fitOptions->mode = PM_SOURCE_FIT_NO_INDEX; 221 } 222 if (modelType == pmModelClassGetType("PS_MODEL_TRAIL")) { 223 fitOptions->mode = PM_SOURCE_FIT_TRAIL; 224 } 225 226 if (TEST_FIT_CONVOLVED) { 227 pmPCMdata *pcm = pmPCMinit (source, fitOptions, model, maskVal, psfSize); 228 if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) { 229 psphotSersicModelClassGuessPCM (pcm, source); 230 } else { 231 pmSourceModelGuessPCM (pcm, source, maskVal, markVal); 232 } 233 pmPCMupdate(pcm, source, fitOptions, model); 234 pmSourceFitPCM (pcm, source, fitOptions, maskVal, markVal, psfSize); 235 psFree (pcm); 236 } else { 237 status = pmSourceFitModel (source, model, fitOptions, maskVal); 238 } 193 239 194 240 // measure the source mags -
branches/eam_branches/ipp-20130419/psphot/src/psphotSetThreads.c
r34559 r35421 40 40 psFree(task); 41 41 42 task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 1 5);42 task = psThreadTaskAlloc("PSPHOT_EXTENDED_FIT", 18); 43 43 task->function = &psphotExtendedSourceFits_Threaded; 44 44 psThreadTaskAdd(task); -
branches/eam_branches/ipp-20130419/psphot/src/psphotSourceFits.c
r34258 r35421 457 457 458 458 // use the source moments, etc to guess basic model parameters 459 pmModel *model = pmSourceModelGuess (source, modelType );459 pmModel *model = pmSourceModelGuess (source, modelType, maskVal, markVal); 460 460 if (!model) { 461 461 psTrace ("psphot", 5, "failed to generate a model for source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy); … … 625 625 model->params->data.F32[PM_PAR_7] = 0.5/indexGuess[i]; 626 626 627 if (!model->modelGuess(model, source )) {627 if (!model->modelGuess(model, source, maskVal, markVal)) { 628 628 model->flags |= PM_MODEL_STATUS_BADARGS; 629 629 return false; … … 648 648 model->flags = PM_MODEL_STATUS_NONE; // do not attempt to handle failures here, let the next iteration deal with it 649 649 model->params->data.F32[PM_PAR_7] = 0.5/indexGuess[iMin]; 650 model->modelGuess(model, source );650 model->modelGuess(model, source, maskVal, markVal); 651 651 652 652 return true; … … 677 677 model->params->data.F32[PM_PAR_7] = indexGuess[i]; 678 678 679 if (!model->modelGuess(model, source )) {679 if (!model->modelGuess(model, source, maskVal, markVal)) { 680 680 model->flags |= PM_MODEL_STATUS_BADARGS; 681 681 return false; -
branches/eam_branches/ipp-20130419/psphot/src/psphotStackImageLoop.c
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/psphot/src/psphotStackImageLoop.c (added) merged: 35350,35413
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130419/pswarp/src/Makefile.am
r28043 r35421 28 28 pswarp.c \ 29 29 pswarpArguments.c \ 30 pswarpExit .c\30 pswarpExitCode.c \ 31 31 pswarpLoop.c \ 32 pswarpLoopBackground.c \ 33 pswarpCleanup.c \ 34 pswarpStatsFile.c \ 32 35 pswarpDefine.c \ 33 pswarpDefineSkycell.c \ 36 pswarpDefineBackground.c \ 37 pswarpDefineSkycell.c \ 34 38 pswarpErrorCodes.c \ 35 39 pswarpMapGrid.c \ -
branches/eam_branches/ipp-20130419/pswarp/src/pswarp.c
r34800 r35421 12 12 13 13 #include "pswarp.h" 14 #include "pswarpFileNames.h"15 14 16 15 int main (int argc, char **argv) … … 22 21 psphotInit(); 23 22 24 const char *statsName = NULL; // Filename for statistics25 psMetadata *stats = NULL; // Container for statistics26 FILE *statsFile = NULL; // File stream for statistics27 28 23 pmConfig *config = pswarpArguments(argc, argv); 29 24 if (!config) { 30 goto DIE;25 pswarpCleanup(config, NULL); 31 26 } 27 28 pswarpStatsFile *statsFile = pswarpStatsFileOpen (config); 32 29 33 30 pswarpVersionPrint(); … … 35 32 // load identify the data sources 36 33 if (!pswarpParseCamera(config)) { 37 goto DIE;34 pswarpCleanup(config, statsFile); 38 35 } 39 36 40 37 if (!pswarpOptions(config)) { 41 goto DIE;38 pswarpCleanup(config, statsFile); 42 39 } 43 40 44 // load the skycell layout information 41 // load the skycell layout information: 42 // read the output astrometry description 43 // generate the output pixels 44 // convert header astrometry to pmFPA astrometry structures 45 45 if (!pswarpDefine(config)) { 46 goto DIE;46 pswarpCleanup(config, statsFile); 47 47 } 48 if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND.MODEL")) { 49 if (!pswarpDefineBackground(config)) { 50 goto DIE; 51 } 52 } 53 54 // Open the statistics file 55 bool mdok; ///< Status of MD lookup 56 statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); ///< Filename for statistics 57 if (mdok && statsName && strlen(statsName) > 0) { 58 psString resolved = pmConfigConvertFilename(statsName, config, true, true); 59 statsFile = fopen(resolved, "w"); 60 if (!statsFile) { 61 psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.\n", resolved); 62 psFree(resolved); 63 goto DIE; 64 } 65 psFree(resolved); 66 stats = psMetadataAlloc(); 67 psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0); 48 if (!pswarpDefineBackground(config)) { 49 pswarpCleanup(config, statsFile); 68 50 } 69 51 70 52 // load and warp 71 if (!pswarpLoop(config, stats )) {72 goto DIE;53 if (!pswarpLoop(config, statsFile->md)) { 54 pswarpCleanup(config, statsFile); 73 55 } 74 if (psMetadataLookupBool(NULL,config->arguments,"BACKGROUND.MODEL")) { 75 if (!pswarpLoopBackground(config, stats)) { 56 if (!pswarpLoopBackground(config, statsFile->md)) { 76 57 fprintf(stderr,"Dying!\n"); 77 goto DIE; 78 } 58 pswarpCleanup(config, statsFile); 79 59 } 80 60 81 61 psLogMsg("pswarp", PS_LOG_INFO, "complete pswarp run: %f sec\n", psTimerMark("pswarp")); 62 pswarpCleanup(config, statsFile); 63 } 82 64 83 DIE: 84 { 85 psExit exitValue = pswarpExitCode(PS_EXIT_SUCCESS); // Exit code 86 87 // Ensure everything is written out, at every level 88 pswarpFileActivation(config, detectorFiles, true); 89 pswarpFileActivation(config, skycellFiles, true); 90 pswarpFileActivation(config, photFiles, true); 91 pswarpFileActivation(config, independentFiles, true); 92 if (!pswarpIOChecksAfter(config)) { 93 psError(psErrorCodeLast(), false, "Unable to write files."); 94 exitValue = pswarpExitCode(exitValue); 95 pmFPAfileFreeSetStrict(false); 96 } 97 98 // Write out summary statistics 99 if (stats && statsFile) { 100 psMetadataAddF32(stats, PS_LIST_TAIL, "DT_WARP", 0, "Time for warp completion", 101 psTimerMark("pswarp")); 102 103 const char *statsMDC = psMetadataConfigFormat(stats); 104 if (!statsMDC) { 105 psError(psErrorCodeLast(), false, "Unable to get statistics file."); 106 exitValue = pswarpExitCode(exitValue); 107 } 108 psFree(stats); 109 if (fprintf(statsFile, "%s", statsMDC) != strlen(statsMDC)) { 110 psError(PSWARP_ERR_IO, true, "Unable to write statistics file."); 111 exitValue = pswarpExitCode(exitValue); 112 } 113 psFree(statsMDC); 114 if (fclose(statsFile) == EOF) { 115 psError(PSWARP_ERR_IO, true, "Unable to close statistics file."); 116 exitValue = pswarpExitCode(exitValue); 117 } 118 pmConfigRunFilenameAddWrite(config, "STATS", statsName); 119 } 120 121 // Dump configuration 122 psString dump_file = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG"); 123 if (dump_file) { 124 if (!pmConfigDump(config, dump_file)) { 125 psError(psErrorCodeLast(), false, "Unable to dump configuration"); 126 exitValue = pswarpExitCode(exitValue); 127 } 128 } 129 130 psThreadPoolFinalize(); 131 psMemCheckCorruption(stderr, true); 132 133 psFree(config); 134 135 psTimerStop(); 136 pmVisualClose(); 137 pmModelClassCleanup(); 138 pmConceptsDone(); 139 pmConfigDone(); 140 psLibFinalize(); 141 142 exitValue = pswarpExitCode(exitValue); 143 return exitValue; 144 } 145 } 65 // NOTE: pswarpCleanup calls exit -
branches/eam_branches/ipp-20130419/pswarp/src/pswarp.h
r34800 r35421 77 77 double jacobian; ///< (Square root of) local Jacobian 78 78 } pswarpTransformTileArgs; 79 80 typedef struct { 81 FILE *f; // File stream for statistics 82 char *name; // Filename for statistics 83 psMetadata *md; // Container for statistics 84 } pswarpStatsFile; 79 85 80 86 pswarpTransformTileArgs *pswarpTransformTileArgsAlloc(void); … … 160 166 ); 161 167 168 pswarpStatsFile *pswarpStatsFileAlloc (); 169 pswarpStatsFile *pswarpStatsFileOpen (pmConfig *config); 170 bool pswarpStatsFileSave (pmConfig *config, pswarpStatsFile *statsFile); 171 172 // cleanup memory and exit 173 void pswarpCleanup (pmConfig *config, pswarpStatsFile *statsFile) PS_ATTR_NORETURN; -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpArguments.c
r34800 r35421 183 183 184 184 // Set recipe values in the recipe (since we've possibly altered some) 185 psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE, 186 "Iso-astrom grid spacing in x", nGridX); 187 psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NY", PS_META_REPLACE, 188 "Iso-astrom grid spacing in y", nGridY); 189 psMetadataAddStr(recipe, PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, 190 "Interpolation mode", name); 191 psMetadataAddS32(recipe, PS_LIST_TAIL, "INTERPOLATION.NUM", PS_META_REPLACE, 192 "Interpolation pre-calculated kernels", numKernels); 193 psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE, 194 "Fraction of bad flux for a pixel to be marked as poor", poorFrac); 185 psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NX", PS_META_REPLACE, "Iso-astrom grid spacing in x", nGridX); 186 psMetadataAddS32(recipe, PS_LIST_TAIL, "GRID.NY", PS_META_REPLACE, "Iso-astrom grid spacing in y", nGridY); 187 psMetadataAddStr(recipe, PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, "Interpolation mode", name); 188 psMetadataAddS32(recipe, PS_LIST_TAIL, "INTERPOLATION.NUM", PS_META_REPLACE, "Interpolation pre-calculated kernels", numKernels); 189 psMetadataAddF32(recipe, PS_LIST_TAIL, "POOR.FRAC", PS_META_REPLACE, "Fraction of bad flux for a pixel to be marked as poor", poorFrac); 195 190 psMetadataAddBool(recipe, PS_LIST_TAIL, "PSF", PS_META_REPLACE, "Generate a PSF Model?", PSF); 196 191 psMetadataAddBool(recipe, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Generate the warped background model?", doBKG); … … 198 193 psMetadataAddS32(recipe, PS_LIST_TAIL, "BKG.YGRID", PS_META_REPLACE, "Ysize of background model", bkgYgrid); 199 194 200 201 195 // Set recipe values in the arguments 202 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0, 203 "Iso-astrom grid spacing in x", nGridX); 204 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NY", 0, 205 "Iso-astrom grid spacing in y", nGridY); 206 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.MODE", 0, 207 "Interpolation mode", interpolationMode); 208 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.NUM", 0, 209 "Interpolation pre-calculated kernels", numKernels); 210 psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0, 211 "Fraction of bad flux for a pixel to be marked as poor", poorFrac); 196 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NX", 0, "Iso-astrom grid spacing in x", nGridX); 197 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "GRID.NY", 0, "Iso-astrom grid spacing in y", nGridY); 198 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.MODE", 0, "Interpolation mode", interpolationMode); 199 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "INTERPOLATION.NUM", 0, "Interpolation pre-calculated kernels", numKernels); 200 psMetadataAddF32(config->arguments, PS_LIST_TAIL, "POOR.FRAC", 0, "Fraction of bad flux for a pixel to be marked as poor", poorFrac); 212 201 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "PSF", PS_META_REPLACE, "Generate a PSF Model?", PSF); 213 202 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "BACKGROUND.MODEL", PS_META_REPLACE, "Generate the warped background model?", doBKG); … … 215 204 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "BKG.YGRID", PS_META_REPLACE, "Ysize of background model", bkgYgrid); 216 205 217 psTrace("pswarp", 1, "Done with pswarp Arguments...\n");206 psTrace("pswarp", 1, "Done with pswarpOptions...\n"); 218 207 219 208 return (config); -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpDefine.c
r34800 r35421 1 1 /** @file pswarpDefine.c 2 2 * 3 * @brief 4 * 3 * @brief generates the output images 5 4 * @ingroup pswarp 6 5 * … … 13 12 # include "pswarp.h" 14 13 15 /**16 * loads the skycell metadata17 */18 14 bool pswarpDefine (pmConfig *config) { 19 15 … … 42 38 } 43 39 44 // open the full skycell file; no need to defer different depths. only load the header data 45 pmFPAview *view = pmFPAviewAlloc (0); 46 pmFPAfileOpen (skycell, view, config); 40 // Read the output astrometry 41 // XXX this section loops over the input skycell to load the header info 42 { 43 pmFPAview *view = pmFPAviewAlloc(0); 47 44 48 // Read header and create target 49 { 50 if (!pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config)) { 51 psError(psErrorCodeLast(), false, "Unable to read headers for skycell."); 52 psFree(view); 53 return false; 54 } 55 view->chip = 0; 56 view->cell = 0; 57 view->readout = 0; 58 pmCell *source = pmFPAfileThisCell(config->files, view, "PSWARP.SKYCELL"); ///< Source cell 59 pmHDU *hdu = pmHDUFromCell(source); ///< HDU for source 60 if (!hdu || !hdu->header) { 61 psError(PM_ERR_PROG, false, "Unable to find header for sky cell."); 62 psFree(view); 63 return false; 64 } 65 int numCols = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); ///< Number of columns 66 int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); ///< Number of rows 67 if ((numCols == 0) || (numRows == 0)) { 68 psError(PSWARP_ERR_DATA, false, "skycell has invalid dimensions %d x %d", numCols, numRows); 69 psFree(view); 70 return false; 71 } 45 pmChip *chip; 46 if (!pmFPAfileRead (skycell, view, config)) { 47 psError(PS_ERR_IO, false, "failed READ at FPA %s", skycell->name); 48 psFree(view); 49 return false; 50 } 51 while ((chip = pmFPAviewNextChip (view, skycell->fpa, 1)) != NULL) { 52 psTrace ("pswarp", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 53 if (!chip->process || !chip->file_exists) { continue; } 54 if (!pmFPAfileRead (skycell, view, config)) { 55 psError(psErrorCodeLast(), false, "failed READ at CHIP %s", skycell->name); 56 psFree(view); 57 return false; 58 } 59 pmCell *cell; 60 while ((cell = pmFPAviewNextCell (view, skycell->fpa, 1)) != NULL) { 61 psTrace ("pswarp", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 62 if (!cell->process || !cell->file_exists) { continue; } 63 if (!pmFPAfileRead (skycell, view, config)) { 64 psError(psErrorCodeLast(), false, "failed READ at CELL %s", skycell->name); 65 psFree(view); 66 return false; 67 } 68 if (!pmFPAfileClose(skycell, view)) { 69 psError(psErrorCodeLast(), false, "failed CLOSE at CELL %s", skycell->name); 70 psFree (view); 71 return false; 72 } 72 73 73 pmCell *target = pmFPAviewThisCell(view, output->fpa); ///< Target cell 74 pmReadout *readout = pmReadoutAlloc(target); ///< Target readout 75 readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); 76 psImageInit(readout->image, NAN); 77 psFree(readout); // Drop reference 78 79 bool status = false; 80 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XBIN"); 81 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YBIN"); 82 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XSIZE"); 83 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YSIZE"); 84 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XPARITY"); 85 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YPARITY"); 86 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.X0"); 87 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.Y0"); 88 89 74 // we've got the output astrom header 75 pmHDU *hdu = pmHDUFromCell(cell); ///< HDU for source 76 if (!hdu || !hdu->header) { 77 psError(PM_ERR_PROG, false, "Unable to find header for sky cell."); 78 psFree(view); 79 return false; 80 } 81 int numCols = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); ///< Number of columns 82 int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); ///< Number of rows 83 if ((numCols == 0) || (numRows == 0)) { 84 psError(PSWARP_ERR_DATA, false, "skycell has invalid dimensions %d x %d", numCols, numRows); 85 psFree(view); 86 return false; 87 } 88 89 // XXX generate the output pixels 90 pmCell *target = pmFPAviewThisCell(view, output->fpa); ///< Target cell 91 pmReadout *readout = pmReadoutAlloc(target); ///< Target readout 92 readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); 93 psImageInit(readout->image, NAN); 94 psFree(readout); // Drop reference 95 96 bool status = false; 97 psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.XBIN"); 98 psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.YBIN"); 99 psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.XSIZE"); 100 psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.YSIZE"); 101 psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.XPARITY"); 102 psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.YPARITY"); 103 psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.X0"); 104 psMetadataItemSupplement(&status, target->concepts, cell->concepts, "CELL.Y0"); 105 } 106 if (!pmFPAfileClose(skycell, view)) { 107 psError(psErrorCodeLast(), false, "failed CLOSE at CHIP %s", skycell->name); 108 psFree (view); 109 return false; 110 } 111 } 112 if (!pmFPAfileClose(skycell, view)) { 113 psError(psErrorCodeLast(), false, "failed CLOSE at FPA %s", skycell->name); 114 psFree (view); 115 return false; 116 } 117 psFree(view); 90 118 } 91 119 92 // XXX this is not a sufficient test 120 // the section below converts the header astrometry info (in skycell) to the pmFPA 121 // astrometry structures, saving them on the output fpa structure. 122 123 // XXX this block should be modified to loop over all chips 124 125 pmFPAview *view = pmFPAviewAlloc (0); 93 126 view->chip = 0; 94 127 view->cell = 0; … … 134 167 } 135 168 136 bool pswarpDefineBackground (pmConfig *config) {137 138 // load the PSWARP recipe139 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSWARP_RECIPE);140 if (!recipe) {141 psError(PSWARP_ERR_CONFIG, true, "Can't find PSWARP recipe!\n");142 return false;143 }144 145 // select the input data sources146 pmFPAfile *skycell = psMetadataLookupPtr (NULL, config->files, "PSWARP.SKYCELL");147 if (!skycell) {148 psError(PSWARP_ERR_CONFIG, false, "Can't find skycell data!\n");149 return false;150 }151 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PSWARP.OUTPUT.BKGMODEL");152 if (!output) {153 psError(PSWARP_ERR_CONFIG, false, "Can't find output data!\n");154 return false;155 }156 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.INPUT");157 if (!input) {158 psError(PSWARP_ERR_CONFIG, false, "Can't find input data!\n");159 return false;160 }161 162 // open the full skycell file; no need to defer different depths. only load the header data163 pmFPAview *view = pmFPAviewAlloc (0);164 pmFPAfileOpen (skycell, view, config);165 166 // Read header and create target167 {168 if (!pmFPAReadHeaderSet(skycell->fpa, skycell->fits, config)) {169 psError(psErrorCodeLast(), false, "Unable to read headers for skycell.");170 psFree(view);171 return false;172 }173 view->chip = 0;174 view->cell = 0;175 view->readout = 0;176 pmCell *source = pmFPAfileThisCell(config->files, view, "PSWARP.SKYCELL"); ///< Source cell177 pmHDU *hdu = pmHDUFromCell(source); ///< HDU for source178 if (!hdu || !hdu->header) {179 psError(PM_ERR_PROG, false, "Unable to find header for sky cell.");180 psFree(view);181 return false;182 }183 int numCols = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); ///< Number of columns184 int numRows = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); ///< Number of rows185 if ((numCols == 0) || (numRows == 0)) {186 psError(PSWARP_ERR_DATA, false, "skycell has invalid dimensions %d x %d", numCols, numRows);187 psFree(view);188 return false;189 }190 191 pmCell *target = pmFPAviewThisCell(view, output->fpa); ///< Target cell192 pmReadout *readout = pmReadoutAlloc(target); ///< Target readout193 readout->image = psImageAlloc(numCols / output->xBin, numRows / output->yBin, PS_TYPE_F32);194 psImageInit(readout->image, NAN);195 psFree(readout); // Drop reference196 197 bool status = false;198 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XBIN");199 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YBIN");200 /* psMetadataAddS32(target->concepts,PS_LIST_TAIL,"CELL.XBIN",PS_META_REPLACE,"",output->xBin); */201 /* psMetadataAddS32(target->concepts,PS_LIST_TAIL,"CELL.YBIN",PS_META_REPLACE,"",output->yBin); */202 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XSIZE");203 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YSIZE");204 /* psMetadataAddS32(target->concepts,PS_LIST_TAIL,"CELL.XSIZE",PS_META_REPLACE,"",numCols / output->xBin); */205 /* psMetadataAddS32(target->concepts,PS_LIST_TAIL,"CELL.YSIZE",PS_META_REPLACE,"",numRows / output->yBin); */206 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.XPARITY");207 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.YPARITY");208 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.X0");209 psMetadataItemSupplement(&status, target->concepts, source->concepts, "CELL.Y0");210 211 212 }213 214 // XXX this is not a sufficient test215 view->chip = 0;216 view->cell = 0;217 view->readout = -1;218 pmHDU *phu = pmFPAviewThisPHU(view, skycell->fpa); ///< Skycell PHU219 pmHDU *hdu = pmFPAviewThisHDU(view, skycell->fpa); ///< Skycell header220 221 pmAstromWCS *WCS = pmAstromWCSfromHeader(hdu->header);222 223 double cd1f = 1.0 * output->xBin;224 double cd2f = 1.0 * output->yBin;225 226 WCS->crpix1 = WCS->crpix1 / cd1f;227 WCS->crpix2 = WCS->crpix2 / cd2f;228 229 WCS->cdelt1 *= cd1f;230 WCS->cdelt2 *= cd2f;231 232 WCS->trans->x->coeff[1][0] *= cd1f;233 WCS->trans->x->coeff[0][1] *= cd2f;234 WCS->trans->y->coeff[1][0] *= cd1f;235 WCS->trans->y->coeff[0][1] *= cd2f;236 237 238 pmAstromWCStoHeader (hdu->header,WCS);239 240 bool bilevelAstrometry = false;241 if (phu) {242 char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1");243 if (ctype) {244 bilevelAstrometry = !strcmp(&ctype[4], "-DIS");245 }246 }247 248 // We read from the skycell into the output. i.e., the output receives the desired astrometry.249 pmChip *outputChip = pmFPAviewThisChip(view, output->fpa); ///< Chip in the output250 if (bilevelAstrometry) {251 if (!pmAstromReadBilevelMosaic(output->fpa, phu->header)) {252 psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for skycell.");253 psFree(view);254 return false;255 }256 if (!pmAstromReadBilevelChip(outputChip, hdu->header)) {257 psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for skycell.");258 psFree(view);259 return false;260 }261 } else {262 // we use a default FPA pixel scale of 1.0263 if (!pmAstromReadWCS(output->fpa, outputChip, hdu->header, 1.0)) {264 psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for skycell.");265 psFree(view);266 return false;267 }268 }269 270 271 view->chip = view->cell = view->readout = -1;272 pmFPAAddSourceFromView(output->fpa, view, output->format);273 274 275 psFree (view);276 return true;277 } -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpDefineSkycell.c
r27096 r35421 73 73 psFitsClose(fits); 74 74 75 // We need to force the format for the skycell to be equivalent to SIMPLE. Determine 76 // the current format from the header; Determine camera if not specified already 77 // XXX EAM : this operation should be defined as a pmConfig function (pmConfigCopy?) 78 skyConfig = pmConfigAlloc(); 79 skyConfig->user = psMemIncrRefCounter(config->user); 80 skyConfig->system = psMemIncrRefCounter(config->system); 75 { // this bit is unique to pswarpDefineSkycell: 81 76 82 psFree (skyConfig->files); 83 skyConfig->files = psMemIncrRefCounter(config->files); 84 psFree (skyConfig->arguments); 85 skyConfig->arguments = psMemIncrRefCounter(config->arguments); 77 // We need to force the format for the skycell to be equivalent to SIMPLE. Determine 78 // the current format from the header; Determine camera if not specified already 79 // XXX EAM : this operation should be defined as a pmConfig function (pmConfigCopy?) 80 skyConfig = pmConfigAlloc(); 81 skyConfig->user = psMemIncrRefCounter(config->user); 82 skyConfig->system = psMemIncrRefCounter(config->system); 83 84 psFree (skyConfig->files); 85 skyConfig->files = psMemIncrRefCounter(config->files); 86 psFree (skyConfig->arguments); 87 skyConfig->arguments = psMemIncrRefCounter(config->arguments); 88 } 86 89 87 90 format = pmConfigCameraFormatFromHeader (NULL, NULL, NULL, skyConfig, phu, false); … … 94 97 95 98 // Record the camera name of the skycell, so we can save its configuration 96 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL.CAMERA", 0, "Name of camera for skycell",97 skyConfig->cameraName);99 // XXX this can be put outside of the f 100 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL.CAMERA", 0, "Name of camera for skycell", skyConfig->cameraName); 98 101 99 102 // build the template fpa, set up the basic view -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoop.c
r34800 r35421 1 1 /** @file pswarpLoop.c 2 2 * 3 * @brief 4 * 3 * @brief mail processing loop for pswarp 5 4 * @ingroup pswarp 6 5 * … … 17 16 #define WCS_NONLIN_TOL 0.001 // Non-linear tolerance for header WCS 18 17 #define TESTING 0 // Testing output? 19 20 21 18 22 19 // Loop over the inputs, warp them to the output skycell and then write out the output. … … 80 77 // Turn all skycell files on to generate them, and then turn them off for the loop over the input images 81 78 // the input, which is in a different format. 82 { 83 pswarpFileActivation(config, detectorFiles, false); 84 pswarpFileActivation(config, photFiles, false); 85 pswarpFileActivation(config, independentFiles, false); 86 pswarpFileActivation(config, skycellFiles, true); 87 if (!pswarpIOChecksBefore(config)) { 88 psError(psErrorCodeLast(), false, "Unable to read files."); 89 goto DONE; 90 } 91 pswarpFileActivation(config, skycellFiles, false); 92 } 79 // XXX why is this being done here, doesn't it duplicate the work in pswarpDefine.c?? 80 pswarpFileActivation(config, detectorFiles, false); 81 pswarpFileActivation(config, photFiles, false); 82 pswarpFileActivation(config, independentFiles, false); 83 pswarpFileActivation(config, skycellFiles, false); 84 85 // pswarpFileActivation(config, skycellFiles, true); 86 // if (0) { 87 // if (!pswarpIOChecksBefore(config)) { 88 // psError(psErrorCodeLast(), false, "Unable to read files."); 89 // goto DONE; 90 // } 91 // } 92 93 93 94 94 // Read the input astrometry … … 155 155 psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for input FPA."); 156 156 psFree(view); 157 psFree(stats);158 157 goto DONE; 159 158 } … … 168 167 } 169 168 169 // *** main transformation block 170 170 pmChip *chip; 171 171 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) { … … 185 185 psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for input FPA."); 186 186 psFree(view); 187 psFree(stats);188 187 goto DONE; 189 188 } … … 193 192 psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for input FPA."); 194 193 psFree(view); 195 psFree(stats);196 194 goto DONE; 197 195 } … … 301 299 if (!pmConceptsAverageCells(outCell, cells, NULL, NULL, false)) { 302 300 psError(psErrorCodeLast(), false, "Unable to average cell concepts."); 303 psFree(stats);304 301 psFree(cells); 305 302 psFree(view); … … 313 310 if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) { 314 311 psError(psErrorCodeLast(), false, "Unable to copy FPA concepts from input to output."); 315 psFree(stats);316 312 psFree(view); 317 313 goto DONE; … … 345 341 if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) { 346 342 psError(psErrorCodeLast(), false, "Unable to generate WCS header."); 347 psFree(stats);348 343 goto DONE; 349 344 } … … 452 447 return true; 453 448 } 454 455 // Loop over the inputs, warp them to the output skycell and then write out the output.456 bool pswarpLoopBackground(pmConfig *config, psMetadata *stats)457 {458 bool status;459 bool mdok; // Status of MD lookup460 const char *skyCamera = psMetadataLookupStr(NULL, config->arguments,461 "SKYCELL.CAMERA"); // Name of camera for skycell462 pmConfigCamerasCull(config, skyCamera);463 pmConfigRecipesCull(config, "PSWARP,PPSTATS,PSPHOT,PSASTRO,MASKS,JPEG");464 465 // load the recipe466 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE);467 if (!recipe) {468 psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);469 return false;470 }471 472 if (!pswarpSetMaskBits(config)) {473 psError(psErrorCodeLast(), false, "failed to set mask bits");474 return NULL;475 }476 477 // select the input data sources478 pmFPAfile *input = psMetadataLookupPtr(NULL, config->files, "PSWARP.BKGMODEL");479 if (!input) {480 psError(PSWARP_ERR_CONFIG, true, "Can't find input data!\n");481 return false;482 }483 484 // use the external astrometry source if supplied485 pmFPAfile *astrom = psMetadataLookupPtr(NULL, config->files, "PSWARP.ASTROM");486 if (!astrom) {487 astrom = input;488 }489 490 if (astrom->camera != input->camera) {491 psError(PSWARP_ERR_DATA, true, "Input camera and astrometry camera do not match.");492 return false;493 }494 495 // select the output readout496 pmFPAview *view = pmFPAviewAlloc(0);497 view->chip = 0;498 view->cell = 0;499 view->readout = 0;500 pmReadout *output = pmFPAfileThisReadout(config->files, view, "PSWARP.OUTPUT.BKGMODEL");501 if (!output) {502 psError(PSWARP_ERR_CONFIG, true, "Can't find output background data!\n");503 return false;504 }505 psFree (view);506 // Turn all skycell files on to generate them, and then turn them off for the loop over the input images507 // the input, which is in a different format.508 {509 pswarpFileActivation(config, detectorFiles, false);510 pswarpFileActivation(config, photFiles, false);511 pswarpFileActivation(config, independentFiles, false);512 pswarpFileActivation(config, skycellFiles, true);513 if (!pswarpIOChecksBefore(config)) {514 psError(psErrorCodeLast(), false, "Unable to read files.");515 goto DONE;516 }517 pswarpFileActivation(config, skycellFiles, false);518 }519 // Read the input astrometry520 // XXX rather than use the activations here, this should just explicitly loop over the desired filerule521 {522 523 pmFPAfileActivate(config->files, true, "PSWARP.ASTROM");524 525 pmChip *chip;526 pmFPAview *view = pmFPAviewAlloc(0);527 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {528 psError(psErrorCodeLast(), false, "Unable to read files.");529 goto DONE;530 }531 532 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {533 #if 0534 // This needs to be removed because otherwise it throws an error of duplicate PSPHOT.DETECTIONS.535 if (!chip->process || !chip->file_exists) { continue; }536 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {537 psError(psErrorCodeLast(), false, "Unable to read files.");538 goto DONE;539 }540 #endif541 pmCell *cell;542 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {543 psTrace ("pswarp", 4, "ACell %d: %x %x %d\n", view->cell, cell->file_exists, cell->process,psErrorCodeLast());544 if (!cell->process || !cell->file_exists) { continue; }545 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE) ||546 !pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {547 psError(psErrorCodeLast(), false, "Unable to read files.");548 goto DONE;549 }550 }551 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {552 psError(psErrorCodeLast(), false, "Unable to write files.");553 goto DONE;554 }555 }556 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {557 psError(psErrorCodeLast(), false, "Unable to write files.");558 goto DONE;559 }560 psFree(view);561 pswarpFileActivation(config, detectorFiles, true);562 pmFPAfileActivate(config->files, false, "PSWARP.ASTROM");563 }564 565 // Don't care about the skycell anymore --- we've read it, and that's all we need to do.566 pmFPAfileActivate(config->files, false, "PSWARP.SKYCELL");567 view = pmFPAviewAlloc(0);568 569 // find the FPA phu570 bool bilevelAstrometry = false;571 pmHDU *phu = pmFPAviewThisPHU(view, astrom->fpa);572 573 // pmAstromWCS *WCSF = pmAstromWCSfromHeader(phu->header);574 575 if (phu) {576 char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1");577 if (ctype) {578 bilevelAstrometry = !strcmp (&ctype[4], "-DIS");579 }580 }581 if (bilevelAstrometry) {582 if (!pmAstromReadBilevelMosaic(input->fpa, phu->header)) {583 psError(psErrorCodeLast(), false, "Unable to read bilevel mosaic astrometry for input FPA.");584 psFree(view);585 psFree(stats);586 goto DONE;587 }588 }589 590 psList *cells = psListAlloc(NULL); // List of cells, for concepts averaging591 592 // files associated with the science image593 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {594 psError(psErrorCodeLast(), false, "Unable to read files.");595 goto DONE;596 }597 pmChip *chip;598 while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {599 psTrace ("pswarp", 4, "DChip %d: %x %x\n", view->chip, chip->file_exists, chip->process);600 if (!chip->process || !chip->file_exists) { continue; }601 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {602 psError(psErrorCodeLast(), false, "Unable to read files.");603 goto DONE;604 }605 606 // Pull information from the header of the background files so we can use it to set values.607 pmHDU *hdu = pmFPAviewThisHDU(view,input->fpa);608 psMetadata *header = hdu->header;609 610 int IMAXIS1 = psMetadataLookupS32(NULL,header,"IMNAXIS1");611 int IMAXIS2 = psMetadataLookupS32(NULL,header,"IMNAXIS2");612 int NAXIS1 = psMetadataLookupS32(NULL,header,"NAXIS1");613 int NAXIS2 = psMetadataLookupS32(NULL,header,"NAXIS2");614 char *CCDSUM = psMetadataLookupStr(NULL,header,"CCDSUM");615 int CCDSUM1 = atoi(strtok(CCDSUM," "));616 int CCDSUM2 = atoi(strtok(NULL," "));617 618 psMetadataAddF32(config->arguments,PS_LIST_TAIL,"BKG_WARP_XOFFSET", PS_META_REPLACE,619 "xoffset for background model data", (NAXIS1 * CCDSUM1 - IMAXIS1) / (2.0 * CCDSUM1));620 psMetadataAddF32(config->arguments,PS_LIST_TAIL,"BKG_WARP_YOFFSET", PS_META_REPLACE,621 "yoffset for background model data", (NAXIS2 * CCDSUM2 - IMAXIS2) / (2.0 * CCDSUM2));622 psTrace("pswarp",5,"%d %d %d %d %d %d %g %g %d %d",623 psMetadataLookupS32(NULL,header,"IMNAXIS1"),624 psMetadataLookupS32(NULL,header,"IMNAXIS2"),625 psMetadataLookupS32(NULL,header,"NAXIS1"),626 psMetadataLookupS32(NULL,header,"NAXIS2"),627 CCDSUM1,CCDSUM2,628 psMetadataLookupF32(NULL,config->arguments,"BKG_WARP_XOFFSET"),629 psMetadataLookupF32(NULL,config->arguments,"BKG_WARP_YOFFSET"),630 psMetadataLookupS32(NULL,config->arguments,"BKG.XGRID"),631 psMetadataLookupS32(NULL,config->arguments,"BKG.YGRID"));632 633 634 // read WCS data from the corresponding header635 hdu = pmFPAviewThisHDU (view, astrom->fpa);636 637 pmAstromWCS *WCS = pmAstromWCSfromHeader(hdu->header);638 639 double cd1f = (1.0 * CCDSUM1);// * (1.0 * psMetadataLookupS32(NULL,config->arguments,"BKG.XGRID"));640 double cd2f = (1.0 * CCDSUM2);// * (1.0 * psMetadataLookupS32(NULL,config->arguments,"BKG.YGRID"));641 642 WCS->cdelt1 *= cd1f;643 WCS->cdelt2 *= cd2f;644 WCS->crpix1 = WCS->crpix1 / cd1f;645 WCS->crpix2 = WCS->crpix2 / cd2f;646 647 // WCS->trans->x->nX/nY648 for (int q = 0; q <= WCS->trans->x->nX; q++) {649 for (int r = 0; r <= WCS->trans->x->nY; r++) {650 WCS->trans->x->coeff[q][r] *= pow(cd1f,q) * pow(cd2f,r);651 }652 }653 for (int q = 0; q <= WCS->trans->y->nX; q++) {654 for (int r = 0; r <= WCS->trans->y->nY; r++) {655 WCS->trans->y->coeff[q][r] *= pow(cd1f,q) * pow(cd2f,r);656 }657 }658 pmAstromWCStoHeader (hdu->header,WCS);659 660 if (bilevelAstrometry) {661 if (!pmAstromReadBilevelChip (chip, hdu->header)) {662 psError(psErrorCodeLast(), false, "Unable to read bilevel chip astrometry for input FPA.");663 psFree(view);664 psFree(stats);665 goto DONE;666 }667 } else {668 // we use a default FPA pixel scale of 1.0669 if (!pmAstromReadWCS (astrom->fpa, chip, hdu->header, 1.0)) {670 psError(psErrorCodeLast(), false, "Unable to read WCS astrometry for input FPA.");671 psFree(view);672 psFree(stats);673 goto DONE;674 }675 }676 // Modify structure here.677 678 679 pmCell *cell;680 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {681 psTrace ("pswarp", 4, "DCell %d: %x %x\n", view->cell, cell->file_exists, cell->process);682 if (!cell->process || !cell->file_exists) { continue; }683 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {684 psError(psErrorCodeLast(), false, "Unable to read files.");685 goto DONE;686 }687 688 psListAdd(cells, PS_LIST_TAIL, cell);689 690 // process each of the readouts691 pmReadout *readout;692 while ((readout = pmFPAviewNextReadout(view, input->fpa, 1)) != NULL) {693 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {694 psError(psErrorCodeLast(), false, "Unable to read files.");695 goto DONE;696 }697 if (!readout->data_exists) {698 continue;699 }700 701 for (int x = 0; x < readout->image->numCols; x++) {702 for (int y = 0; y < readout->image->numRows; y++) {703 readout->image->data.F32[y][x] = readout->image->data.F32[y][x] * (cd1f * cd2f) /704 (psMetadataLookupS32(&mdok,config->arguments,"BKG.XGRID") *705 psMetadataLookupS32(&mdok,config->arguments,"BKG.YGRID"));706 }707 }708 709 psMetadataAddS32(config->arguments,PS_LIST_TAIL, "INTERPOLATION.MODE", PS_META_REPLACE, "", 8);710 711 psMetadataAddBool(config->arguments,PS_LIST_TAIL, "BACKGROUND_WARPING", PS_META_REPLACE, "", true);712 pswarpTransformReadout(output, readout, config);713 psMetadataAddBool(config->arguments,PS_LIST_TAIL, "BACKGROUND_WARPING", PS_META_REPLACE, "", false);714 715 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {716 psError(psErrorCodeLast(), false, "Unable to write files.");717 goto DONE;718 }719 }720 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {721 psError(psErrorCodeLast(), false, "Unable to write files.");722 goto DONE;723 }724 }725 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {726 psError(psErrorCodeLast(), false, "Unable to write files.");727 goto DONE;728 }729 }730 if (!output->data_exists) {731 psWarning("No overlap between input and skycell.");732 psphotFilesActivate(config, false);733 psFree(cells);734 psFree(view);735 goto DONE;736 }737 pmCell *outCell = output->parent; ///< Output cell738 pmChip *outChip = outCell->parent; ///< Output chip739 pmFPA *outFPA = outChip->parent; ///< Output FP740 741 /* if (!pswarpPixelsLit(output, stats, config)) { */742 /* psError(psErrorCodeLast(), false, "Unable to calculate pixel regions."); */743 /* psFree(cells); */744 /* psFree(view); */745 /* goto DONE; */746 /* } */747 psRegion *trimsec = psMetadataLookupPtr(NULL, outCell->concepts, "CELL.TRIMSEC"); ///< Trim section748 trimsec->x0 = trimsec->x1 = trimsec->y0 = trimsec->y1 = 0; ///< All pixels749 750 if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) {751 psError(psErrorCodeLast(), false, "Unable to copy FPA concepts from input to output.");752 psFree(stats);753 psFree(view);754 goto DONE;755 }756 757 pmHDU *hdu = outFPA->hdu; ///< HDU for the output warped image758 759 // Copy header from target760 {761 pmFPAview *skyView = pmFPAviewAlloc(0); ///< View into skycell762 skyView->chip = skyView->cell = 0;763 pmCell *cell = pmFPAfileThisCell(config->files, skyView, "PSWARP.SKYCELL"); // Skycell cell764 psFree(skyView);765 pmHDU *skyHDU = pmHDUFromCell(cell); ///< HDU766 if (!skyHDU) {767 psError(PSWARP_ERR_DATA, false, "Unable to find skycell HDU.");768 psFree(view);769 goto DONE;770 }771 hdu->header = psMetadataCopy(hdu->header, skyHDU->header);772 }773 pswarpVersionHeader(hdu->header);774 775 if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) {776 psError(psErrorCodeLast(), false, "Unable to generate WCS header.");777 psFree(stats);778 goto DONE;779 }780 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {781 psError(psErrorCodeLast(), false, "Unable to write files.");782 goto DONE;783 }784 // Done with the detector side of things785 pswarpFileActivation(config, detectorFiles, false);786 pswarpFileActivation(config, independentFiles, false);787 788 789 // Add MD5 information for readout790 const char *chipName = psMetadataLookupStr(NULL, output->parent->parent->concepts, "CHIP.NAME");791 const char *cellName = psMetadataLookupStr(NULL, output->parent->concepts, "CELL.NAME");792 psString headerName = NULL; ///< Header name for MD5793 psStringAppend(&headerName, "MD5_%s_%s_%d", chipName, cellName, view->readout);794 psVector *md5 = psImageMD5(output->image); ///< md5 hash795 psString md5string = psMD5toString(md5); ///< String796 psFree(md5);797 psMetadataAddStr(hdu->header, PS_LIST_TAIL, headerName, PS_META_REPLACE,798 "Image MD5", md5string);799 psFree(md5string);800 psFree(headerName);801 psFree(view);802 DONE:803 804 return true;805 } -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpParseCamera.c
r34800 r35421 55 55 } 56 56 57 58 59 60 57 bool pswarpParseCamera(pmConfig *config) 61 58 { … … 70 67 } 71 68 72 pmFPAfile *astrom = defineInputFile(config, NULL, "PSWARP.ASTROM", "ASTROM", PM_FPA_FILE_CMF); 69 // XXX I should allow the astrometry input to be either WCS or CMF 70 // Define the input astrometry file(s) 71 bool status = false; 72 pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM"); 73 if (!astrom) { 74 // look for the file on the RUN metadata 75 astrom = pmFPAfileDefineFromRun(&status, NULL, config, "PSWARP.ASTROM"); // File to return 76 if (!status) { 77 psLogMsg("pswarp", PS_LOG_INFO, "Failed to load file definition for %s", "PSWARP.ASTROM"); 78 } 79 } 80 if ((astrom->type != PM_FPA_FILE_CMF) && (astrom->type != PM_FPA_FILE_WCS)) { 81 psLogMsg("pswarp", PS_LOG_INFO, "%s is neither CMF nor WCS", "PSWARP.ASTROM"); 82 } 73 83 psLogMsg("pswarp", PS_LOG_INFO, "Astrometry source: %s", astrom ? "supplied" : "header"); 74 84 85 // Define the input mask file(s) 75 86 pmFPAfile *inMask = defineInputFile(config, input, "PSWARP.MASK", "MASK", PM_FPA_FILE_MASK); 76 87 if (!inMask) { … … 78 89 } 79 90 91 // Define the input variance file(s) 80 92 pmFPAfile *inVariance = defineInputFile(config, input, "PSWARP.VARIANCE", "VARIANCE", 81 93 PM_FPA_FILE_VARIANCE); … … 91 103 92 104 // The input skycell is a required argument: it defines the output image 93 // XXX we may need a different skycell structure here105 pmConfig *skyConfig = NULL; 94 106 pmFPAfile *skycell = NULL; 95 pmConfig *skyConfig = NULL; 96 bool status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 97 if (!status) { 98 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.SKYCELL"); 99 return false; 100 } 107 108 # define USE_PSWARP_DEFINE_SKYCELL 0 109 # if (USE_PSWARP_DEFINE_SKYCELL) 110 // XXX this function is no longer needed; drop 111 status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 112 # else 113 skycell = pmFPAfileDefineNewConfig(&status, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL"); 114 # endif 115 116 if (!status || !skycell) { 117 psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.SKYCELL"); 118 return false; 119 } 120 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL.CAMERA", 0, "Name of camera for skycell", skyConfig->cameraName); 101 121 psFree(skyConfig); 102 122 … … 142 162 if (inBackground && psMetadataLookupBool(&mdok, recipe, "BACKGROUND.MODEL")) { 143 163 pmFPAfile *outBackground = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT.BKGMODEL"); 144 /* pmFPAfile *outBackground = pmFPAfileDefineFromFPA(config,output->fpa, */145 /* psMetadataLookupS32(&mdok,recipe,"BKG.XGRID"), */146 /* psMetadataLookupS32(&mdok,recipe,"BKG.YGRID"), */147 /* "PSWARP.OUTPUT.BKGMODEL"); */148 164 outBackground->xBin = psMetadataLookupS32(&mdok, recipe, "BKG.XGRID"); 149 165 outBackground->yBin = psMetadataLookupS32(&mdok, recipe, "BKG.YGRID");
Note:
See TracChangeset
for help on using the changeset viewer.
