Changeset 30118
- Timestamp:
- Dec 20, 2010, 2:30:45 PM (15 years ago)
- Location:
- branches/czw_branch/20101203
- Files:
-
- 16 deleted
- 246 edited
- 39 copied
-
. (modified) (1 prop)
-
Ohana/src/addstar/Makefile (modified) (1 diff)
-
Ohana/src/addstar/doc/resort_catalog.alloc.c (copied) (copied from trunk/Ohana/src/addstar/doc/resort_catalog.alloc.c )
-
Ohana/src/addstar/include/addstar.h (modified) (3 diffs)
-
Ohana/src/addstar/src/ReadStarsFITS.c (modified) (1 diff)
-
Ohana/src/addstar/src/ReadStarsSDSS.c (modified) (1 diff)
-
Ohana/src/addstar/src/addstar.c (modified) (2 diffs)
-
Ohana/src/addstar/src/args.c (modified) (2 diffs)
-
Ohana/src/addstar/src/resort_catalog.c (modified) (2 diffs)
-
Ohana/src/addstar/src/resort_threaded.c (copied) (copied from trunk/Ohana/src/addstar/src/resort_threaded.c )
-
Ohana/src/addstar/src/resort_unthreaded.c (copied) (copied from trunk/Ohana/src/addstar/src/resort_unthreaded.c )
-
Ohana/src/addstar/test/dvomerge.dvo (modified) (3 diffs)
-
Ohana/src/dvomerge/Makefile (modified) (2 diffs)
-
Ohana/src/dvomerge/doc (copied) (copied from trunk/Ohana/src/dvomerge/doc )
-
Ohana/src/dvomerge/doc/notes.txt (copied) (copied from trunk/Ohana/src/dvomerge/doc/notes.txt )
-
Ohana/src/dvomerge/include/dvomerge.h (modified) (4 diffs)
-
Ohana/src/dvomerge/src/ImageOps.c (copied) (copied from trunk/Ohana/src/dvomerge/src/ImageOps.c )
-
Ohana/src/dvomerge/src/LoadCatalog.c (modified) (1 diff)
-
Ohana/src/dvomerge/src/LoadImages.c (copied) (copied from trunk/Ohana/src/dvomerge/src/LoadImages.c )
-
Ohana/src/dvomerge/src/ReadDeleteList.c (copied) (copied from trunk/Ohana/src/dvomerge/src/ReadDeleteList.c )
-
Ohana/src/dvomerge/src/args.c (modified) (2 diffs)
-
Ohana/src/dvomerge/src/dvo_image_merge_dbs.c (modified) (1 diff)
-
Ohana/src/dvomerge/src/dvoconvert.c (modified) (4 diffs)
-
Ohana/src/dvomerge/src/dvomerge.c (modified) (2 diffs)
-
Ohana/src/dvomerge/src/dvomergeContinue.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvomergeContinue.c )
-
Ohana/src/dvomerge/src/dvomergeContinue_threaded.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvomergeContinue_threaded.c )
-
Ohana/src/dvomerge/src/dvomergeCreate.c (modified) (10 diffs)
-
Ohana/src/dvomerge/src/dvomergeFromList.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvomergeFromList.c )
-
Ohana/src/dvomerge/src/dvomergeImageIDs.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvomergeImageIDs.c )
-
Ohana/src/dvomerge/src/dvomergeUpdate.c (modified) (11 diffs)
-
Ohana/src/dvomerge/src/dvomergeUpdate_threaded.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvomergeUpdate_threaded.c )
-
Ohana/src/dvomerge/src/dvorepair.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvorepair.c )
-
Ohana/src/dvomerge/src/dvorepairCPT.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvorepairCPT.c )
-
Ohana/src/dvomerge/src/dvorepairDeleteImageList.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvorepairDeleteImageList.c )
-
Ohana/src/dvomerge/src/dvorepairFixCPT.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvorepairFixCPT.c )
-
Ohana/src/dvomerge/src/dvorepairFixImages.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvorepairFixImages.c )
-
Ohana/src/dvomerge/src/dvorepairFixTables.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvorepairFixTables.c )
-
Ohana/src/dvomerge/src/dvorepairImageVsMeasure.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvorepairImageVsMeasure.c )
-
Ohana/src/dvomerge/src/dvorepairImagesVsMeasures.c (copied) (copied from trunk/Ohana/src/dvomerge/src/dvorepairImagesVsMeasures.c )
-
Ohana/src/dvomerge/src/dvoverify.c (modified) (1 diff)
-
Ohana/src/dvomerge/src/help.c (modified) (6 diffs)
-
Ohana/src/dvomerge/src/match_image.c (copied) (copied from trunk/Ohana/src/dvomerge/src/match_image.c )
-
Ohana/src/dvomerge/src/merge_catalogs_old.c (modified) (3 diffs)
-
Ohana/src/imregister/imphot/rfits.c (modified) (1 diff)
-
Ohana/src/kapa2/Makefile (modified) (1 diff)
-
Ohana/src/kapa2/include/prototypes.h (modified) (8 diffs)
-
Ohana/src/kapa2/include/structures.h (modified) (1 diff)
-
Ohana/src/kapa2/src/ButtonFunctions.c (modified) (1 diff)
-
Ohana/src/kapa2/src/CheckPipe.c (modified) (4 diffs)
-
Ohana/src/kapa2/src/DefineSection.c (modified) (1 diff)
-
Ohana/src/kapa2/src/DrawFrame.c (modified) (15 diffs)
-
Ohana/src/kapa2/src/Image.c (modified) (1 diff)
-
Ohana/src/kapa2/src/JPEGit24.c (modified) (3 diffs)
-
Ohana/src/kapa2/src/PNGit.c (modified) (4 diffs)
-
Ohana/src/kapa2/src/PPMit.c (modified) (2 diffs)
-
Ohana/src/kapa2/src/PSFrame.c (modified) (3 diffs)
-
Ohana/src/kapa2/src/PSimage.c (modified) (1 diff)
-
Ohana/src/kapa2/src/PSit.c (modified) (2 diffs)
-
Ohana/src/kapa2/src/Resize.c (modified) (1 diff)
-
Ohana/src/kapa2/src/SetGraphSize.c (modified) (10 diffs)
-
Ohana/src/kapa2/src/bDrawFrame.c (modified) (6 diffs)
-
Ohana/src/kapa2/src/bDrawImage.c (copied) (copied from trunk/Ohana/src/kapa2/src/bDrawImage.c )
-
Ohana/src/kapa2/src/bDrawIt.c (modified) (4 diffs)
-
Ohana/src/kapa2/src/bDrawLabels.c (modified) (4 diffs)
-
Ohana/src/kapa2/src/bDrawObjects.c (modified) (35 diffs)
-
Ohana/src/kapa2/src/bDrawOverlay.c (modified) (6 diffs)
-
Ohana/src/libdvo/include/dvo.h (modified) (5 diffs)
-
Ohana/src/libdvo/src/dvo_catalog.c (modified) (3 diffs)
-
Ohana/src/libdvo/src/dvo_catalog_mef.c (modified) (4 diffs)
-
Ohana/src/libdvo/src/dvo_catalog_split.c (modified) (4 diffs)
-
Ohana/src/libdvo/src/dvo_photcode_ops.c (modified) (1 diff)
-
Ohana/src/libdvo/src/fits_db.c (modified) (1 diff)
-
Ohana/src/libdvo/src/mosaic_astrom.c (modified) (7 diffs)
-
Ohana/src/libfits/include/gfitsio.h (modified) (2 diffs)
-
Ohana/src/libfits/table/F_read_T.c (modified) (3 diffs)
-
Ohana/src/libkapa/include/kapa.h (modified) (4 diffs)
-
Ohana/src/libkapa/src/KapaWindow.c (modified) (2 diffs)
-
Ohana/src/libkapa/src/bDrawFuncs.c (modified) (16 diffs)
-
Ohana/src/libkapa/src/bDrawRotFont.c (modified) (10 diffs)
-
Ohana/src/opihi/cmd.astro/region.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/Makefile (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/densify.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/densify.c )
-
Ohana/src/opihi/cmd.data/init.c (modified) (2 diffs)
-
Ohana/src/opihi/cmd.data/rd.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/read_vectors.c (modified) (4 diffs)
-
Ohana/src/opihi/cmd.data/resize.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/section.c (modified) (4 diffs)
-
Ohana/src/opihi/cmd.data/vgauss.c (modified) (1 diff)
-
Ohana/src/opihi/dvo/images.c (modified) (8 diffs)
-
Ohana/src/opihi/dvo/imlist.c (modified) (1 diff)
-
Ohana/src/opihi/lib.data/starfuncs.c (modified) (5 diffs)
-
Ohana/src/photdbc/include/photdbc.h (modified) (1 diff)
-
Ohana/src/photdbc/src/args.c (modified) (2 diffs)
-
Ohana/src/photdbc/src/initialize.c (modified) (1 diff)
-
Ohana/src/photdbc/src/join_stars.c (modified) (1 diff)
-
Ohana/src/relastro/src/GetAstromError.c (modified) (4 diffs)
-
Ohana/src/relastro/src/UpdateObjects.c (modified) (8 diffs)
-
Ohana/src/relastro/src/high_speed_objects.c (modified) (13 diffs)
-
Ohana/src/relphot/doc/config.txt (copied) (copied from trunk/Ohana/src/relphot/doc/config.txt )
-
Ohana/src/tools/Makefile (modified) (1 diff)
-
Ohana/src/tools/src/roc.c (copied) (copied from trunk/Ohana/src/tools/src/roc.c )
-
PS-IPP-Config/lib/PS/IPP/Config.pm (modified) (2 diffs)
-
dbconfig (modified) (1 prop)
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/notes.txt (modified) (1 diff)
-
dbconfig/publish.md (modified) (1 diff)
-
ippMonitor/raw/czartool_labels.php (modified) (9 diffs)
-
ippMonitor/raw/site.php.in (modified) (1 diff)
-
ippScripts (modified) (1 prop)
-
ippScripts/scripts/automate_stacks.pl (modified) (2 diffs)
-
ippScripts/scripts/camera_exp.pl (modified) (1 diff)
-
ippScripts/scripts/chip_imfile.pl (modified) (9 diffs)
-
ippScripts/scripts/dist_bundle.pl (modified) (2 diffs)
-
ippScripts/scripts/magic_destreak.pl (modified) (1 diff)
-
ippScripts/scripts/magic_destreak_defineruns.pl (modified) (1 diff)
-
ippScripts/scripts/magic_destreak_revert.pl (modified) (3 diffs)
-
ippScripts/scripts/publish_file.pl (modified) (5 diffs)
-
ippScripts/scripts/receive_file.pl (modified) (2 diffs)
-
ippScripts/scripts/register_imfile.pl (modified) (2 diffs)
-
ippTasks (modified) (1 prop)
-
ippTasks/detrend.resid.pro (modified) (2 diffs)
-
ippTasks/publish.pro (modified) (2 diffs)
-
ippTasks/register.pro (modified) (2 diffs)
-
ippToPsps/docs (copied) (copied from trunk/ippToPsps/docs )
-
ippToPsps/docs/loadingSummary.txt (copied) (copied from trunk/ippToPsps/docs/loadingSummary.txt )
-
ippToPsps/perl/checkOdmStatus.pl (modified) (2 diffs)
-
ippToPsps/perl/exposureSummary.pl (copied) (copied from trunk/ippToPsps/perl/exposureSummary.pl )
-
ippToPsps/perl/ippToPsps/DetectionBatch.pm (modified) (1 diff)
-
ippToPsps/perl/ippToPsps/IppToPspsDb.pm (modified) (5 diffs)
-
ippToPsps/perl/ippToPsps_run.pl (modified) (2 diffs)
-
ippTools (modified) (1 prop)
-
ippTools/configure.ac (modified) (2 diffs)
-
ippTools/share/camtool_find_pendingimfile.sql (modified) (1 prop)
-
ippTools/share/pubtool_definerun.sql (modified) (4 diffs)
-
ippTools/share/pubtool_pending.sql (modified) (3 diffs)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff, 1 prop)
-
ippTools/share/regtool_pendingexp.sql (modified) (1 diff)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/dettool.c (modified) (1 diff)
-
ippTools/src/dettoolConfig.c (modified) (1 diff)
-
ippTools/src/difftool.c (modified) (4 diffs)
-
ippTools/src/difftoolConfig.c (modified) (1 diff)
-
ippTools/src/magicdstool.c (modified) (1 diff)
-
ippTools/src/magicdstoolConfig.c (modified) (1 diff)
-
ippTools/src/pstamptool.c (modified) (1 diff)
-
ippTools/src/pstamptoolConfig.c (modified) (1 diff)
-
ippTools/src/pubtool.c (modified) (2 diffs)
-
ippTools/src/pubtoolConfig.c (modified) (1 diff)
-
ippTools/src/regtool.c (modified) (4 diffs)
-
ippconfig (modified) (1 prop)
-
ippconfig/gpc1/camera.config (modified) (1 diff)
-
ippconfig/gpc1/ppImage.config (modified) (30 diffs)
-
ippconfig/gpc1/psastro.config (modified) (1 diff)
-
ippconfig/recipes/filerules-mef.mdc (modified) (1 diff)
-
ippconfig/recipes/filerules-simple.mdc (modified) (1 diff)
-
ippconfig/recipes/filerules-split.mdc (modified) (2 diffs)
-
ippconfig/recipes/nightly_science.config (modified) (2 diffs)
-
ippconfig/recipes/ppImage.config (modified) (65 diffs)
-
ippconfig/recipes/ppSub.config (modified) (2 diffs)
-
ippconfig/recipes/psastro.config (modified) (1 diff)
-
ippconfig/recipes/psphot.config (modified) (1 diff)
-
ippconfig/recipes/reductionClasses.mdc (modified) (2 diffs)
-
ippconfig/simtest/camera.config (modified) (1 diff)
-
pedestal/src/pedestal.c (modified) (1 diff)
-
ppConfigDump/src/ppConfigDump.c (modified) (6 diffs)
-
ppImage/src/ppImageDetrendReadout.c (modified) (2 diffs)
-
ppImage/src/ppImageOptions.c (modified) (2 diffs)
-
ppImage/src/ppImagePhotom.c (modified) (4 diffs)
-
ppImage/src/ppImageStatsOutput.c (modified) (1 diff)
-
ppStack/src/ppStackPhotometry.c (modified) (2 diffs)
-
ppSub/doc/psphot.txt (copied) (copied from trunk/ppSub/doc/psphot.txt )
-
ppSub/src/Makefile.am (modified) (2 diffs)
-
ppSub/src/ppSub.h (modified) (2 diffs)
-
ppSub/src/ppSubArguments.c (modified) (1 diff)
-
ppSub/src/ppSubBackground.c (modified) (2 diffs)
-
ppSub/src/ppSubCamera.c (modified) (3 diffs)
-
ppSub/src/ppSubFlagNeighbors.c (modified) (1 diff)
-
ppSub/src/ppSubInputDetections.c (copied) (copied from trunk/ppSub/src/ppSubInputDetections.c )
-
ppSub/src/ppSubLoop.c (modified) (16 diffs)
-
ppSub/src/ppSubMakePSF.c (modified) (2 diffs)
-
ppSub/src/ppSubMatchPSFs.c (modified) (1 diff)
-
ppSub/src/ppSubReadoutForcedPhot.c (copied) (copied from trunk/ppSub/src/ppSubReadoutForcedPhot.c )
-
ppSub/src/ppSubReadoutPhotometry.c (modified) (4 diffs)
-
psLib/src/fits/psFitsImage.c (modified) (1 diff)
-
psLib/src/imageops (modified) (1 prop)
-
psLib/src/imageops/psImageMapFit.c (modified) (13 diffs)
-
psLib/src/imageops/psImageMapFit.h (modified) (4 diffs)
-
psLib/src/jpeg/psImageJpeg.c (modified) (3 diffs)
-
psLib/src/math/psStats.c (modified) (7 diffs)
-
psLib/src/sys/psSlurp.c (modified) (6 diffs)
-
psLib/src/sys/psSlurp.h (modified) (2 diffs)
-
psLib/src/sys/psString.c (modified) (1 diff)
-
psLib/src/sys/psString.h (modified) (2 diffs)
-
psLib/src/types/psMetadata.c (modified) (4 diffs)
-
psLib/src/types/psMetadataConfig.c (modified) (1 diff)
-
psLib/src/types/psMetadataConfig.h (modified) (2 diffs)
-
psLib/test/astro/tst_psCoord.c (deleted)
-
psLib/test/astro/tst_psCoord01.c (deleted)
-
psLib/test/astro/tst_psCoord02.c (deleted)
-
psLib/test/astro/tst_psEarthOrientation.c (deleted)
-
psLib/test/astro/tst_psSphereOps.c (deleted)
-
psLib/test/astro/tst_psTime_01.c (deleted)
-
psLib/test/astro/tst_psTime_02.c (deleted)
-
psLib/test/astro/tst_psTime_03.c (deleted)
-
psLib/test/astro/tst_psTime_04.c (deleted)
-
psLib/test/db/tst_psDB.c (deleted)
-
psLib/test/imageops (modified) (1 prop)
-
psLib/test/imageops/Makefile.am (modified) (1 diff)
-
psLib/test/imageops/tap_psImageInterpolate3.c (copied) (copied from trunk/psLib/test/imageops/tap_psImageInterpolate3.c )
-
psLib/test/math (modified) (1 prop)
-
psLib/test/math/data/yraw_01.dat (copied) (copied from trunk/psLib/test/math/data/yraw_01.dat )
-
psLib/test/math/data/yraw_02.dat (copied) (copied from trunk/psLib/test/math/data/yraw_02.dat )
-
psLib/test/math/data/yraw_03.dat (copied) (copied from trunk/psLib/test/math/data/yraw_03.dat )
-
psLib/test/math/data/yraw_04.dat (copied) (copied from trunk/psLib/test/math/data/yraw_04.dat )
-
psLib/test/math/mana.stats.pro (copied) (copied from trunk/psLib/test/math/mana.stats.pro )
-
psLib/test/math/tap_psStats_Sample_01.c (modified) (5 diffs)
-
psLib/test/types/tap_psMetadataConfigWrite.c (modified) (5 diffs)
-
psModules/src/camera/pmFPAFlags.c (modified) (2 diffs)
-
psModules/src/camera/pmFPAFlags.h (modified) (2 diffs)
-
psModules/src/camera/pmFPAfile.c (modified) (1 diff)
-
psModules/src/camera/pmFPAfileIO.c (modified) (8 diffs)
-
psModules/src/concepts/pmConceptsAverage.c (modified) (4 diffs)
-
psModules/src/config/pmConfigDump.c (modified) (1 diff)
-
psModules/src/detrend/pmNonLinear.c (modified) (4 diffs)
-
psModules/src/objects (modified) (1 prop)
-
psModules/src/objects/pmPSF_IO.c (modified) (3 diffs)
-
psModules/src/objects/pmPSFtry.h (modified) (2 diffs)
-
psModules/src/objects/pmPSFtryMakePSF.c (modified) (10 diffs)
-
psModules/src/objects/pmPSFtryModel.c (modified) (2 diffs)
-
psModules/src/objects/pmSource.c (modified) (1 diff)
-
psModules/src/objects/pmSourcePhotometry.c (modified) (2 diffs)
-
psModules/src/objects/pmTrend2D.c (modified) (4 diffs)
-
psModules/src/objects/pmTrend2D.h (modified) (1 diff)
-
psphot (modified) (1 prop)
-
psphot/src/Makefile.am (modified) (2 diffs)
-
psphot/src/psphot.h (modified) (4 diffs)
-
psphot/src/psphotAddNoise.c (modified) (1 diff)
-
psphot/src/psphotApResid.c (modified) (5 diffs, 1 prop)
-
psphot/src/psphotBasicDeblend.c (modified) (1 diff)
-
psphot/src/psphotBlendFit.c (modified) (1 diff)
-
psphot/src/psphotChoosePSF.c (modified) (2 diffs)
-
psphot/src/psphotDeblendSatstars.c (modified) (1 diff)
-
psphot/src/psphotDetect.c (deleted)
-
psphot/src/psphotDetect.h (deleted)
-
psphot/src/psphotDetectArguments.c (deleted)
-
psphot/src/psphotDetectImageLoop.c (deleted)
-
psphot/src/psphotDetectParseCamera.c (deleted)
-
psphot/src/psphotDetectReadout.c (deleted)
-
psphot/src/psphotEfficiency.c (modified) (1 diff)
-
psphot/src/psphotExtendedSourceAnalysis.c (modified) (1 diff)
-
psphot/src/psphotExtendedSourceAnalysisByObject.c (modified) (1 diff)
-
psphot/src/psphotExtendedSourceFits.c (modified) (1 diff)
-
psphot/src/psphotFindDetections.c (modified) (1 diff)
-
psphot/src/psphotFitSourcesLinear.c (modified) (1 diff)
-
psphot/src/psphotForcedImageLoop.c (modified) (1 diff)
-
psphot/src/psphotForcedReadout.c (modified) (5 diffs)
-
psphot/src/psphotGuessModels.c (modified) (2 diffs)
-
psphot/src/psphotImageLoop.c (modified) (1 diff)
-
psphot/src/psphotImageQuality.c (modified) (2 diffs)
-
psphot/src/psphotLoadPSF.c (modified) (3 diffs)
-
psphot/src/psphotMagnitudes.c (modified) (1 diff)
-
psphot/src/psphotMakeFluxScale.c (modified) (1 diff, 1 prop)
-
psphot/src/psphotMakePSFImageLoop.c (modified) (1 diff)
-
psphot/src/psphotMakePSFReadout.c (modified) (4 diffs)
-
psphot/src/psphotMaskReadout.c (modified) (2 diffs)
-
psphot/src/psphotMergeSources.c (modified) (4 diffs)
-
psphot/src/psphotModelBackground.c (modified) (1 diff)
-
psphot/src/psphotOutput.c (modified) (4 diffs)
-
psphot/src/psphotParseCamera.c (modified) (1 diff)
-
psphot/src/psphotRadialApertures.c (modified) (1 diff)
-
psphot/src/psphotRadialAperturesByObject.c (modified) (1 diff)
-
psphot/src/psphotRadiusChecks.c (modified) (1 diff)
-
psphot/src/psphotReadout.c (modified) (8 diffs)
-
psphot/src/psphotReadoutCleanup.c (modified) (1 diff)
-
psphot/src/psphotReadoutFindPSF.c (modified) (5 diffs)
-
psphot/src/psphotReadoutForcedKnownSources.c (copied) (copied from trunk/psphot/src/psphotReadoutForcedKnownSources.c )
-
psphot/src/psphotReadoutKnownSources.c (modified) (5 diffs)
-
psphot/src/psphotReadoutMinimal.c (modified) (4 diffs)
-
psphot/src/psphotReplaceUnfit.c (modified) (1 diff)
-
psphot/src/psphotRoughClass.c (modified) (1 diff)
-
psphot/src/psphotSkyReplace.c (modified) (1 diff)
-
psphot/src/psphotSourceFreePixels.c (modified) (1 diff)
-
psphot/src/psphotSourceMatch.c (modified) (2 diffs)
-
psphot/src/psphotSourceSize.c (modified) (2 diffs)
-
psphot/src/psphotSourceStats.c (modified) (1 diff)
-
psphot/src/psphotStackChisqImage.c (modified) (4 diffs)
-
psphot/src/psphotStackImageLoop.c (modified) (3 diffs)
-
psphot/src/psphotStackMatchPSFs.c (modified) (1 diff)
-
psphot/src/psphotStackReadout.c (modified) (1 diff)
-
psphot/src/psphotSubtractBackground.c (modified) (1 diff)
-
psphot/src/psphotTest.c (modified) (1 diff)
-
pstamp/scripts/pstamp_job_run.pl (modified) (1 diff)
-
pstamp/scripts/pstampparse.pl (modified) (2 diffs)
-
pstamp/src/ppstampMakeStamp.c (modified) (1 diff)
-
pswarp/src/pswarpLoop.c (modified) (1 diff)
-
tools/czarplot.pl (modified) (2 diffs)
-
tools/czarpoll.pl (modified) (5 diffs)
-
tools/czartool/DayMetrics.pm (modified) (1 diff)
-
tools/czartool/Metrics.pm (modified) (1 diff)
-
tools/czartool/Plotter.pm (modified) (2 diffs)
-
tools/makedistdest (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20101203
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/Ohana/src/addstar/Makefile
r27582 r30118 72 72 $(SRC)/replace_match.$(ARCH).o \ 73 73 $(SRC)/resort_catalog.$(ARCH).o \ 74 $(SRC)/resort_threaded.$(ARCH).o \ 75 $(SRC)/resort_unthreaded.$(ARCH).o \ 74 76 $(SRC)/StarOps.$(ARCH).o \ 75 77 $(SRC)/ReadStarsFITS.$(ARCH).o \ -
branches/czw_branch/20101203/Ohana/src/addstar/include/addstar.h
r29541 r30118 125 125 float ZPT_ERR_PHU; 126 126 127 int OLD_RESORT; 128 127 129 // carries the mosaic into gstars 128 130 … … 135 137 double MIN_FWHM_X; 136 138 double MIN_FWHM_Y; 139 int NTHREADS; 137 140 138 141 /* modify server behavior (make this an addstar cleanup mode?) */ … … 207 210 Stars *rd_gsc PROTO((char *filename, unsigned int *nstars)); 208 211 int replace_match PROTO((Average *average, Measure *measure, Stars *star)); 212 int resort_threaded PROTO((AddstarClientOptions *options, SkyTable *sky)); 213 int resort_unthreaded PROTO((AddstarClientOptions *options, SkyTable *sky)); 209 214 void resort_catalog PROTO((Catalog *catalog)); 215 void resort_catalog_old PROTO((Catalog *catalog)); 210 216 Stars *ReadStarsFITS PROTO((FILE *f, Header *header, Header *in_theader, unsigned int *nstars)); 211 217 Stars *ReadStarsTEXT PROTO((FILE *f, unsigned int *nstars)); -
branches/czw_branch/20101203/Ohana/src/addstar/src/ReadStarsFITS.c
r29541 r30118 22 22 23 23 /* load the table data */ 24 if (!gfits_fread_ftable_data (f, &table )) {24 if (!gfits_fread_ftable_data (f, &table, FALSE)) { 25 25 fprintf (stderr, "ERROR: can't read table header\n"); 26 26 exit (1); -
branches/czw_branch/20101203/Ohana/src/addstar/src/ReadStarsSDSS.c
r28939 r30118 60 60 61 61 /* load the table data */ 62 if (!gfits_fread_ftable_data (f, &table )) {62 if (!gfits_fread_ftable_data (f, &table, FALSE)) { 63 63 fprintf (stderr, "ERROR: can't read table header\n"); 64 64 exit (1); -
branches/czw_branch/20101203/Ohana/src/addstar/src/addstar.c
r28241 r30118 34 34 SkyTableSetFilenames (sky, CATDIR, "cpt"); 35 35 36 if (options.mode == M_RESORT) { 37 if (NTHREADS == 0) { 38 resort_unthreaded (&options, sky); 39 } else { 40 resort_threaded (&options, sky); 41 } 42 exit (0); 43 } 44 36 45 stars = NULL; 37 46 … … 157 166 } 158 167 159 resort_catalog (&catalog); 168 if (OLD_RESORT) { 169 resort_catalog_old (&catalog); 170 } else { 171 resort_catalog (&catalog); 172 } 160 173 Nsubset = 1; 161 174 break; -
branches/czw_branch/20101203/Ohana/src/addstar/src/args.c
r27392 r30118 34 34 remove_argument (N, &argc, argv); 35 35 } 36 OLD_RESORT = FALSE; 37 if ((N = get_argument (argc, argv, "-old-resort"))) { 38 remove_argument (N, &argc, argv); 39 OLD_RESORT = TRUE; 40 } 36 41 if ((N = get_argument (argc, argv, "-fakeimage"))) { 37 42 options.mode = M_FAKEIMAGE; … … 62 67 remove_argument (N, &argc, argv); 63 68 PMM_CCD_TABLE = strcreate (argv[N]); 69 remove_argument (N, &argc, argv); 70 } 71 72 // number of worker threads for resort (must have at least one worker thread) 73 NTHREADS = 0; 74 if ((N = get_argument (argc, argv, "-threads"))) { 75 remove_argument (N, &argc, argv); 76 NTHREADS = MAX(0, atoi (argv[N])); 64 77 remove_argument (N, &argc, argv); 65 78 } -
branches/czw_branch/20101203/Ohana/src/addstar/src/resort_catalog.c
r27435 r30118 1 1 # include "addstar.h" 2 2 3 void resort_catalog (Catalog *catalog) {3 void resort_catalog_old (Catalog *catalog) { 4 4 5 5 off_t *next_meas; … … 28 28 return; 29 29 } 30 31 # define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); } 32 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort(); } } 33 34 // sort the measure Sequence based on the average Sequence entries 35 void SortAveMeasMatch (off_t *MEAS, off_t *AVE, off_t N) { 36 37 # define SWAPFUNC(A,B){ off_t tmp_meas; off_t tmp_ave; \ 38 tmp_meas = MEAS[A]; MEAS[A] = MEAS[B]; MEAS[B] = tmp_meas; \ 39 tmp_ave = AVE[A]; AVE[A] = AVE[B]; AVE[B] = tmp_ave; \ 40 } 41 # define COMPARE(A,B)(MEAS[A] < MEAS[B]) 42 OHANA_SORT (N, COMPARE, SWAPFUNC); 43 # undef SWAPFUNC 44 # undef COMPARE 45 } 46 47 # define MARKTIME(MSG,...) { \ 48 float dtime; \ 49 gettimeofday (&stop, (void *) NULL); \ 50 dtime = DTIME (stop, start); start = stop; \ 51 fprintf (stderr, MSG, __VA_ARGS__); } 52 53 // XXX : where is the time going? perhaps the ALLOCATE? 54 // XXX : I don't thnk his is getting the right answer yet. 55 56 void resort_catalog (Catalog *catalog) { 57 58 off_t Naverage, Nmeasure; 59 Measure *measure; 60 Average *average; 61 off_t i, j, N, currentAve; 62 63 off_t *measureSeq = NULL; 64 off_t *averageSeq = NULL; 65 Measure *measureTMP = NULL; 66 67 if (catalog[0].sorted == TRUE) return; 68 69 // struct timeval start, stop; 70 // gettimeofday (&start, NULL); 71 72 /* internal counters */ 73 Nmeasure = catalog[0].Nmeasure; 74 Naverage = catalog[0].Naverage; 75 76 measure = catalog[0].measure; 77 average = catalog[0].average; 78 79 // we have a table of average objects and an unsorted table of measurements. each measurement 80 // has a reference to the average object sequence (as well as an ID) 81 // measure[i].averef -> average[averef] 82 // measure[i].objID = average[averef].objID 83 // measure[i].catID = average[averef].catID 84 85 // we want a sorted measure array with all averef entries in sequence 86 87 ALLOCATE (measureSeq, off_t, Nmeasure); 88 ALLOCATE (averageSeq, off_t, Nmeasure); 89 90 for (i = 0; i < Nmeasure; i++) { 91 measureSeq[i] = i; 92 averageSeq[i] = measure[i].averef; 93 94 myAssert(average[averageSeq[i]].objID == measure[measureSeq[i]].objID, "object / detection mismatch"); 95 myAssert(average[averageSeq[i]].catID == measure[measureSeq[i]].catID, "object / detection mismatch"); 96 } 97 98 SortAveMeasMatch(measureSeq, averageSeq, Nmeasure); 99 // MARKTIME("sort : %f sec\n", dtime); 100 101 // copy the measurements in the sorted order 102 ALLOCATE (measureTMP, Measure, Nmeasure); 103 for (i = 0; i < Nmeasure; i++) { 104 j = measureSeq[i]; 105 measureTMP[i] = measure[j]; 106 } 107 // MARKTIME("assign measure : %f sec\n", dtime); 108 109 // update the values of average.measureOffset and average.Nmeasure 110 FREE(measure); 111 catalog[0].measure = measureTMP; 112 113 N = 0; 114 currentAve = averageSeq[0]; 115 average[currentAve].measureOffset = 0; 116 for (i = 0; i < Nmeasure; i++) { 117 if (averageSeq[i] != currentAve) { 118 average[currentAve].Nmeasure = N; 119 N = 0; 120 currentAve = averageSeq[i]; 121 average[currentAve].measureOffset = i; 122 } 123 N++; 124 } 125 N++; 126 average[currentAve].Nmeasure = N; 127 // MARKTIME("update Nmeasure : %f sec\n", dtime); 128 129 // MARKTIME(" match time %9.4f sec for %7lld measures, %6lld average\n", dtime, (long long) Nmeasure, (long long) Naverage); 130 131 FREE (measureSeq); 132 FREE (averageSeq); 133 134 return; 135 } 136 -
branches/czw_branch/20101203/Ohana/src/addstar/test/dvomerge.dvo
r29001 r30118 4 4 5 5 # create 2 populated catdirs, each with a couple of cmf files 6 macro test.dvomerge. update6 macro test.dvomerge.continue 7 7 8 8 tapPLAN 51 … … 16 16 17 17 mkinput 18 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec 10.0 20.0 19 exec addstar -D CATDIR catdir.test1 -D CAMERA simtest test.cmf 20 21 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 02:00:00 -radec 10.0 20.0 22 exec addstar -D CATDIR catdir.test1 -D CAMERA simtest test.cmf 23 24 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 03:00:00 -radec 9.9 20.0 25 exec addstar -D CATDIR catdir.test2 -D CAMERA simtest test.cmf 26 27 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 04:00:00 -radec 9.9 20.0 28 exec addstar -D CATDIR catdir.test2 -D CAMERA simtest test.cmf 29 30 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 05:00:00 -radec 10.0 19.9 31 exec addstar -D CATDIR catdir.test1 -D CAMERA simtest test.cmf 32 33 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 06:00:00 -radec 10.0 19.9 34 exec addstar -D CATDIR catdir.test1 -D CAMERA simtest test.cmf 35 36 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 07:00:00 -radec 9.9 19.9 37 exec addstar -D CATDIR catdir.test2 -D CAMERA simtest test.cmf 38 39 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 08:00:00 -radec 9.9 19.9 40 exec addstar -D CATDIR catdir.test2 -D CAMERA simtest test.cmf 41 42 break 43 44 exec rsync -auc catdir.test2/ catdir.test3/ 45 46 date -var t1 -seconds -reftime 1276000000 47 exec dvomerge catdir.test1 into catdir.test3 48 date -var t2 -seconds -reftime 1276000000 49 echo "merge time: {$t2 - $t1}" 50 51 catdir catdir.test3 52 skyregion {$RA-1} {$RA+1} {$DEC-1} {$DEC+1} 53 mextract ra dec mag 54 create n 0 ra[] 55 subset r0 = ra if (n % 4 == 0) 56 subset r1 = ra if (n % 4 == 1) 57 subset r2 = ra if (n % 4 == 2) 58 subset r3 = ra if (n % 4 == 3) 59 60 catdir catdir.test1/ 61 mextract RA DEC MAG 62 create N 0 RA[] 63 subset R0 = RA if (N % 2 == 0) 64 subset R1 = RA if (N % 2 == 1) 65 66 set dr0 = r0 - R0 67 vstat -q dr0 68 tapOK {abs($MEAN) < 0.001} "ra (in - 0) vs ra (out - 0) (MEAN)" 69 tapOK {abs($SIGMA) < 0.001} "ra (in - 0) vs ra (out - 0) (SIGMA)" 70 71 set dr1 = r1 - R1 72 vstat -q dr1 73 tapOK {abs($MEAN) < 0.001} "ra (in - 0) vs ra (out - 0) (MEAN)" 74 tapOK {abs($SIGMA) < 0.001} "ra (in - 0) vs ra (out - 0) (SIGMA)" 75 76 catdir catdir.test2/ 77 mextract RA DEC MAG 78 create N 0 RA[] 79 subset R2 = RA if (N % 2 == 0) 80 subset R3 = RA if (N % 2 == 1) 81 82 set dr2 = r2 - R2 83 vstat -q dr2 84 tapOK {abs($MEAN) < 0.001} "ra (in - 0) vs ra (out - 0) (MEAN)" 85 tapOK {abs($SIGMA) < 0.001} "ra (in - 0) vs ra (out - 0) (SIGMA)" 86 87 set dr3 = r3 - R3 88 vstat -q dr3 89 tapOK {abs($MEAN) < 0.001} "ra (in - 0) vs ra (out - 0) (MEAN)" 90 tapOK {abs($SIGMA) < 0.001} "ra (in - 0) vs ra (out - 0) (SIGMA)" 91 92 # check on updates to imageID 93 catdir catdir.test3 94 imextract imageID 95 sort imageID 96 tapOK {imageID[] == 4} "image IDs exist" 97 tapOK {imageID[0] == 1} "updated image IDs" 98 tapOK {imageID[1] == 2} "updated image IDs" 99 tapOK {imageID[2] == 3} "updated image IDs" 100 tapOK {imageID[3] == 4} "updated image IDs" 101 102 catdir catdir.test3 103 mextract imageID, time 104 set id = imageID 105 set t = time 106 imextract imageID, time 107 108 for i 0 time[] 109 subset T = t if (id == imageID[$i]) 110 set dT = T - time[$i] 111 vstat dT 112 tapOK {abs($MEAN) < 0.00001} "time for measure ID $i (MEAN)" 113 tapOK {abs($SIGMA) < 0.00001} "time for measure ID $i (SIGMA)" 114 end 115 116 # exec rm test.in.txt test.cmf 117 # exec rm -rf catdir.test1 118 # exec rm -rf catdir.test2 119 # exec rm -rf catdir.test3 120 121 tapDONE 122 end 123 124 # create 2 populated catdirs, each with a couple of cmf files 125 macro test.dvomerge.update 126 127 tapPLAN 51 128 129 exec rm -rf catdir.test1 130 exec rm -rf catdir.test2 131 exec rm -rf catdir.test3 132 133 $RA = 10.0 134 $DEC = 20.0 135 136 mkinput 18 137 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC 19 138 exec addstar -D CATDIR catdir.test1 -D CAMERA simtest test.cmf … … 27 146 exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 04:00:00 -radec $RA $DEC 28 147 exec addstar -D CATDIR catdir.test2 -D CAMERA simtest test.cmf 148 149 break 29 150 30 151 exec rsync -auc catdir.test2/ catdir.test3/ -
branches/czw_branch/20101203/Ohana/src/dvomerge/Makefile
r29001 r30118 22 22 all: dvomerge dvoconvert dvosecfilt 23 23 24 # $(SRC)/dvomergeContinue.$(ARCH).o 25 24 26 DVOMERGE = \ 25 27 $(SRC)/dvomerge.$(ARCH).o \ 26 28 $(SRC)/dvomergeUpdate.$(ARCH).o \ 27 29 $(SRC)/dvomergeCreate.$(ARCH).o \ 30 $(SRC)/dvomergeUpdate_threaded.$(ARCH).o \ 31 $(SRC)/dvomergeFromList.$(ARCH).o \ 32 $(SRC)/dvomergeImageIDs.$(ARCH).o \ 28 33 $(SRC)/dvo_image_merge_dbs.$(ARCH).o \ 29 34 $(SRC)/SetSignals.$(ARCH).o \ … … 70 75 $(BIN)/dvosecfilt.$(ARCH) : $(DVOSECFILT) 71 76 72 INSTALL = dvomerge dvoconvert dvosecfilt 77 DVOREPAIR = \ 78 $(SRC)/dvorepair.$(ARCH).o \ 79 $(SRC)/dvorepairFixCPT.$(ARCH).o \ 80 $(SRC)/dvorepairImagesVsMeasures.$(ARCH).o \ 81 $(SRC)/dvorepairDeleteImageList.$(ARCH).o \ 82 $(SRC)/dvorepairFixImages.$(ARCH).o \ 83 $(SRC)/psps_ids.$(ARCH).o \ 84 $(SRC)/LoadImages.$(ARCH).o \ 85 $(SRC)/ReadDeleteList.$(ARCH).o \ 86 $(SRC)/match_image.$(ARCH).o \ 87 $(SRC)/help.$(ARCH).o \ 88 $(SRC)/ImageOps.$(ARCH).o 89 90 $(DVOREPAIR) : $(INC)/dvomerge.h 91 92 $(BIN)/dvorepair.$(ARCH) : $(DVOREPAIR) 93 94 DVOVERIFY = \ 95 $(SRC)/dvoverify.$(ARCH).o 96 97 $(DVOVERIFY) : $(INC)/dvomerge.h 98 99 $(BIN)/dvoverify.$(ARCH) : $(DVOVERIFY) 100 101 INSTALL = dvomerge dvoconvert dvosecfilt dvorepair dvoverify 73 102 74 103 # dependancy rules for binary code ######################### -
branches/czw_branch/20101203/Ohana/src/dvomerge/include/dvomerge.h
r29001 r30118 17 17 # include <glob.h> 18 18 19 # define myAbort(MSG) { fprintf (stderr, "%s\n", MSG); abort(); } 20 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort(); } } 21 19 22 int VERBOSE; 20 23 char CATDIR[256]; … … 25 28 float RADIUS; 26 29 int SKY_DEPTH; 30 int NTHREADS; 27 31 char *ALTERNATE_PHOTCODE_FILE; 28 32 … … 65 69 SkyList *SkyTablePopulatedList_old PROTO((SkyTable *sky, off_t Ns, off_t Ne)); 66 70 67 int LoadCatalog PROTO((Catalog *catalog, SkyRegion *region, char *filename, char *mode ));71 int LoadCatalog PROTO((Catalog *catalog, SkyRegion *region, char *filename, char *mode, int Nsecfilt)); 68 72 69 73 int merge_catalogs_new PROTO((SkyRegion *region, Catalog *output, Catalog *input, int *secflitMap)); … … 86 90 off_t dvo_map_image_ID PROTO((IDmapType *IDmap, off_t oldID)); 87 91 int dvo_update_image_IDs PROTO((IDmapType *IDmap, Catalog *catalog)); 92 93 // dvorepair prototypes 94 Image *LoadImages PROTO((FITS_DB *db, char *filename, off_t *Nimage)); 95 Image *MatchImage PROTO((Image *image, off_t Nimage, unsigned int time, short int source, unsigned int imageID)); 96 off_t match_image PROTO((Image *image, off_t Nimage, unsigned int T, short int S)); 97 98 int SaveImages PROTO((FITS_DB *oldDB, char *filename, Image *imagesOut, off_t Nout)); 99 100 int dvorepairFixCPT PROTO((int argc, char **argv)); 101 int dvorepairImagesVsMeasures PROTO((int argc, char **argv)); 102 int dvorepairDeleteImageList PROTO((int argc, char **argv)); 103 int dvorepairFixImages PROTO((int argc, char **argv)); 104 105 int *ReadDeleteList PROTO((char *filename, int *nindex)); 106 int RepairTableCPT PROTO((char *cptFilenameSrc, char *cptFilenameTgt, char *cpsFilenameSrc, char *cpsFilenameTgt, Measure *measure, off_t Nmeasure, Image *image, off_t Nimage, char catformat)); 107 void dvorepair_help PROTO((int argc, char **argv)); 108 109 off_t getTgtIndex PROTO((e_time start, e_time stop, short photcode, off_t *TgtIndex, e_time *TgtTimes, short *TgtCodes, off_t NimagesTgt)); 110 void SortTgtByTimes PROTO((e_time *S, off_t *I, short *C, off_t N)); 111 int dvo_image_match_dbs PROTO((IDmapType *IDmap, FITS_DB *tgt, FITS_DB *src)); 112 int dvomergeImagesGetMap PROTO((IDmapType *IDmap, char *input, char *output)); 113 int dvomergeFromList PROTO((int argc, char **argv)); 114 int dvomergeUpdate_threaded PROTO((int argc, char **argv)); -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/LoadCatalog.c
r28329 r30118 1 1 # include "dvomerge.h" 2 2 3 int LoadCatalog (Catalog *catalog, SkyRegion *region, char *filename, char *mode ) {3 int LoadCatalog (Catalog *catalog, SkyRegion *region, char *filename, char *mode, int Nsecfilt) { 4 4 5 5 // set the parameters which guide catalog open/load/create 6 6 catalog[0].filename = filename; 7 catalog[0].Nsecfilt = GetPhotcodeNsecfilt ();7 catalog[0].Nsecfilt = Nsecfilt; 8 8 9 9 // always load all of the data (if any exists) -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/args.c
r29001 r30118 15 15 remove_argument (N, argc, argv); 16 16 ALTERNATE_PHOTCODE_FILE = strdup(argv[N]); 17 remove_argument (N, argc, argv); 18 } 19 20 NTHREADS = 0; 21 if ((N = get_argument (*argc, argv, "-threads"))) { 22 remove_argument (N, argc, argv); 23 NTHREADS = MAX(0, atoi(argv[N])); 17 24 remove_argument (N, argc, argv); 18 25 } … … 36 43 } 37 44 38 if ((*argc != 6) && (*argc != 4)) dvomerge_usage();45 if ((*argc < 4) || (*argc > 6)) dvomerge_usage(); 39 46 return TRUE; 40 47 } -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c
r29001 r30118 2 2 3 3 void sort_IDmap (IDmapType *IDmap); 4 5 off_t getTgtIndex (e_time start, e_time stop, short photcode, off_t *TgtIndex, e_time *TgtTimes, short *TgtCodes, off_t NimagesTgt) { 6 7 // use bisection to find the starting entry by time 8 9 off_t Nlo, Nhi, N; 10 11 // find the last TGT before start 12 Nlo = 0; Nhi = NimagesTgt; 13 while (Nhi - Nlo > 10) { 14 N = 0.5*(Nlo + Nhi); 15 if (TgtTimes[N] < start) { 16 Nlo = MAX(N, 0); 17 } else { 18 Nhi = MIN(N + 1, NimagesTgt); 19 } 20 } 21 22 // check for the matched mosaic starting from Nlo 23 // we may have to go much beyond Nlo since stop is not sorted 24 // can we use a sorted version of stop to check when we are beyond the valid range?? 25 for (N = Nlo; N < NimagesTgt; N++) { 26 if (TgtTimes[N] < start) continue; 27 if (TgtTimes[N] > stop) return (-1); 28 if (TgtCodes[N] != photcode) continue; 29 return (TgtIndex[N]); 30 } 31 return (-1); 32 } 33 34 // sort two times vectors and an index by first time vector 35 void SortTgtByTimes (e_time *S, off_t *I, short *C, off_t N) { 36 37 # define SWAPFUNC(A,B){ e_time tmp_t; off_t tmp_i; short tmp_c; \ 38 tmp_t = S[A]; S[A] = S[B]; S[B] = tmp_t; \ 39 tmp_i = I[A]; I[A] = I[B]; I[B] = tmp_i; \ 40 tmp_c = C[A]; C[A] = C[B]; C[B] = tmp_c; \ 41 } 42 # define COMPARE(A,B)(S[A] < S[B]) 43 44 OHANA_SORT (N, COMPARE, SWAPFUNC); 45 46 # undef SWAPFUNC 47 # undef COMPARE 48 49 } 50 51 // we have two tables; 'tgt' contains some exposures from 'src' : find them and match a map 52 int dvo_image_match_dbs (IDmapType *IDmap, FITS_DB *tgt, FITS_DB *src) { 53 54 Image *imagesSrc, *imagesTgt; 55 off_t NimagesSrc, NimagesTgt; 56 off_t iSrc, iTgt; 57 off_t *TgtIndex; 58 e_time *TgtTimes; 59 short *TgtCodes; 60 61 imagesSrc = gfits_table_get_Image (&src[0].ftable, &NimagesSrc, &src[0].swapped); 62 if (!imagesSrc) { 63 fprintf (stderr, "ERROR: failed to read images from src\n"); 64 exit (2); 65 } 66 67 imagesTgt = gfits_table_get_Image (&tgt[0].ftable, &NimagesTgt, &tgt[0].swapped); 68 if (!imagesTgt) { 69 fprintf (stderr, "ERROR: failed to read images from tgt\n"); 70 exit (2); 71 } 72 73 ALLOCATE (IDmap->old, off_t, NimagesSrc); 74 ALLOCATE (IDmap->new, off_t, NimagesSrc); 75 IDmap->Nmap = NimagesSrc; 76 77 // match by time and photcode 78 ALLOCATE (TgtIndex, off_t, NimagesTgt); 79 ALLOCATE (TgtTimes, e_time, NimagesTgt); 80 ALLOCATE (TgtCodes, short, NimagesTgt); 81 82 // save the Index, Times, Codes for all TGT images 83 for (iTgt = 0; iTgt < NimagesTgt; iTgt++) { 84 TgtIndex[iTgt] = iTgt; 85 TgtTimes[iTgt] = imagesTgt[iTgt].tzero; 86 TgtCodes[iTgt] = imagesTgt[iTgt].photcode; 87 } 88 89 // sort the index, start, and stop by the start times: 90 SortTgtByTimes (TgtTimes, TgtIndex, TgtCodes, NimagesTgt); 91 92 for (iSrc = 0; iSrc < NimagesSrc; iSrc++) { 93 iTgt = getTgtIndex (imagesSrc[iSrc].tzero, imagesSrc[iSrc].tzero + (int) imagesSrc[iSrc].exptime, imagesSrc[iSrc].photcode, TgtIndex, TgtTimes, TgtCodes, NimagesTgt); 94 if (iTgt < 0) Shutdown ("failure to match images: %s\n", imagesSrc[iSrc].name); 95 IDmap[0].old[iSrc] = imagesSrc[iSrc].imageID; 96 IDmap[0].new[iSrc] = imagesTgt[iTgt].imageID; 97 } 98 99 FREE(TgtIndex); 100 FREE(TgtTimes); 101 FREE(TgtCodes); 102 103 // sort IDmap->old,new on the basis of IDmap->old: 104 sort_IDmap (IDmap); 105 106 return TRUE; 107 } 4 108 5 109 // merge db2 into db1 -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/dvoconvert.c
r29001 r30118 6 6 char filename[256], *input, *output; 7 7 8 int depth ;8 int depth, Nsecfilt; 9 9 off_t i, j, Ns, Ne; 10 10 SkyTable *outsky, *insky; … … 32 32 exit (1); 33 33 } 34 Nsecfilt = GetPhotcodeNsecfilt(); 35 34 36 // save the photcodes in the output catdir 35 37 sprintf (filename, "%s/Photcodes.dat", output); … … 67 69 68 70 // load / create output catalog 69 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w" );71 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w", Nsecfilt); 70 72 71 73 // combine only tables at equal or larger depth … … 77 79 78 80 // load input catalog 79 LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r" );81 LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r", Nsecfilt); 80 82 81 83 // skip empty input catalogs -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/dvomerge.c
r28327 r30118 8 8 dvomerge_args (&argc, argv); 9 9 10 // XXX require both inputs to be sorted? 11 12 if (argc == 6) dvomergeCreate (argc, argv); 13 if (argc == 4) dvomergeUpdate (argc, argv); 10 if (argc == 6) { 11 if (!strcasecmp (argv[2], "and")) { 12 dvomergeCreate (argc, argv); 13 } else { 14 dvomergeFromList (argc, argv); 15 } 16 } 17 if ((argc == 4) || (argc == 5)) { 18 if (NTHREADS) { 19 dvomergeUpdate_threaded (argc, argv); 20 } else { 21 dvomergeUpdate (argc, argv); 22 } 23 } 14 24 dvomerge_usage(); 15 25 exit (2); // cannot reach here. … … 18 28 /* we have two possible modes of operation: 19 29 20 Create : dvomerge (in1) and (in2) to (out) -- create a new db from two input dbs 21 Update : dvomerge (in) into (out) -- merge a new db into an existing db 30 Create : dvomerge (in1) and (in2) to (out) -- create a new db from two input dbs 31 Update : dvomerge (in) into (out) -- merge a new db into an existing db 32 Continue : dvomerge (in) into (out) continue -- merge a new db into an existing db 22 33 23 34 */ -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/dvomergeCreate.c
r28855 r30118 15 15 char *input1, *input2, *output; 16 16 IDmapType IDmap1, IDmap2; 17 int NsecfiltInput1, NsecfiltInput2, NsecfiltOutput; 17 18 18 19 if (strcasecmp (argv[2], "and")) dvomerge_usage(); … … 39 40 } 40 41 input1Photcodes = GetPhotcodeTable(); 42 NsecfiltInput1 = GetPhotcodeNsecfilt(); 41 43 42 44 // Read the input2 photcodes … … 48 50 } 49 51 input2Photcodes = GetPhotcodeTable(); 52 NsecfiltInput2 = GetPhotcodeNsecfilt(); 50 53 51 54 if (ALTERNATE_PHOTCODE_FILE) { … … 60 63 } 61 64 outputPhotcodes = GetPhotcodeTable(); 65 NsecfiltOutput = GetPhotcodeNsecfilt(); 62 66 63 67 secfiltMap1 = GetSecFiltMap(outputPhotcodes, input1Photcodes); … … 74 78 outputPhotcodes = input1Photcodes; 75 79 codesFilename = filename1; 80 NsecfiltOutput = NsecfiltInput1; 76 81 // secfitMap1 can remain NULL since input1 defines the set of codes 77 82 } … … 84 89 } 85 90 91 // trigger any dependencies, if any 92 SetPhotcodeTable(NULL); 93 86 94 // save the output photcodes in the output catdir 87 SetPhotcodeTable(outputPhotcodes);95 // SetPhotcodeTable(outputPhotcodes); 88 96 sprintf (filename, "%s/Photcodes.dat", output); 89 97 if (!check_file_access (filename, TRUE, TRUE, VERBOSE)) { … … 121 129 if (VERBOSE) fprintf (stderr, "output: %s\n", outsky[0].regions[i].name); 122 130 123 if (outputPhotcodes) {124 SetPhotcodeTable(outputPhotcodes);125 }131 // if (outputPhotcodes) { 132 // SetPhotcodeTable(outputPhotcodes); 133 // } 126 134 // load / create output catalog 127 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w" );128 129 if (input1Photcodes) {130 SetPhotcodeTable(input1Photcodes);131 }135 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w", NsecfiltOutput); 136 137 // if (input1Photcodes) { 138 // SetPhotcodeTable(input1Photcodes); 139 // } 132 140 // combine only tables at equal or larger depth 133 141 … … 138 146 139 147 // load input catalog (1) 140 LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r" );148 LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r", NsecfiltInput1); 141 149 142 150 // skip empty input catalogs … … 153 161 SkyListFree (inlist); 154 162 155 if (input2Photcodes) {156 SetPhotcodeTable(input2Photcodes);157 }163 // if (input2Photcodes) { 164 // SetPhotcodeTable(input2Photcodes); 165 // } 158 166 159 167 // load in all of the tables from input2 for this region … … 163 171 164 172 // load input catalog (2) 165 LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r" );173 LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r", NsecfiltInput2); 166 174 167 175 // skip empty input catalogs -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/dvomergeUpdate.c
r29001 r30118 3 3 int dvomergeUpdate (int argc, char **argv) { 4 4 5 int depth ;5 int depth, CONTINUE; 6 6 off_t i, j, Ns, Ne; 7 7 SkyTable *outsky, *insky; … … 13 13 PhotCodeData *outputPhotcodes; 14 14 int *secfiltMap = NULL; 15 int NsecfiltInput, NsecfiltOutput; 15 16 17 double dtime; 18 struct timeval start, stop; 19 gettimeofday (&start, NULL); 20 21 CONTINUE = FALSE; 16 22 if (strcasecmp (argv[2], "into")) dvomerge_usage(); 23 if (argc == 5) { 24 if (strcasecmp (argv[4], "continue")) dvomerge_usage(); 25 CONTINUE = TRUE; 26 } 17 27 18 28 input = argv[1]; … … 31 41 } 32 42 inputPhotcodes = GetPhotcodeTable(); 43 NsecfiltInput = GetPhotcodeNsecfilt(); 33 44 34 45 // since we are merging the input db into the output db, the output defines the photcode … … 41 52 42 53 outputPhotcodes = GetPhotcodeTable(); 54 NsecfiltOutput = GetPhotcodeNsecfilt(); 43 55 44 56 secfiltMap = GetSecFiltMap(outputPhotcodes, inputPhotcodes); … … 50 62 fprintf(stderr, "%s not found using photcodes from %s/Photcodes.dat\n", filename, input); 51 63 outputPhotcodes = inputPhotcodes; 64 NsecfiltOutput = NsecfiltInput; 65 52 66 if (!check_dir_access (output, VERBOSE)) { 53 67 fprintf (stderr, "error creating output database directory %s\n", output); … … 61 75 } 62 76 63 dvomergeImagesUpdate (&IDmap, input, output); 77 if (CONTINUE) { 78 // need to determine the mapping from the input to the output images 79 dvomergeImagesGetMap (&IDmap, input, output); 80 } else { 81 dvomergeImagesUpdate (&IDmap, input, output); 82 } 64 83 65 84 // load the sky table for the existing database … … 85 104 depth = inlist[0].regions[Ns][0].depth; 86 105 106 SetPhotcodeTable(NULL); 107 87 108 // loop over the populated input regions 88 109 for (i = 0; i < inlist[0].Nregions; i++) { … … 90 111 if (VERBOSE) fprintf (stderr, "input: %s\n", inlist[0].regions[i][0].name); 91 112 92 SetPhotcodeTable(inputPhotcodes);93 113 // load / create output catalog (if catalog does not exist, it will be created) 94 LoadCatalog (&incatalog, &inlist[0].regions[i][0], inlist[0].filename[i], "r" );114 LoadCatalog (&incatalog, &inlist[0].regions[i][0], inlist[0].filename[i], "r", NsecfiltInput); 95 115 // skip empty input catalogs 96 116 if (!incatalog.Naves_disk) { … … 111 131 112 132 // load input catalog 113 SetPhotcodeTable(outputPhotcodes); 114 LoadCatalog (&outcatalog, outlist[0].regions[j], outlist[0].filename[j], "w"); 133 LoadCatalog (&outcatalog, outlist[0].regions[j], outlist[0].filename[j], "w", NsecfiltOutput); 115 134 116 135 dvo_update_image_IDs (&IDmap, &incatalog); … … 121 140 // if we receive a signal which would cause us to exit, wait until the full catalog is written 122 141 SetProtect (TRUE); 123 dvo_catalog_save (&outcatalog, VERBOSE); 142 if (!dvo_catalog_save (&outcatalog, VERBOSE)) { 143 fprintf (stderr, "ERROR: failed to save catalog %s\n", outlist[0].filename[j]); 144 exit (1); 145 } 124 146 SetProtect (FALSE); 125 147 … … 143 165 } 144 166 167 gettimeofday (&stop, NULL); 168 dtime = DTIME (stop, start); 169 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec\n", dtime); 170 145 171 exit (0); 146 172 } 147 148 /*** update the image table ***/149 int dvomergeImagesUpdate (IDmapType *IDmap, char *input, char *output) {150 151 FITS_DB inDB;152 FITS_DB outDB;153 int status;154 155 /*** load input1/Images.dat ***/156 sprintf (ImageCat, "%s/Images.dat", input);157 inDB.mode = dvo_catalog_catmode (CATMODE);158 inDB.format = dvo_catalog_catformat (CATFORMAT);159 status = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout?160 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename);161 162 // load the image table163 if (inDB.dbstate == LCK_EMPTY) {164 // Shutdown ("can't find input image catalog %s", inDB.filename);165 IDmap->Nmap = 0;166 return TRUE;167 }168 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) {169 Shutdown ("can't read input image catalog %s", inDB.filename);170 }171 172 /*** load output/Images.dat ***/173 sprintf (ImageCat, "%s/Images.dat", output);174 outDB.mode = dvo_catalog_catmode (CATMODE);175 outDB.format = dvo_catalog_catformat (CATFORMAT);176 status = dvo_image_lock (&outDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout?177 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", outDB.filename);178 179 /* load the image table */180 if (outDB.dbstate == LCK_EMPTY) {181 dvo_image_create (&outDB, GetZeroPoint());182 } else {183 if (!dvo_image_load (&outDB, VERBOSE, TRUE)) {184 Shutdown ("can't read output image catalog %s", outDB.filename);185 }186 }187 188 // convert database table to internal structure & add to output image db189 dvo_image_merge_dbs(IDmap, &outDB, &inDB);190 dvo_image_unlock (&inDB); // unlock input191 192 SetProtect (TRUE);193 dvo_image_save (&outDB, VERBOSE);194 SetProtect (FALSE);195 dvo_image_unlock (&outDB); // unlock output196 197 return TRUE;198 } -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/dvoverify.c
r29001 r30118 8 8 */ 9 9 10 int VerifyTableFile (char *filename); 11 12 # define DEBUG 0 13 10 14 int main (int argc, char **argv) { 11 15 12 char filename[ 256], *input, *output;13 14 int depth;15 off_t i , j, Ns, Ne;16 SkyTable * outsky, *insky;16 char filename[1024]; 17 18 int N, Nbad; 19 off_t i; 20 SkyTable *insky; 17 21 SkyList *inlist; 18 Catalog incatalog, outcatalog; 19 20 SetSignals (); 21 dvoconvert_help (argc, argv); 22 ConfigInit (&argc, argv); 23 dvoconvert_args (&argc, argv); 24 25 if (strcasecmp (argv[2], "to")) dvoconvert_usage(); 26 input = argv[1]; 27 output = argv[3]; 28 29 // load input images, save to output images 30 dvoConvert_copy_images (input, output); 31 32 // copy photcode table 33 { 34 // the first input defines the photcode table & db layout 35 sprintf (filename, "%s/Photcodes.dat", input); 36 if (!LoadPhotcodes (filename, NULL, FALSE)) { 37 fprintf (stderr, "error loading photcode table %s\n", filename); 38 exit (1); 39 } 40 // save the photcodes in the output catdir 41 sprintf (filename, "%s/Photcodes.dat", output); 42 if (!check_file_access (filename, TRUE, TRUE, VERBOSE)) { 43 fprintf (stderr, "error creating output catdir %s\n", output); 44 exit (1); 45 } 46 if (!SavePhotcodesFITS (filename)) { 47 fprintf (stderr, "error saving photcode table %s\n", filename); 48 exit (1); 49 } 50 } 51 52 // copy skytable 53 { 54 // load the sky table for the existing database 55 insky = SkyTableLoadOptimal (input, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE); 56 SkyTableSetFilenames (insky, input, "cpt"); 57 58 // generate an output table populated at the desired depth 59 // XXX force this to match the input? 60 outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 61 SkyTableSetFilenames (outsky, output, "cpt"); 62 63 SkyTablePopulatedRange (&Ns, &Ne, insky, 0); 64 depth = insky[0].regions[Ns].depth; 65 // XXX this seems to imply that insky is a uniform depth... 66 } 67 68 // loop over all input catalogs, save to output catalogs 69 // loop over the populatable output regions 70 for (i = 0; i < outsky[0].Nregions; i++) { 71 if (!outsky[0].regions[i].table) continue; 72 if (VERBOSE) fprintf (stderr, "output: %s\n", outsky[0].regions[i].name); 73 74 // load / create output catalog 75 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w"); 76 77 // combine only tables at equal or larger depth 78 79 // load in all of the tables from input for this region 80 inlist = SkyListByBounds (insky, depth, outsky[0].regions[i].Rmin, outsky[0].regions[i].Rmax, outsky[0].regions[i].Dmin, outsky[0].regions[i].Dmax); 81 for (j = 0; j < inlist[0].Nregions; j++) { 82 if (VERBOSE) fprintf (stderr, "input : %s\n", inlist[0].regions[j][0].name); 83 84 // load input catalog 85 LoadCatalog (&incatalog, inlist[0].regions[j], inlist[0].filename[j], "r"); 86 87 // skip empty input catalogs 88 if (!incatalog.Naves_disk) { 89 dvo_catalog_unlock (&incatalog); 90 dvo_catalog_free (&incatalog); 91 continue; 92 } 93 merge_catalogs_new (&outsky[0].regions[i], &outcatalog, &incatalog); 94 dvo_catalog_unlock (&incatalog); 95 dvo_catalog_free (&incatalog); 96 } 97 SkyListFree (inlist); 98 99 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 100 dvo_catalog_save (&outcatalog, VERBOSE); 101 dvo_catalog_unlock (&outcatalog); 102 dvo_catalog_free (&outcatalog); 103 } 104 105 // save the output sky table copy 106 sprintf (filename, "%s/SkyTable.fits", output); 107 check_file_access (filename, TRUE, TRUE, VERBOSE); 108 if (!SkyTableSave (outsky, filename)) { 109 fprintf (stderr, "ERROR: failed to save sky table for %s\n", output); 22 SkyRegion UserPatch; 23 // Catalog catalog; 24 25 // restrict to a portion of the sky 26 UserPatch.Rmin = 0; 27 UserPatch.Rmax = 360; 28 UserPatch.Dmin = -90; 29 UserPatch.Dmax = +90; 30 if ((N = get_argument (argc, argv, "-region"))) { 31 remove_argument (N, &argc, argv); 32 UserPatch.Rmin = atof (argv[N]); 33 remove_argument (N, &argc, argv); 34 UserPatch.Rmax = atof (argv[N]); 35 remove_argument (N, &argc, argv); 36 UserPatch.Dmin = atof (argv[N]); 37 remove_argument (N, &argc, argv); 38 UserPatch.Dmax = atof (argv[N]); 39 remove_argument (N, &argc, argv); 40 } 41 42 if (argc != 2) { 43 fprintf (stderr, "USAGE: dvoverify (catdir) [-region Rmin Rmax Dmin Dmax]\n"); 44 fprintf (stderr, " catdir : database of interest\n"); 45 exit (2); 46 } 47 48 char *catdir = argv[1]; 49 50 Nbad = 0; 51 52 // XXX make this step optional 53 if (1) { 54 // check the photcode table 55 sprintf (filename, "%s/Photcodes.dat", catdir); 56 if (!VerifyTableFile (filename)) { 57 Nbad ++; 58 } 59 60 // check the skytable 61 sprintf (filename, "%s/SkyTable.fits", catdir); 62 if (!VerifyTableFile (filename)) { 63 Nbad ++; 64 } 65 66 // check the image table 67 sprintf (filename, "%s/Images.dat", catdir); 68 if (!VerifyTableFile (filename)) { 69 Nbad ++; 70 } 71 } 72 73 // load the sky table for the existing database 74 insky = SkyTableLoadOptimal (catdir, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE); 75 myAssert(insky, "can't read SkyTable"); 76 SkyTableSetFilenames (insky, catdir, "cpt"); 77 inlist = SkyListByPatch (insky, -1, &UserPatch); 78 79 // loop over all catalogs, save to output catalogs 80 for (i = 0; i < inlist[0].Nregions; i++) { 81 if (!inlist[0].regions[i][0].table) continue; 82 83 if (i % 1000 == 0) fprintf (stderr, "."); 84 85 sprintf (filename, "%s/%s.cpt", catdir, inlist[0].regions[i][0].name); 86 if (!VerifyTableFile (filename)) { 87 Nbad ++; 88 } 89 90 sprintf (filename, "%s/%s.cps", catdir, inlist[0].regions[i][0].name); 91 if (!VerifyTableFile (filename)) { 92 Nbad ++; 93 } 94 95 sprintf (filename, "%s/%s.cpm", catdir, inlist[0].regions[i][0].name); 96 if (!VerifyTableFile (filename)) { 97 Nbad ++; 98 } 99 } 100 101 if (Nbad > 0) { 102 fprintf (stderr, "ERROR: %d files are bad\n", Nbad); 110 103 exit (1); 111 104 } 112 105 106 fprintf (stderr, "SUCCESS: no files are bad\n"); 113 107 exit (0); 114 108 } 115 109 116 int dvoConvert_copy_images (char *input, char *output) { 117 118 FITS_DB inDB; 119 FITS_DB outDB; 120 int status; 121 122 Image *images; 123 off_t Nimages; 124 off_t ID; 125 126 /*** load output/Images.dat ***/ 127 sprintf (ImageCat, "%s/Images.dat", output); 128 outDB.mode = dvo_catalog_catmode (CATMODE); 129 outDB.format = dvo_catalog_catformat (CATFORMAT); 130 status = dvo_image_lock (&outDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout? 131 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", outDB.filename); 132 133 // output image table should not already exist 134 if (outDB.dbstate != LCK_EMPTY) { 135 Shutdown ("ERROR: image table %s already exists", outDB.filename); 136 } 137 dvo_image_create (&outDB, GetZeroPoint()); 138 139 /*** load input/Images.dat ***/ 140 sprintf (ImageCat, "%s/Images.dat", input); 141 // inDB.mode = dvo_catalog_catmode (CATMODE); 142 // inDB.format = dvo_catalog_catformat (CATFORMAT); 143 status = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_XCLD); // shorter timeout? 144 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename); 145 146 // load the image table 147 if (inDB.dbstate == LCK_EMPTY) { 148 Shutdown ("can't find input image catalog %s", inDB.filename); 149 } 150 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) { 151 Shutdown ("can't read input image catalog %s", inDB.filename); 152 } 153 154 // convert the raw image table to Image type (byteswap if needed) 155 images = gfits_table_get_Image (&inDB.ftable, &Nimages, &inDB.swapped); 156 if (!images) { 157 fprintf (stderr, "ERROR: failed to read images\n"); 158 exit (2); 159 } 160 161 // update additional metadata 162 gfits_scan (&inDB.header, "IMAGEID", OFF_T_FMT, 1, &ID); 163 gfits_modify (&outDB.header, "NIMAGES", OFF_T_FMT, 1, Nimages); 164 gfits_modify (&outDB.header, "IMAGEID", OFF_T_FMT, 1, ID); 165 166 // copy input rows to output table 167 gfits_add_rows (&outDB.ftable, (char *) images, Nimages, sizeof(Image)); 168 169 // write out the image table to disk 170 SetProtect (TRUE); 171 dvo_image_save (&outDB, VERBOSE); 172 SetProtect (FALSE); 173 dvo_image_unlock (&outDB); // unlock output 174 dvo_image_unlock (&inDB); // unlock input1 175 110 // is this file a consistent FITS file? 111 int VerifyTableFile (char *filename) { 112 113 int status; 114 off_t Nbytes; 115 Header header; 116 117 struct stat fileStats; 118 FILE *file; 119 120 // does the file exist? 121 status = stat (filename, &fileStats); 122 if (status) { 123 // some error accessing the file. there is only one acceptable error: file not found 124 switch (errno) { 125 case ENOENT: 126 if (DEBUG) fprintf (stderr, "file does not exist, skipping %s\n", filename); 127 return TRUE; 128 case ENOMEM: 129 fprintf (stderr, "Out of memory: %s\n", filename); 130 return TRUE; 131 case EACCES: 132 fprintf (stderr, "Permission error on %s\n", filename); 133 return FALSE; 134 case EFAULT: 135 fprintf (stderr, "Bad address: %s\n", filename); 136 return FALSE; 137 case ELOOP: 138 fprintf (stderr, "Too many symbolic links encountered while traversing the path: %s\n", filename); 139 return FALSE; 140 case ENAMETOOLONG: 141 fprintf (stderr, "File name too long: %s\n", filename); 142 return FALSE; 143 case ENOTDIR: 144 fprintf (stderr, "A component of the path is not a directory: %s\n", filename); 145 return FALSE; 146 case EOVERFLOW: 147 fprintf (stderr, "file too large for program version: %s\n", filename); 148 return FALSE; 149 default: 150 fprintf (stderr, "unknown error: %s\n", filename); 151 return FALSE; 152 } 153 } 154 155 // does it have any data? 156 if (fileStats.st_size == 0) { 157 fprintf (stderr, "file is empty: %s\n", filename); 158 return FALSE; 159 } 160 161 // can we open it? 162 file = fopen(filename, "r"); 163 if (!file) { 164 fprintf (stderr, "unable to open valid file: %s\n", filename); 165 return FALSE; 166 } 167 168 // scan all extentions 169 Nbytes = 0; 170 if (DEBUG) fprintf (stderr, "sizes: ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nbytes, fileStats.st_size); 171 while (Nbytes < fileStats.st_size) { 172 173 // Check on the PHU 174 if (!gfits_fread_header (file, &header)) { 175 fprintf (stderr, "unable to read PHU header for %s\n", filename); 176 fclose(file); 177 return (FALSE); 178 } 179 180 // move to TBL header 181 Nbytes += header.datasize + gfits_data_size (&header); 182 if (DEBUG) fprintf (stderr, "sizes: ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nbytes, fileStats.st_size); 183 if (Nbytes > fileStats.st_size) { 184 fprintf (stderr, "file is short ("OFF_T_FMT" vs "OFF_T_FMT"): %s\n", Nbytes, fileStats.st_size, filename); 185 gfits_free_header(&header); 186 fclose (file); 187 return FALSE; 188 } 189 gfits_free_header(&header); 190 191 status = fseeko (file, Nbytes, SEEK_SET); 192 if (status) { 193 switch (errno) { 194 case EBADF: 195 fprintf (stderr, "something wrong with file handle: %s\n", filename); 196 fclose (file); 197 return FALSE; 198 case EINVAL: 199 fprintf (stderr, "invalid offset: %s\n", filename); 200 fclose (file); 201 return FALSE; 202 default: 203 fprintf (stderr, "other error in fseeko: %s\n", filename); 204 fclose (file); 205 return FALSE; 206 } 207 } 208 } 209 if (DEBUG) fprintf (stderr, "file is good: %s\n", filename); 210 fclose (file); 176 211 return TRUE; 177 212 } 213 214 // gfits_scan(&cpmHeaderTBL, "NAXIS1", "%d", 1, &NbytesPerRow); 215 // gfits_scan(&cpmHeaderTBL, "NAXIS2", "%d", 1, &Nrows); 216 217 -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/help.c
r29001 r30118 4 4 fprintf (stderr, "USAGE: dvomerge (input1) and (input2) to (output)\n"); 5 5 fprintf (stderr, " OR: dvomerge (input) into (output)\n"); 6 fprintf (stderr, " OR: dvomerge (input) into (output) continue\n"); 7 fprintf (stderr, " OR: dvomerge (input) into (output) from (list)\n"); 6 8 fprintf (stderr, " [-region Rmin Rmax Dmin Dmax]\n"); 7 9 exit (2); … … 17 19 void dvosecfilt_usage(void) { 18 20 19 fprintf (stderr, "USAGE: dvosecfilt ( input) -photcodes (photcodes.txt)\n");21 fprintf (stderr, "USAGE: dvosecfilt (catdir) (Nsecfilt)\n"); 20 22 21 23 exit (2); … … 33 35 fprintf (stderr, "USAGE\n"); 34 36 fprintf (stderr, " dvomerge (input1) and (input2) to (output)\n"); 35 fprintf (stderr, " dvomerge (input) into (output)\n\n"); 37 fprintf (stderr, " dvomerge (input) into (output)\n"); 38 fprintf (stderr, " dvomerge (input) into (output) continue\n\n"); 39 fprintf (stderr, " dvomerge (input) into (output) from (list)\n\n"); 36 40 fprintf (stderr, " merge DVO databases\n"); 37 41 fprintf (stderr, " optional flags:\n"); … … 39 43 fprintf (stderr, " -help : this list\n"); 40 44 fprintf (stderr, " -h : this list\n\n"); 45 fprintf (stderr, " -region Rmin Rmax Dmin Dmax : region to merge\n\n"); 41 46 exit (2); 42 47 } … … 75 80 76 81 fprintf (stderr, "USAGE\n"); 77 fprintf (stderr, " dvosecfilt ( input) (Nsecfilt)\n\n");82 fprintf (stderr, " dvosecfilt (catdir) (Nsecfilt)\n\n"); 78 83 79 fprintf (stderr, " change number of secfilt entries in photcode table (updates secfilt tables only)\n"); 84 fprintf (stderr, " change number of secfilt entries in photcode table (updates secfilt tables (cps), NSECFILT in cpt files)\n"); 85 fprintf (stderr, " NOTE: the user must change the photcode table to reflect the change (use photcode-table -export / -import)\n"); 80 86 81 87 fprintf (stderr, " optional flags:\n"); … … 86 92 } 87 93 94 void dvorepair_help (int argc, char **argv) { 95 96 /* check for help request */ 97 if (!argv) goto show_help; 98 if (get_argument (argc, argv, "-help")) goto show_help; 99 if (get_argument (argc, argv, "-h")) goto show_help; 100 if (argc < 2) goto show_help; 101 return; 102 103 show_help: 104 105 fprintf (stderr, "USAGE\n"); 106 fprintf (stderr, " dvorepair -fix-cpt (images) (rootlist) - regenerate cpt & cps files from the cpm files\n"); 107 fprintf (stderr, " dvorepair -images-vs-measures (catdir) (Ntol) - find images with too many missing detections\n"); 108 fprintf (stderr, " dvorepair -delete-image-list (catdir) (deleteList) - delete a set of images based on image IDs (output from -images-vs-measures)\n"); 109 fprintf (stderr, " dvorepair -fix-images (catdir) (deleteList) - delete a set of images based on image IDs (output from -images-vs-measures)\n"); 110 fprintf (stderr, "\n"); 111 112 fprintf (stderr, " optional flags:\n"); 113 fprintf (stderr, " -help : this list\n"); 114 fprintf (stderr, " -h : this list\n\n"); 115 exit (2); 116 } 117 -
branches/czw_branch/20101203/Ohana/src/dvomerge/src/merge_catalogs_old.c
r29181 r30118 28 28 unsigned int objID, catID; 29 29 Coords tcoords; 30 30 31 31 // struct timeval start, stop; 32 32 // gettimeofday (&start, (void *) NULL); … … 240 240 } else { 241 241 for (k = 0; k < NsecfiltIn; k++) { 242 if (secfiltMap[k] < 0) continue; // skip secfilt entries from input that are not in the output 243 242 244 // index for this entry in output's secfilt list 243 245 int outputIndex = n * NsecfiltOut + secfiltMap[k]; … … 254 256 i++; 255 257 } 256 // MARKTIME("find matched stars: %f sec for "OFF_T_FMT","OFF_T_FMT" stars \n", dtime, Nstars, Nave);258 // MARKTIME("find matched stars: %f sec for "OFF_T_FMT","OFF_T_FMT" stars ("OFF_T_FMT" meas)\n", dtime, Nstars, Nave, Nmeas); 257 259 258 260 /** incorporate unmatched image stars, if this star is in field of this catalog **/ -
branches/czw_branch/20101203/Ohana/src/imregister/imphot/rfits.c
r7080 r30118 17 17 return (FALSE); 18 18 } 19 if (!gfits_fread_ftable_data (db[0].f, &db[0].ftable )) {19 if (!gfits_fread_ftable_data (db[0].f, &db[0].ftable, FALSE)) { 20 20 fprintf (stderr, "can't read table data"); 21 21 return (FALSE); -
branches/czw_branch/20101203/Ohana/src/kapa2/Makefile
r25757 r30118 42 42 $(SRC)/bDrawObjects.$(ARCH).o $(SRC)/bDrawFrame.$(ARCH).o \ 43 43 $(SRC)/bDrawLabels.$(ARCH).o $(SRC)/bDrawIt.$(ARCH).o \ 44 $(SRC)/bDrawImage.$(ARCH).o \ 44 45 $(SRC)/PNGit.$(ARCH).o $(SRC)/PPMit.$(ARCH).o \ 45 46 $(SRC)/PSit.$(ARCH).o $(SRC)/CrossHairs.$(ARCH).o \ -
branches/czw_branch/20101203/Ohana/src/kapa2/include/prototypes.h
r29539 r30118 40 40 void DrawYErrors PROTO((KapaGraphWidget *graph, Gobjects *objects)); 41 41 void DrawTick PROTO((Graphic *graphic, Axis *axis, int P, TickMarkData *tick, int naxis)); 42 void AxisTickScale PROTO((Axis *axis, double *major, double *minor ));42 void AxisTickScale PROTO((Axis *axis, double *major, double *minor, int *nsignif)); 43 43 TickMarkData *CreateAxisTicks PROTO((Axis *axis, int *nticks)); 44 int PrintTick PROTO((char *string, double value, double min, double max ));44 int PrintTick PROTO((char *string, double value, double min, double max, int nsignif)); 45 45 46 46 /* EventLoop */ 47 47 int PScommand PROTO((int sock)); 48 int PNGcommand PROTO((int sock)); 48 49 int CheckPipe PROTO((void)); 49 50 int Reconfig PROTO((XEvent *event)); … … 52 53 53 54 /* CheckPipe */ 54 int PNGit PROTO(( int sock));55 int PNGit PROTO((char *filename)); 55 56 int PPMit PROTO((int sock)); 56 57 int LoadFrame PROTO((int sock)); … … 67 68 int MoveSection PROTO((int sock)); 68 69 int DefineSection PROTO((int sock)); 70 int DefineSectionByImage PROTO((int sock)); 69 71 int SetFont PROTO((int sock)); 70 72 int EraseCurrentPlot PROTO((void)); … … 126 128 127 129 /* kapa bDraw Functions */ 128 int bDrawFrame PROTO((KapaGraphWidget *graph)); 129 int bDrawObjects PROTO((KapaGraphWidget *graph)); 130 void bDrawLabels PROTO((KapaGraphWidget *graph)); 131 void bDrawTextlines PROTO((KapaGraphWidget *graph)); 132 void bDrawConnect PROTO((KapaGraphWidget *graph, Gobjects *object)); 133 void bDrawHistogram PROTO((KapaGraphWidget *graph, Gobjects *object)); 134 void bDrawPoints PROTO((KapaGraphWidget *graph, Gobjects *object)); 135 void bDrawXErrors PROTO((KapaGraphWidget *graph, Gobjects *object)); 136 void bDrawYErrors PROTO((KapaGraphWidget *graph, Gobjects *object)); 137 void bDrawTick PROTO((Axis *axis, int P, TickMarkData *tick, int naxis)); 138 void bDrawClipLine PROTO((double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0)); 139 bDrawBuffer *bDrawIt PROTO((void)); 140 void bDrawGraph PROTO((KapaGraphWidget *graph)); 130 int bDrawFrame PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph)); 131 int bDrawObjects PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph)); 132 void bDrawLabels PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph)); 133 void bDrawTextlines PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph)); 134 void bDrawConnect PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 135 void bDrawHistogram PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 136 void bDrawPoints PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 137 void bDrawXErrors PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 138 void bDrawYErrors PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 139 void bDrawTick PROTO((bDrawBuffer *buffer, Axis *axis, int P, TickMarkData *tick, int naxis)); 140 void bDrawClipLine PROTO((bDrawBuffer *buffer, double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0)); 141 void bDrawGraph PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph)); 142 int bDrawImage PROTO((bDrawBuffer *buffer, KapaImageWidget *image, Graphic *graphic)); 143 bDrawBuffer *bDrawIt PROTO((png_color *palette, int Npalette, int Nbyte)); 141 144 142 145 /* misc support */ … … 212 215 int Overlay3 PROTO((Graphic *graphic, KapaImageWidget *image)); 213 216 int PSfunction PROTO((Graphic *graphic, KapaImageWidget *image)); 217 int PNGfunction PROTO((Graphic *graphic, KapaImageWidget *image)); 218 int JPEGfunction PROTO((Graphic *graphic, KapaImageWidget *image)); 214 219 215 220 /* misc functions */ … … 219 224 int SaveOverlay (int sock); 220 225 int CSaveOverlay (int sock); 221 int JPEGit24 (int sock); 226 int JPEGit24 (char *filename); 227 int JPEGcommand (int sock); 222 228 223 229 int UpdatePointer (Graphic *graphic, XMotionEvent *event); … … 241 247 int GetActiveSocket (void); 242 248 void InvertButton (Graphic *graphic, Button *button); 243 void bDrawOverlay ( KapaImageWidget *image, int N);249 void bDrawOverlay (bDrawBuffer *buffer, KapaImageWidget *image, int N); 244 250 245 251 /* color cube tools */ … … 261 267 int SetColorScale3D_CC (Graphic *graphic, KapaImageWidget *image); 262 268 int SetColorCubeHistogram (void); 269 int GetGraphBoundary (Section *section, double *x0, double *y0, double *x1, double *y1, int *dXm, int *dXp, int *dYm, int *dYp); 270 int ResizeByImage (int sock); 271 -
branches/czw_branch/20101203/Ohana/src/kapa2/include/structures.h
r29539 r30118 148 148 int IsMajor; 149 149 int IsLabel; 150 int nsignif; 150 151 } TickMarkData; 151 152 -
branches/czw_branch/20101203/Ohana/src/kapa2/src/ButtonFunctions.c
r29539 r30118 7 7 8 8 status = PSit ("kapa.ps", "default", TRUE, KAPA_PS_NEWPLOT); 9 return (status); 10 } 11 12 int PNGfunction (Graphic *graphic, KapaImageWidget *image) { 13 14 int status; 15 16 status = PNGit ("kapa.png"); 17 return (status); 18 } 19 20 int JPEGfunction (Graphic *graphic, KapaImageWidget *image) { 21 22 int status; 23 24 status = JPEGit24 ("kapa.jpg"); 9 25 return (status); 10 26 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/CheckPipe.c
r27790 r30118 89 89 90 90 if (!strcmp (word, "PNGF")) { 91 status = PNGit (sock); 92 KiiSendCommand (sock, 4, "DONE"); 93 FINISHED (status); 94 } 95 91 status = PNGcommand (sock); 92 KiiSendCommand (sock, 4, "DONE"); 93 FINISHED (status); 94 } 95 96 if (!strcmp (word, "JPEG")) { 97 status = JPEGcommand (sock); 98 KiiSendCommand (sock, 4, "DONE"); 99 FINISHED (status); 100 } 101 96 102 if (!strcmp (word, "PPMF")) { 97 103 status = PPMit (sock); … … 131 137 } 132 138 139 if (!strcmp (word, "ISIZ")) { 140 status = ResizeByImage (sock); 141 KiiSendCommand (sock, 4, "DONE"); 142 FINISHED (TRUE); 143 } 144 133 145 if (!strcmp (word, "MOVE")) { 134 146 status = Relocate (sock); … … 211 223 if (!strcmp (word, "DSEC")) { 212 224 status = DefineSection (sock); 225 KiiSendCommand (sock, 4, "DONE"); 226 FINISHED (TRUE); 227 } 228 229 if (!strcmp (word, "ISEC")) { 230 status = DefineSectionByImage (sock); 213 231 KiiSendCommand (sock, 4, "DONE"); 214 232 FINISHED (TRUE); … … 300 318 if (!strcmp (word, "CSVE")) { 301 319 status = CSaveOverlay (sock); 302 KiiSendCommand (sock, 4, "DONE");303 FINISHED (status);304 }305 306 if (!strcmp (word, "JPEG")) {307 status = JPEGit24 (sock);308 320 KiiSendCommand (sock, 4, "DONE"); 309 321 FINISHED (status); -
branches/czw_branch/20101203/Ohana/src/kapa2/src/DefineSection.c
r27790 r30118 40 40 return (TRUE); 41 41 } 42 43 // define the section, but do not create a graph or image 44 int DefineSectionByImage (int sock) { 45 46 int N, bg; 47 char name[128]; 48 double x, y, dx, dy; 49 int dXm, dXp, dYm, dYp; 50 double x0, y0, x1, y1, expand; 51 Section *section; 52 Graphic *graphic; 53 KapaImageWidget *image; 54 55 KiiScanMessage (sock, "%s %lf %lf %d", name, &x, &y, &bg); 56 57 N = GetSectionByName (name); 58 section = GetSectionByNumber (N); 59 image = section->image; 60 if (!image) { 61 fprintf (stderr, "no image to define section\n"); 62 return (TRUE); 63 } 64 SetActiveSectionByNumber (N); 65 66 graphic = GetGraphic (); 67 68 GetGraphBoundary (section, &x0, &y0, &x1, &y1, &dXm, &dXp, &dYm, &dYp); 69 70 expand = 1.0; 71 if (image[0].picture.expand > 0) { 72 expand = image[0].picture.expand; 73 } 74 if (image[0].picture.expand < 0) { 75 expand = 1.0 / fabs((double)image[0].picture.expand); 76 } 77 78 // pixel dimensions of the imaging region + boundary 79 dx = image[0].image[0].matrix.Naxis[0]*expand + x1; 80 dy = image[0].image[0].matrix.Naxis[1]*expand + y1; 81 82 section[0].x = x; 83 section[0].y = y; 84 section[0].bg = bg; 85 section[0].dx = dx / graphic[0].dx; 86 section[0].dy = dy / graphic[0].dy; 87 88 // if (section[0].x != x) MoveSection = TRUE; 89 // if (section[0].y != y) MoveSection = TRUE; 90 // if (section[0].dx != dx) MoveSection = TRUE; 91 // if (section[0].dy != dy) MoveSection = TRUE; 92 93 SetSectionSizes (section); 94 Refresh (); 95 96 return (TRUE); 97 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/DrawFrame.c
r29539 r30118 5 5 int DrawFrame (KapaGraphWidget *graph) { 6 6 7 int i, j, Nticks, P ;8 double fx, fy, dfx, dfy, lweight;7 int i, j, Nticks, P, doffset; 8 double fx, fy, dfx, dfy, dx = 0, dy = 0, lweight; 9 9 Graphic *graphic; 10 10 TickMarkData *ticks; … … 15 15 /* each axis is drawn independently, but ticks and labels are placed according to perpendicular distance. */ 16 16 for (i = 0; i < 4; i++) { 17 fx = graph[0].axis[i].fx;18 fy = graph[0].axis[i].fy;19 dfx = graph[0].axis[i].dfx;20 dfy = graph[0].axis[i].dfy;21 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy);22 23 17 lweight = MAX (0, MIN (10, graph[0].axis[i].lweight)); 24 18 color = MAX (0, MIN (15, graph[0].axis[i].color)); 19 20 /* temporarily assume rectilinear axes */ 21 doffset = ((int)(lweight) % 2) ? 0.5*(lweight - 1) : 0.5*lweight; 22 if (i == 0) { dx = doffset; dy = 0.0; } 23 if (i == 2) { dx = doffset; dy = 0.0; } 24 if (i == 1) { dx = 0.0; dy = doffset; } 25 if (i == 3) { dx = 0.0; dy = doffset; } 26 27 fx = graph[0].axis[i].fx - dx; 28 fy = graph[0].axis[i].fy - dy; 29 dfx = graph[0].axis[i].dfx + 2*dx; 30 dfy = graph[0].axis[i].dfy + 2*dy; 31 32 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy); 33 P *= (1 + 0.25*lweight); 25 34 26 35 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineSolid, CapNotLast, JoinMiter); … … 43 52 } 44 53 45 int PrintTick (char *string, double value, double min, double max ) {54 int PrintTick (char *string, double value, double min, double max, int nsignif) { 46 55 47 56 int Nexp = 0; … … 54 63 } 55 64 56 double lvalue = log10(fabs(value)); 57 58 if (isfinite(lvalue)) { 59 Nexp = fabs(lvalue); 60 } else { 61 Nexp = 0; 62 } 63 65 // double lvalue = log10(fabs(value)); 66 // if (isfinite(lvalue)) { 67 // Nexp = fabs(lvalue); 68 // } else { 69 // Nexp = 0; 70 // } 71 72 Nexp = abs(nsignif); 73 64 74 if (Nexp > 3) { 65 75 Nchar = sprintf (string, "%.1e", value); 66 76 } else { 67 Nchar = sprintf (string, "%.1f", value); 77 if (nsignif < 0) { 78 char format[16]; 79 snprintf (format, 16, "%%.%df", -1 * nsignif); 80 Nchar = sprintf (string, format, value); 81 } else { 82 Nchar = sprintf (string, "%.1f", value); 83 } 68 84 } 69 85 return Nchar; … … 129 145 yt = fy + (value-min)*dfy/(max - min) + dy; 130 146 131 PrintTick (string, value, min, max );147 PrintTick (string, value, min, max, tick->nsignif); 132 148 DrawRotText (xt, yt, string, pos, 0.0); 133 149 } … … 136 152 # define MIN_RANGE 1e-10 137 153 138 void AxisTickScale (Axis *axis, double *major, double *minor ) {154 void AxisTickScale (Axis *axis, double *major, double *minor, int *nsignif) { 139 155 140 156 double range, lrange, factor, mantis, fmantis, power; … … 152 168 } 153 169 170 // how many significant digits are needed? 171 154 172 power = MAX(pow(10.0, factor), MIN_RANGE); 155 173 fmantis = pow(10.0, mantis); … … 160 178 *major = 0.5 * power; 161 179 *minor = 0.1 * power; 180 *nsignif = factor - 1; 162 181 if (axis[0].areticks == 1) { 163 182 *major = 0.25 * power; 164 183 *minor = 0.05 * power; 184 *nsignif = factor - 2; 165 185 } 166 186 } … … 168 188 *major = 1.0 * power; 169 189 *minor = 0.2 * power; 190 *nsignif = factor; 170 191 if (axis[0].areticks == 1) { 171 192 *major = 0.5 * power; 172 193 *minor = 0.1 * power; 194 *nsignif = factor - 1; 173 195 } 174 196 } … … 176 198 *major = 1.0 * power; 177 199 *minor = 0.5 * power; 200 *nsignif = factor; 178 201 if (axis[0].areticks == 1) { 179 202 *major = 1.0 * power; 180 203 *minor = 0.2 * power; 204 *nsignif = factor; 181 205 } 182 206 } … … 184 208 *major = 2.0 * power; 185 209 *minor = 0.5 * power; 210 *nsignif = factor; 186 211 if (axis[0].areticks == 1) { 187 212 *major = 1.0 * power; 188 213 *minor = 0.5 * power; 214 *nsignif = factor; 189 215 } 190 216 } … … 192 218 *major = 2.5 * power; 193 219 *minor = 0.5 * power; 220 *nsignif = factor - 1; 194 221 if (axis[0].areticks == 1) { 195 222 *major = 2.0 * power; 196 223 *minor = 0.5 * power; 224 *nsignif = factor; 197 225 } 198 226 } … … 203 231 TickMarkData *ticks; 204 232 double range, major, minor, first, value, dPixels, overshoot; 205 int i, NTICKS, nPixels, done, ifirst ;233 int i, NTICKS, nPixels, done, ifirst, nsignif; 206 234 207 235 *nticks = 0; … … 223 251 dPixels = nPixels / range; // axis pixel-scale 224 252 225 AxisTickScale (axis, &major, &minor );253 AxisTickScale (axis, &major, &minor, &nsignif); 226 254 227 255 // be a little generous … … 256 284 ticks[i].IsLabel = (ticks[i].IsMajor && axis->islabel); 257 285 ticks[i].value = value; 286 ticks[i].nsignif = nsignif; 258 287 if (range > 0) 259 288 value += minor; -
branches/czw_branch/20101203/Ohana/src/kapa2/src/Image.c
r29539 r30118 88 88 89 89 InitButtonSize (&image[0].PS_button, PS_width, PS_height, PS_bits); 90 InitButtonFunc (&image[0].PS_button, PSfunction); 90 // InitButtonFunc (&image[0].PS_button, PSfunction); 91 image->PS_button.function_1 = PSfunction; 92 image->PS_button.function_2 = PNGfunction; 93 image->PS_button.function_3 = JPEGfunction; 91 94 92 95 InitButtonSize (&image[0].grey_button, grey_width, grey_height, grey_bits); -
branches/czw_branch/20101203/Ohana/src/kapa2/src/JPEGit24.c
r27601 r30118 8 8 # define WHITE_B 255 9 9 10 int JPEGcommand (int sock) { 11 12 int status; 13 char filename[1024]; 14 15 KiiScanMessage (sock, "%s", filename); 16 status = JPEGit24 (filename); 17 return (status); 18 } 19 10 20 // XXX this currently writes out the jpeg for just the active image 11 int JPEGit24 ( int sock) {21 int JPEGit24 (char *filename) { 12 22 13 23 struct jpeg_compress_struct cinfo; … … 31 41 unsigned short *in_pix, *in_pix_ref; 32 42 unsigned char *pixel1, *pixel2, *pixel3; 33 char filename[1024];34 43 FILE *f; 35 36 /* expect a line telling the number of bytes and a filename */37 KiiScanMessage (sock, "%s", filename);38 44 39 45 graphic = GetGraphic(); … … 196 202 palette = KapaPNGPalette (&Npalette); 197 203 198 buffer = bDrawBufferCreate (dx, dy); 199 bDrawSetBuffer (buffer); 204 buffer = bDrawBufferCreate (dx, dy, 1, palette, Npalette); 200 205 for (i = 0; i < NOVERLAYS; i++) { 201 if (image[ i].overlay[i].active) bDrawOverlay (image, i);206 if (image[0].overlay[i].active) bDrawOverlay (buffer, image, i); 202 207 } 203 208 -
branches/czw_branch/20101203/Ohana/src/kapa2/src/PNGit.c
r29408 r30118 7 7 */ 8 8 9 bDrawBuffer *bDrawBufferCreate8bitRGB (int Nx, int Ny); 10 int bDrawImage (bDrawBuffer *buffer, Graphic *graphic); 9 int PNGcommand (int sock) { 11 10 12 int PNGit (int sock) { 11 int status; 12 char filename[1024]; 13 14 KiiScanMessage (sock, "%s", filename); 15 status = PNGit (filename); 16 return (status); 17 } 18 19 int PNGit (char *filename) { 13 20 14 21 FILE *f; 15 22 png_structp png_ptr; 16 23 png_infop info_ptr; 17 int status, Npalette; 18 char filename[1024]; 24 int i, status, Npalette, Nsection; 19 25 bDrawBuffer *buffer = NULL; 20 26 Graphic *graphic = NULL; 21 27 png_color *palette = NULL; 28 Section *section; 22 29 23 30 graphic = GetGraphic(); 24 25 /* expect a line telling the number of bytes and a filename */26 KiiScanMessage (sock, "%s", filename);27 31 28 32 f = fopen (filename, "w"); … … 62 66 png_init_io (png_ptr, f); 63 67 68 palette = KapaPNGPalette (&Npalette); 69 70 // do we have an image in any of the sections? 71 Nsection = GetNumberOfSections (); 72 int haveImage = FALSE; 73 for (i = 0; !haveImage && (i < Nsection); i++) { 74 section = GetSectionByNumber (i); 75 haveImage = (section->image != NULL); 76 } 77 64 78 /* see docs for write-row-callback to provide progress info */ 65 # define PALETTE 1 66 if (PALETTE) { 67 png_set_IHDR (png_ptr, info_ptr, graphic->dx, graphic->dy, 8, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); 68 palette = KapaPNGPalette (&Npalette); 69 png_set_PLTE (png_ptr, info_ptr, palette, Npalette); 70 } else { 79 if (haveImage) { 71 80 // png_set_IHDR (png_ptr, info_ptr, graphic->dx, graphic->dy, 16, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); 72 81 png_set_IHDR (png_ptr, info_ptr, graphic->dx, graphic->dy, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); 73 82 png_set_sRGB (png_ptr, info_ptr, PNG_sRGB_INTENT_ABSOLUTE); 83 } else { 84 png_set_IHDR (png_ptr, info_ptr, graphic->dx, graphic->dy, 8, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); 85 png_set_PLTE (png_ptr, info_ptr, palette, Npalette); 74 86 } 75 87 … … 81 93 png_write_info (png_ptr, info_ptr); 82 94 83 if (PALETTE) { 84 buffer = bDrawIt (); 95 if (haveImage) { 96 buffer = bDrawIt (palette, Npalette, 3); 97 // bDrawImage (buffer, graphic); 85 98 } else { 86 buffer = bDrawBufferCreate8bitRGB(graphic->dx, graphic->dy); 87 bDrawImage (buffer, graphic); 99 buffer = bDrawIt (palette, Npalette, 1); 88 100 } 89 101 … … 93 105 94 106 bDrawBufferFree (buffer); 95 free (palette);96 107 fclose (f); 97 108 return (TRUE); 98 109 99 110 } 100 101 /* For color images, I need to define the relationship between the drawing colors and the RGB values? */102 103 104 bDrawBuffer *bDrawBufferCreate8bitRGB (int Nx, int Ny) {105 106 int i, j;107 bDrawBuffer *buffer;108 109 ALLOCATE (buffer, bDrawBuffer, 1);110 buffer[0].Nx = Nx;111 buffer[0].Ny = Ny;112 113 ALLOCATE (buffer[0].pixels, bDrawColor *, Ny);114 for (i = 0; i < Ny; i++) {115 ALLOCATE (buffer[0].pixels[i], bDrawColor, 3*Nx);116 for (j = 0; j < 3*Nx; j+=3) {117 buffer[0].pixels[i][j+0] = 0xff;118 buffer[0].pixels[i][j+1] = 0xff;119 buffer[0].pixels[i][j+2] = 0xff;120 }121 }122 return (buffer);123 }124 125 # define WHITE_R 255126 # define WHITE_G 255127 # define WHITE_B 255128 # define MY_SWAP_INT(A,B) { int tmp; tmp = A; A = B; B = tmp; }129 130 int bDrawImage (bDrawBuffer *buffer, Graphic *graphic) {131 132 Section *section;133 KapaImageWidget *image;134 135 int ii, i, j;136 int i_start, i_end, j_start, j_end;137 int I_start, J_start;138 int dropback; /* this is a bit of a kludge... */139 int dx, dy, DX, DY, inDX, inDY;140 int expand_in, expand_out;141 double expand, Ix, Iy;142 unsigned char *out_pix;143 unsigned short *in_pix, *in_pix_ref;144 unsigned char *pixel1, *pixel2, *pixel3;145 146 bDrawColor *line_buffer;147 148 section = GetActiveSection();149 image = section->image;150 if (image == NULL) return (TRUE);151 152 ALLOCATE (pixel1, unsigned char, graphic[0].Npixels);153 ALLOCATE (pixel2, unsigned char, graphic[0].Npixels);154 ALLOCATE (pixel3, unsigned char, graphic[0].Npixels);155 156 /** cmap[i].pixel must be defined even if X is not used **/157 for (i = 0; i < graphic[0].Npixels; i++) { /* set up pixel array */158 pixel1[i] = graphic[0].cmap[i].red >> 8;159 pixel2[i] = graphic[0].cmap[i].green >> 8;160 pixel3[i] = graphic[0].cmap[i].blue >> 8;161 }162 163 assert ((image[0].picture.expand >= 1) || (image[0].picture.expand <= -2));164 expand = expand_in = expand_out = 1.0;165 if (image[0].picture.expand > 0) {166 expand = 1 / (1.0*image[0].picture.expand);167 expand_out = image[0].picture.expand;168 expand_in = 1;169 }170 if (image[0].picture.expand < 0) {171 expand = fabs((double)image[0].picture.expand);172 expand_out = 1;173 expand_in = -image[0].picture.expand;174 }175 176 dx = image[0].picture.dx;177 dy = image[0].picture.dy;178 DX = image[0].image[0].matrix.Naxis[0];179 DY = image[0].image[0].matrix.Naxis[1];180 181 // i_start, j_start are the closest lit screen pixel to 0,0182 // I_start, J_start are the image pixel corresponding to i_start, j_start183 Picture_Lower (&i_start, &j_start, &I_start, &J_start, &image[0].image[0].matrix, &image[0].picture);184 185 // i_end, j_end are the closest lit screen pixel to dx, dy186 // I_end, J_end are the image pixel corresponding to i_end, j_end187 Picture_Upper (&i_end, &j_end, i_start, j_start, &image[0].image[0].matrix, &image[0].picture);188 189 assert (i_start <= i_end);190 assert (j_start <= j_end);191 192 Ix = image[0].picture.flipx ? I_start - 1 : I_start;193 Iy = image[0].picture.flipy ? J_start - 1 : J_start;194 195 inDX = image[0].picture.flipx ? -1 : +1;196 inDY = image[0].picture.flipy ? -1 : +1;197 198 dropback = expand_out - (i_end - i_start) % expand_out;199 if ((i_end - i_start) % expand_out == 0) dropback = 0;200 201 ALLOCATE (line_buffer, bDrawColor, 3*dx);202 203 in_pix_ref = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)];204 205 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/206 207 /**** fill in bottom area ****/208 out_pix = line_buffer;209 for (i = 0; i < dx; i++, out_pix+=3) {210 out_pix[0] = WHITE_R;211 out_pix[1] = WHITE_G;212 out_pix[2] = WHITE_B;213 }214 for (j = 0; j < j_start; j++) {215 memcpy (buffer[0].pixels[j], line_buffer, 3*dx);216 }217 218 /*** fill in the image data region ***/219 for (j = j_start; j < j_end; j+= expand_out, in_pix_ref += inDY*expand_in*DX) {220 221 /* create one output image line */222 in_pix = in_pix_ref;223 out_pix = line_buffer;224 225 /**** fill in area to the left of the picture ****/226 for (i = 0; i < i_start; i++, out_pix+=3) {227 out_pix[0] = WHITE_R;228 out_pix[1] = WHITE_G;229 out_pix[2] = WHITE_B;230 }231 232 /*** fill in the picture region ***/233 for (i = i_start; i < i_end; i+=expand_out, in_pix += inDX*expand_in) {234 for (ii = 0; ii < expand_out; ii++, out_pix+=3) {235 out_pix[0] = pixel1[*in_pix];236 out_pix[1] = pixel2[*in_pix];237 out_pix[2] = pixel3[*in_pix];238 }239 }240 241 /**** fill in area to the right of the picture ****/242 for (i = i_end; i < dx; i++, out_pix+=3) {243 out_pix[0] = WHITE_R;244 out_pix[1] = WHITE_G;245 out_pix[2] = WHITE_B;246 }247 248 /* write out the image line expand_out times */249 for (i = 0; i < expand_out; i++) {250 memcpy (buffer[0].pixels[j + i], line_buffer, 3*dx);251 }252 }253 254 /**** fill in top area ****/255 out_pix = line_buffer;256 for (i = 0; i < dx; i++, out_pix+=3) {257 out_pix[0] = WHITE_R;258 out_pix[1] = WHITE_G;259 out_pix[2] = WHITE_B;260 }261 for (j = j_end; j < dy; j++) {262 memcpy (buffer[0].pixels[j], line_buffer, 3*dx);263 }264 265 free (pixel1);266 free (pixel2);267 free (pixel3);268 free (line_buffer);269 270 return (TRUE);271 }272 273 # if (0)274 275 /* I need to write the overlay objects on the jpeg image.276 if i can write / overwrite data in jpeg buffer, then do it here,277 otherwise i need to create a temporary image buffer, then write the278 scanlines to that buffer */279 280 {281 int Npalette;282 png_color *palette;283 bDrawColor white, color;284 bDrawBuffer *buffer;285 286 palette = KapaPNGPalette (&Npalette);287 288 buffer = bDrawBufferCreate (dx, dy);289 bDrawSetBuffer (buffer);290 for (i = 0; i < NOVERLAYS; i++) {291 if (image[i].overlay[i].active) bDrawOverlay (image, i);292 }293 294 white = KapaColorByName ("white");295 for (j = 0; j < dy; j++) {296 for (i = 0; i < dx; i++) {297 color = buffer[0].pixels[j][i];298 if (color == white) continue;299 image_buffer[j*3*dx + 3*i + 0] = palette[color].red;300 image_buffer[j*3*dx + 3*i + 1] = palette[color].green;301 image_buffer[j*3*dx + 3*i + 2] = palette[color].blue;302 }303 }304 bDrawBufferFree (buffer);305 }306 307 # endif -
branches/czw_branch/20101203/Ohana/src/kapa2/src/PPMit.c
r27435 r30118 30 30 fprintf (f, "255\n"); 31 31 32 buffer = bDrawIt ( );32 buffer = bDrawIt (palette, Npalette, 1); 33 33 34 34 ALLOCATE (line, char, 3*dx); … … 47 47 bDrawBufferFree (buffer); 48 48 return (TRUE); 49 50 49 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/PSFrame.c
r29539 r30118 4 4 int PSFrame (KapaGraphWidget *graph, FILE *f) { 5 5 6 int i, j, Nticks, P ;7 double fx, fy, dfx, dfy, lweight;6 int i, j, Nticks, P, doffset; 7 double fx, fy, dfx, dfy, dx = 0, dy = 0, lweight; 8 8 Graphic *graphic; 9 9 TickMarkData *ticks; … … 15 15 fprintf (f, "1 setlinewidth\n"); 16 16 for (i = 0; i < 4; i++) { 17 fx = graph[0].axis[i].fx;18 fy = graphic->dy - graph[0].axis[i].fy;19 dfx = graph[0].axis[i].dfx;20 dfy = -graph[0].axis[i].dfy;21 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy);22 23 17 lweight = MAX (0, MIN (10, graph[0].axis[i].lweight)); 24 18 color = MAX (0, MIN (15, graph[0].axis[i].color)); 19 20 /* temporarily assume rectilinear axes */ 21 doffset = ((int)(lweight) % 2) ? 0.5*(lweight - 1) : 0.5*lweight; 22 if (i == 0) { dx = doffset; dy = 0.0; } 23 if (i == 2) { dx = doffset; dy = 0.0; } 24 if (i == 1) { dx = 0.0; dy = doffset; } 25 if (i == 3) { dx = 0.0; dy = doffset; } 26 27 fx = graph[0].axis[i].fx - dx; 28 fy = graphic->dy - graph[0].axis[i].fy - dy; 29 dfx = graph[0].axis[i].dfx + 2*dx; 30 dfy = -graph[0].axis[i].dfy + 2*dy; 31 32 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy); 33 P *= (1 + 0.25*lweight); 25 34 26 35 fprintf (f, "%.1f setlinewidth\n", lweight); … … 95 104 yt = fy + (value-min)*dfy/(max - min) + dy; 96 105 97 PrintTick (string, value, min, max );106 PrintTick (string, value, min, max, tick->nsignif); 98 107 PSRotText (f, xt, yt, string, pos, 0.0); 99 108 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/PSimage.c
r14913 r30118 13 13 graphic = GetGraphic(); 14 14 15 fprintf (f, " newpath 0 0 moveto %d 0 lineto %d %d lineto 0 %d lineto closepath clip\n\n", 16 image[0].picture.dx, image[0].picture.dx, image[0].picture.dy, image[0].picture.dy); 15 fprintf (f, " newpath %d %d moveto %d %d lineto %d %d lineto %d %d lineto closepath\n\n", 16 (int) image[0].picture.x, graphic->dy - (int) image[0].picture.y, 17 (int) image[0].picture.x + image[0].picture.dx, graphic->dy - (int) image[0].picture.y, 18 (int) image[0].picture.x + image[0].picture.dx, graphic->dy - (int) image[0].picture.y - image[0].picture.dy, 19 (int) image[0].picture.x, graphic->dy - (int) image[0].picture.y - image[0].picture.dy); 17 20 fprintf (f, "gsave %% encloses image\n"); 21 fprintf (f, "%d %d translate\n", (int) image[0].picture.x, graphic->dy - (int) image[0].picture.y - image[0].picture.dy); 18 22 fprintf (f, "%d %d 8\n", image[0].picture.dx, image[0].picture.dy); 19 23 fprintf (f, "[1 0 0 1 0 0]\n"); -
branches/czw_branch/20101203/Ohana/src/kapa2/src/PSit.c
r13479 r30118 87 87 for (i = 0; i < Nsection; i++) { 88 88 section = GetSectionByNumber (i); 89 if (section->image) { 90 PSimage (section->image, f); 91 } 89 92 if (section->graph) { 90 93 PSFrame (section->graph, f); … … 92 95 PSLabels (section->graph, f); 93 96 PSTextlines (section->graph, f); 94 }95 if (section->image) {96 PSimage (section->image, f);97 97 } 98 98 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/Resize.c
r26891 r30118 39 39 return (TRUE); 40 40 } 41 42 // resise the window so the image in the currently active window fills its section 43 int ResizeByImage (int sock) { 44 45 int i, Nsection; 46 unsigned int NX, NY; 47 double dx, dy; 48 int dXm, dXp, dYm, dYp; 49 double x0, y0, x1, y1, expand; 50 Section *section; 51 Graphic *graphic; 52 KapaImageWidget *image; 53 54 graphic = GetGraphic(); 55 56 section = GetActiveSection(); 57 58 image = section->image; 59 if (!image) { 60 fprintf (stderr, "no image to define size\n"); 61 return (TRUE); 62 } 63 64 GetGraphBoundary (section, &x0, &y0, &x1, &y1, &dXm, &dXp, &dYm, &dYp); 65 66 expand = 1.0; 67 if (image[0].picture.expand > 0) { 68 expand = image[0].picture.expand; 69 } 70 if (image[0].picture.expand < 0) { 71 expand = 1.0 / fabs((double)image[0].picture.expand); 72 } 73 74 // pixel dimensions of the imaging region + boundary 75 dx = image[0].image[0].matrix.Naxis[0]*expand + x1; 76 dy = image[0].image[0].matrix.Naxis[1]*expand + y1; 77 78 NX = dx / section[0].dx; 79 NY = dy / section[0].dy; 80 81 NX = MAX(NX, MIN_WIDTH); 82 NY = MAX(NY, MIN_HEIGHT); 83 84 // if the new size is the same as the old size, do nothing. 85 if ((graphic->dx == NX) && (graphic->dy == NY)) return (TRUE); 86 87 // set the new window size 88 graphic->dx = NX; 89 graphic->dy = NY; 90 91 if (USE_XWINDOW) XResizeWindow (graphic->display, graphic->window, NX, NY); 92 93 // reset the sizes for all sections 94 Nsection = GetNumberOfSections (); 95 for (i = 0; i < Nsection; i++) { 96 section = GetSectionByNumber (i); 97 SetSectionSizes (section); 98 } 99 100 if (USE_XWINDOW) XClearWindow (graphic->display, graphic->window); 101 Refresh (); 102 103 return (TRUE); 104 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/SetGraphSize.c
r29539 r30118 5 5 6 6 void SetGraphSize (Section *section) { 7 8 int dXm, dXp, dYm, dYp; 9 double x0, y0, x1, y1; 10 KapaGraphWidget *graph; 11 Graphic *graphic; 12 13 GetGraphBoundary(section, &x0, &y0, &x1, &y1, &dXm, &dXp, &dYm, &dYp); 14 15 if (section == NULL) return; 16 graph = section->graph; 17 if (graph == NULL) return; 18 19 graphic = GetGraphic (); 20 21 double X0 = graphic[0].dx * section[0].x + x0; 22 double Y0 = graphic[0].dy * section[0].y + y0; 23 double dX = graphic[0].dx * section[0].dx - x1; 24 double dY = graphic[0].dy * section[0].dy - y1; 25 26 /* define locations of coordinate axes */ 27 graph[0].axis[0].fx = X0; 28 graph[0].axis[0].fy = graphic->dy - Y0; 29 graph[0].axis[0].dfx = dX; 30 graph[0].axis[0].dfy = 0; 31 32 graph[0].axis[1].fx = X0; 33 graph[0].axis[1].fy = graphic->dy - Y0; 34 graph[0].axis[1].dfx = 0; 35 graph[0].axis[1].dfy = -dY; 36 37 graph[0].axis[2].fx = X0; 38 graph[0].axis[2].fy = graphic->dy - Y0 - dY; 39 graph[0].axis[2].dfx = dX; 40 graph[0].axis[2].dfy = 0; 41 42 graph[0].axis[3].fx = X0 + dX; 43 graph[0].axis[3].fy = graphic->dy - Y0; 44 graph[0].axis[3].dfx = 0; 45 graph[0].axis[3].dfy = -dY; 46 47 /* define locations of axis labels */ 48 graph[0].label[LABELLL].x = graph[0].axis[0].fx; 49 graph[0].label[LABELLL].y = graph[0].axis[0].fy + dXm; 50 graph[0].label[LABELX0].x = graph[0].axis[0].fx + 0.5*graph[0].axis[0].dfx; 51 graph[0].label[LABELX0].y = graph[0].axis[0].fy + dXm; 52 graph[0].label[LABELLR].x = graph[0].axis[0].fx + graph[0].axis[0].dfx; 53 graph[0].label[LABELLR].y = graph[0].axis[0].fy + dXm; 54 55 graph[0].label[LABELUL].x = graph[0].axis[2].fx; 56 graph[0].label[LABELUL].y = graph[0].axis[2].fy - dXp; 57 graph[0].label[LABELX1].x = graph[0].axis[2].fx + 0.5*graph[0].axis[2].dfx; 58 graph[0].label[LABELX1].y = graph[0].axis[2].fy - dXp; 59 graph[0].label[LABELUR].x = graph[0].axis[2].fx + graph[0].axis[2].dfx; 60 graph[0].label[LABELUR].y = graph[0].axis[2].fy - dXp; 61 62 graph[0].label[LABELY0].y = graph[0].axis[1].fy + 0.5*graph[0].axis[1].dfy; 63 graph[0].label[LABELY0].x = graph[0].axis[1].fx - dYm; 64 65 graph[0].label[LABELY1].y = graph[0].axis[3].fy + 0.5*graph[0].axis[3].dfy; 66 graph[0].label[LABELY1].x = graph[0].axis[3].fx + dYp; 67 68 return; 69 } 70 71 int GetGraphBoundary (Section *section, double *x0, double *y0, double *x1, double *y1, int *dXm, int *dXp, int *dYm, int *dYp) { 7 72 8 73 int i, Nticks; 9 74 int fontsize, Nc = 0; 10 75 int textpad, textdY, WdY; 11 int dXm, dXp, dYm, dYp;12 76 double padXm, padXp, padYm, padYp; 13 77 double minPADx, maxPADx, minPADy; 14 78 double minPAD, maxPAD; 15 double X0, Y0, dX, dY;16 79 char string[64], *fontname; 17 80 KapaGraphWidget *graph; … … 19 82 TickMarkData *ticks; 20 83 21 if (section == NULL) return; 84 *x0 = 0.0; 85 *y0 = 0.0; 86 *x1 = 0.0; 87 *y1 = 0.0; 88 89 *dXm = 0; 90 *dXp = 0; 91 *dYm = 0; 92 *dYp = 0; 93 94 if (section == NULL) return FALSE; 22 95 graph = section->graph; 23 if (graph == NULL) return ;96 if (graph == NULL) return FALSE; 24 97 25 98 graphic = GetGraphic (); … … 40 113 // these depend on (a) existence of tick labels and (b) auto-offset or not 41 114 if (isnan(graph[0].axis[0].labelPad)) { 42 dXm = (graph[0].axis[0].islabel) ? maxPAD : minPAD;43 } else { 44 dXm = graph[0].axis[0].labelPad * fontsize;115 *dXm = (graph[0].axis[0].islabel) ? maxPAD : minPAD; 116 } else { 117 *dXm = graph[0].axis[0].labelPad * fontsize; 45 118 } 46 119 if (isnan(graph[0].axis[0].pad)) { … … 53 126 // these depend on (a) existence of tick labels and (b) auto-offset or not 54 127 if (isnan(graph[0].axis[2].labelPad)) { 55 dXp = (graph[0].axis[2].islabel) ? maxPAD : minPAD;56 } else { 57 dXp = graph[0].axis[2].labelPad * fontsize;128 *dXp = (graph[0].axis[2].islabel) ? maxPAD : minPAD; 129 } else { 130 *dXp = graph[0].axis[2].labelPad * fontsize; 58 131 } 59 132 if (isnan(graph[0].axis[2].pad)) { … … 73 146 if (!ticks[i].IsMajor) continue; 74 147 75 int Nchar = PrintTick (string, ticks[i].value, graph[0].axis[1].min, graph[0].axis[1].max );148 int Nchar = PrintTick (string, ticks[i].value, graph[0].axis[1].min, graph[0].axis[1].max, ticks[i].nsignif); 76 149 77 150 Nc = MAX (Nc, Nchar); … … 80 153 } 81 154 if (isnan(graph[0].axis[1].labelPad)) { 82 dYm = (graph[0].axis[1].islabel) ? (0.7*(Nc + 1.5)*fontsize) : minPAD;83 } else { 84 dYm = graph[0].axis[1].labelPad * fontsize;155 *dYm = (graph[0].axis[1].islabel) ? (0.7*(Nc + 1.5)*fontsize) : minPAD; 156 } else { 157 *dYm = graph[0].axis[1].labelPad * fontsize; 85 158 } 86 159 if (isnan(graph[0].axis[1].pad)) { … … 98 171 for (i = 0; i < Nticks; i++) { 99 172 if (!ticks[i].IsMajor) continue; 100 int Nchar = PrintTick (string, ticks[i].value, graph[0].axis[3].min, graph[0].axis[3].max );173 int Nchar = PrintTick (string, ticks[i].value, graph[0].axis[3].min, graph[0].axis[3].max, ticks[i].nsignif); 101 174 Nc = MAX (Nc, Nchar); 102 175 } … … 104 177 } 105 178 if (isnan(graph[0].axis[3].labelPad)) { 106 dYp = (graph[0].axis[3].islabel) ? (0.7*(Nc + 1.5)*fontsize) : minPAD;107 } else { 108 dYp = graph[0].axis[3].labelPad * fontsize;179 *dYp = (graph[0].axis[3].islabel) ? (0.7*(Nc + 1.5)*fontsize) : minPAD; 180 } else { 181 *dYp = graph[0].axis[3].labelPad * fontsize; 109 182 } 110 183 if (isnan(graph[0].axis[3].pad)) { … … 115 188 116 189 /* basic size of the graph in Xwindow coordinates, but measured from lower-left corner */ 117 X0 = graphic[0].dx * section[0].x +padYm;118 Y0 = graphic[0].dy * section[0].y +padXm;119 dX = graphic[0].dx * section[0].dx - padYm -padYp;120 dY = graphic[0].dy * section[0].dy - padXm -padXp;190 *x0 = padYm; 191 *y0 = padXm; 192 *x1 = padYm + padYp; 193 *y1 = padXm + padXp; 121 194 122 195 // if we are tied to an image, make mods as needed … … 128 201 switch (section->image->location) { 129 202 case 0: 130 // no changes?131 203 break; 132 204 case 1: 133 Y0 = graphic[0].dy * section[0].y + padXm+ 2*PAD1 + WdY + 2;134 dY = graphic[0].dy * section[0].dy - padXm - padXp - 4*PAD1 - 1 - WdY -COLORPAD;205 *y0 = padXm + 2*PAD1 + WdY + 2; 206 *y1 = padXm + padXp + 4*PAD1 + 1 + WdY + COLORPAD; 135 207 break; 136 208 case 3: 137 dY = graphic[0].dy * section[0].dy - padXm - padXp - 4*PAD1 - 1 - WdY -COLORPAD;209 *y1 = padXm + padXp + 4*PAD1 + 1 + WdY + COLORPAD; 138 210 break; 139 211 case 2: 140 X0 = graphic[0].dx * section[0].x + padYm+ 2*PAD1 + ZOOM_X;141 dX = graphic[0].dx * section[0].dx - padYm - padYp - 3*PAD1 -ZOOM_X;142 dY = graphic[0].dy * section[0].dy - padXm - padXp - 2*PAD1 -COLORPAD;212 *x0 = padYm + 2*PAD1 + ZOOM_X; 213 *x1 = padYm + padYp + 3*PAD1 + ZOOM_X; 214 *y1 = padXm + padXp + 2*PAD1 + COLORPAD; 143 215 break; 144 216 case 4: 145 dX = graphic[0].dx * section[0].dx - padYm - padYp - 3*PAD1 -ZOOM_X;146 dY = graphic[0].dy * section[0].dy - padXm - padXp - 2*PAD1 -COLORPAD;217 *x1 = padYm + padYp + 3*PAD1 + ZOOM_X; 218 *y1 = padXm + padXp + 2*PAD1 + COLORPAD; 147 219 break; 148 220 } 149 221 } 150 222 151 /* define locations of coordinate axes */ 152 graph[0].axis[0].fx = X0; 153 graph[0].axis[0].fy = graphic->dy - Y0; 154 graph[0].axis[0].dfx = dX; 155 graph[0].axis[0].dfy = 0; 156 157 graph[0].axis[1].fx = X0; 158 graph[0].axis[1].fy = graphic->dy - Y0; 159 graph[0].axis[1].dfx = 0; 160 graph[0].axis[1].dfy = -dY; 161 162 graph[0].axis[2].fx = X0; 163 graph[0].axis[2].fy = graphic->dy - Y0 - dY; 164 graph[0].axis[2].dfx = dX; 165 graph[0].axis[2].dfy = 0; 166 167 graph[0].axis[3].fx = X0 + dX; 168 graph[0].axis[3].fy = graphic->dy - Y0; 169 graph[0].axis[3].dfx = 0; 170 graph[0].axis[3].dfy = -dY; 171 172 /* define locations of axis labels */ 173 graph[0].label[LABELLL].x = graph[0].axis[0].fx; 174 graph[0].label[LABELLL].y = graph[0].axis[0].fy + dXm; 175 graph[0].label[LABELX0].x = graph[0].axis[0].fx + 0.5*graph[0].axis[0].dfx; 176 graph[0].label[LABELX0].y = graph[0].axis[0].fy + dXm; 177 graph[0].label[LABELLR].x = graph[0].axis[0].fx + graph[0].axis[0].dfx; 178 graph[0].label[LABELLR].y = graph[0].axis[0].fy + dXm; 179 180 graph[0].label[LABELUL].x = graph[0].axis[2].fx; 181 graph[0].label[LABELUL].y = graph[0].axis[2].fy - dXp; 182 graph[0].label[LABELX1].x = graph[0].axis[2].fx + 0.5*graph[0].axis[2].dfx; 183 graph[0].label[LABELX1].y = graph[0].axis[2].fy - dXp; 184 graph[0].label[LABELUR].x = graph[0].axis[2].fx + graph[0].axis[2].dfx; 185 graph[0].label[LABELUR].y = graph[0].axis[2].fy - dXp; 186 187 graph[0].label[LABELY0].y = graph[0].axis[1].fy + 0.5*graph[0].axis[1].dfy; 188 graph[0].label[LABELY0].x = graph[0].axis[1].fx - dYm; 189 190 graph[0].label[LABELY1].y = graph[0].axis[3].fy + 0.5*graph[0].axis[3].dfy; 191 graph[0].label[LABELY1].x = graph[0].axis[3].fx + dYp; 192 193 // fprintf (stderr, "section %s, %f,%f : %f,%f\n", section->name, X0, Y0, dX, dY); 194 195 /* these are wrong and have to be adjusted to sit in the corners */ 196 223 return (TRUE); 197 224 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/bDrawFrame.c
r29539 r30118 2 2 // bDrawLine is a function, not a macro like DrawLine 3 3 4 int bDrawFrame ( KapaGraphWidget *graph) {4 int bDrawFrame (bDrawBuffer *buffer, KapaGraphWidget *graph) { 5 5 6 int i, j, Nticks, P ;7 double fx, fy, dfx, dfy, lweight ;6 int i, j, Nticks, P, doffset; 7 double fx, fy, dfx, dfy, lweight, dx = 0, dy = 0; 8 8 // Graphic graphic; is not needed 9 9 TickMarkData *ticks; … … 14 14 /* each axis is drawn independently */ 15 15 for (i = 0; i < 4; i++) { 16 fx = graph[0].axis[i].fx;17 fy = graph[0].axis[i].fy;18 dfx = graph[0].axis[i].dfx;19 dfy = graph[0].axis[i].dfy;20 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy);21 22 16 lweight = MAX (0, MIN (10, graph[0].axis[i].lweight)); 23 17 color = MAX (0, MIN (15, graph[0].axis[i].color)); 24 18 25 bDrawSetStyle (color, lweight, 0); 26 // function about sets solor and weight 19 /* temporarily assume rectilinear axes */ 20 doffset = ((int)(lweight) % 2) ? 0.5*(lweight - 1) : 0.5*lweight; 21 if (i == 0) { dx = doffset; dy = 0.0; } 22 if (i == 2) { dx = doffset; dy = 0.0; } 23 if (i == 1) { dx = 0.0; dy = doffset; } 24 if (i == 3) { dx = 0.0; dy = doffset; } 25 26 fx = graph[0].axis[i].fx - dx; 27 fy = graph[0].axis[i].fy - dy; 28 dfx = graph[0].axis[i].dfx + 2*dx; 29 dfy = graph[0].axis[i].dfy + 2*dy; 30 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy); 31 P *= (1 + 0.25*lweight); 32 33 bDrawSetStyle (buffer, color, lweight, 0); 34 // function about sets color and weight 27 35 // bDrawRotTextInit does not exist 28 36 29 37 if (graph[0].axis[i].isaxis) { 30 bDrawLine ( fx, fy, fx+dfx, fy+dfy);38 bDrawLine (buffer, fx, fy, fx+dfx, fy+dfy); 31 39 } 32 40 … … 34 42 ticks = CreateAxisTicks (&graph[0].axis[i], &Nticks); 35 43 for (j = 0; j < Nticks; j++) { 36 bDrawTick (&graph[0].axis[i], P, &ticks[j], i); 44 bDrawTick (buffer, &graph[0].axis[i], P, &ticks[j], i); 45 46 // XXX DrawTick sets the style to (color, 0, 0) for the font 47 // should the font weight stay the same? 48 // XXX probably not needed now: 49 // bDrawSetStyle (buffer, color, lweight, 0); 37 50 } 38 51 FREE (ticks); … … 42 55 } 43 56 44 void bDrawTick ( Axis *axis, int P, TickMarkData *tick, int naxis) {57 void bDrawTick (bDrawBuffer *buffer, Axis *axis, int P, TickMarkData *tick, int naxis) { 45 58 46 59 double x, y, dx, dy; … … 75 88 dy = dir*size*dfx*n; 76 89 77 bDrawLine ( x, y, x+dx, y+dy);90 bDrawLine (buffer, x, y, x+dx, y+dy); 78 91 79 92 if (tick->IsLabel) { … … 94 107 yt = fy + (value-min)*dfy/(max - min) + dy; 95 108 96 PrintTick (string, value, min, max );97 bDrawRotText ( xt, yt, string, pos, 0.0);109 PrintTick (string, value, min, max, tick->nsignif); 110 bDrawRotText (buffer, xt, yt, string, pos, 0.0); 98 111 } 99 112 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/bDrawIt.c
r13479 r30118 1 1 # include "Ximage.h" 2 2 3 bDrawBuffer *bDrawIt ( ) {3 bDrawBuffer *bDrawIt (png_color *palette, int Npalette, int Nbyte) { 4 4 5 5 int i, Nsection; … … 13 13 black = KapaColorByName ("black"); 14 14 15 buffer = bDrawBufferCreate (graphic->dx, graphic->dy); 16 bDrawSetBuffer (buffer); 17 bDrawSetStyle (black, 0, 0); 15 buffer = bDrawBufferCreate (graphic->dx, graphic->dy, Nbyte, palette, Npalette); 16 bDrawSetStyle (buffer, black, 0, 0); 18 17 19 18 // reset the sizes for all sections … … 21 20 for (i = 0; i < Nsection; i++) { 22 21 section = GetSectionByNumber (i); 23 bDraw Graph (section->graph);24 // bDrawImage (section->image);22 bDrawImage (buffer, section->image, graphic); 23 bDrawGraph (buffer, section->graph); 25 24 } 26 25 … … 28 27 } 29 28 30 void bDrawGraph ( KapaGraphWidget *graph) {29 void bDrawGraph (bDrawBuffer *buffer, KapaGraphWidget *graph) { 31 30 if (graph == NULL) return; 32 bDrawFrame ( graph);33 bDrawObjects ( graph);34 bDrawLabels ( graph);35 bDrawTextlines ( graph);31 bDrawFrame (buffer, graph); 32 bDrawObjects (buffer, graph); 33 bDrawLabels (buffer, graph); 34 bDrawTextlines (buffer, graph); 36 35 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/bDrawLabels.c
r13320 r30118 1 1 # include "Ximage.h" 2 2 3 void bDrawLabels ( KapaGraphWidget *graph) {3 void bDrawLabels (bDrawBuffer *buffer, KapaGraphWidget *graph) { 4 4 5 5 int i, pos, x, y, size; … … 25 25 y = graph[0].label[i].y; 26 26 SetRotFont (graph[0].label[i].font, graph[0].label[i].size); 27 bDrawRotText ( x, y, graph[0].label[i].text, pos, angle);27 bDrawRotText (buffer, x, y, graph[0].label[i].text, pos, angle); 28 28 } 29 29 } … … 31 31 } 32 32 33 void bDrawTextlines ( KapaGraphWidget *graph) {33 void bDrawTextlines (bDrawBuffer *buffer, KapaGraphWidget *graph) { 34 34 35 35 int i, x, y, size; … … 44 44 y = graph[0].textline[i].y; 45 45 SetRotFont (graph[0].textline[i].font, graph[0].textline[i].size); 46 bDrawRotText ( x, y, graph[0].textline[i].text, 5, angle);46 bDrawRotText (buffer, x, y, graph[0].textline[i].text, 5, angle); 47 47 } 48 48 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/bDrawObjects.c
r27530 r30118 1 1 # include "Ximage.h" 2 2 3 # define DrawLine( X1,Y1,X2,Y2) (bDrawLine ((X1), (Y1), (X2), (Y2)))4 # define DrawCircle( X1,Y1,R) (bDrawCircle ((X1), (Y1), (R)))5 # define DrawRectangle( X,Y,dX,dY) (bDrawRectOpen ((X-0.5*dX), (Y-0.5*dY), (X+0.5*dX), (Y+0.5*dY)))6 # define FillRectangle( X,Y,dX,dY) (bDrawRectFill ((X-0.5*dX), (Y-0.5*dY), (X+0.5*dX), (Y+0.5*dY)))7 # define FillTriangle( X1,Y1,X2,Y2,X3,Y3) (bDrawTriFill ((X1), (Y1), (X2), (Y2), (X3), (Y3)))8 # define OpenTriangle( X1,Y1,X2,Y2,X3,Y3) (bDrawTriOpen ((X1), (Y1), (X2), (Y2), (X3), (Y3)))3 # define DrawLine(BUF,X1,Y1,X2,Y2) (bDrawLine (BUF, (X1), (Y1), (X2), (Y2))) 4 # define DrawCircle(BUF,X1,Y1,R) (bDrawCircle (BUF, (X1), (Y1), (R))) 5 # define DrawRectangle(BUF,X,Y,dX,dY) (bDrawRectOpen (BUF, (X-0.5*dX), (Y-0.5*dY), (X+0.5*dX), (Y+0.5*dY))) 6 # define FillRectangle(BUF,X,Y,dX,dY) (bDrawRectFill (BUF, (X-0.5*dX), (Y-0.5*dY), (X+0.5*dX), (Y+0.5*dY))) 7 # define FillTriangle(BUF,X1,Y1,X2,Y2,X3,Y3) (bDrawTriFill (BUF, (X1), (Y1), (X2), (Y2), (X3), (Y3))) 8 # define OpenTriangle(BUF,X1,Y1,X2,Y2,X3,Y3) (bDrawTriOpen (BUF, (X1), (Y1), (X2), (Y2), (X3), (Y3))) 9 9 10 10 # define CONNECT 0 … … 14 14 static Graphic *graphic; 15 15 16 int bDrawObjects ( KapaGraphWidget *graph) {16 int bDrawObjects (bDrawBuffer *buffer, KapaGraphWidget *graph) { 17 17 18 18 int i; … … 30 30 type = graph[0].objects[i].ltype; 31 31 color = graph[0].objects[i].color; 32 bDrawSetStyle ( color, weight, type);32 bDrawSetStyle (buffer, color, weight, type); 33 33 34 34 switch (graph[0].objects[i].style) { 35 35 case CONNECT: 36 bDrawConnect ( graph, &graph[0].objects[i]);36 bDrawConnect (buffer, graph, &graph[0].objects[i]); 37 37 break; 38 38 case HISTOGRAM: 39 bDrawHistogram ( graph, &graph[0].objects[i]);39 bDrawHistogram (buffer, graph, &graph[0].objects[i]); 40 40 break; 41 41 case POINTS: 42 bDrawPoints ( graph, &graph[0].objects[i]);42 bDrawPoints (buffer, graph, &graph[0].objects[i]); 43 43 break; 44 44 } 45 45 46 46 if (graph[0].objects[i].etype & 0x01) { 47 bDrawYErrors ( graph, &graph[0].objects[i]);47 bDrawYErrors (buffer, graph, &graph[0].objects[i]); 48 48 } 49 49 if (graph[0].objects[i].etype & 0x02) { 50 bDrawXErrors ( graph, &graph[0].objects[i]);51 } 52 } 53 bDrawSetStyle (b lack, 0, 0);50 bDrawXErrors (buffer, graph, &graph[0].objects[i]); 51 } 52 } 53 bDrawSetStyle (buffer, black, 0, 0); 54 54 return (TRUE); 55 55 } 56 56 57 void bDrawConnect ( KapaGraphWidget *graph, Gobjects *object) {57 void bDrawConnect (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 58 58 59 59 int i; … … 91 91 sx1 = x[i]*mxi + y[i]*mxj + bx; 92 92 sy1 = x[i]*myi + y[i]*myj + by; 93 bDrawClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);93 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 94 94 sx0 = sx1; sy0 = sy1; 95 95 } 96 96 } 97 97 98 void bDrawClipLine ( double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0) {98 void bDrawClipLine (bDrawBuffer *buffer, double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0) { 99 99 100 100 /* skip line segement if both points are beyond box */ … … 145 145 y1 = Y1; 146 146 } 147 DrawLine ( x0, y0, x1, y1);147 DrawLine (buffer, x0, y0, x1, y1); 148 148 } 149 149 150 150 /*******/ 151 void bDrawHistogram ( KapaGraphWidget *graph, Gobjects *object) {151 void bDrawHistogram (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 152 152 153 153 int i; … … 192 192 sy1 = MAX (MIN (sy1, Y0), Y1); 193 193 sxa = 0.5*(sx0 + sx1); 194 DrawLine ( sx0, sy0, sxa, sy0);195 DrawLine ( sxa, sy0, sxa, sy1);196 DrawLine ( sxa, sy1, sx1, sy1);194 DrawLine (buffer, sx0, sy0, sxa, sy0); 195 DrawLine (buffer, sxa, sy0, sxa, sy1); 196 DrawLine (buffer, sxa, sy1, sx1, sy1); 197 197 sx0 = sx1; sy0 = sy1; 198 198 } … … 200 200 201 201 /*******/ 202 void bDrawPoints ( KapaGraphWidget *graph, Gobjects *object) {202 void bDrawPoints (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 203 203 204 204 int i; … … 233 233 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 234 234 { 235 FillRectangle ( sx, sy, 2*d*z[i], 2*d*z[i]);235 FillRectangle (buffer, sx, sy, 2*d*z[i], 2*d*z[i]); 236 236 } 237 237 } … … 245 245 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 246 246 { 247 DrawRectangle ( sx, sy, 2*d*z[i], 2*d*z[i]);247 DrawRectangle (buffer, sx, sy, 2*d*z[i], 2*d*z[i]); 248 248 } 249 249 } … … 257 257 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 258 258 { 259 DrawLine ( sx - d*z[i], sy, sx + d*z[i], sy);260 DrawLine ( sx, sy - d*z[i], sx, sy + d*z[i]);259 DrawLine (buffer, sx - d*z[i], sy, sx + d*z[i], sy); 260 DrawLine (buffer, sx, sy - d*z[i], sx, sy + d*z[i]); 261 261 } 262 262 } … … 270 270 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 271 271 { 272 DrawLine ( sx + d*z[i], sy - d*z[i], sx - d*z[i], sy + d*z[i]);273 DrawLine ( sx - d*z[i], sy - d*z[i], sx + d*z[i], sy + d*z[i]);272 DrawLine (buffer, sx + d*z[i], sy - d*z[i], sx - d*z[i], sy + d*z[i]); 273 DrawLine (buffer, sx - d*z[i], sy - d*z[i], sx + d*z[i], sy + d*z[i]); 274 274 } 275 275 } … … 283 283 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 284 284 { 285 FillTriangle ( sx - d*z[i], sy - 0.58*d*z[i], sx + d*z[i], sy - 0.58*d*z[i], sx, sy + 1.15*d*z[i]);285 FillTriangle (buffer, sx - d*z[i], sy - 0.58*d*z[i], sx + d*z[i], sy - 0.58*d*z[i], sx, sy + 1.15*d*z[i]); 286 286 } 287 287 } … … 295 295 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 296 296 { 297 OpenTriangle ( sx - d*z[i], sy + 0.58*d*z[i], sx, sy - 1.15*d*z[i], sx + d*z[i], sy + 0.58*d*z[i]);297 OpenTriangle (buffer, sx - d*z[i], sy + 0.58*d*z[i], sx, sy - 1.15*d*z[i], sx + d*z[i], sy + 0.58*d*z[i]); 298 298 } 299 299 } … … 307 307 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 308 308 { 309 DrawLine ( sx, sy, sx - d*z[i], sy + 0.58*d*z[i]);310 DrawLine ( sx, sy, sx + d*z[i], sy + 0.58*d*z[i]);311 DrawLine ( sx, sy, sx, sy - 1.15*d*z[i]);309 DrawLine (buffer, sx, sy, sx - d*z[i], sy + 0.58*d*z[i]); 310 DrawLine (buffer, sx, sy, sx + d*z[i], sy + 0.58*d*z[i]); 311 DrawLine (buffer, sx, sy, sx, sy - 1.15*d*z[i]); 312 312 } 313 313 } … … 321 321 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 322 322 { 323 DrawCircle ( sx, sy, d*z[i]);323 DrawCircle (buffer, sx, sy, d*z[i]); 324 324 } 325 325 } … … 333 333 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 334 334 { 335 DrawLine ( sx + 0.00*d*z[i], sy - 1.00*d*z[i], sx + 0.95*d*z[i], sy - 0.31*d*z[i]);336 DrawLine ( sx + 0.95*d*z[i], sy - 0.31*d*z[i], sx + 0.58*d*z[i], sy + 0.81*d*z[i]);337 DrawLine ( sx + 0.58*d*z[i], sy + 0.81*d*z[i], sx - 0.58*d*z[i], sy + 0.81*d*z[i]);338 DrawLine ( sx - 0.58*d*z[i], sy + 0.81*d*z[i], sx - 0.95*d*z[i], sy - 0.31*d*z[i]);339 DrawLine ( sx - 0.95*d*z[i], sy - 0.31*d*z[i], sx + 0.00*d*z[i], sy - 1.00*d*z[i]);335 DrawLine (buffer, sx + 0.00*d*z[i], sy - 1.00*d*z[i], sx + 0.95*d*z[i], sy - 0.31*d*z[i]); 336 DrawLine (buffer, sx + 0.95*d*z[i], sy - 0.31*d*z[i], sx + 0.58*d*z[i], sy + 0.81*d*z[i]); 337 DrawLine (buffer, sx + 0.58*d*z[i], sy + 0.81*d*z[i], sx - 0.58*d*z[i], sy + 0.81*d*z[i]); 338 DrawLine (buffer, sx - 0.58*d*z[i], sy + 0.81*d*z[i], sx - 0.95*d*z[i], sy - 0.31*d*z[i]); 339 DrawLine (buffer, sx - 0.95*d*z[i], sy - 0.31*d*z[i], sx + 0.00*d*z[i], sy - 1.00*d*z[i]); 340 340 } 341 341 } … … 349 349 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 350 350 { 351 DrawLine ( sx - d*z[i], sy, sx - 0.50*d*z[i], sy + 0.87*d*z[i]);352 DrawLine ( sx - 0.50*d*z[i], sy + 0.87*d*z[i], sx + 0.50*d*z[i], sy + 0.87*d*z[i]);353 DrawLine ( sx + 0.50*d*z[i], sy + 0.87*d*z[i], sx + d*z[i], sy);354 355 DrawLine ( sx + d*z[i], sy, sx + 0.50*d*z[i], sy - 0.87*d*z[i]);356 DrawLine ( sx + 0.50*d*z[i], sy - 0.87*d*z[i], sx - 0.50*d*z[i], sy - 0.87*d*z[i]);357 DrawLine ( sx - 0.50*d*z[i], sy - 0.87*d*z[i], sx - d*z[i], sy);351 DrawLine (buffer, sx - d*z[i], sy, sx - 0.50*d*z[i], sy + 0.87*d*z[i]); 352 DrawLine (buffer, sx - 0.50*d*z[i], sy + 0.87*d*z[i], sx + 0.50*d*z[i], sy + 0.87*d*z[i]); 353 DrawLine (buffer, sx + 0.50*d*z[i], sy + 0.87*d*z[i], sx + d*z[i], sy); 354 355 DrawLine (buffer, sx + d*z[i], sy, sx + 0.50*d*z[i], sy - 0.87*d*z[i]); 356 DrawLine (buffer, sx + 0.50*d*z[i], sy - 0.87*d*z[i], sx - 0.50*d*z[i], sy - 0.87*d*z[i]); 357 DrawLine (buffer, sx - 0.50*d*z[i], sy - 0.87*d*z[i], sx - d*z[i], sy); 358 358 } 359 359 } … … 366 366 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 367 367 sy2 = x[i+1]*myi + y[i+1]*myj + by; 368 DrawLine ( sx1, sy1, sx2, sy2);368 DrawLine (buffer, sx1, sy1, sx2, sy2); 369 369 } 370 370 } … … 380 380 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 381 381 { 382 FillRectangle ( sx, sy, 2*d, 2*d);382 FillRectangle (buffer, sx, sy, 2*d, 2*d); 383 383 } 384 384 } … … 392 392 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 393 393 { 394 DrawRectangle ( sx, sy, 2*d, 2*d);394 DrawRectangle (buffer, sx, sy, 2*d, 2*d); 395 395 } 396 396 } … … 404 404 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 405 405 { 406 DrawLine ( sx - d, sy, sx + d, sy);407 DrawLine ( sx, sy - d, sx, sy + d);406 DrawLine (buffer, sx - d, sy, sx + d, sy); 407 DrawLine (buffer, sx, sy - d, sx, sy + d); 408 408 } 409 409 } … … 417 417 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 418 418 { 419 DrawLine ( sx + d, sy - d, sx - d, sy + d);420 DrawLine ( sx - d, sy - d, sx + d, sy + d);419 DrawLine (buffer, sx + d, sy - d, sx - d, sy + d); 420 DrawLine (buffer, sx - d, sy - d, sx + d, sy + d); 421 421 } 422 422 } … … 430 430 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 431 431 { 432 FillTriangle ( sx - d, sy - 0.58*d, sx + d, sy - 0.58*d, sx, sy + 1.15*d);432 FillTriangle (buffer, sx - d, sy - 0.58*d, sx + d, sy - 0.58*d, sx, sy + 1.15*d); 433 433 } 434 434 } … … 442 442 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 443 443 { 444 OpenTriangle ( sx - d, sy + 0.58*d, sx + d, sy + 0.58*d, sx, sy - 1.15*d);444 OpenTriangle (buffer, sx - d, sy + 0.58*d, sx + d, sy + 0.58*d, sx, sy - 1.15*d); 445 445 } 446 446 } … … 454 454 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 455 455 { 456 DrawLine ( sx, sy, sx - d, sy - 0.58*d);457 DrawLine ( sx, sy, sx + d, sy - 0.58*d);458 DrawLine ( sx, sy, sx, sy + 1.15*d);456 DrawLine (buffer, sx, sy, sx - d, sy - 0.58*d); 457 DrawLine (buffer, sx, sy, sx + d, sy - 0.58*d); 458 DrawLine (buffer, sx, sy, sx, sy + 1.15*d); 459 459 } 460 460 } … … 468 468 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 469 469 { 470 DrawCircle ( sx, sy, d);470 DrawCircle (buffer, sx, sy, d); 471 471 } 472 472 } … … 480 480 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 481 481 { 482 DrawLine ( sx + 0.00*d, sy - 1.00*d, sx + 0.95*d, sy - 0.31*d);483 DrawLine ( sx + 0.95*d, sy - 0.31*d, sx + 0.58*d, sy + 0.81*d);484 DrawLine ( sx + 0.58*d, sy + 0.81*d, sx - 0.58*d, sy + 0.81*d);485 DrawLine ( sx - 0.58*d, sy + 0.81*d, sx - 0.95*d, sy - 0.31*d);486 DrawLine ( sx - 0.95*d, sy - 0.31*d, sx + 0.00*d, sy - 1.00*d);482 DrawLine (buffer, sx + 0.00*d, sy - 1.00*d, sx + 0.95*d, sy - 0.31*d); 483 DrawLine (buffer, sx + 0.95*d, sy - 0.31*d, sx + 0.58*d, sy + 0.81*d); 484 DrawLine (buffer, sx + 0.58*d, sy + 0.81*d, sx - 0.58*d, sy + 0.81*d); 485 DrawLine (buffer, sx - 0.58*d, sy + 0.81*d, sx - 0.95*d, sy - 0.31*d); 486 DrawLine (buffer, sx - 0.95*d, sy - 0.31*d, sx + 0.00*d, sy - 1.00*d); 487 487 } 488 488 } … … 496 496 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 497 497 { 498 DrawLine ( sx - 1.00*d, sy + 0.00*d, sx - 0.50*d, sy + 0.87*d);499 DrawLine ( sx - 0.50*d, sy + 0.87*d, sx + 0.50*d, sy + 0.87*d);500 DrawLine ( sx + 0.50*d, sy + 0.87*d, sx + 1.00*d, sy + 0.00*d);501 DrawLine ( sx + 1.00*d, sy + 0.00*d, sx + 0.50*d, sy - 0.87*d);502 DrawLine ( sx + 0.50*d, sy - 0.87*d, sx - 0.50*d, sy - 0.87*d);503 DrawLine ( sx - 0.50*d, sy - 0.87*d, sx - 1.00*d, sy + 0.00*d);498 DrawLine (buffer, sx - 1.00*d, sy + 0.00*d, sx - 0.50*d, sy + 0.87*d); 499 DrawLine (buffer, sx - 0.50*d, sy + 0.87*d, sx + 0.50*d, sy + 0.87*d); 500 DrawLine (buffer, sx + 0.50*d, sy + 0.87*d, sx + 1.00*d, sy + 0.00*d); 501 DrawLine (buffer, sx + 1.00*d, sy + 0.00*d, sx + 0.50*d, sy - 0.87*d); 502 DrawLine (buffer, sx + 0.50*d, sy - 0.87*d, sx - 0.50*d, sy - 0.87*d); 503 DrawLine (buffer, sx - 0.50*d, sy - 0.87*d, sx - 1.00*d, sy + 0.00*d); 504 504 } 505 505 } … … 512 512 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 513 513 sy2 = x[i+1]*myi + y[i+1]*myj + by; 514 DrawLine ( sx1, sy1, sx2, sy2);514 DrawLine (buffer, sx1, sy1, sx2, sy2); 515 515 } 516 516 } … … 519 519 520 520 /*******/ 521 void bDrawXErrors ( KapaGraphWidget *graph, Gobjects *object) {521 void bDrawXErrors (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 522 522 523 523 int i, bar; … … 553 553 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 554 554 { 555 DrawLine ( sx0, sy0, sx1, sy1);555 DrawLine (buffer, sx0, sy0, sx1, sy1); 556 556 if (bar) { 557 557 sx10 = sy1 - sz; 558 558 sx11 = sy1 + sz; 559 DrawLine ( sx1, sx10, sx1, sx11);559 DrawLine (buffer, sx1, sx10, sx1, sx11); 560 560 } 561 561 } … … 570 570 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 571 571 { 572 DrawLine ( sx0, sy0, sx1, sy1);572 DrawLine (buffer, sx0, sy0, sx1, sy1); 573 573 if (bar) { 574 574 sx10 = sy1 - sz; 575 575 sx11 = sy1 + sz; 576 DrawLine ( sx1, sx10, sx1, sx11);576 DrawLine (buffer, sx1, sx10, sx1, sx11); 577 577 } 578 578 } … … 581 581 582 582 /*******/ 583 void bDrawYErrors ( KapaGraphWidget *graph, Gobjects *object) {583 void bDrawYErrors (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 584 584 585 585 int i, bar; … … 615 615 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 616 616 { 617 DrawLine ( sx0, sy0, sx1, sy1);617 DrawLine (buffer, sx0, sy0, sx1, sy1); 618 618 if (bar) { 619 619 sx10 = sx1 - sz; 620 620 sx11 = sx1 + sz; 621 DrawLine ( sx10, sy1, sx11, sy1);621 DrawLine (buffer, sx10, sy1, sx11, sy1); 622 622 } 623 623 } … … 632 632 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 633 633 { 634 DrawLine ( sx0, sy0, sx1, sy1);634 DrawLine (buffer, sx0, sy0, sx1, sy1); 635 635 if (bar) { 636 636 sx10 = sx1 - sz; 637 637 sx11 = sx1 + sz; 638 DrawLine ( sx10, sy1, sx11, sy1);638 DrawLine (buffer, sx10, sy1, sx11, sy1); 639 639 } 640 640 } -
branches/czw_branch/20101203/Ohana/src/kapa2/src/bDrawOverlay.c
r25757 r30118 4 4 static char name[4][16] = {"red", "green", "blue", "yellow"}; 5 5 6 void bDrawOverlay ( KapaImageWidget *image, int N) {6 void bDrawOverlay (bDrawBuffer *buffer, KapaImageWidget *image, int N) { 7 7 8 8 int i; … … 14 14 /* translate color to bDrawColors : image[0].overlay[N].color */ 15 15 color = KapaColorByName (name[N]); 16 bDrawSetStyle ( color, 0, 0);16 bDrawSetStyle (buffer, color, 0, 0); 17 17 18 18 expand = 1.0; … … 57 57 switch (image[0].overlay[N].objects[i].type) { 58 58 case KII_OVERLAY_LINE: 59 bDrawLine ( X, Y, (X+dX), (Y+dY));59 bDrawLine (buffer, X, Y, (X+dX), (Y+dY)); 60 60 break; 61 61 case KII_OVERLAY_TEXT: 62 bDrawRotText ( X, Y, image[0].overlay[N].objects[i].text, 8, 0.0);62 bDrawRotText (buffer, X, Y, image[0].overlay[N].objects[i].text, 8, 0.0); 63 63 break; 64 64 case KII_OVERLAY_BOX: 65 65 dx = MAX (abs(dX),2) / 2; 66 66 dy = MAX (abs(dY),2) / 2; 67 bDrawRectOpen ( (X-dx), (Y-dy), (X+dx), (Y+dy));68 // bDrawRectOpen ( (X-dx), (Y-dy), (X), (Y));67 bDrawRectOpen (buffer, (X-dx), (Y-dy), (X+dx), (Y+dy)); 68 // bDrawRectOpen (buffer, (X-dx), (Y-dy), (X), (Y)); 69 69 break; 70 70 case KII_OVERLAY_CIRCLE: … … 72 72 dy = MAX (abs(dY),2); 73 73 if (image[0].overlay[N].objects[i].angle == 0.0) { 74 bDrawArc ( X, Y, dx, dy, 0, 360);74 bDrawArc (buffer, X, Y, dx, dy, 0, 360); 75 75 } else { 76 76 // moderately-stupid rotated ellipse drawing: … … 88 88 x1 = X + pX*dx*cos(t)*cs - pX*dy*sin(t)*sn; 89 89 y1 = Y + pY*dx*cos(t)*sn + pY*dy*sin(t)*cs; 90 bDrawLine ( x0, y0, x1, y1);90 bDrawLine (buffer, x0, y0, x1, y1); 91 91 x0 = x1; 92 92 y0 = y1; … … 101 101 102 102 /* translate color to bDrawColors : image[0].overlay[N].color */ 103 bDrawSetStyle ( color, 0, 0);103 bDrawSetStyle (buffer, color, 0, 0); 104 104 } 105 105 -
branches/czw_branch/20101203/Ohana/src/libdvo/include/dvo.h
r29001 r30118 58 58 // these are used as NAN for types of int values 59 59 typedef enum { 60 NAN_S_CHAR = 0x7f,61 NAN_U_CHAR = 0xff, // was NO_ERR62 NAN_S_SHORT = 0x7fff, // was NO_MAG63 NAN_U_SHORT = 0xffff,64 NAN_S_INT = 0x7fffffff,65 NAN_U_INT =0xffffffff,60 NAN_S_CHAR = 0x7f, 61 NAN_U_CHAR = 0xff, // was NO_ERR 62 NAN_S_SHORT = 0x7fff, // was NO_MAG 63 NAN_U_SHORT = 0xffff, 64 NAN_S_INT = 0x7fffffff, 65 NAN_U_INT = (signed int) 0xffffffff, 66 66 } DVO_INT_NAN; 67 67 … … 135 135 /* Average.code values -- these values are 32 bit (as of PS1_V1) */ 136 136 typedef enum { 137 ID_STAR_FEW = 0x00000001, // used within relphot: skip star 138 ID_STAR_POOR = 0x00000002, // used within relphot: skip star 139 ID_PROPER = 0x00000400, // star with large proper motion 140 ID_TRANSIENT = 0x00001000, // is this mutually exclusive with USNO? 141 ID_VARIABLE = 0x00002000, // not currently set? 142 ID_ASTEROID = 0x00002000, // identified with an asteroid 143 ID_BAD_OBJECT = 0x00004000, // if all measurements are bad, set this bit 137 ID_STAR_FEW = 0x00000001, // used within relphot: skip star 138 ID_STAR_POOR = 0x00000002, // used within relphot: skip star 139 ID_PROPER = 0x00000400, // star with large proper motion 140 ID_TRANSIENT = 0x00001000, // is this mutually exclusive with USNO? 141 ID_VARIABLE = 0x00002000, // not currently set? 142 ID_ASTEROID = 0x00002000, // identified with an asteroid 143 ID_BAD_OBJECT = 0x00004000, // if all measurements are bad, set this bit 144 144 ID_MOVING = 0x00008000, // is a moving object 145 ID_ROCK = 0x0000a000, // 0x8000 + 0x2000 146 ID_GHOST = 0x0000c001, // 0x8000 + 0x4000 + 0x0001 147 ID_TRAIL = 0x0000c002, // 0x8000 + 0x4000 + 0x0002 148 ID_BLEED = 0x0000c003, // 0x8000 + 0x4000 + 0x0003 149 ID_COSMIC = 0x0000c004, // 0x8000 + 0x4000 + 0x0004 145 ID_ROCK = 0x0000a000, // 0x8000 + 0x2000 146 ID_GHOST = 0x0000c001, // 0x8000 + 0x4000 + 0x0001 147 ID_TRAIL = 0x0000c002, // 0x8000 + 0x4000 + 0x0002 148 ID_BLEED = 0x0000c003, // 0x8000 + 0x4000 + 0x0003 149 ID_COSMIC = 0x0000c004, // 0x8000 + 0x4000 + 0x0004 150 150 ID_STAR_FIT_AVE = 0x00010000, // average position fitted 151 151 ID_STAR_FIT_PM = 0x00020000, // proper motion fitted … … 156 156 ID_OBJ_EXT = 0x01000000, // extended in our data (eg, PS) 157 157 ID_OBJ_EXT_ALT = 0x02000000, // extended in external data (eg, 2MASS) 158 ID_OBJ_GOOD = 0x04000000, // good-quality measurement in our data (eg, PS)159 ID_OBJ_GOOD_ALT = 0x08000000, // good-quality measurement in external data (eg, 2MASS)158 ID_OBJ_GOOD = 0x04000000, // good-quality measurement in our data (eg,PS) 159 ID_OBJ_GOOD_ALT = 0x08000000, // good-quality measurement in external data (eg, 2MASS) 160 160 } DVOAverageFlags; 161 161 … … 233 233 *** that is just silly, and bad: convert to using Nsec_mem, Nsec_disk, Nsec_off. 234 234 *** unless we always require the secfilt and average entries to be loaded sychronously. 235 */235 */ 236 236 237 237 /* pointers to split data files */ … … 293 293 int isRegisteredMosaic (void); 294 294 off_t GetRegisteredMosaic (void); 295 off_t *GetChipMatch (void); 295 296 int GetMosaicCoords (Coords *coords); 296 297 int FindMosaicForImage (Image *images, off_t Nimages, off_t entry); -
branches/czw_branch/20101203/Ohana/src/libdvo/src/dvo_catalog.c
r27580 r30118 302 302 int dvo_catalog_save (Catalog *catalog, char VERBOSE) { 303 303 304 int status = FALSE; 305 304 306 // set the 'sorted' header keyword 305 307 gfits_modify_alt (&catalog[0].header, "SORTED", "%t", 1, catalog[0].sorted); … … 308 310 switch (catalog[0].catmode) { 309 311 case DVO_MODE_RAW: 310 dvo_catalog_save_raw (catalog, VERBOSE);312 status = dvo_catalog_save_raw (catalog, VERBOSE); 311 313 break; 312 314 case DVO_MODE_MEF: 313 dvo_catalog_save_mef (catalog, VERBOSE);315 status = dvo_catalog_save_mef (catalog, VERBOSE); 314 316 break; 315 317 case DVO_MODE_SPLIT: 316 dvo_catalog_save_split (catalog, VERBOSE);318 status = dvo_catalog_save_split (catalog, VERBOSE); 317 319 break; 318 320 default: … … 320 322 exit (2); 321 323 } 322 return ( TRUE);324 return (status); 323 325 } 324 326 -
branches/czw_branch/20101203/Ohana/src/libdvo/src/dvo_catalog_mef.c
r29001 r30118 66 66 /* read Average table data (or skip) */ 67 67 if (catalog[0].catflags & LOAD_AVES) { 68 if (!gfits_fread_ftable_data (f, &ftable )) {68 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { 69 69 if (VERBOSE) fprintf (stderr, "can't read table average data"); 70 70 return (FALSE); … … 94 94 /* read Measure table data */ 95 95 if (catalog[0].catflags & LOAD_MEAS) { 96 if (!gfits_fread_ftable_data (f, &ftable )) {96 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { 97 97 if (VERBOSE) fprintf (stderr, "can't read table measure data"); 98 98 return (FALSE); … … 119 119 /* read Missing table data */ 120 120 if (catalog[0].catflags & LOAD_MISS) { 121 if (!gfits_fread_ftable_data (f, &ftable )) {121 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { 122 122 if (VERBOSE) fprintf (stderr, "can't read table missing data"); 123 123 return (FALSE); … … 149 149 /* read secfilt table data */ 150 150 if (catalog[0].catflags & LOAD_SECF) { 151 if (!gfits_fread_ftable_data (f, &ftable )) {151 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) { 152 152 if (VERBOSE) fprintf (stderr, "can't read table secfilt data"); 153 153 return (FALSE); -
branches/czw_branch/20101203/Ohana/src/libdvo/src/dvo_catalog_split.c
r29001 r30118 218 218 } 219 219 /* read Average table data : format is irrelevant here */ 220 if (!gfits_fread_ftable_data (catalog[0].f, &ftable )) {220 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 221 221 if (VERBOSE) fprintf (stderr, "can't read table average data"); 222 222 return (FALSE); … … 249 249 // XXX this allows an empty Measure catalog with non-empty Average catalog : is that OK? 250 250 /* read Measure table data */ 251 if (!gfits_fread_ftable_data (catalog[0].measure_catalog[0].f, &ftable )) {251 if (!gfits_fread_ftable_data (catalog[0].measure_catalog[0].f, &ftable, FALSE)) { 252 252 if (VERBOSE) fprintf (stderr, "can't read table measure data\n"); 253 253 return (FALSE); … … 279 279 if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_MISS)) { 280 280 /* read Missing table data */ 281 if (!gfits_fread_ftable_data (catalog[0].missing_catalog[0].f, &ftable )) {281 if (!gfits_fread_ftable_data (catalog[0].missing_catalog[0].f, &ftable, FALSE)) { 282 282 if (VERBOSE) fprintf (stderr, "can't read table missing data\n"); 283 283 return (FALSE); … … 313 313 if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_SECF)) { 314 314 /* read secfilt table data */ 315 if (!gfits_fread_ftable_data (catalog[0].secfilt_catalog[0].f, &ftable )) {315 if (!gfits_fread_ftable_data (catalog[0].secfilt_catalog[0].f, &ftable, FALSE)) { 316 316 if (VERBOSE) fprintf (stderr, "can't read table secfilt data\n"); 317 317 return (FALSE); -
branches/czw_branch/20101203/Ohana/src/libdvo/src/dvo_photcode_ops.c
r29182 r30118 557 557 } 558 558 } 559 if (entry == -1) { 560 // entry is missing fail (no printfs in this file) 561 free(map); 562 return(FALSE); 563 } 559 // if (entry == -1) { 560 // // entry is missing fail (no printfs in this file) 561 // free(map); 562 // return(FALSE); 563 // } 564 565 // if entry is still -1, we will skip this one (not map into the output db) 564 566 map[i] = entry; 565 567 } -
branches/czw_branch/20101203/Ohana/src/libdvo/src/fits_db.c
r28246 r30118 83 83 return (FALSE); 84 84 } 85 if (!gfits_fread_ftable_data (db[0].f, &db[0].ftable )) {85 if (!gfits_fread_ftable_data (db[0].f, &db[0].ftable, FALSE)) { 86 86 fprintf (stderr, "can't read table data"); 87 87 gfits_db_free (db); -
branches/czw_branch/20101203/Ohana/src/libdvo/src/mosaic_astrom.c
r27435 r30118 17 17 } 18 18 19 /* what is the currently registered mosaic image? */ 20 off_t *GetChipMatch () { 21 return (ChipMatch); 22 } 23 19 24 /* given an image array and a current entry of type WRP, find matching DIS & Register it */ 20 25 int FindMosaicForImage (Image *images, off_t Nimages, off_t entry) { … … 40 45 if (strcmp(&images[entry].coords.ctype[4], "-WRP")) { 41 46 /* not a wrp image, do nothing */ 42 return ( TRUE); /* error or not */47 return (entry + 1); /* error or not */ 43 48 } 44 49 … … 52 57 RegisterMosaic (&images[i].coords); 53 58 iDIS = i; 54 return ( TRUE);59 return (i + 1); 55 60 } 56 61 … … 62 67 RegisterMosaic (&images[i].coords); 63 68 iDIS = i; 64 return ( TRUE);69 return (i + 1); 65 70 } 66 71 return (FALSE); … … 74 79 if (strcmp(&images[entry].coords.ctype[4], "-WRP")) { 75 80 /* not a wrp image, do nothing */ 76 return ( TRUE); /* error or not? */81 return (entry + 1); /* error or not? */ 77 82 } 78 83 … … 85 90 RegisterMosaic (&images[N].coords); 86 91 iDIS = N; 87 return ( TRUE);92 return (N + 1); 88 93 } 89 94 … … 165 170 SortDISindex (DIStzero, DISentry, Ndis); 166 171 172 // ChipMatch has a few possible values: 173 // -3 : image is a mosaic (DIS) 174 // -2 : image is an unassigned WRP image 175 // -1 : image is not a WRP or DIS images 176 // >= 0 : value is the mosaic seq number for this WRP image 177 167 178 /* find all matched WRP images */ 168 179 ALLOCATE (ChipMatch, off_t, Nimages); 169 180 for (i = 0; i < Nimages; i++) { 170 181 ChipMatch[i] = -1; 182 if (!strcmp(&images[i].coords.ctype[4], "-DIS")) { 183 ChipMatch[i] = -3; 184 continue; 185 } 171 186 if (strcmp(&images[i].coords.ctype[4], "-WRP")) continue; 172 187 -
branches/czw_branch/20101203/Ohana/src/libfits/include/gfitsio.h
r29537 r30118 64 64 char *buffer; 65 65 off_t datasize; 66 off_t validsize; 66 67 } FTable; 67 68 … … 172 173 int gfits_define_table_column PROTO((Header *header, char *format, char *label, char *comment, char *unit)); 173 174 int gfits_fread_ftable PROTO((FILE *f, FTable *ftable, char *extname)); 174 int gfits_fread_ftable_data PROTO((FILE *f, FTable *ftable ));175 int gfits_fread_ftable_data PROTO((FILE *f, FTable *ftable, int padIfShort)); 175 176 int gfits_fread_ftable_range PROTO((FILE *f, FTable *ftable, off_t start, off_t Nrows)); 176 177 int gfits_fread_vtable PROTO((FILE *f, VTable *vtable, char *extname, off_t Nrow, off_t *row)); -
branches/czw_branch/20101203/Ohana/src/libfits/table/F_read_T.c
r28241 r30118 36 36 gfits_scan (header, "EXTNAME", "%s", 1, tname); 37 37 if (!strcmp (tname, extname)) { 38 if (gfits_fread_ftable_data (f, table )) return (TRUE);38 if (gfits_fread_ftable_data (f, table, FALSE)) return (TRUE); 39 39 gfits_free_header (header); 40 40 return (FALSE); … … 50 50 51 51 /*********************** fits read ftable data ***********************************/ 52 int gfits_fread_ftable_data (FILE *f, FTable *table ) {52 int gfits_fread_ftable_data (FILE *f, FTable *table, int padIfShort) { 53 53 54 54 off_t Nbytes, Nread; … … 65 65 if (Nread < gfits_data_min_size (table[0].header)) { 66 66 fprintf (stderr, "error: fits read error in %s, read "OFF_T_FMT", need "OFF_T_FMT"\n", __func__, Nread, gfits_data_min_size (table[0].header)); 67 gfits_free_table (table); 68 return (FALSE); 67 if (padIfShort) { 68 memset (&table[0].buffer[Nread], 0, Nbytes - Nread); 69 fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n"); 70 table[0].validsize = Nread; 71 table[0].datasize = Nbytes; 72 return (TRUE); 73 } else { 74 gfits_free_table (table); 75 return (FALSE); 76 } 69 77 } 70 78 fprintf (stderr, "warning: file missing pad\n"); 71 79 } 80 table[0].validsize = Nread; 72 81 table[0].datasize = Nbytes; 73 82 return (TRUE); -
branches/czw_branch/20101203/Ohana/src/libkapa/include/kapa.h
r29537 r30118 115 115 116 116 typedef struct { 117 int Nx, Ny ;117 int Nx, Ny, Nbyte; 118 118 bDrawColor **pixels; 119 png_color *palette; 120 int Npalette; 121 // current drawing values: 122 int bWeight; 123 int bType; 124 bDrawColor bColor; 125 bDrawColor bColor_R; 126 bDrawColor bColor_G; 127 bDrawColor bColor_B; 119 128 } bDrawBuffer; 120 129 … … 165 174 /* KapaWindow.c */ 166 175 int KiiResize (int fd, int Nx, int Ny); 176 int KiiResizeByImage (int fd); 167 177 int KiiRelocate (int fd, int x, int y); 168 178 int KiiCenter (int fd, double x, double y, int zoom); … … 182 192 int KapaGetLimits (int fd, float *dx, float *dy); 183 193 int KapaSetSection (int fd, KapaSection *section); 194 int KapaSetSectionByImage (int fd, KapaSection *section); 184 195 int KapaSelectSection (int fd, char *name); 185 196 int KapaGetSection (int fd, char *name); … … 221 232 222 233 /* bDrawFuncs.c */ 223 bDrawBuffer *bDrawBufferCreate (int Nx, int Ny );234 bDrawBuffer *bDrawBufferCreate (int Nx, int Ny, int Nbyte, png_color *palette, int Npalette); 224 235 void bDrawBufferFree (bDrawBuffer *buffer); 225 236 void bDrawSetBuffer (bDrawBuffer *buffer); 226 void bDrawSetStyle (bDraw Color color, int lw, int lt);227 void bDrawPoint ( int x, int y);228 void bDrawPointf ( float x, float y);229 230 void bDrawArc ( double Xc, double Yc, double Xr, double Yr, double Ts, double Te);231 void bDrawCircle ( double Xc, double Yc, double radius);232 void bDrawCircleFill ( double xc, double yc, double radius);233 234 void bDrawLine ( double x1, double y1, double x2, double y2);235 void bDrawLineWeight ( int X1, int Y1, int X2, int Y2, int swapcoords);236 void bDrawLineBresen ( int X1, int Y1, int X2, int Y2, int swapcoords);237 void bDrawLineHorizontal ( int X1, int X2, int Y);238 void bDrawLineVertical ( int X, int Y1, int Y2);239 240 void bDrawRectOpen ( double x1, double y1, double x2, double y2);241 void bDrawRectFill ( double x1, double y1, double x2, double y2);242 void bDrawTriOpen (double x1, double y1, double x2, double y2, double x3, double y3);243 void bDrawTriFill (double x1, double y1, double x2, double y2, double x3, double y3);237 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt); 238 void bDrawPoint (bDrawBuffer *buffer, int x, int y); 239 void bDrawPointf (bDrawBuffer *buffer, float x, float y); 240 241 void bDrawArc (bDrawBuffer *buffer, double Xc, double Yc, double Xr, double Yr, double Ts, double Te); 242 void bDrawCircle (bDrawBuffer *buffer, double Xc, double Yc, double radius); 243 void bDrawCircleFill (bDrawBuffer *buffer, double xc, double yc, double radius); 244 245 void bDrawLine (bDrawBuffer *buffer, double x1, double y1, double x2, double y2); 246 void bDrawLineWeight (bDrawBuffer *buffer, int X1, int Y1, int X2, int Y2, int swapcoords); 247 void bDrawLineBresen (bDrawBuffer *buffer, int X1, int Y1, int X2, int Y2, int swapcoords); 248 void bDrawLineHorizontal (bDrawBuffer *buffer, int X1, int X2, int Y); 249 void bDrawLineVertical (bDrawBuffer *buffer, int X, int Y1, int Y2); 250 251 void bDrawRectOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2); 252 void bDrawRectFill (bDrawBuffer *buffer, double x1, double y1, double x2, double y2); 253 void bDrawTriOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2, double x3, double y3); 254 void bDrawTriFill (bDrawBuffer *buffer, double x1, double y1, double x2, double y2, double x3, double y3); 244 255 245 256 /* bDrawRotFont.c */ 246 int bDrawRotText ( int x, int y, char *string, int pos, double angle);247 int bDrawRotBitmap ( int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale);257 int bDrawRotText (bDrawBuffer *buffer, int x, int y, char *string, int pos, double angle); 258 int bDrawRotBitmap (bDrawBuffer *buffer, int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale); 248 259 249 260 /* Kapa Socket functions */ -
branches/czw_branch/20101203/Ohana/src/libkapa/src/KapaWindow.c
r27790 r30118 23 23 KiiSendCommand (fd, 4, "RSIZ"); 24 24 KiiSendMessage (fd, "%d %d", Nx, Ny); 25 KiiWaitAnswer (fd, "DONE"); 26 return (TRUE); 27 } 28 29 int KiiResizeByImage (int fd) { 30 31 KiiSendCommand (fd, 4, "ISIZ"); 25 32 KiiWaitAnswer (fd, "DONE"); 26 33 return (TRUE); … … 370 377 } 371 378 379 int KapaSetSectionByImage (int fd, KapaSection *section) { 380 381 KiiSendCommand (fd, 4, "ISEC"); 382 KiiSendMessage (fd, "%s %6.3f %6.3f %3d", 383 section[0].name, 384 section[0].x, 385 section[0].y, 386 section[0].bg); 387 KiiWaitAnswer (fd, "DONE"); 388 return (TRUE); 389 } 390 372 391 int KapaSectionBG (int fd, char *name, int bg) { 373 392 -
branches/czw_branch/20101203/Ohana/src/libkapa/src/bDrawFuncs.c
r29537 r30118 1 1 # include <kapa_internal.h> 2 3 // XXX we can get rid of these static vars by making them elements of the bDrawBuffer 4 // 5 6 7 static int bWeight; 8 static int bType; 9 static bDrawColor bColor; 10 static bDrawBuffer *bBuffer; 11 void bDrawCircleSingle (double xc, double yc, double radius); 12 13 bDrawBuffer *bDrawBufferCreate (int Nx, int Ny) { 2 # define myAssert(LOGIC,MSG) { if (!(LOGIC)) { fprintf (stderr, "%s\n", MSG); abort (); } } 3 4 // move these to the bDrawBuffer type 5 // static int bWeight; 6 // static int bType; 7 // static bDrawColor bColor; 8 // static bDrawColor bColor_R; 9 // static bDrawColor bColor_G; 10 // static bDrawColor bColor_B; 11 // static bDrawBuffer *bBuffer; 12 13 void bDrawCircleSingle (bDrawBuffer *buffer, double xc, double yc, double radius); 14 15 // create a drawing buffer with either 1 or 3 byte colors 16 bDrawBuffer *bDrawBufferCreate (int Nx, int Ny, int Nbyte, png_color *palette, int Npalette) { 14 17 15 18 int i, j; 16 bDrawColor white ;19 bDrawColor white, white_R, white_G, white_B; 17 20 bDrawBuffer *buffer; 18 21 22 myAssert((Nbyte == 1) || (Nbyte == 3), "invalid depth"); 23 myAssert(palette, "missing palette"); 24 19 25 white = KapaColorByName ("white"); 26 white_R = palette[white].red; 27 white_G = palette[white].green; 28 white_B = palette[white].blue; 20 29 21 30 ALLOCATE (buffer, bDrawBuffer, 1); 22 31 buffer[0].Nx = Nx; 23 32 buffer[0].Ny = Ny; 33 buffer[0].Nbyte = Nbyte; 34 buffer[0].palette = palette; 35 buffer[0].Npalette = Npalette; 24 36 25 37 ALLOCATE (buffer[0].pixels, bDrawColor *, Ny); 26 38 for (i = 0; i < Ny; i++) { 27 ALLOCATE (buffer[0].pixels[i], bDrawColor, N x);39 ALLOCATE (buffer[0].pixels[i], bDrawColor, Nbyte*Nx); 28 40 for (j = 0; j < Nx; j++) { 29 buffer[0].pixels[i][j] = white; 30 } 31 } 41 if (Nbyte == 1) { 42 buffer[0].pixels[i][j] = white; 43 } else { 44 buffer[0].pixels[i][3*j+0] = white_R; 45 buffer[0].pixels[i][3*j+1] = white_G; 46 buffer[0].pixels[i][3*j+2] = white_B; 47 } 48 } 49 } 50 51 buffer[0].bWeight = 0; 52 buffer[0].bType = 0; 53 buffer[0].bColor = white; 54 buffer[0].bColor_R = white_R; 55 buffer[0].bColor_G = white_G; 56 buffer[0].bColor_B = white_B; 32 57 return (buffer); 33 58 } … … 41 66 } 42 67 free (buffer[0].pixels); 68 free (buffer[0].palette); 43 69 free (buffer); 44 70 return; 45 71 } 46 72 47 void bDrawSetBuffer (bDrawBuffer *buffer) { 48 bBuffer = buffer; 49 return; 50 } 51 52 void bDrawSetStyle (bDrawColor color, int lw, int lt) { 53 bColor = color; 54 bWeight = lw; 55 bType = lt; 73 // void bDrawSetBuffer (bDrawBuffer *buffer) { 74 // myAssert(buffer[0].Nbyte == 1, "invalid depth"); 75 // bBuffer = buffer; 76 // return; 77 // } 78 79 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt) { 80 buffer->bColor = color; 81 buffer->bColor_R = buffer->palette[color].red; 82 buffer->bColor_G = buffer->palette[color].green; 83 buffer->bColor_B = buffer->palette[color].blue; 84 buffer->bWeight = lw; 85 buffer->bType = lt; 56 86 return; 57 87 } 58 88 59 89 // draw a point in the current color 60 void bDrawPoint (int x, int y) { 61 90 void bDrawPoint (bDrawBuffer *buffer, int x, int y) { 91 92 // myAssert(buffer[0].Nbyte == 1, "invalid depth"); 62 93 if (x < 0) return; 63 94 if (y < 0) return; 64 if (x >= bBuffer[0].Nx) return; 65 if (y >= bBuffer[0].Ny) return; 66 bBuffer[0].pixels[y][x] = bColor; 95 if (x >= buffer[0].Nx) return; 96 if (y >= buffer[0].Ny) return; 97 if (buffer[0].Nbyte == 1) { 98 buffer[0].pixels[y][x] = buffer->bColor; 99 } else { 100 buffer[0].pixels[y][3*x+0] = buffer->bColor_R; 101 buffer[0].pixels[y][3*x+1] = buffer->bColor_G; 102 buffer[0].pixels[y][3*x+2] = buffer->bColor_B; 103 } 67 104 return; 68 105 } 69 106 70 107 // draw a point in the current color 71 void bDrawPointf ( float x, float y) {72 73 bDrawPoint ( ROUND(x), ROUND(y));74 return; 75 } 76 77 void bDrawTriOpen ( double x1, double y1, double x2, double y2, double x3, double y3) {78 79 bDrawLine ( x1, y1, x2, y2);80 bDrawLine ( x2, y2, x3, y3);81 bDrawLine ( x3, y3, x1, y1);82 83 return; 84 } 85 86 void bDrawRectOpen ( double x1, double y1, double x2, double y2) {108 void bDrawPointf (bDrawBuffer *buffer, float x, float y) { 109 110 bDrawPoint (buffer, ROUND(x), ROUND(y)); 111 return; 112 } 113 114 void bDrawTriOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2, double x3, double y3) { 115 116 bDrawLine (buffer, x1, y1, x2, y2); 117 bDrawLine (buffer, x2, y2, x3, y3); 118 bDrawLine (buffer, x3, y3, x1, y1); 119 120 return; 121 } 122 123 void bDrawRectOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2) { 87 124 88 125 int X1, Y1, X2, Y2; … … 91 128 if (y1 > y2) SWAP (y1, y2); 92 129 93 X1 = MIN (MAX (ROUND (x1), 0), b Buffer[0].Nx - 1);94 X2 = MIN (MAX (ROUND (x2), 1), b Buffer[0].Nx);95 96 Y1 = MIN (MAX (ROUND (y1), 0), b Buffer[0].Ny - 1);97 Y2 = MIN (MAX (ROUND (y2), 1), b Buffer[0].Ny);98 99 bDrawLineHorizontal ( X1, X2, Y1);100 bDrawLineHorizontal ( X1, X2, Y2);101 bDrawLineVertical (X1, Y1, Y2);102 bDrawLineVertical (X2, Y1, Y2);103 return; 104 } 105 106 void bDrawRectFill ( double x1, double y1, double x2, double y2) {130 X1 = MIN (MAX (ROUND (x1), 0), buffer[0].Nx - 1); 131 X2 = MIN (MAX (ROUND (x2), 1), buffer[0].Nx - 1); 132 133 Y1 = MIN (MAX (ROUND (y1), 0), buffer[0].Ny - 1); 134 Y2 = MIN (MAX (ROUND (y2), 1), buffer[0].Ny - 1); 135 136 bDrawLineHorizontal (buffer, X1, X2, Y1); 137 bDrawLineHorizontal (buffer, X1, X2, Y2); 138 bDrawLineVertical (buffer, X1, Y1, Y2); 139 bDrawLineVertical (buffer, X2, Y1, Y2); 140 return; 141 } 142 143 void bDrawRectFill (bDrawBuffer *buffer, double x1, double y1, double x2, double y2) { 107 144 108 145 int i; … … 112 149 if (y1 > y2) SWAP (y1, y2); 113 150 114 X1 = MIN (MAX (ROUND (x1), 0), b Buffer[0].Nx - 1);115 X2 = MIN (MAX (ROUND (x2), 1), b Buffer[0].Nx);116 117 Y1 = MIN (MAX (ROUND (y1), 0), b Buffer[0].Ny - 1);118 Y2 = MIN (MAX (ROUND (y2), 0), b Buffer[0].Ny);151 X1 = MIN (MAX (ROUND (x1), 0), buffer[0].Nx - 1); 152 X2 = MIN (MAX (ROUND (x2), 1), buffer[0].Nx - 1); 153 154 Y1 = MIN (MAX (ROUND (y1), 0), buffer[0].Ny - 1); 155 Y2 = MIN (MAX (ROUND (y2), 0), buffer[0].Ny - 1); 119 156 120 157 for (i = Y1; i < Y2; i++) { 121 bDrawLineHorizontal ( X1, X2, i);158 bDrawLineHorizontal (buffer, X1, X2, i); 122 159 } 123 160 return; … … 125 162 126 163 // identify the quadrant and draw the correct line 127 void bDrawLine ( double x1, double y1, double x2, double y2) {164 void bDrawLine (bDrawBuffer *buffer, double x1, double y1, double x2, double y2) { 128 165 129 166 int FlipDirect, FlipCoords; … … 144 181 FlipDirect = FlipCoords ? (y1 > y2) : (x1 > x2); 145 182 146 if (!FlipDirect && !FlipCoords) bDrawLineWeight ( X1, Y1, X2, Y2, FALSE);147 if ( FlipDirect && !FlipCoords) bDrawLineWeight ( X2, Y2, X1, Y1, FALSE);148 if (!FlipDirect && FlipCoords) bDrawLineWeight ( Y1, X1, Y2, X2, TRUE);149 if ( FlipDirect && FlipCoords) bDrawLineWeight ( Y2, X2, Y1, X1, TRUE);183 if (!FlipDirect && !FlipCoords) bDrawLineWeight (buffer, X1, Y1, X2, Y2, FALSE); 184 if ( FlipDirect && !FlipCoords) bDrawLineWeight (buffer, X2, Y2, X1, Y1, FALSE); 185 if (!FlipDirect && FlipCoords) bDrawLineWeight (buffer, Y1, X1, Y2, X2, TRUE); 186 if ( FlipDirect && FlipCoords) bDrawLineWeight (buffer, Y2, X2, Y1, X1, TRUE); 150 187 151 188 return; … … 153 190 154 191 // draw a series of lines to give the line weight 155 void bDrawLineWeight ( int X1, int Y1, int X2, int Y2, int swapcoords) {192 void bDrawLineWeight (bDrawBuffer *buffer, int X1, int Y1, int X2, int Y2, int swapcoords) { 156 193 157 194 int dN, dNs, dNe; 158 195 159 dNs = -0.5*(b Weight - 1);196 dNs = -0.5*(buffer->bWeight - 1); 160 197 /* 0, 0, 0, -1, -1, -2, -2 */ 161 198 162 dNe = +0.5*b Weight + 1;199 dNe = +0.5*buffer->bWeight + 1; 163 200 /* 1, 1, 2, 2, 2, 3, 3 */ 164 201 165 202 for (dN = dNs; dN < dNe; dN++) { 166 bDrawLineBresen ( X1, Y1 + dN, X2, Y2 + dN, swapcoords);203 bDrawLineBresen (buffer, X1, Y1 + dN, X2, Y2 + dN, swapcoords); 167 204 } 168 205 return; … … 171 208 // use the Bresenham line drawing technique 172 209 // integer-only Bresenham line-draw version which is fast 173 void bDrawLineBresen ( int X1, int Y1, int X2, int Y2, int swapcoords) {210 void bDrawLineBresen (bDrawBuffer *buffer, int X1, int Y1, int X2, int Y2, int swapcoords) { 174 211 175 212 int X, Y, dX, dY; … … 185 222 e = 0; 186 223 for (X = X1, N = 0; X <= X2; X++, N++) { 187 if (b Type == 1) { DashOn = (N % 10) < 5; }188 if (b Type == 2) { DashOn = (N % 6) < 3; }224 if (buffer->bType == 1) { DashOn = (N % 10) < 5; } 225 if (buffer->bType == 2) { DashOn = (N % 6) < 3; } 189 226 if (swapcoords) { 190 if (DashOn) bDrawPoint ( Y,X);227 if (DashOn) bDrawPoint (buffer, Y,X); 191 228 } else { 192 if (DashOn) bDrawPoint ( X,Y);229 if (DashOn) bDrawPoint (buffer, X,Y); 193 230 } 194 231 e += dY; … … 206 243 } 207 244 208 void bDrawLineHorizontal ( int X1, int X2, int Y) {245 void bDrawLineHorizontal (bDrawBuffer *buffer, int X1, int X2, int Y) { 209 246 210 247 int i; 211 248 212 249 for (i = X1; i < X2; i++) { 213 bBuffer[0].pixels[Y][i] = bColor; 214 } 215 return; 216 } 217 218 void bDrawLineVertical (int X, int Y1, int Y2) { 250 if (buffer[0].Nbyte == 1) { 251 buffer[0].pixels[Y][i] = buffer->bColor; 252 } else { 253 buffer[0].pixels[Y][3*i+0] = buffer->bColor_R; 254 buffer[0].pixels[Y][3*i+1] = buffer->bColor_G; 255 buffer[0].pixels[Y][3*i+2] = buffer->bColor_B; 256 } 257 } 258 return; 259 } 260 261 void bDrawLineVertical (bDrawBuffer *buffer, int X, int Y1, int Y2) { 219 262 220 263 int i; 221 264 222 265 for (i = Y1; i < Y2; i++) { 223 bBuffer[0].pixels[i][X] = bColor; 224 } 225 return; 226 } 227 228 void bDrawTriFill (double x1, double y1, double x2, double y2, double x3, double y3) { 229 230 bDrawTriOpen (x1, y1, x2, y2, x3, y3); 231 return; 232 } 233 234 void bDrawArc (double Xc, double Yc, double Xr, double Yr, double Ts, double Te) { 266 if (buffer[0].Nbyte == 1) { 267 buffer[0].pixels[i][X] = buffer->bColor; 268 } else { 269 buffer[0].pixels[i][3*X+0] = buffer->bColor_R; 270 buffer[0].pixels[i][3*X+1] = buffer->bColor_G; 271 buffer[0].pixels[i][3*X+2] = buffer->bColor_B; 272 } 273 } 274 return; 275 } 276 277 void bDrawTriFill (bDrawBuffer *buffer, double x1, double y1, double x2, double y2, double x3, double y3) { 278 279 bDrawTriOpen (buffer, x1, y1, x2, y2, x3, y3); 280 return; 281 } 282 283 void bDrawArc (bDrawBuffer *buffer, double Xc, double Yc, double Xr, double Yr, double Ts, double Te) { 235 284 236 285 float t, dt; … … 258 307 259 308 /* we could use the value of MAX(dy/dt,dx/dt) to set dt */ 260 bDrawPoint ( x,y);309 bDrawPoint (buffer, x,y); 261 310 262 311 dt = MAX (fabs(Xr * sin(t)), fabs(Yr * cos(t))); … … 267 316 268 317 // draw a series of circles to give line weight 269 void bDrawCircle ( double xc, double yc, double radius) {318 void bDrawCircle (bDrawBuffer *buffer, double xc, double yc, double radius) { 270 319 271 320 int dN, dNs, dNe; 272 321 273 dNs = -0.5*(b Weight - 1);322 dNs = -0.5*(buffer->bWeight - 1); 274 323 /* 0, 0, 0, -1, -1, -2, -2 */ 275 324 276 dNe = +0.5*b Weight + 1;325 dNe = +0.5*buffer->bWeight + 1; 277 326 /* 1, 1, 2, 2, 2, 3, 3 */ 278 327 279 328 for (dN = dNs; dN < dNe; dN++) { 280 bDrawCircleSingle ( xc, yc, radius + dN);329 bDrawCircleSingle (buffer, xc, yc, radius + dN); 281 330 } 282 331 return; … … 284 333 285 334 // draw a pure circle 286 void bDrawCircleSingle ( double xc, double yc, double radius) {335 void bDrawCircleSingle (bDrawBuffer *buffer, double xc, double yc, double radius) { 287 336 288 337 int Xc, Yc, Radius; … … 300 349 301 350 while (x <= y) { 302 bDrawPoint ( Xc+x, Yc+y);303 bDrawPoint ( Xc+x, Yc-y);304 bDrawPoint ( Xc-x, Yc+y);305 bDrawPoint ( Xc-x, Yc-y);306 bDrawPoint ( Xc+y, Yc+x);307 bDrawPoint ( Xc+y, Yc-x);308 bDrawPoint ( Xc-y, Yc+x);309 bDrawPoint ( Xc-y, Yc-x);351 bDrawPoint (buffer, Xc+x, Yc+y); 352 bDrawPoint (buffer, Xc+x, Yc-y); 353 bDrawPoint (buffer, Xc-x, Yc+y); 354 bDrawPoint (buffer, Xc-x, Yc-y); 355 bDrawPoint (buffer, Xc+y, Yc+x); 356 bDrawPoint (buffer, Xc+y, Yc-x); 357 bDrawPoint (buffer, Xc-y, Yc+x); 358 bDrawPoint (buffer, Xc-y, Yc-x); 310 359 311 360 if (d < 0) { … … 322 371 323 372 // draw a pure circle 324 void bDrawCircleFill ( double xc, double yc, double radius) {373 void bDrawCircleFill (bDrawBuffer *buffer, double xc, double yc, double radius) { 325 374 326 375 int Xc, Yc, Radius; … … 338 387 339 388 while (x <= y) { 340 bDrawLineHorizontal ( Xc-x, Xc+x, Yc+y);341 bDrawLineHorizontal ( Xc-x, Xc+x, Yc-y);342 bDrawLineHorizontal ( Xc-y, Xc+y, Yc+x);343 bDrawLineHorizontal ( Xc-y, Xc+y, Yc-x);389 bDrawLineHorizontal (buffer, Xc-x, Xc+x, Yc+y); 390 bDrawLineHorizontal (buffer, Xc-x, Xc+x, Yc-y); 391 bDrawLineHorizontal (buffer, Xc-y, Xc+y, Yc+x); 392 bDrawLineHorizontal (buffer, Xc-y, Xc+y, Yc-x); 344 393 345 394 if (d < 0) { -
branches/czw_branch/20101203/Ohana/src/libkapa/src/bDrawRotFont.c
r12332 r30118 6 6 # define NEARINT(x) ((x < 0) ? ((int)(x - 0.5)) : ((int)(x + 0.5))) 7 7 8 static bDrawColor black; 9 static bDrawColor white; 10 11 int bDrawRotText (int x, int y, char *string, int pos, double angle) { 8 // XXX need to pass the rot text color here 9 // static bDrawColor black; 10 // static bDrawColor white; 11 12 int bDrawRotText (bDrawBuffer *buffer, int x, int y, char *string, int pos, double angle) { 12 13 13 14 unsigned char *bitmap; … … 19 20 RotFont *currentfont; 20 21 21 white = KapaColorByName ("white");22 black = KapaColorByName ("black");22 // white = KapaColorByName ("white"); 23 // black = KapaColorByName ("black"); 23 24 24 25 currentname = GetRotFont (¤tsize); … … 111 112 X = x + (int)(Xoff*cs - Yoff*sn) + (int)(currentscale*currentfont[N].ascent*sn); 112 113 Y = y + (int)(Xoff*sn + Yoff*cs) - (int)(currentscale*currentfont[N].ascent*cs); 113 bDrawRotBitmap ( X, Y, dx, dy, bitmap, TRUE, angle, currentscale);114 bDrawRotBitmap (buffer, X, Y, dx, dy, bitmap, TRUE, angle, currentscale); 114 115 Xoff += 1 + (int)(currentscale*dx + 0.5); 115 116 } … … 118 119 } 119 120 120 int bDrawRotBitmap ( int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) {121 int bDrawRotBitmap (bDrawBuffer *buffer, int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) { 121 122 122 123 int ii, jj, byte_line, byte, bit, flag; 123 bDrawColor color;124 124 double i, j, cs, sn, rscale, tmp; 125 125 int X, Y, X0, X1, X2, Y0, Y1, Y2, x0, y0; 126 126 127 127 /* this mode option is nort actually used... */ 128 if (mode) {129 color = black;130 } else {131 color = white;132 }128 // if (mode) { 129 // color = black; 130 // } else { 131 // color = white; 132 // } 133 133 134 134 byte_line = (int) ((dx + 7) / 8); … … 148 148 Y = YPROC (dx,0); 149 149 # ifdef DRAWBOXES 150 bDrawLine ( x+X, y+Y, x+X1, y+Y1);150 bDrawLine (buffer, x+X, y+Y, x+X1, y+Y1); 151 151 Xt = X; 152 152 Yt = Y; … … 160 160 Y = YPROC (dx,dy); 161 161 # ifdef DRAWBOXES 162 bDrawLine ( x+X, y+Y, x+Xt, y+Yt);162 bDrawLine (buffer, x+X, y+Y, x+Xt, y+Yt); 163 163 Xt = X; 164 164 Yt = Y; … … 172 172 Y = YPROC (0,dy); 173 173 # ifdef DRAWBOXES 174 bDrawLine ( x+X, y+Y, x+Xt, y+Yt);174 bDrawLine (buffer, x+X, y+Y, x+Xt, y+Yt); 175 175 Xt = X; 176 176 Yt = Y; … … 181 181 X2 = MAX (X, X2); 182 182 183 bDrawSetStyle (color, 0, 0);183 // bDrawSetStyle (color, 0, 0); 184 184 if (scale > 1) { 185 185 for (i = X1; i <= X2; i+=1) { … … 191 191 bit = ii % 8; 192 192 flag = 0x01 & (bitmap[byte] >> bit); 193 if (flag) bDrawPointf ( x + i, y + j);193 if (flag) bDrawPointf (buffer, x + i, y + j); 194 194 } 195 195 } … … 203 203 bit = ii % 8; 204 204 flag = 0x01 & (bitmap[byte] >> bit); 205 if (flag) bDrawPointf ( x + i, y + j);205 if (flag) bDrawPointf (buffer, x + i, y + j); 206 206 } 207 207 } 208 208 } 209 bDrawSetStyle (black, 0, 0);209 // bDrawSetStyle (black, 0, 0); 210 210 return (TRUE); 211 211 } -
branches/czw_branch/20101203/Ohana/src/opihi/cmd.astro/region.c
r27435 r30118 55 55 if ((argc != 4) && (argc != 5)) { 56 56 gprint (GP_ERR, "USAGE: region Ra Dec Radius [projection] [orientation]\n"); 57 gprint (GP_ERR, " [-image] [-ew] [+ew] [-ns] [+ns] [-no-clear]\n"); 57 58 gprint (GP_ERR, " current: %f %f (%f x %f) (%s)\n", 58 59 graphmode.coords.crval1, graphmode.coords.crval2, -
branches/czw_branch/20101203/Ohana/src/opihi/cmd.data/Makefile
r29540 r30118 36 36 $(SRC)/cut.$(ARCH).o \ 37 37 $(SRC)/delete.$(ARCH).o \ 38 $(SRC)/densify.$(ARCH).o \ 38 39 $(SRC)/device.$(ARCH).o \ 39 40 $(SRC)/dimendown.$(ARCH).o \ -
branches/czw_branch/20101203/Ohana/src/opihi/cmd.data/init.c
r29540 r30118 25 25 int dbselect PROTO((int, char **)); 26 26 int delete PROTO((int, char **)); 27 int densify PROTO((int, char **)); 27 28 int device PROTO((int, char **)); 28 29 int dimendown PROTO((int, char **)); … … 161 162 {1, "dbselect", dbselect, "extract vectors from mysql database table"}, 162 163 {1, "delete", delete, "delete vectors or images"}, 164 {1, "densify", densify, "create an image histogram from a set of vectors"}, 163 165 {1, "device", device, "set / get current graphics device"}, 164 166 {1, "dimendown", dimendown, "convert image to vector"}, -
branches/czw_branch/20101203/Ohana/src/opihi/cmd.data/rd.c
r28241 r30118 184 184 ftable.header[0].buffer = NULL; 185 185 gfits_copy_header (&buf[0].header, ftable.header); 186 status = gfits_fread_ftable_data (f, &ftable ); // this just reads the bytes (not even a SWAP)186 status = gfits_fread_ftable_data (f, &ftable, FALSE); // this just reads the bytes (not even a SWAP) 187 187 status = gfits_uncompress_image (&buf[0].header, &buf[0].matrix, &ftable); 188 188 // uncompressing the image leaves the format as an extension -
branches/czw_branch/20101203/Ohana/src/opihi/cmd.data/read_vectors.c
r29540 r30118 160 160 161 161 off_t Nbytes; 162 int i, j, k, N, Nextend, Ny, Binary, vecType ;162 int i, j, k, N, Nextend, Ny, Binary, vecType, padIfShort; 163 163 char type[16], ID[80], *CCDKeyword; 164 164 FTable table; … … 174 174 CCDKeyword = strcreate (argv[N]); 175 175 remove_argument (N, &argc, argv); 176 } 177 178 padIfShort = FALSE; 179 if ((N = get_argument (argc, argv, "-pad-if-short"))) { 180 remove_argument (N, &argc, argv); 181 padIfShort = TRUE; 176 182 } 177 183 … … 205 211 } 206 212 if (!gfits_load_header (f, &header)) ESCAPE ("error reading header for extension"); 207 if (!gfits_fread_ftable_data (f, &table )) ESCAPE ("error reading table for extension");213 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension"); 208 214 209 215 } else { … … 236 242 continue; 237 243 } 238 if (!gfits_fread_ftable_data (f, &table )) ESCAPE ("error reading table for extension");244 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension"); 239 245 break; 240 246 } -
branches/czw_branch/20101203/Ohana/src/opihi/cmd.data/resize.c
r13479 r30118 17 17 if (!GetImage (NULL, &kapa, name)) return (FALSE); 18 18 FREE (name); 19 20 if ((N = get_argument (argc, argv, "-by-image"))) { 21 remove_argument (N, &argc, argv); 22 KiiResizeByImage (kapa); 23 return (TRUE); 24 } 19 25 20 26 if (argc != 3) { -
branches/czw_branch/20101203/Ohana/src/opihi/cmd.data/section.c
r27790 r30118 1 1 # include "data.h" 2 2 3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL, BG };3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL, BG, IMAGE}; 4 4 5 5 int section (int argc, char **argv) { … … 49 49 remove_argument (N, &argc, argv); 50 50 action = BG; 51 } 52 53 if ((N = get_argument (argc, argv, "-image"))) { 54 remove_argument (N, &argc, argv); 55 action = IMAGE; 51 56 } 52 57 … … 130 135 } 131 136 137 if (argc == 4) { 138 /* set section */ 139 section.name = argv[1]; 140 section.x = atof (argv[2]); 141 section.y = atof (argv[3]); 142 section.bg = background; 143 KapaSetSectionByImage (kapa, §ion); 144 return (TRUE); 145 } 146 132 147 if (argc == 6) { 133 148 /* set section */ … … 142 157 } 143 158 gprint (GP_ERR, "USAGE: section name [x y dx dy]\n"); 159 gprint (GP_ERR, "USAGE: section name [-image x y] : width based on current image\n"); 144 160 gprint (GP_ERR, "USAGE: section name [-list] [-up] [-down] [-top] [-bottom]\n"); 145 161 return (FALSE); -
branches/czw_branch/20101203/Ohana/src/opihi/cmd.data/vgauss.c
r29001 r30118 45 45 CastVector (yvec, OPIHI_FLT); 46 46 CastVector (svec, OPIHI_FLT); 47 // XXX Cast is failing. 48 47 49 48 50 Npts = xvec[0].Nelements; -
branches/czw_branch/20101203/Ohana/src/opihi/dvo/images.c
r28958 r30118 11 11 int images (int argc, char **argv) { 12 12 13 off_t i, Nimage ;13 off_t i, Nimage, Nmosaic; 14 14 int j, status, InPic, leftside, *plist, TimeSelect, ByName; 15 15 int WITH_MOSAIC, SOLO_MOSAIC, HIDDEN; 16 16 time_t tzero, tend; 17 int N, NPTS, n, npts, Npts, kapa ;17 int N, NPTS, n, npts, Npts, kapa, *foundMosaic; 18 18 Vector Xvec, Yvec; 19 19 double r[8], d[8], x[8], y[8], Rmin, Rmax, Rmid, trange, Radius; … … 35 35 36 36 SOLO_MOSAIC = FALSE; 37 foundMosaic = NULL; 37 38 if ((N = get_argument (argc, argv, "-mosaic"))) { 38 39 remove_argument (N, &argc, argv); … … 132 133 BuildChipMatch (image, Nimage); 133 134 135 if (SOLO_MOSAIC && photcode) { 136 ALLOCATE(foundMosaic, int, Nimage); 137 memset(foundMosaic, 0, Nimage*sizeof(int)); 138 } 139 134 140 Rmin = graphmode.coords.crval1 - 180.0; 135 141 Rmax = graphmode.coords.crval1 + 180.0; … … 137 143 138 144 int DistortImage = wordhash ("-DIS"); 145 int ChipImage = wordhash ("-WRP"); 139 146 int TriangleUp = wordhash ("TRP-"); 140 147 int TriangleDn = wordhash ("TRM-"); … … 150 157 if (ByName && strncmp (image[i].name, name, strlen(name))) continue; 151 158 if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue; 152 if (!FindMosaicForImage (image, Nimage, i)) continue; 159 if (!(Nmosaic = FindMosaicForImage (image, Nimage, i))) continue; 160 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 153 161 if (photcode) { 154 162 if ( photcodeEquiv && (photcode[0].code != GetPhotcodeEquivCodebyCode(image[i].photcode))) continue; … … 161 169 162 170 typehash = wordhash (&image[i].coords.ctype[4]); 171 172 if (photcode && SOLO_MOSAIC) { 173 // mosaic (DIS) images are not currently given a photcode : plot these via the WRP entries 174 /* DIS images represent a field, not a chip */ 175 if (typehash != ChipImage) continue; 176 if (foundMosaic[Nmosaic]) continue; 177 x[0] = -0.5*image[Nmosaic].NX; y[0] = -0.5*image[Nmosaic].NY; 178 x[1] = +0.5*image[Nmosaic].NX; y[1] = -0.5*image[Nmosaic].NY; 179 x[2] = +0.5*image[Nmosaic].NX; y[2] = +0.5*image[Nmosaic].NY; 180 x[3] = -0.5*image[Nmosaic].NX; y[3] = +0.5*image[Nmosaic].NY; 181 for (j = 0; j < Npts; j++) { 182 status = XY_to_RD (&r[j], &d[j], x[j], y[j], &image[Nmosaic].coords); 183 if (!status) break; 184 r[j] = ohana_normalize_angle (r[j]); 185 while (r[j] < Rmin) { r[j] += 360.0; } 186 while (r[j] > Rmax) { r[j] -= 360.0; } 187 if (j == 0) { 188 leftside = (r[j] < Rmid); 189 } 190 if (j > 0) { 191 if ( leftside && (r[j] > Rmid + 90)) { r[j] -= 360.0; } 192 if (!leftside && (r[j] < Rmid - 90)) { r[j] += 360.0; } 193 } 194 } 195 foundMosaic[Nmosaic] = TRUE; 196 goto plot_points; 197 } 163 198 164 199 /* DIS images represent a field, not a chip */ … … 270 305 if (Npts == 0) continue; 271 306 307 plot_points: 308 272 309 status = FALSE; 273 310 for (j = 0; j < Npts; j++) { … … 320 357 free (Yvec.elements.Flt); 321 358 FreeImages (image); 359 FREE (foundMosaic); 322 360 return (TRUE); 323 361 -
branches/czw_branch/20101203/Ohana/src/opihi/dvo/imlist.c
r29540 r30118 104 104 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 105 105 } 106 gprint (GP_LOG, "%3lld %s %8 .4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n",107 (long long) i, image[i].name, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal);106 gprint (GP_LOG, "%3lld %s %8lld %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f\n", 107 (long long) i, image[i].name, (long long) image[i].imageID, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal, image[i].dMcal); 108 108 } 109 109 -
branches/czw_branch/20101203/Ohana/src/opihi/lib.data/starfuncs.c
r20936 r30118 5 5 double *ring; 6 6 double x, y, x2, y2, xy, I, sky, FWHMx, FWHMy, value, mag, Sxy; 7 int i, j, n, Npix2, Nring, Nmax;7 int i, j, n, Radius, Nring, Nmax; 8 8 double Npts, gain, dsky2, dmag, peak, offset; 9 9 char *string; … … 19 19 Nborder = MIN (1000, Nborder); 20 20 21 Npix2= (int)(0.5*Npix);22 Npix = 2 * Npix2+ 1;21 Radius = (int)(0.5*Npix); 22 Npix = 2 * Radius + 1; 23 23 Nring = 4*Nborder*(Nborder + Npix); 24 24 ALLOCATE (ring, double, Nring); … … 27 27 n = 0; 28 28 for (j = 0; j < Nborder; j++) { 29 for (i = X - Npix2 - Nborder; i < X + Npix2+ Nborder + 1; i++, n+=2) {30 ring[n] = gfits_get_matrix_value (matrix, i, (int)(Y - Npix2- j));31 ring[n+1] = gfits_get_matrix_value (matrix, i, (int)(Y + Npix2+ j));32 } 33 for (i = Y - Npix2; i < Y + Npix2+ 1; i++, n+=2) {34 ring[n] = gfits_get_matrix_value (matrix, (int)(X - Npix2- j), i);35 ring[n+1] = gfits_get_matrix_value (matrix, (int)(X + Npix2+ j), i);29 for (i = X - Radius - Nborder; i < X + Radius + Nborder + 1; i++, n+=2) { 30 ring[n] = gfits_get_matrix_value (matrix, i, (int)(Y - Radius - j)); 31 ring[n+1] = gfits_get_matrix_value (matrix, i, (int)(Y + Radius + j)); 32 } 33 for (i = Y - Radius; i < Y + Radius + 1; i++, n+=2) { 34 ring[n] = gfits_get_matrix_value (matrix, (int)(X - Radius - j), i); 35 ring[n+1] = gfits_get_matrix_value (matrix, (int)(X + Radius + j), i); 36 36 } 37 37 } … … 50 50 Npts = Nmax = 0; 51 51 x = y = x2 = y2 = xy = I = 0; 52 for (i = X - Npix2; i < X + Npix2 + 1; i++) { 53 for (j = Y - Npix2; j < Y + Npix2 + 1; j++) { 52 for (i = X - Radius; i < X + Radius + 1; i++) { 53 for (j = Y - Radius; j < Y + Radius + 1; j++) { 54 if (hypot((i-X), (j-Y)) > Radius) continue; 54 55 value = gfits_get_matrix_value (matrix, i, j); 55 56 offset = value - sky; … … 92 93 set_variable ("Zpk", peak); 93 94 set_int_variable ("Nsat", Nmax); 95 set_int_variable ("Npts", Npts); 94 96 95 97 gprint (GP_LOG, "%f %f %f %f %f %f %f %f\n", x, y, FWHMx, FWHMy, sky, I, mag, dmag); -
branches/czw_branch/20101203/Ohana/src/photdbc/include/photdbc.h
r28331 r30118 114 114 int SetSignals (void); 115 115 int copy_images (char *outdir); 116 void usage(); -
branches/czw_branch/20101203/Ohana/src/photdbc/src/args.c
r8630 r30118 61 61 } 62 62 63 if (argc != 2) { 64 fprintf (stderr, "USAGE: photdbc (output)\n"); 65 exit (2); 66 } 63 if (argc != 2) usage(); 67 64 68 65 if ((REGION.Rmin == 0) && (REGION.Rmax == 360) && (REGION.Dmin == -90) && (REGION.Dmax == +90)) { … … 80 77 } 81 78 82 /** 79 void usage() { 83 80 84 this program takes an existing DVO database and makes a copy, applying a number of optional 85 filters in the process. 86 87 photdbc (output) 88 89 allowed filters / restrictions include: 90 91 -region ra dec ra dec : limit operation to the specified region 92 -join : join measurements between stars using JOIN_RADIUS 93 -ccdregion X Y X Y : only keep detections within the specified detector region 94 (can this be limited to specific photcodes? cameras? detectors?) 95 -photcode_limits code Mmin Mmax : allow multiples of these 96 97 SIGMA_MAX 98 NMEAS_MIN 99 INST_MAG_MAX 100 INST_MAG_MIN 101 102 **/ 81 fprintf (stderr, "USAGE: photdbc (output)\n\n"); 82 fprintf (stderr, " this program takes an existing DVO database and makes a copy, applying a number of optional\n"); 83 fprintf (stderr, " filters in the process. \n"); 84 fprintf (stderr, "\n"); 85 fprintf (stderr, " photdbc (output)\n"); 86 fprintf (stderr, "\n"); 87 fprintf (stderr, " allowed filters / restrictions include:\n"); 88 fprintf (stderr, "\n"); 89 fprintf (stderr, " -region Rmin Rmax Dmin Dmax : limit operation to the specified region \n"); 90 fprintf (stderr, " -join : join measurements between stars using JOIN_RADIUS\n"); 91 fprintf (stderr, " -ccdregion X Y X Y : only keep detections within the specified detector region\n"); 92 fprintf (stderr, " (can this be limited to specific photcodes? cameras? detectors?)\n"); 93 fprintf (stderr, " -photcode_limits code Mmin Mmax : allow multiples of these\n"); 94 fprintf (stderr, "\n"); 95 fprintf (stderr, " SIGMA_MAX\n"); 96 fprintf (stderr, " NMEAS_MIN\n"); 97 fprintf (stderr, " INST_MAG_MAX\n"); 98 fprintf (stderr, " INST_MAG_MIN\n"); 99 exit (2); 100 } -
branches/czw_branch/20101203/Ohana/src/photdbc/src/initialize.c
r4808 r30118 4 4 5 5 /* are these set correctly? */ 6 if (get_argument (argc, argv, "-h")) usage(); 7 if (get_argument (argc, argv, "--h")) usage(); 8 if (get_argument (argc, argv, "-help")) usage(); 9 if (get_argument (argc, argv, "--help")) usage(); 10 6 11 ConfigInit (&argc, argv); 7 12 args (argc, argv); -
branches/czw_branch/20101203/Ohana/src/photdbc/src/join_stars.c
r28306 r30118 32 32 33 33 /* reference for coords is this region */ 34 Ncurr = 0; 34 35 Naves = 0; 35 36 Rmid = Dmid = 0; -
branches/czw_branch/20101203/Ohana/src/relastro/src/GetAstromError.c
r27581 r30118 2 2 3 3 float GetAstromError (Measure *measure, int mode) { 4 4 //BIG HACKXXXXXXXX 5 return 0.1; 5 6 PhotCode *code; 6 7 float dPobs, dPsys, dPtotal, dM, AS, MS; 7 8 8 switch (mode) { 9 9 case ERROR_MODE_RA: … … 19 19 abort(); 20 20 } 21 22 21 /* the astrometric errors are not being carried yet (but should be!) */ 23 22 /* we use the photometric mag error as a weighting term */ … … 28 27 dPsys = code[0].astromErrSys; 29 28 dM = measure[0].dM; 30 31 29 dPtotal = sqrt(SQ(dPsys) + AS*SQ(dPobs) + MS*SQ(dM)); 32 30 … … 35 33 36 34 dPtotal = MAX (dPtotal, MIN_ERROR); 37 38 35 return (dPtotal); 39 36 } -
branches/czw_branch/20101203/Ohana/src/relastro/src/UpdateObjects.c
r28241 r30118 54 54 memset (&fitPM, 0, sizeof(fitPM)); 55 55 memset (&fitPAR, 0, sizeof(fitPAR)); 56 57 56 initObjectData (catalog, Ncatalog); 58 57 … … 72 71 // use J2000 as a reference time 73 72 T2000 = ohana_date_to_sec ("2000/01/01"); 74 75 73 // XXX in the future, use catalog[0].Nsecfilt only? allow catalogs to have variable Nsecfilt? 76 74 Nsecfilt = GetPhotcodeNsecfilt (); … … 97 95 N = 0; 98 96 m = catalog[i].average[j].measureOffset; 99 100 97 Tmin = Tmax = (catalog[i].measure[m].t - T2000) / (86400*365.25); 101 98 mode = FIT_MODE; … … 137 134 138 135 // dX, dY : error in arcsec -- 139 dX[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_RA); 140 dY[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_DEC); 136 // dX[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_RA); 137 // dY[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_DEC); 138 139 dX[N] = 0.1; 140 dY[N] = 0.1; 141 141 dT[N] = catalog[i].measure[m].dt; 142 142 … … 145 145 // non-circular errors (different values for X and Y), then dR and dD will be 146 146 // incorrect: they would need to be rotated to take out the position angle 147 dR[ k] = dX[k] / 3600.0;148 dD[ k] = dY[k] / 3600.0;147 dR[N] = dX[N] / 3600.0; 148 dD[N] = dY[N] / 3600.0; 149 149 150 150 N++; … … 194 194 195 195 FitPM (&fitPM, X, dX, Y, dY, T, N); 196 196 197 if (XVERB) fprintf (stderr, "fitted: %f - %f : %f %f : %f %f : %f vs %f\n", Tmin, Tmax, fitPM.Ro, fitPM.Do, fitPM.uR, fitPM.uD, fitPM.chisq, fitAve.chisq); 197 198 … … 244 245 245 246 switch (result) { 246 case FIT_AVERAGE: 247 catalog[i].average[j].flags |= ID_STAR_USE_AVE; 248 fit = fitAve; 249 break; 250 case FIT_PM_ONLY: 251 catalog[i].average[j].flags |= ID_STAR_USE_PM; 252 fit = fitPM; 253 break; 254 case FIT_PM_AND_PAR: 255 catalog[i].average[j].flags |= ID_STAR_USE_PAR; 256 fit = fitPAR; 257 break; 258 } 259 260 if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f)\n", 247 case FIT_AVERAGE: 248 catalog[i].average[j].flags |= ID_STAR_USE_AVE; 249 fit = fitAve; 250 break; 251 case FIT_PM_ONLY: 252 catalog[i].average[j].flags |= ID_STAR_USE_PM; 253 fit = fitPM; 254 break; 255 case FIT_PM_AND_PAR: 256 catalog[i].average[j].flags |= ID_STAR_USE_PAR; 257 fit = fitPAR; 258 break; 259 } 260 if (XVERB) fprintf (stderr, "A%f %f -> %f %f (%f,%f) pm=(%f %f)\n", 261 261 catalog[i].average[j].R, 262 262 catalog[i].average[j].D, 263 263 fit.Ro, fit.Do, 264 264 3600*(catalog[i].average[j].R - fit.Ro), 265 3600*(catalog[i].average[j].D - fit.Do)); 265 3600*(catalog[i].average[j].D - fit.Do), 266 fit.uR, 267 fit.uD); 266 268 267 269 //make sure that the fit succeeded 268 status = finite(fit.Ro); 270 status = TRUE; 271 status &= finite(fit.Ro); 269 272 status &= finite(fit.Do); 270 273 status &= finite(fit.dRo); … … 310 313 catalog[i].average[j].Trange = (Trange * 86400 * 365.26); 311 314 catalog[i].average[j].Npos = fit.Nfit; 315 if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f)\n", 316 catalog[i].average[j].R, 317 catalog[i].average[j].D, 318 fit.Ro, fit.Do, 319 3600*(catalog[i].average[j].R - fit.Ro), 320 3600*(catalog[i].average[j].D - fit.Do), 321 catalog[i].average[j].uR, 322 catalog[i].average[j].uD); 323 312 324 } 313 325 -
branches/czw_branch/20101203/Ohana/src/relastro/src/high_speed_objects.c
r28811 r30118 13 13 // XXX seems silly to require region here just to find the catalog bounds / center 14 14 15 off_t i, j, m, J, ni, nj, *N1, Nslow, Ninvalid, NgroupA, NgroupB, NgroupAbad, NgroupBbad ;16 int *slowMoving, *groupA, *groupB, status, foundA, foundB, Nmatch, valid ;15 off_t i, j, m, J, ni, nj, *N1, Nslow, Ninvalid, NgroupA, NgroupB, NgroupAbad, NgroupBbad,l,i1,Noff,Nmeasure,Naverage, NAVERAGE, NMEASURE; 16 int *slowMoving, *groupA, *groupB, status, foundA, foundB, Nmatch, valid,Nmatchmeas,Nepoch,nv[2],Nmatchmeasobj; 17 17 double *X1, *Y1; 18 double dX, dY, dR, RADIUS2 , yJ;18 double dX, dY, dR, RADIUS2; 19 19 Coords tcoords; 20 Catalog catalog1; 20 21 21 22 int zcode, zNsec, ycode, yNsec, jcode, jNsec, hcode, hNsec, kcode, kNsec, USNO_R, USNO_N, Nsecfilt; 23 char filename[1024]; 24 char outdir[]="/data/ipp022.0/ndeacon/hispeedzy"; 25 Noff = strlen(CATDIR); 26 sprintf (filename, "%s/%s", outdir, &catalog[0].filename[Noff]); 27 dvo_catalog_init(&catalog1, TRUE); /*initialise new catalogue*/ 28 catalog1.filename = strcreate(filename); 29 30 SIGMA_LIM = 0.0; 22 31 23 32 Nsecfilt = GetPhotcodeNsecfilt(); 33 Naverage=catalog[0].Naverage; 34 Nmeasure=catalog[0].Nmeasure; 35 // ALLOCATE (catalog1.average, Average,Naverage); 36 // ALLOCATE (catalog1.measure, Measure,Nmeasure); 37 // ALLOCATE(catalog1.secfilt, SecFilt,catalog[0].Naverage*Nsecfilt); 38 catalog1.filename = filename; // based on the input name, need to keep everything below the catdir portion 39 catalog1.Nsecfilt = Nsecfilt; 40 // always load all of the data (if any exists) 41 catalog1.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 42 43 catalog1.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 44 catalog1.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 45 46 if (!dvo_catalog_open (&catalog1, region, VERBOSE,"w")) { 47 fprintf (stderr, "ERROR: failure to open catalog file %s\n", 48 filename); 49 exit (2); 50 } 51 52 NAVERAGE = 1000; 53 NMEASURE = 10000; 54 REALLOCATE (catalog1.average, Average, NAVERAGE); 55 REALLOCATE (catalog1.measure, Measure, NMEASURE); 56 REALLOCATE(catalog1.secfilt, SecFilt, NAVERAGE*Nsecfilt); 24 57 25 58 ycode = GetPhotcodeCodebyName("y"); … … 67 100 NgroupBbad = 0; 68 101 69 fprintf (stdout, "# RA_A DEC_A RA_B DEC_B : pmx pmy dR : z dz y dy J dJ H dH K dK\n");102 fprintf (stdout, "# RA_A DEC_A RA_B DEC_B : pmx pmy dR dt: z dz y dy J dJ H dH K dK\n"); 70 103 //................270.2346670 20.2471540 270.2170434 20.2717396 : -59.11 88.78 106.66 : 0.000 0.000 19.582 0.112 16.041 0.110 15.388 0.098 14.858 0.001 71 104 … … 88 121 foundA = FALSE; 89 122 for (j = 0; !foundA && (j < catalog[0].average[i].Nmeasure); j++, m++) { 123 if((catalog[0].average[i].R>204.1923)&&(catalog[0].average[i].R<204.1924)&&(catalog[0].average[i].D>11.376)&&(catalog[0].average[i].D<11.377)) 124 { 125 printf("Hello"); 126 } 127 90 128 if (MeasMatchesPhotcode(&catalog[0].measure[m], photcodesGroupA, NphotcodesGroupA)) { 91 129 foundA = TRUE; … … 97 135 foundB = FALSE; 98 136 for (j = 0; !foundB && (j < catalog[0].average[i].Nmeasure); j++, m++) { 137 138 if((catalog[0].average[i].R>204.192)&&(catalog[0].average[i].R<204.1925)&&(catalog[0].average[i].D>11.376)&&(catalog[0].average[i].D<11.377)) 139 { 140 printf("Hello"); 141 } 142 99 143 if (MeasMatchesPhotcode(&catalog[0].measure[m], photcodesGroupB, NphotcodesGroupB)) { 100 144 foundB = TRUE; … … 114 158 if (foundA && !foundB) { 115 159 // average-based tests: 160 161 if((catalog[0].average[i].R>204.1923)&&(catalog[0].average[i].R<204.1924)&&(catalog[0].average[i].D>11.376)&&(catalog[0].average[i].D<11.377)) 162 { 163 printf("Hello"); 164 } 165 116 166 valid = TRUE; 117 valid &= ((catalog[0].average[i].flags & 0x 40000) == 0);118 valid &= ((catalog[0].average[i].flags & 0x 80000) > 0);119 valid &= ( catalog[0].secfilt[i*Nsecfilt + yNsec].M < 1.0);120 valid &= ( catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0);167 valid &= ((catalog[0].average[i].flags & 0x02000000) == 0); 168 valid &= ((catalog[0].average[i].flags & 0x08000000) > 0); 169 valid &= ((catalog[0].secfilt[i*Nsecfilt + yNsec].M < 1.0)||(isnan(catalog[0].secfilt[i*Nsecfilt + yNsec].M))); 170 valid &= (((catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0))||(isnan(catalog[0].secfilt[i*Nsecfilt + zNsec].M))); 121 171 // XXX color restrictions are applied in the pair-wise matching below 122 172 123 173 // measure-based tests: 124 m = catalog[0].average[i].measureOffset;174 /* m = catalog[0].average[i].measureOffset; 125 175 for (j = 0; valid && (j < catalog[0].average[i].Nmeasure); j++, m++) { 126 176 if (catalog[0].measure[m].photcode == USNO_R) { … … 130 180 valid &= ((catalog[0].measure[m].M > 18.0) || isnan(catalog[0].measure[m].M)); 131 181 } 132 } 182 }*/ 133 183 134 184 // ((objflags & 524288) == 524288) && … … 154 204 155 205 // average-based tests: 206 if((catalog[0].average[i].R>204.192)&&(catalog[0].average[i].R<204.193)&&(catalog[0].average[i].D>11.372)&&(catalog[0].average[i].D<11.373)) 207 { 208 printf("Hello"); 209 } 156 210 valid = TRUE; 157 valid &= ((catalog[0].average[i].flags & 0x10000) == 0); 158 valid &= ((catalog[0].average[i].flags & 0x20000) > 0); 159 valid &= (catalog[0].secfilt[i*Nsecfilt + jNsec].M < 1.0); 211 valid &= ((catalog[0].average[i].flags & 0x01000000) == 0); 212 213 valid &= ((catalog[0].average[i].flags & 0x04000000) > 0); 214 215 valid &= ((catalog[0].secfilt[i*Nsecfilt + jNsec].M < 1.0)||(isnan(catalog[0].secfilt[i*Nsecfilt + jNsec].M))); 160 216 valid &= (catalog[0].secfilt[i*Nsecfilt + yNsec].Nused > 1); 161 217 valid &= (catalog[0].secfilt[i*Nsecfilt + yNsec].dM < 0.2); 162 218 163 if ((catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0) || (catalog[0].secfilt[i*Nsecfilt + zNsec].Nused == 1)) {219 /*if ((catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0) || (catalog[0].secfilt[i*Nsecfilt + zNsec].Nused == 1)) { 164 220 valid &= TRUE; 165 221 } else { 166 222 valid &= ((catalog[0].secfilt[i*Nsecfilt + zNsec].M - catalog[0].secfilt[i*Nsecfilt + yNsec].M) > 0.2); 167 } 223 }*/ 168 224 169 225 // measure-based tests: 170 m = catalog[0].average[i].measureOffset;226 /*m = catalog[0].average[i].measureOffset; 171 227 for (j = 0; valid && (j < catalog[0].average[i].Nmeasure); j++, m++) { 172 228 if (catalog[0].measure[m].photcode == USNO_R) { … … 176 232 valid &= ((catalog[0].measure[m].M > 18.5) || isnan(catalog[0].measure[m].M)); 177 233 } 178 } 234 }*/ 179 235 180 236 // (abs(glat)>15.0) && … … 236 292 237 293 Nmatch = 0; 294 Nmatchmeas = 0; 238 295 RADIUS2 = SQ(RADIUS); 239 296 … … 243 300 ni = N1[i]; 244 301 nj = N1[j]; 245 246 302 // if (ni == 131030) { 247 303 // fprintf (stderr, "got 2mass\n"); … … 268 324 269 325 // within match range; look for valid matches 270 for (J = j; (dX > -1.02*RADIUS) && (J < catalog[0].Naverage); J++) { 326 for (J = j; (dX > -1.02*RADIUS) && (J < catalog[0].Naverage); J++) { 271 327 if (J == i) continue; // avoid auto-matches 272 328 … … 281 337 282 338 // y_groupA - J_groupB 283 yJ = catalog[0].secfilt[nj*Nsecfilt + yNsec].M - catalog[0].secfilt[ni*Nsecfilt + jNsec].M; 339 340 /* yJ = catalog[0].secfilt[nj*Nsecfilt + yNsec].M - catalog[0].secfilt[ni*Nsecfilt + jNsec].M; 284 341 if (yJ < 1.25) continue; 285 if (yJ > 5.0) continue; 342 if (yJ > 5.0) continue;*/ 286 343 287 344 /*** a match is found (just print it for the moment) ***/ 345 /*Define a vector of matched indices and set averages in new catalogue*/ 346 Nepoch=2; 347 FIT_MODE = FIT_PM_ONLY; 348 /*nv=(int *)malloc(Nepoch*sizeof(int));*/ 349 nv[0]=ni; /*THESE SHOULD BE CHANGED FOR MULTIPLE EPOCHS AS SHOULD nv*/ 350 nv[1]=nj; 351 352 catalog1.average[Nmatch]=catalog[0].average[nv[0]]; 353 /*Loop over index values and set measurements in new catalogue*/ 354 Nmatchmeasobj=0; 355 catalog1.average[Nmatch].measureOffset=Nmatchmeas; 356 for(l=0;l<Nepoch;l++) { 357 m = catalog[0].average[nv[l]].measureOffset; 358 for(i1=0;i1<catalog[0].average[nv[l]].Nmeasure;i1++) { 359 catalog1.measure[Nmatchmeas]=catalog[0].measure[m+i1]; 360 /*Set offset RA and Dec wrt correct average value*/ 361 catalog1.measure[Nmatchmeas].dR=catalog[0].measure[m+i1].dR+3600.0*(catalog[0].average[nv[0]].R-catalog[0].average[nv[l]].R); 362 catalog1.measure[Nmatchmeas].dD=catalog[0].measure[m+i1].dD+3600.0*(catalog[0].average[nv[0]].D-catalog[0].average[nv[l]].D); 363 catalog1.measure[Nmatchmeas].averef = Nmatch; 364 Nmatchmeasobj++; 365 Nmatchmeas++; 366 367 if (Nmatchmeas == NMEASURE - 1) { 368 NMEASURE += 10000; 369 REALLOCATE (catalog1.measure, Measure, NMEASURE); 370 } 371 } 372 } 373 catalog1.average[Nmatch].Nmeasure=Nmatchmeasobj; 288 374 Nmatch ++; 289 375 376 if (Nmatch == NAVERAGE - 1) { 377 NAVERAGE += 1000; 378 REALLOCATE (catalog1.average, Average, NAVERAGE); 379 REALLOCATE(catalog1.secfilt, SecFilt, NAVERAGE*Nsecfilt); 380 } 290 381 // for the moment, just write the matches to stdout: 291 float pmx = -dX; // proper-motion displacement in ra direction (B - A) [arcsec]292 float pmy = -dY; // proper-motion displacement in dec direction (B - A) [arcsec]293 fprintf (stdout, "%11.7f %11.7f %11.7f %11.7f : %7.2f %7.2f %7.2f: %7.3f %6.3f %7.3f %6.3f %7.3f %6.3f %7.3f %6.3f %7.3f %6.3f\n",382 //float pmx = -dX; // proper-motion displacement in ra direction (B - A) [arcsec] 383 //float pmy = -dY; // proper-motion displacement in dec direction (B - A) [arcsec] 384 /* fprintf (stdout, "%11.7f %11.7f %11.7f %11.7f : %7.2f %7.2f %7.2f: %7.3f %6.3f %7.3f %6.3f %7.3f %6.3f %7.3f %6.3f %7.3f %6.3f\n", 294 385 catalog[0].average[ni].R, catalog[0].average[ni].D, 295 386 catalog[0].average[nj].R, catalog[0].average[nj].D, 296 pmx, pmy, sqrt(dR),387 dX, dY, sqrt(dR), 297 388 catalog[0].secfilt[nj*Nsecfilt + zNsec].M, 298 389 catalog[0].secfilt[nj*Nsecfilt + zNsec].dM, … … 304 395 catalog[0].secfilt[ni*Nsecfilt + hNsec].dM, 305 396 catalog[0].secfilt[ni*Nsecfilt + kNsec].M, 306 catalog[0].secfilt[ni*Nsecfilt + kNsec].dM); 397 catalog[0].secfilt[ni*Nsecfilt + kNsec].dM);*/ 307 398 } 308 399 i++; 309 400 } 401 catalog1.Naverage=Nmatch; 402 catalog1.Nmeasure=Nmatchmeas; 403 catalog1.Nsecfilt=Nsecfilt; 404 catalog1.Nsecf_mem=Nmatch*Nsecfilt; 405 406 UpdateObjects(&catalog1, 1); 407 310 408 fprintf (stderr, "found %d matches\n", Nmatch); 311 409 dvo_catalog_save (&catalog1, VERBOSE); 410 dvo_catalog_unlock (&catalog1); 411 dvo_catalog_free (&catalog1); 312 412 free (slowMoving); 313 413 free (groupA); -
branches/czw_branch/20101203/Ohana/src/tools/Makefile
r20983 r30118 17 17 PROGRAMS = gconfig fhead ftable fields list_astro glockfile \ 18 18 radec mktemp precess csystem fits_insert \ 19 medianfilter mefhead ckfits 19 medianfilter mefhead ckfits roc 20 20 21 21 all tools: $(PROGRAMS) -
branches/czw_branch/20101203/PS-IPP-Config/lib/PS/IPP/Config.pm
r29891 r30118 1107 1107 } 1108 1108 1109 if (file_scheme($output) ne 'neb') { 1109 my $scheme = file_scheme($output); 1110 if (!$scheme or ($scheme ne 'neb')) { 1110 1111 # non-nebulous file we're done 1111 if ($delete_existing ) {1112 if ($delete_existing and $self->file_exists($output)) { 1112 1113 if (!$self->file_delete($output)) { 1113 1114 carp "failed to delete $output"; … … 1181 1182 my $copies = shift; 1182 1183 1183 if (file_scheme($file) ne 'neb') { 1184 my $scheme = file_scheme($file); 1185 if (!$scheme or ($scheme ne 'neb')) { 1184 1186 carp "cannot replicate non-neulous file: $file"; 1185 1187 return 0; -
branches/czw_branch/20101203/dbconfig
- Property svn:mergeinfo deleted
-
branches/czw_branch/20101203/dbconfig/changes.txt
r29965 r30118 1989 1989 UPDATE dbversion set schema_version = '1.1.66', updated= CURRENT_TIMESTAMP(); 1990 1990 1991 -- output format for publishing / unique name for clients 1992 ALTER TABLE publishClient ADD name VARCHAR(64) UNIQUE; -- (Bill's request) 1993 ALTER TABLE publishClient ADD output_format SMALLINT NOT NULL default 1; 1994 1991 1995 -- Version 1.1.67 1992 1996 -
branches/czw_branch/20101203/dbconfig/notes.txt
r13740 r30118 8 8 * build ippbd ('make src' in dbconfig) 9 9 * check in dbconfig, ippdb, and ippTools 10 * update dbversion.schema.version (added by bills) 10 11 11 12 2007.06.04 : EAM -
branches/czw_branch/20101203/dbconfig/publish.md
r27028 r30118 9 9 workdir STR 255 10 10 comment STR 255 11 name STR 64 12 output_format S16 0 11 13 END 12 14 -
branches/czw_branch/20101203/ippMonitor/raw/czartool_labels.php
r29792 r30118 64 64 include 'version.php'; 65 65 echo "</p>"; 66 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus<br>Use <a href=\"$link\"> $plotTypeLink</a> plots <br/><a href=\"http://ipp004.ifa.hawaii.edu/clusterMonitor/top.html\">Who uses the cluster?</a>< /p>";66 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus<br>Use <a href=\"$link\"> $plotTypeLink</a> plots <br/><a href=\"http://ipp004.ifa.hawaii.edu/clusterMonitor/top.html\">Who uses the cluster?</a><br><a href=\"http://ipp004.ifa.hawaii.edu/ippMetrics\">IPP Metrics</a><br/><a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/PS1_IPP_CzarLogs\">Czar log pages</a></p>"; 67 67 68 68 … … 399 399 ."&plottype=".$plotType; 400 400 401 $searchState = "new"; 402 if ($server == "update") $searchState = "update"; 403 401 404 // write rows 402 405 foreach ($labels as &$thisLabel) { … … 437 440 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 438 441 439 $link = "failedChipProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $thisLabel . "&chipRun.state= new";442 $link = "failedChipProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $thisLabel . "&chipRun.state=".$searchState; 440 443 getStateAndFaults($db, $thisLabel, $selectedState, "chip", $str, $anyFaults); 441 444 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 442 445 443 $link = "failedCamProcessedExp.php?pass=" . $pass . "&proj=" . $proj . "&camRun.label=" . $thisLabel . "&camRun.state= new";446 $link = "failedCamProcessedExp.php?pass=" . $pass . "&proj=" . $proj . "&camRun.label=" . $thisLabel . "&camRun.state=".$searchState; 444 447 getStateAndFaults($db, $thisLabel, $selectedState, "cam", $str, $anyFaults); 445 448 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 446 449 447 $link = "failedFakeProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&fakeRun.label=" . $thisLabel . "&fakeRun.state= new";450 $link = "failedFakeProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&fakeRun.label=" . $thisLabel . "&fakeRun.state=".$searchState; 448 451 getStateAndFaults($db, $thisLabel, $selectedState, "fake", $str, $anyFaults); 449 452 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 450 453 451 $link = "failedWarpSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.label=" . $thisLabel . "&warpRun.state= new";454 $link = "failedWarpSkyfiles.php?pass=" . $pass . "&proj=" . $proj . "&warpRun.label=" . $thisLabel . "&warpRun.state=".$searchState; 452 455 getStateAndFaults($db, $thisLabel, $selectedState, "warp", $str, $anyFaults); 453 456 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 454 457 455 $link = "failedStackSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.label=" . $thisLabel . "&stackRun.state= new";458 $link = "failedStackSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&stackRun.label=" . $thisLabel . "&stackRun.state=".$searchState; 456 459 getStateAndFaults($db, $thisLabel, $selectedState, "stack", $str, $anyFaults); 457 460 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 458 461 459 $link = "failedDiffSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.label=" . $thisLabel . "&diffRun.state= new";462 $link = "failedDiffSkyfile.php?pass=" . $pass . "&proj=" . $proj . "&diffRun.label=" . $thisLabel . "&diffRun.state=".$searchState; 460 463 getStateAndFaults($db, $thisLabel, $selectedState, "diff", $str, $anyFaults); 461 464 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); … … 605 608 ."&allservercmd=stop"; 606 609 607 write_table_cell($class, '%s', $link, "Stop all"); 610 $link = ""; # TODO removed links temporarily 611 write_table_cell($class, '%s', $link, "Stop all"); 608 612 $link = "czartool_labels.php?pass=".$pass 609 613 ."&proj=".$proj … … 613 617 ."&allservercmd=run"; 614 618 615 write_table_cell($class, '%s', $link, "Run all"); 619 $link = ""; # TODO removed links temporarily 620 write_table_cell($class, '%s', $link, "Run all"); 616 621 echo "</tr>\n"; 617 622 … … 628 633 ."&plottype=".$plotType; 629 634 630 write_table_cell($class, '%s', $link, $server); 635 $link = ""; # TODO removed links temporarily 636 write_table_cell($class, '%s', $link, $server); 631 637 write_table_cell($class, '%s', "", $alive ? "yes" : "NO"); 632 638 … … 644 650 645 651 $link = $link . "stop"; 646 write_table_cell($class, '%s', $link, "stop"); 652 $link = ""; # TODO removed links temporarily 653 write_table_cell($class, '%s', $link, "stop"); 647 654 write_table_cell($class, '%s', "", ""); 648 655 } … … 651 658 $link = $link . "run"; 652 659 write_table_cell($class, '%s', "", ""); 653 write_table_cell($class, '%s', $link, "run"); 660 $link = ""; # TODO removed links temporarily 661 write_table_cell($class, '%s', $link, "run"); 654 662 } 655 663 } … … 759 767 ########################################################################### 760 768 function showReplicationsStatus($replHost, $replUser, $replPassword, $replDatabaseName) { 761 #print "<br>$replHost, $replUser, $replPassword, $replDatabaseName<br/>";762 $dbRepl = DB::connect("mysql://$replUser:$replPassword@$replHost");763 if (PEAR::isError($dbRepl)) {764 die("MySQL DB connection error: Check the configuration for $replDatabaseName");765 }766 $res = $dbRepl->query('SHOW SLAVE STATUS');767 while ($res->fetchInto($row)) {768 # Have a look for Last_Errno in http://dev.mysql.com/doc/refman/5.0/en/show-slave-status.html769 $errorStatusInMySql = $row[18];770 $replStatus = ($errorStatusInMySql==0?"OK":"<font color=\"red\">PROBLEM</font>");771 echo "<tr><td>$replDatabaseName</td><td>$replStatus</td></tr>";772 if ($errorStatusInMySql!=0) {773 echo "<tr><td colspan=\"2\">Connect to $replDatabaseName replication host, execute 'SHOW SLAVE STATUS', and fix the problem.<br/>";774 echo "Information <a href=\"http://dev.mysql.com/doc/refman/5.0/en/show-slave-status.html\">here</a></td></tr>";775 }776 }777 $dbRepl->disconnect();769 #print "<br>$replHost, $replUser, $replPassword, $replDatabaseName<br/>"; 770 $dbRepl = DB::connect("mysql://$replUser:$replPassword@$replHost"); 771 if (PEAR::isError($dbRepl)) { 772 die("MySQL DB connection error: Check the configuration for $replDatabaseName"); 773 } 774 $res = $dbRepl->query('SHOW SLAVE STATUS'); 775 while ($res->fetchInto($row)) { 776 # Have a look for Last_Errno in http://dev.mysql.com/doc/refman/5.0/en/show-slave-status.html 777 $errorStatusInMySql = $row[18]; 778 $replStatus = ($errorStatusInMySql==0?"OK":"<font color=\"red\">PROBLEM</font>"); 779 echo "<tr><td>$replDatabaseName</td><td>$replStatus</td></tr>"; 780 if ($errorStatusInMySql!=0) { 781 echo "<tr><td colspan=\"2\">Connect to $replDatabaseName replication host, execute 'SHOW SLAVE STATUS', and fix the problem.<br/>"; 782 echo "Information <a href=\"http://dev.mysql.com/doc/refman/5.0/en/show-slave-status.html\">here</a></td></tr>"; 783 } 784 } 785 $dbRepl->disconnect(); 778 786 } 779 787 -
branches/czw_branch/20101203/ippMonitor/raw/site.php.in
r29654 r30118 27 27 $REPL_DBNAME_GPC1 = "gpc1"; 28 28 29 $REPL_HOST_NEBULOUS = "ipp 0222.IfA.Hawaii.Edu";29 $REPL_HOST_NEBULOUS = "ippdb02.IfA.Hawaii.Edu"; 30 30 $REPL_USER_NEBULOUS = "ippMonitor"; 31 31 $REPL_PASSWORD_NEBULOUS = "ippMonitor"; -
branches/czw_branch/20101203/ippScripts
- Property svn:mergeinfo deleted
-
branches/czw_branch/20101203/ippScripts/scripts/automate_stacks.pl
r29700 r30118 1355 1355 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target); 1356 1356 1357 if ( $target eq 'OSS') {1357 if (($target eq 'OSS')||($target eq 'SweetSpot')) { 1358 1358 my $db = init_gpc_db(); 1359 1359 … … 1372 1372 1373 1373 if (($#{ $warps } + 1) % 2 != 0) { 1374 print STDERR "Number of input warps to make OSS diffs is not even! $#{ $warps }\n"; 1375 last; 1374 print STDERR "Number of input warps to make OSS diffs is not even! $this_object $#{ $warps }\n"; 1375 # last; 1376 next; 1376 1377 } 1377 1378 -
branches/czw_branch/20101203/ippScripts/scripts/camera_exp.pl
r29893 r30118 378 378 $ipprc->file_exists($file); 379 379 380 if ($replicate and (file_scheme($file) eq 'neb')) { 380 my $scheme = file_scheme($file); 381 if ($replicate and $scheme and (file_scheme($file) eq 'neb')) { 381 382 $ipprc->replicate_file($file) or &my_die("failed to replicate: $file\n", $cam_id, $PS_EXIT_SYS_ERROR); 382 383 } -
branches/czw_branch/20101203/ippScripts/scripts/chip_imfile.pl
r29896 r30118 159 159 if (storage_object_exists($configuration, \$gone)) { 160 160 if ($gone) { 161 rename_gone_file($configuration);162 161 $configuration = prepare_output('PPIMAGE.CONFIG', $outroot, $class_id, 1); 163 162 # if we dump the config we need to insure that the config dump represents … … 177 176 $ipprc->delete_destreak_backup_file($outputWeight) 178 177 or &my_die("failed to delete existing destreak backup weight file", $exp_id, $chip_id, $class_id, $PS_EXIT_UNKNOWN_ERROR); 178 179 # don't do binned images when updating unless we are starting from scratch. 180 $do_binned_images = 0 unless $dump_config; 179 181 } 180 182 if ($do_binned_images) { … … 491 493 check_output($configuration, 1) if $dump_config; 492 494 check_output($backmdl, 1) if $outputBackmdlExpect; 493 check_output($pattern, 1) if $outputPatternExpect; 495 # allow the pattern file to be missing if run state is update older data doesn't have one 496 # I should parse the config dump file to calculate the 'Expect' variables 497 check_output($pattern, 1, $run_state eq 'update') if $outputPatternExpect; 494 498 if ($do_photom) { 495 499 check_output($outputSources, 1); … … 556 560 if ($gone) { 557 561 carp "WARNING: photometry sources storage object exists but all instances are permanently gone"; 558 rename_gone_file($outputSources);559 562 $make_sources = 1; 560 563 } … … 579 582 if ($gone) { 580 583 carp "WARNING: PSF storage object exists but all instances are permanently gone"; 581 rename_gone_file($outputPsf);582 584 $make_psf = 1; 583 585 } … … 613 615 sub storage_object_exists 614 616 { 617 return 0 if !$neb; 618 615 619 my $file = shift; 616 620 my $ref_all_gone = shift; 621 617 622 618 623 my $exists = $neb->storage_object_exists($file); … … 678 683 return 1; 679 684 } 680 sub rename_gone_file681 {682 # check whether the only instance of file is on a lost volume683 # XXX: we don't have a proper interface for this.684 # For now try to use Bill's hack: the script 'whichnode'685 686 my $file = shift;687 $neb->move($file, "$file.gone") or688 &my_die("failed to rename: $file", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);689 }690 685 691 686 # Prepare to write to an output file … … 711 706 my $file = shift; 712 707 my $replicate = shift; 708 my $allow_missing = shift; 713 709 714 710 if (!defined $file) { … … 716 712 } 717 713 718 &my_die("Couldn't find expected output file: $file", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($file); 719 720 if ($replicate and (file_scheme($file) eq 'neb')) { 714 my $exists = $ipprc->file_exists($file); 715 716 if (!$exists) { 717 if ($allow_missing) { 718 carp("Couldn't find expected output_file: $file but continuing anyways\n"); 719 return 1; 720 } 721 &my_die("Couldn't find expected output file: $file", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 722 } 723 724 if ($replicate and $neb) { 721 725 $ipprc->replicate_file($file) or &my_die("failed to replicate: $file\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 722 726 } -
branches/czw_branch/20101203/ippScripts/scripts/dist_bundle.pl
r29063 r30118 62 62 my $streaksrelease = can_run('streaksrelease') or (warn "Can't find streaksrelease" and $missing_tools = 1); 63 63 my $bgtool = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1); 64 my $file_cmd = can_run('file') or (warn "can't find program file" and $missing_tools = 1); 65 my $zcat = can_run('zcat') or (warn "can't find program zcat" and $missing_tools = 1); 64 66 if ($missing_tools) { 65 67 warn("Can't find required tools."); … … 526 528 $PS_EXIT_CONFIG_ERROR) if (!$resolved); 527 529 530 &my_die("config dump file resolved but not accessible: $config_file_rule", $component, 531 $PS_EXIT_CONFIG_ERROR) if !$ipprc->file_exists($resolved); 532 533 my $mdc_compressed; 534 { 535 my $command = "$file_cmd $resolved"; 536 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 537 run(command => $command, verbose => $verbose); 538 unless ($success) { 539 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 540 &my_die("Unable to perform $command: $error_code", $component, $error_code); 541 } 542 my $output = join "", @$stdout_buf; 543 # XXX: may need to to make this more robust 544 $mdc_compressed = ($output =~ /gzip/); 545 } 546 my $inName; 547 if ($mdc_compressed) { 548 my $tmpfile; 549 ($tmpfile, $inName) = tempfile( "/tmp/bundle.XXXX", UNLINK => !$save_temps ); 550 close($tmpfile) or &my_die("failed to close $inName", $component, $PS_EXIT_UNKNOWN_ERROR); 551 552 my $command = "$zcat $resolved > $inName"; 553 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 554 run(command => $command, verbose => $verbose); 555 unless ($success) { 556 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 557 &my_die("Unable to perform $command: $error_code", $component, $error_code); 558 } 559 560 561 } else { 562 $inName = $resolved; 563 } 564 my $in = open_with_retries($inName); 565 528 566 # we don't use the mdc parser because the perl parser is way is too slow for complicated config 529 567 # files like this 530 my $in = open_with_retries($resolved);531 532 568 my $line; 533 569 while ($line = <$in>) { -
branches/czw_branch/20101203/ippScripts/scripts/magic_destreak.pl
r29571 r30118 309 309 } 310 310 311 $sources = $ipprc->filename("PSPHOT.OUTPUT", $path_base, $class_id); 311 # only destreak cmf file if this is a new run 312 if ($run_state eq 'new') { 313 $sources = $ipprc->filename("PSPHOT.OUTPUT", $path_base, $class_id); 314 } 312 315 313 316 } elsif ($stage eq "chip_bg") { -
branches/czw_branch/20101203/ippScripts/scripts/magic_destreak_defineruns.pl
r27718 r30118 78 78 foreach my $label (@labels) { 79 79 my $command = "$magicdstool -definebyquery -stage $stage -workdir $workdir -label $label"; 80 $command .= " - dry_run" if $no_update;80 $command .= " -pretend" if $no_update; 81 81 $command .= " -limit $stage_limit" if $stage_limit; 82 82 $command .= " -set_label $label"; -
branches/czw_branch/20101203/ippScripts/scripts/magic_destreak_revert.pl
r29573 r30118 191 191 $image = $ipprc->filename("PPIMAGE.CHIP", $path_base, $class_id); 192 192 $weight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $path_base, $class_id); 193 $sources = $ipprc->filename("PSPHOT.OUTPUT", $path_base, $class_id);194 193 195 194 # we use the mask output from the camera stage for input and replace … … 204 203 } 205 204 205 # only revert sources if this is a new run, not one being updated 206 if ($run_state eq 'new') { 207 $sources = $ipprc->filename("PSPHOT.OUTPUT", $path_base, $class_id); 208 $bsources = $ipprc->filename("PSPHOT.OUTPUT", $backup_path_base, $class_id); 209 } 210 206 211 $bimage = $ipprc->filename("PPIMAGE.CHIP", $backup_path_base, $class_id); 207 212 # This is somewhat kludgey but it works whether the mask is camera mask or chip mask … … 209 214 $bch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $backup_path_base, $class_id); 210 215 $bweight = $ipprc->filename("PPIMAGE.CHIP.VARIANCE", $backup_path_base, $class_id); 211 $bsources = $ipprc->filename("PSPHOT.OUTPUT", $backup_path_base, $class_id);212 216 } elsif ($stage eq "camera") { 213 217 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $path_base); -
branches/czw_branch/20101203/ippScripts/scripts/publish_file.pl
r29622 r30118 44 44 my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir ); 45 45 my ( $dbname, $verbose, $no_update, $no_op, $save_temps, $redirect ); 46 my ( $output_format ); 46 47 47 48 GetOptions( … … 59 60 'save-temps' => \$save_temps, # Save temporary files? 60 61 'redirect-output' => \$redirect, # Redirect output to log file? 62 'output_format=i' => \$output_format, # Output format for ppMops 61 63 ) or pod2usage( 2 ); 62 64 … … 191 193 warp_id => $comp->{warp1}, 192 194 diff_id => $comp->{diff_id}, 195 output_format => $comp->{output_format}, 193 196 direction => 1, 194 197 }; … … 323 326 324 327 my $command = "$ppMops $input $output"; 325 $command .= " -version 1"; # XXX : NOTE: for now, MOPS just wants PS1_DV1 (remove this eventually...)326 328 $command .= " -exp_name " . $data->{exp_name} if defined $data->{exp_name}; 327 329 $command .= " -exp_id " . $data->{exp_id} if defined $data->{exp_id}; … … 335 337 $command .= " -zp_error " . $data->{zp_err} if defined $data->{zp_err}; 336 338 $command .= " -astrom_rms " . $data->{astrom} if defined $data->{astrom}; 339 $command .= " -version " . $data->{output_format} if defined $data->{output_format}; 337 340 338 341 unless ($no_op) { -
branches/czw_branch/20101203/ippScripts/scripts/receive_file.pl
r29574 r30118 32 32 my $receivetool = can_run('receivetool') or (warn "Can't find receivetool" and $missing_tools = 1); 33 33 my $dsproductls = can_run('dsfilesetls') or (warn "Can't find dsfilesetls" and $missing_tools = 1); 34 my $gunzip = can_run('gunzip') or (warn "Can't find gunzip" and $missing_tools = 1); 34 35 if ($missing_tools) { 35 36 warn("Can't find required tools."); … … 404 405 my $workdir = shift; 405 406 407 my $filecmd_output = `file $src`; 408 &my_die("failed to determinte file type of $src", $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$filecmd_output; 409 chomp $filecmd_output; 410 411 my $tmpName; 412 if ($filecmd_output =~ /gzip/) { 413 my $tmpfile; 414 ($tmpfile, $tmpName) = tempfile( "/tmp/receive.XXXX", UNLINK => !$save_temps ); 415 close($tmpfile) or &my_die("failed to close $tmpName", $file_id, $PS_EXIT_UNKNOWN_ERROR); 416 417 my $command = "$gunzip -c $src > $tmpName"; 418 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 419 run(command => $command, verbose => $verbose); 420 unless ($success) { 421 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 422 &my_die("Unable to perform $command: $error_code", $component, $error_code); 423 } 424 $src = $tmpName; 425 } 426 406 427 open my $IN, "<$src" or &my_die("failed to open $src for input", $file_id, $PS_EXIT_UNKNOWN_ERROR); 407 428 open my $OUT, ">$dest" or &my_die("failed to open $dest for output", $file_id, $PS_EXIT_UNKNOWN_ERROR); -
branches/czw_branch/20101203/ippScripts/scripts/register_imfile.pl
r29982 r30118 287 287 if ($burntool_data->{burnable} == 0) { 288 288 $regtool_update .= " -burntool_state 0 -set_state pending_burntool "; 289 unless ($no_update) { 290 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 291 IPC::Cmd::run(command => $regtool_update, verbose => $verbose); 292 unless ($success) { 293 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 294 warn ("Unable to perform regtool -addprocessedimfile: $error_code"); 295 exit($error_code); 296 } 297 } else { 298 print "skipping command: $command\n"; 299 } 289 300 } 290 301 else { … … 296 307 $apply_command .= " --verbose " if $verbose; 297 308 print "$apply_command\n"; 298 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 299 IPC::Cmd::run(command => $apply_command, verbose => $verbose); 300 unless ($success) { 301 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 302 warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code"); 303 exit($error_code); 309 unless ($no_update) { 310 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 311 IPC::Cmd::run(command => $apply_command, verbose => $verbose); 312 unless ($success) { 313 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 314 warn ("Unable to perform ipp_apply_burntool_single.pl: $error_code"); 315 exit($error_code); 316 } 304 317 } 305 318 } 306 319 307 unless ($no_update) {308 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =309 IPC::Cmd::run(command => $regtool_update, verbose => $verbose);310 unless ($success) {311 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);312 warn ("Unable to perform regtool -addprocessedimfile: $error_code");313 exit($error_code);314 }315 } else {316 print "skipping command: $command\n";317 }318 320 319 321 } -
branches/czw_branch/20101203/ippTasks
- Property svn:mergeinfo deleted
-
branches/czw_branch/20101203/ippTasks/detrend.resid.pro
r28598 r30118 136 136 137 137 task.exec 138 periods -exec $RUNEXEC 139 138 140 book npages detPendingResidImfile -var N 139 141 if ($N == 0) break … … 187 189 echo command $run 188 190 end 191 periods -exec 0.05 189 192 command $run 190 193 end -
branches/czw_branch/20101203/ippTasks/publish.pro
r29724 r30118 130 130 book getword publishRun $pageName stage_id -var STAGE_ID 131 131 book getword publishRun $pageName dbname -var DBNAME 132 book getword publishRun $pageName output_format -var OUTPUT_FORMAT 132 133 133 134 stdout $LOGDIR/publish.run.log … … 137 138 strsub $WORKDIR_TEMPLATE @HOST@ $default_host -var WORKDIR 138 139 139 $run = publish_file.pl --pub_id $PUB_ID --camera $CAMERA --workdir $WORKDIR --product $PRODUCT --stage $STAGE --stage_id $STAGE_ID -- redirect-output140 $run = publish_file.pl --pub_id $PUB_ID --camera $CAMERA --workdir $WORKDIR --product $PRODUCT --stage $STAGE --stage_id $STAGE_ID --output_format $OUTPUT_FORMAT --redirect-output 140 141 add_standard_args run 141 142 -
branches/czw_branch/20101203/ippTasks/register.pro
r29982 r30118 466 466 $today = `date -u +%Y-%m-%d` 467 467 # debugging purposes 468 $today = "2010-12-06"468 # $today = "2010-12-06" 469 469 $run = $run -date $today -valid_burntool $valid_burntool_value 470 470 if ($DB:n == 0) … … 478 478 end 479 479 480 echo $run480 # echo $run 481 481 add_poll_args run 482 482 command $run -
branches/czw_branch/20101203/ippToPsps/perl/checkOdmStatus.pl
r29652 r30118 39 39 ); 40 40 41 if (@ARGV) { 42 print "* UNKNKOWN: option @ARGV\n"; 43 } 41 44 if (!defined $product) { 42 45 print "* OPTIONAL: a datastore product name -p <name>\n"; … … 159 162 $numBatchesToCheck++; 160 163 161 # if not merged then update by polling ODM for status164 # if not merged or failed load, then update by polling ODM for status 162 165 if (!$merged && !$loadFailed) { 163 164 166 if (checkODM($batch->getName(), \$loadedToOdm, \$loadFailed, \$mergeWorthy, \$merged)) { 165 167 -
branches/czw_branch/20101203/ippToPsps/perl/ippToPsps/DetectionBatch.pm
r29236 r30118 78 78 # get neb path of smf file 79 79 my $nebPath = $self->{_gpc1Db}->getCameraStageSmfForThisDvoDb($self->{_dvoDb}, $self->{_expId}); 80 if (!$nebPath) { return 0; }80 if (!$nebPath) { return undef; } 81 81 82 82 # get real filename from neb 'key' -
branches/czw_branch/20101203/ippToPsps/perl/ippToPsps/IppToPspsDb.pm
r29345 r30118 11 11 ########################################################################### 12 12 # 13 # Returns a list of batches that have been processed and loaded to datastore13 # Returns a list of batches created within the provided dates 14 14 # 15 15 ########################################################################### … … 39 39 $query->execute; 40 40 ${$batches} = $query->fetchall_arrayref(); 41 my $count = scalar @{${$batches}}; 42 43 return $count; 41 return scalar @{${$batches}}; 44 42 } 45 43 … … 72 70 $query->execute; 73 71 ${$batches} = $query->fetchall_arrayref(); 74 my $count = scalar @{${$batches}}; 75 76 return $count; 72 return scalar @{${$batches}}; 73 } 74 75 ########################################################################### 76 # 77 # Returns a count of all distinct exposures between provided limits 78 # 79 ########################################################################### 80 sub countExposures { 81 my ($self, $fromExp, $toExp, $datastoreProduct, $batchType, $dvoDb) = @_; 82 83 my $query = $self->{_db}->prepare(<<SQL); 84 SELECT COUNT(distinct exp_id) 85 FROM batches 86 WHERE exp_id >= $fromExp 87 AND exp_id <= $toExp 88 AND dvo_db = '$dvoDb' 89 AND batch_type = '$batchType' 90 AND datastore_product = '$datastoreProduct' 91 SQL 92 93 $query->execute; 94 return scalar $query->fetchrow_array(); 95 } 96 97 ########################################################################### 98 # 99 # Returns a count of exposures (between provided limits) that have been merged 100 # 101 ########################################################################### 102 sub countMergedExposures { 103 my ($self, $fromExp, $toExp, $datastoreProduct, $batchType, $dvoDb) = @_; 104 105 my $query = $self->{_db}->prepare(<<SQL); 106 SELECT COUNT(distinct exp_id) 107 FROM batches 108 WHERE exp_id >= $fromExp 109 AND exp_id <= $toExp 110 AND dvo_db = '$dvoDb' 111 AND batch_type = '$batchType' 112 AND datastore_product = '$datastoreProduct' 113 AND merged 114 SQL 115 116 $query->execute; 117 return scalar $query->fetchrow_array(); 118 } 119 120 ########################################################################### 121 # 122 # Returns a list of exposures (between provided limits) that have not been merged 123 # 124 ########################################################################### 125 sub getUnmergedExposures { 126 my ($self, $exposures, $fromExp, $toExp, $datastoreProduct, $batchType, $dvoDb) = @_; 127 128 my $query = $self->{_db}->prepare(<<SQL); 129 SELECT batch_id, exp_id 130 FROM batches 131 WHERE exp_id >= $fromExp 132 AND exp_id <= $toExp 133 AND dvo_db = '$dvoDb' 134 AND batch_type = '$batchType' 135 AND datastore_product = '$datastoreProduct' 136 AND !merged 137 GROUP BY exp_id 138 SQL 139 140 $query->execute; 141 ${$exposures} = $query->fetchall_arrayref(); 142 return scalar @{${$exposures}}; 77 143 } 78 144 … … 166 232 ####################################################################################### 167 233 # 234 # Checks whether this exposure failed to load to the ODM 235 # 236 ######################################################################################## 237 sub didLoadFail { 238 my ($self, $expId) = @_; 239 240 my $query = $self->{_db}->prepare(<<SQL); 241 SELECT COUNT(*) 242 FROM batches 243 WHERE exp_id = $expId 244 AND load_failed 245 SQL 246 247 $query->execute; 248 249 return scalar $query->fetchrow_array(); 250 } 251 252 ####################################################################################### 253 # 254 # Checks whether this exposure has a min object ID under old PSPS hard limit of 72010000000000001 255 # 256 ######################################################################################## 257 sub isMinObjIdUnderLimit { 258 my ($self, $expId) = @_; 259 260 my $query = $self->{_db}->prepare(<<SQL); 261 SELECT COUNT(*) 262 FROM batches 263 WHERE exp_id = $expId 264 AND min_obj_id < 72010000000000001 265 SQL 266 267 $query->execute; 268 269 return scalar $query->fetchrow_array(); 270 } 271 ####################################################################################### 272 # 273 # Checks whether this exposure has been processed 274 # 275 ######################################################################################## 276 sub isExposureProcessed { 277 my ($self, $expId) = @_; 278 279 my $query = $self->{_db}->prepare(<<SQL); 280 SELECT COUNT(*) 281 FROM batches 282 WHERE exp_id = $expId 283 AND processed 284 SQL 285 286 $query->execute; 287 288 return scalar $query->fetchrow_array(); 289 } 290 291 ####################################################################################### 292 # 293 # Checks whether this exposure has been merged 294 # 295 ######################################################################################## 296 sub isExposureMerged { 297 my ($self, $expId) = @_; 298 299 my $query = $self->{_db}->prepare(<<SQL); 300 SELECT COUNT(*) 301 FROM batches 302 WHERE exp_id = $expId 303 AND merged 304 SQL 305 306 $query->execute; 307 308 return scalar $query->fetchrow_array(); 309 } 310 311 ####################################################################################### 312 # 313 # Checks whether this exposure has been loaded to ODM 314 # 315 ######################################################################################## 316 sub isExposureLoadedToOdm { 317 my ($self, $expId) = @_; 318 319 my $query = $self->{_db}->prepare(<<SQL); 320 SELECT COUNT(*) 321 FROM batches 322 WHERE exp_id = $expId 323 AND loaded_to_ODM 324 SQL 325 326 $query->execute; 327 328 return scalar $query->fetchrow_array(); 329 } 330 331 ####################################################################################### 332 # 168 333 # Checks whether we have successfully processed this exposure and loaded it to the datastore 169 334 # … … 184 349 my $processed = $query->fetchrow_array(); 185 350 351 # TODO can use return scalar $query->fetchrow_array(); 186 352 return $processed; 187 353 } -
branches/czw_branch/20101203/ippToPsps/perl/ippToPsps_run.pl
r29089 r30118 15 15 use ippToPsps::IppToPspsDb; 16 16 use ippToPsps::Datastore; 17 #use ippToPsps::BatchManager; 17 18 18 19 # globals … … 112 113 my $datastore = undef; 113 114 if ($datastoreProduct) {$datastore = new ippToPsps::Datastore($datastoreProduct, $verbose, $save_temps);} 115 #my $batchManager = new ippToPsps::BatchManager($ippToPspsDb, $output, $verbose, $save_temps); 114 116 115 117 # check we can run programs and get camera config -
branches/czw_branch/20101203/ippTools
- Property svn:mergeinfo deleted
-
branches/czw_branch/20101203/ippTools/configure.ac
r29499 r30118 1 1 AC_PREREQ(2.61) 2 2 3 AC_INIT([ipptools], [1.1.6 5], [ipp-support@ifa.hawaii.edu])3 AC_INIT([ipptools], [1.1.66], [ipp-support@ifa.hawaii.edu]) 4 4 AC_CONFIG_SRCDIR([autogen.sh]) 5 5 … … 18 18 PKG_CHECK_MODULES([PSLIB], [pslib >= 1.1.0]) 19 19 PKG_CHECK_MODULES([PSMODULES], [psmodules >= 1.1.0]) 20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.6 5])20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.66]) 21 21 PKG_CHECK_MODULES([PPSTAMP], [ppstamp >= 0.1.1]) 22 22 -
branches/czw_branch/20101203/ippTools/share/camtool_find_pendingimfile.sql
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20101103/ippTools/share/camtool_find_pendingimfile.sql (added) merged: 29906,29918,29920
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/ippTools/share/pubtool_definerun.sql
r28428 r30118 3 3 client_id, 4 4 stage_id, 5 src_label 5 src_label, 6 output_format 6 7 FROM ( 7 8 -- Get diffs to publish … … 9 10 client_id, 10 11 diff_id AS stage_id, 11 diffRun.label AS src_label 12 diffRun.label AS src_label, 13 output_format 12 14 FROM publishClient 13 15 JOIN diffRun … … 28 30 client_id, 29 31 cam_id AS stage_id, 30 camRun.label AS src_label 32 camRun.label AS src_label, 33 output_format 31 34 FROM publishClient 32 35 JOIN camRun … … 43 46 client_id, 44 47 diff_phot_id AS stage_id, 45 diffPhotRun.label AS src_label 48 diffPhotRun.label AS src_label, 49 output_format 46 50 FROM publishClient 47 51 JOIN diffPhotRun -
branches/czw_branch/20101203/ippTools/share/pubtool_pending.sql
r28491 r30118 9 9 publishClient.stage, 10 10 publishClient.workdir, 11 publishClient.output_format, 11 12 diffRun.diff_id AS stage_id, 12 13 rawExp.camera, … … 35 36 publishClient.stage, 36 37 publishClient.workdir, 38 publishClient.output_format, 37 39 camRun.cam_id AS stage_id, 38 40 rawExp.camera, … … 56 58 publishClient.stage, 57 59 publishClient.workdir, 60 publishClient.output_format, 58 61 diffPhotRun.diff_phot_id AS stage_id, 59 62 rawExp.camera, -
branches/czw_branch/20101203/ippTools/share/pxadmin_create_tables.sql
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20101103/ippTools/share/pxadmin_create_tables.sql (added) merged: 29906,29918,29920
r29982 r30118 1645 1645 workdir VARCHAR(255) NOT NULL, -- working directory 1646 1646 comment VARCHAR(255), -- for human memory 1647 PRIMARY KEY(client_id) 1647 name varchar(64) default NULL, -- unique client_id verbose identifier 1648 output_format SMALLINT NOT NULL default 1, -- format output versioning 1649 PRIMARY KEY(client_id), 1650 UNIQUE KEY name (name) 1648 1651 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1649 1652 - Property svn:mergeinfo changed
-
branches/czw_branch/20101203/ippTools/share/regtool_pendingexp.sql
r29982 r30118 1 1 SELECT DISTINCT 2 exp_id, 3 tmp_exp_name, 4 tmp_camera, 5 tmp_telescope, 6 state, 7 workdir, 8 workdir_state, 9 reduction, 10 dvodb, 11 tess_id, 12 end_stage, 13 label, 14 camera, 15 filter, 16 obs_mode, 17 obs_group, 18 epoch, 19 dateobs 20 FROM 21 (SELECT 22 newExp.*, 23 newImfile.tmp_class_id, 24 rawImfile.tmp_class_id as raw_tmp_class_id, 25 rawImfile.camera, 26 rawImfile.filter, 27 rawImfile.dateobs, 28 rawImfile.obs_mode, 29 rawImfile.obs_group 30 FROM newExp 31 JOIN newImfile 32 USING(exp_id) 33 LEFT JOIN rawExp 34 USING(exp_id) 35 LEFT JOIN rawImfile 36 ON newImfile.exp_id = rawImfile.exp_id 37 AND newImfile.tmp_class_id = rawImfile.tmp_class_id 38 WHERE 39 newExp.state = 'run' 40 AND rawExp.exp_id IS NULL 41 AND rawImfile.data_state = 'full' 42 -- where hook %s 43 GROUP BY 44 newExp.exp_id 45 HAVING 46 COUNT(newImfile.tmp_class_id) = COUNT(rawImfile.tmp_class_id) 47 AND SUM(rawImfile.fault) = 0 2 exp_id, 3 tmp_exp_name, 4 tmp_camera, 5 tmp_telescope, 6 state, 7 workdir, 8 workdir_state, 9 reduction, 10 dvodb, 11 tess_id, 12 end_stage, 13 label, 14 camera, 15 filter, 16 obs_mode, 17 obs_group, 18 epoch, 19 dateobs 20 FROM 21 ( 22 select DISTINCT * from 23 ( 24 select newExp.*,count(newImfile.tmp_class_id) AS new_count 25 from newExp 26 LEFT JOIN newImfile USING (exp_id) 27 LEFT JOIN rawExp USING (exp_id) 28 where 29 newExp.state = 'run' AND rawExp.exp_id IS NULL 30 GROUP BY newExp.exp_id 31 ) AS NEWEXPOSURES 32 JOIN 33 ( 34 select DISTINCT newExp.exp_id, 35 rawImfile.camera, 36 rawImfile.filter, 37 rawImfile.dateobs, 38 rawImfile.obs_mode, 39 rawImfile.obs_group, 40 count(rawImfile.tmp_class_id) AS raw_count 41 from newExp 42 LEFT JOIN rawExp USING (exp_id) 43 LEFT JOIN rawImfile USING (exp_id) 44 where 45 newExp.state = 'run' AND rawExp.exp_id IS NULL 46 AND rawImfile.data_state = 'full' 47 -- where hook %s 48 GROUP BY newExp.exp_id 49 HAVING SUM(rawImfile.fault) = 0 50 ) AS RAWEXPOSURES 51 USING (exp_id) 52 WHERE raw_count = new_count 53 ) AS Foo 48 54 -- limit hook %s 49 ) as Foo -
branches/czw_branch/20101203/ippTools/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20101103/ippTools/src (added) merged: 29664,29835,29872,29906,29918,29920
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/ippTools/src/dettool.c
r28689 r30118 572 572 PXOPT_COPY_F64(config->args, where, "-select_moon_phase_min", "moon_phase", ">="); 573 573 PXOPT_COPY_F64(config->args, where, "-select_moon_phase_max", "moon_phase", "<="); 574 575 PXOPT_COPY_STR(config->args, where, "-select_state", "state", "="); 574 576 PXOPT_COPY_STR(config->args, where, "-comment", "comment", "LIKE"); 575 577 -
branches/czw_branch/20101203/ippTools/src/dettoolConfig.c
r28578 r30118 138 138 psMetadataAddF64(definebyqueryArgs, PS_LIST_TAIL, "-select_moon_phase_min", 0, "define min moon phase", NAN); 139 139 psMetadataAddF64(definebyqueryArgs, PS_LIST_TAIL, "-select_moon_phase_max", 0, "define max moon phase", NAN); 140 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-select_state", 0, "select by state (default is 'full')", "full"); 140 141 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-comment", 0, "search by comment field (LIKE comparison)", NULL); 141 142 -
branches/czw_branch/20101203/ippTools/src/difftool.c
r29696 r30118 483 483 psFree(where); 484 484 485 psStringAppend(&query, "\nORDER by priority DESC, diff_id ");485 psStringAppend(&query, "\nORDER by priority DESC, diff_id, skycell_id"); 486 486 487 487 // treat limit == 0 as "no limit" … … 1978 1978 PXOPT_COPY_STR(config->args, stack2Where, "-skycell_id", "stackRun.skycell_id", "=="); 1979 1979 PXOPT_COPY_STR(config->args, stack1Where, "-input_label", "stackRun.label","=="); 1980 PXOPT_COPY_STR(config->args, stack1Where, "-input_data_group", "stackRun.data_group","=="); 1980 1981 PXOPT_COPY_STR(config->args, stack2Where, "-template_label", "stackRun.label","=="); 1981 1982 PXOPT_COPY_F32(config->args, stack1Where, "-good_frac", "stackSumSkyfile.good_frac", ">="); … … 2042 2043 } 2043 2044 2044 psString queryCopy = psStringCopy(query);2045 psFree(query);2046 query = queryCopy;2047 2048 2045 psStringSubstitute(&query, stack1Query, "@STACK1_QUERY@"); 2049 2046 psStringSubstitute(&query, stack2Query, "@STACK2_QUERY@"); … … 2120 2117 psStringAppend(&this_stack1Query,"AND %s", thisWhere); 2121 2118 psFree(thisWhere); 2122 2123 psString queryCopy = psStringCopy(query);2124 psFree(query);2125 query = queryCopy;2126 2127 2119 2128 2120 psStringSubstitute(&query, this_stack1Query, "@STACK1_QUERY@"); -
branches/czw_branch/20101203/ippTools/src/difftoolConfig.c
r29553 r30118 336 336 psMetadataAddStr(definestackstackArgs, PS_LIST_TAIL, "-input_label", 0, "search by stack label for input", NULL); 337 337 psMetadataAddStr(definestackstackArgs, PS_LIST_TAIL, "-template_label", 0, "search by stack label for template", NULL); 338 psMetadataAddStr(definestackstackArgs, PS_LIST_TAIL, "-input_data_group", 0, "search by stack data_group for input", NULL); 338 339 psMetadataAddF32(definestackstackArgs, PS_LIST_TAIL, "-good_frac", 0, "minimum good fraction of skycell", NAN); 339 340 psMetadataAddStr(definestackstackArgs, PS_LIST_TAIL, "-set_workdir", 0, "define workdir (required)", NULL); -
branches/czw_branch/20101203/ippTools/src/magicdstool.c
r29611 r30118 1155 1155 1156 1156 psMetadata *where = psMetadataAlloc(); 1157 // new state 1158 PXOPT_LOOKUP_STR(new_state, config->args, "-set_state", false, false);1157 // new state (required 1158 PXOPT_LOOKUP_STR(new_state, config->args, "-set_state", true, false); 1159 1159 // old state (required) 1160 1160 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); -
branches/czw_branch/20101203/ippTools/src/magicdstoolConfig.c
r29611 r30118 163 163 // -clearstatefaults 164 164 psMetadata *clearstatefaultsArgs = psMetadataAlloc(); 165 psMetadataAddStr(clearstatefaultsArgs, PS_LIST_TAIL, "-set_state", 0, "new value for state ", NULL);165 psMetadataAddStr(clearstatefaultsArgs, PS_LIST_TAIL, "-set_state", 0, "new value for state (required)", NULL); 166 166 psMetadataAddStr(clearstatefaultsArgs, PS_LIST_TAIL, "-state", 0, "search by state (required)", NULL); 167 167 psMetadataAddS64(clearstatefaultsArgs, PS_LIST_TAIL, "-magic_ds_id", 0, "search by magictool de-streak ID", 0); -
branches/czw_branch/20101203/ippTools/src/pstamptool.c
r29569 r30118 950 950 PXOPT_COPY_S64(config->args, where, "-job_id", "job_id", "=="); 951 951 PXOPT_COPY_S64(config->args, where, "-dep_id", "dep_id", "=="); 952 953 PXOPT_COPY_S64(config->args, where, "-stage_id", "stage_id", "=="); 954 PXOPT_COPY_STR(config->args, where, "-component", "component", "=="); 955 952 956 PXOPT_COPY_S32(config->args, where, "-fault", "pstampDependent.fault", "=="); 957 953 958 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); 954 // if (fault_count) { 955 PXOPT_COPY_S32(config->args, where, "-fault_count", "pstampDependent.fault_count", ">="); 956 // } 959 PXOPT_COPY_S32(config->args, where, "-fault_count", "pstampDependent.fault_count", ">="); 957 960 958 961 // XXX: How about selecting by pstampRequest.label? No. That is too dangerous by itself. -
branches/czw_branch/20101203/ippTools/src/pstamptoolConfig.c
r29328 r30118 178 178 psMetadataAddS64(stopdependentjobArgs, PS_LIST_TAIL, "-job_id", 0, "job_id of jobs to update", 0); 179 179 psMetadataAddS64(stopdependentjobArgs, PS_LIST_TAIL, "-dep_id", 0, "dep_id of jobs to update", 0); 180 psMetadataAddS64(stopdependentjobArgs, PS_LIST_TAIL, "-stage_id", 0, "stage_id of jobs to update", 0); 181 psMetadataAddStr(stopdependentjobArgs, PS_LIST_TAIL, "-component", 0, "component of jobs to update", NULL); 180 182 psMetadataAddS16(stopdependentjobArgs, PS_LIST_TAIL, "-fault", 0, "current value for dependent fault", 0); 181 183 psMetadataAddS32(stopdependentjobArgs, PS_LIST_TAIL, "-fault_count", 0, "select by fault_count (>=)", 0); -
branches/czw_branch/20101203/ippTools/src/pubtool.c
r29321 r30118 96 96 PXOPT_LOOKUP_STR(comment, config->args, "-comment", false, false); 97 97 PXOPT_LOOKUP_BOOL(unmagicked, config->args, "-unmagicked", false); 98 99 if (!publishClientInsert(config->dbh, 0, 0, product, stage, !unmagicked, workdir, comment)) { 98 PXOPT_LOOKUP_STR(name, config->args, "-name", false, false); 99 PXOPT_LOOKUP_S16(output_format, config->args, "-output_format", false, false); 100 101 if (!publishClientInsert(config->dbh, 0, 0, product, stage, !unmagicked, workdir, comment, name, output_format)) { 100 102 psError(PS_ERR_UNKNOWN, false, "Database error"); 101 103 return false; … … 313 315 PXOPT_COPY_STR(config->args, where, "-stage", "publishClient.stage", "=="); 314 316 PXOPT_COPY_STR(config->args, where, "-comment", "publishClient.comment", "LIKE"); 317 PXOPT_COPY_STR(config->args, where, "-name", "publishClient.name", "LIKE"); 315 318 pxAddLabelSearchArgs(config, where, "-label", "publishRun.label", "=="); 316 319 -
branches/czw_branch/20101203/ippTools/src/pubtoolConfig.c
r28371 r30118 83 83 psMetadataAddBool(pendingArgs, PS_LIST_TAIL, "-simple", 0, "use simple output format?", false); 84 84 psMetadataAddU64(pendingArgs, PS_LIST_TAIL, "-limit", 0, "limit result set", 0); 85 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-name", 0, "search on client name", NULL); 85 86 86 87 // -add -
branches/czw_branch/20101203/ippTools/src/regtool.c
r30014 r30118 300 300 psStringSubstitute(&query,date,"@DATE@"); 301 301 302 fprintf(stderr,"%s",query);302 // fprintf(stderr,"%s",query); 303 303 304 304 if (!p_psDBRunQuery(config->dbh, query)) { … … 349 349 psMetadataAddStr(row,PS_LIST_TAIL,"previous_class_id",PS_META_REPLACE,"",previous_class_id); 350 350 } 351 351 // class_id = NULL sorts to the top of the list, so skip those (incomplete downloads) 352 if (!this_class_id) { 353 continue; 354 } 352 355 // Determine if we've crossed a class_id boundary, as this resets the bits. 353 356 if (previous_class_id) { … … 370 373 if ((psMetadataLookupS32(NULL,row,"is_downloaded") != 1)|| 371 374 (psMetadataLookupS32(NULL,row,"is_registered") != 1)) { 375 // printf("I claim this isn't downloaded or registered? %s %s\n",this_uri,this_class_id); 372 376 ok_to_burn = false; 373 377 } 374 378 if (already_burned == false) { 379 // printf("already_burned looks false %s %s\n",this_uri,this_class_id); 375 380 ok_to_burn = false; 376 381 } … … 398 403 } 399 404 400 // printf("STATUS: %s %s %s %s (%d %d) \n",this_uri,previous_uri,this_class_id,previous_class_id,ok_to_burn,already_burned);405 // printf("STATUS: %s %s %s %s (%d %d) %d %d %d\n",this_uri,previous_uri,this_class_id,previous_class_id,ok_to_burn,already_burned,psMetadataLookupS32(NULL,row,"burntool_state"),psMetadataLookupS32(NULL,row,"is_registered"),psMetadataLookupS32(NULL,row,"is_downloaded")); 401 406 402 407 // If the state of this imfile is not "pending_burntool" then we can't burn it. -
branches/czw_branch/20101203/ippconfig
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20101103/ippconfig (added) merged: 29661-29662,29684,29826,29847-29850,29878-29879,29906,29916,29918,29920
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/ippconfig/gpc1/camera.config
r29434 r30118 164 164 # This value is equal to CONV.POOR | STARCORE | SPIKE | SUSPECT = 0x5280 165 165 # unfortunately the perl parser won't accept a hex value 166 MASK.NO.CENSOR U32 21120 166 MASK.NO.CENSOR U32 21120 167 168 METADATA.COMPRESSION STR 7f # compression mode (nM): n = 1-9, M = f (filtered), h (Huffman), R (run-length) -
branches/czw_branch/20101203/ippconfig/gpc1/ppImage.config
r29833 r30118 13 13 NORM.CLASS STR CHIP # How to find the per-class normalizations 14 14 15 NONLIN BOOL FALSE # apply non-linearity correction 15 16 OLDDARK BOOL FALSE 16 17 … … 279 280 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 280 281 OVERSCAN BOOL TRUE # Overscan subtraction 282 NONLIN BOOL FALSE # apply non-linearity correction 281 283 BIAS BOOL FALSE # Bias subtraction 282 284 DARK BOOL TRUE # Dark subtraction … … 308 310 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 309 311 OVERSCAN BOOL TRUE # Overscan subtraction 312 NONLIN BOOL FALSE # apply non-linearity correction 310 313 BIAS BOOL FALSE # Bias subtraction 311 314 DARK BOOL TRUE # Dark subtraction … … 337 340 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 338 341 OVERSCAN BOOL TRUE # Overscan subtraction 342 NONLIN BOOL TRUE # apply non-linearity correction 339 343 BIAS BOOL FALSE # Bias subtraction 340 344 DARK BOOL TRUE # Dark subtraction … … 367 371 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 368 372 OVERSCAN BOOL TRUE # Overscan subtraction 373 NONLIN BOOL TRUE # apply non-linearity correction 369 374 BIAS BOOL FALSE # Bias subtraction 370 375 DARK BOOL TRUE # Dark subtraction … … 392 397 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 393 398 OVERSCAN BOOL TRUE # Overscan subtraction 399 NONLIN BOOL TRUE # apply non-linearity correction 394 400 BIAS BOOL FALSE # Bias subtraction 395 401 DARK BOOL FALSE # Dark subtraction … … 415 421 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 416 422 OVERSCAN BOOL TRUE # Overscan subtraction 423 NONLIN BOOL TRUE # apply non-linearity correction 417 424 BIAS BOOL FALSE # Bias subtraction 418 425 DARK BOOL TRUE # Dark subtraction … … 438 445 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 439 446 OVERSCAN BOOL TRUE # Overscan subtraction 447 NONLIN BOOL TRUE # apply non-linearity correction 440 448 BIAS BOOL FALSE 441 449 DARK BOOL TRUE # Dark subtraction … … 468 476 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 469 477 OVERSCAN BOOL TRUE # Overscan subtraction 478 NONLIN BOOL TRUE # apply non-linearity correction 470 479 BIAS BOOL FALSE # Bias subtraction 471 480 DARK BOOL TRUE # Dark subtraction … … 521 530 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 522 531 OVERSCAN BOOL TRUE # Overscan subtraction 532 NONLIN BOOL TRUE # apply non-linearity correction 523 533 BIAS BOOL FALSE # Bias subtraction 524 534 DARK BOOL TRUE # Dark subtraction … … 544 554 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 545 555 OVERSCAN BOOL TRUE # Overscan subtraction 556 NONLIN BOOL TRUE # apply non-linearity correction 546 557 BIAS BOOL FALSE # Bias subtraction 547 558 DARK BOOL TRUE # Dark subtraction … … 574 585 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 575 586 OVERSCAN BOOL TRUE # Overscan subtraction 587 NONLIN BOOL TRUE # apply non-linearity correction 576 588 BIAS BOOL FALSE # Bias subtraction 577 589 DARK BOOL TRUE # Dark subtraction … … 597 609 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 598 610 OVERSCAN BOOL TRUE # Overscan subtraction 611 NONLIN BOOL TRUE # apply non-linearity correction 599 612 BIAS BOOL FALSE # Bias subtraction 600 613 DARK BOOL TRUE # Dark subtraction … … 631 644 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 632 645 OVERSCAN BOOL TRUE # Overscan subtraction 646 NONLIN BOOL TRUE # apply non-linearity correction 633 647 BIAS BOOL FALSE # Bias subtraction 634 648 DARK BOOL TRUE # Dark subtraction … … 656 670 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 657 671 OVERSCAN BOOL TRUE # Overscan subtraction 672 NONLIN BOOL TRUE # apply non-linearity correction 658 673 BIAS BOOL FALSE # Bias subtraction 659 674 DARK BOOL TRUE # Dark subtraction … … 680 695 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 681 696 OVERSCAN BOOL TRUE # Overscan subtraction 697 NONLIN BOOL TRUE # apply non-linearity correction 682 698 BIAS BOOL FALSE # Bias subtraction 683 699 DARK BOOL TRUE # Dark subtraction … … 704 720 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 705 721 OVERSCAN BOOL TRUE # Overscan subtraction 722 NONLIN BOOL TRUE # apply non-linearity correction 706 723 BIAS BOOL FALSE # Bias subtraction 707 724 DARK BOOL TRUE # Dark subtraction … … 728 745 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 729 746 OVERSCAN BOOL TRUE # Overscan subtraction 747 NONLIN BOOL TRUE # apply non-linearity correction 730 748 BIAS BOOL FALSE # Bias subtraction 731 749 DARK BOOL TRUE # Dark subtraction … … 776 794 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 777 795 OVERSCAN BOOL TRUE # Overscan subtraction 796 NONLIN BOOL TRUE # apply non-linearity correction 778 797 BIAS BOOL FALSE # Bias subtraction 779 798 DARK BOOL TRUE # Dark subtraction … … 820 839 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 821 840 OVERSCAN BOOL FALSE # Overscan subtraction 841 NONLIN BOOL FALSE # apply non-linearity correction 822 842 BIAS BOOL FALSE # Bias subtraction 823 843 DARK BOOL FALSE # Dark subtraction … … 840 860 PPIMAGE_J1_RESID_B METADATA 841 861 OVERSCAN BOOL FALSE # Overscan subtraction 862 NONLIN BOOL FALSE # apply non-linearity correction 842 863 BIAS BOOL FALSE # Bias subtraction 843 864 DARK BOOL FALSE # Dark subtraction … … 877 898 PPIMAGE_J2_RESID_B METADATA 878 899 OVERSCAN BOOL FALSE # Overscan subtraction 900 NONLIN BOOL FALSE # apply non-linearity correction 879 901 BIAS BOOL FALSE # Bias subtraction 880 902 DARK BOOL FALSE # Dark subtraction … … 914 936 PPIMAGE_J1_RESID_F METADATA 915 937 OVERSCAN BOOL FALSE # Overscan subtraction 938 NONLIN BOOL FALSE # apply non-linearity correction 916 939 BIAS BOOL FALSE # Bias subtraction 917 940 DARK BOOL FALSE # Dark subtraction … … 950 973 PPIMAGE_J2_RESID_F METADATA 951 974 OVERSCAN BOOL FALSE # Overscan subtraction 975 NONLIN BOOL FALSE # apply non-linearity correction 952 976 BIAS BOOL FALSE # Bias subtraction 953 977 DARK BOOL FALSE # Dark subtraction … … 991 1015 CHIP.MASK.FITS BOOL FALSE # Save chip-mosaic-ed image? 992 1016 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 993 OVERSCAN BOOL FALSE# Overscan subtraction994 OVERSCAN BOOL TRUE # Overscan subtraction1017 OVERSCAN BOOL TRUE # Overscan subtraction 1018 NONLIN BOOL TRUE # apply non-linearity correction 995 1019 BIAS BOOL FALSE # Bias subtraction 996 1020 DARK BOOL TRUE # Dark subtraction … … 1028 1052 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1029 1053 OVERSCAN BOOL TRUE # Overscan subtraction 1054 NONLIN BOOL TRUE # apply non-linearity correction 1030 1055 BIAS BOOL FALSE # Bias subtraction 1031 1056 DARK BOOL TRUE # Dark subtraction … … 1080 1105 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1081 1106 OVERSCAN BOOL TRUE # Overscan subtraction 1107 NONLIN BOOL TRUE # apply non-linearity correction 1082 1108 BIAS BOOL FALSE # Bias subtraction 1083 1109 DARK BOOL TRUE # Dark subtraction … … 1109 1135 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1110 1136 OVERSCAN BOOL TRUE # Overscan subtraction 1137 NONLIN BOOL TRUE # apply non-linearity correction 1111 1138 BIAS BOOL FALSE # Bias subtraction 1112 1139 DARK BOOL TRUE # Dark subtraction … … 1138 1165 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1139 1166 OVERSCAN BOOL TRUE # Overscan subtraction 1167 NONLIN BOOL TRUE # apply non-linearity correction 1140 1168 BIAS BOOL FALSE # Bias subtraction 1141 1169 DARK BOOL TRUE # Dark subtraction … … 1167 1195 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1168 1196 OVERSCAN BOOL TRUE # Overscan subtraction 1197 NONLIN BOOL TRUE # apply non-linearity correction 1169 1198 BIAS BOOL FALSE # Bias subtraction 1170 1199 DARK BOOL TRUE # Dark subtraction -
branches/czw_branch/20101203/ippconfig/gpc1/psastro.config
r29591 r30118 291 291 REFSTAR_MASK BOOL FALSE 292 292 END 293 294 SAS_REFERENCE METADATA 295 PSASTRO.CATDIR STR SAS.REF.V1 296 END -
branches/czw_branch/20101203/ippconfig/recipes/filerules-mef.mdc
r29889 r30118 276 276 PPSUB.REF.CONV.VARIANCE OUTPUT {OUTPUT}.refConv.wt.fits VARIANCE COMP_WT FPA TRUE NONE 277 277 278 PPSUB.FORCED1.SOURCES OUTPUT {OUTPUT}.frc1.cmf CMF NONE FPA TRUE NONE 279 PPSUB.FORCED2.SOURCES OUTPUT {OUTPUT}.frc2.cmf CMF NONE FPA TRUE NONE 280 PPSUB.POS1.SOURCES OUTPUT {OUTPUT}.pos1.cmf CMF NONE FPA TRUE NONE 281 PPSUB.POS2.SOURCES OUTPUT {OUTPUT}.pos2.cmf CMF NONE FPA TRUE NONE 278 282 279 283 PPSTACK.OUTPUT OUTPUT {OUTPUT}.fits IMAGE COMP_IMG FPA TRUE NONE -
branches/czw_branch/20101203/ippconfig/recipes/filerules-simple.mdc
r29889 r30118 246 246 PPSUB.REF.CONV.VARIANCE OUTPUT {OUTPUT}.refConv.wt.fits VARIANCE NONE FPA TRUE NONE 247 247 248 PPSUB.FORCED1.SOURCES OUTPUT {OUTPUT}.frc1.cmf CMF NONE FPA TRUE NONE 249 PPSUB.FORCED2.SOURCES OUTPUT {OUTPUT}.frc2.cmf CMF NONE FPA TRUE NONE 250 PPSUB.POS1.SOURCES OUTPUT {OUTPUT}.pos1.cmf CMF NONE FPA TRUE NONE 251 PPSUB.POS2.SOURCES OUTPUT {OUTPUT}.pos2.cmf CMF NONE FPA TRUE NONE 252 248 253 PPSTACK.OUTPUT.COMP OUTPUT {OUTPUT}.fits IMAGE COMP_IMG FPA TRUE NONE 249 254 PPSTACK.OUTPUT.RAW OUTPUT {OUTPUT}.fits IMAGE NONE FPA TRUE NONE -
branches/czw_branch/20101203/ippconfig/recipes/filerules-split.mdc
r29889 r30118 272 272 PPSUB.REF.CONV.VARIANCE OUTPUT {OUTPUT}.refConv.wt.fits VARIANCE COMP_WT FPA TRUE NONE 273 273 274 PPSUB.FORCED1.SOURCES OUTPUT {OUTPUT}.frc1.cmf CMF NONE FPA TRUE NONE 275 PPSUB.FORCED2.SOURCES OUTPUT {OUTPUT}.frc2.cmf CMF NONE FPA TRUE NONE 276 PPSUB.POS1.SOURCES OUTPUT {OUTPUT}.pos1.cmf CMF NONE FPA TRUE NONE 277 PPSUB.POS2.SOURCES OUTPUT {OUTPUT}.pos2.cmf CMF NONE FPA TRUE NONE 278 274 279 PPSTACK.OUTPUT.COMP OUTPUT {OUTPUT}.fits IMAGE COMP_IMG FPA TRUE NONE 275 280 PPSTACK.OUTPUT.NOCOMP OUTPUT {OUTPUT}.fits IMAGE NONE FPA TRUE NONE … … 278 283 PPSTACK.OUTPUT.VARIANCE.COMP OUTPUT {OUTPUT}.wt.fits VARIANCE COMP_WT FPA TRUE NONE 279 284 PPSTACK.OUTPUT.VARIANCE.NOCOMP OUTPUT {OUTPUT}.wt.fits VARIANCE NONE FPA TRUE NONE 285 280 286 PPSTACK.OUTPUT.EXP OUTPUT {OUTPUT}.exp.fits IMAGE EXP FPA TRUE NONE 281 287 PPSTACK.OUTPUT.EXPNUM OUTPUT {OUTPUT}.num.fits MASK EXPNUM FPA TRUE NONE -
branches/czw_branch/20101203/ippconfig/recipes/nightly_science.config
r30048 r30118 82 82 NAME STR MD02 83 83 DISTRIBUTION STR MD02 84 TESS STR MD02 84 TESS STR MD02.V2 85 85 OBSMODE STR MD 86 86 OBJECT STR MD02% … … 104 104 NAME STR MD04 105 105 DISTRIBUTION STR MD04 106 TESS STR MD04 106 TESS STR MD04.V2 107 107 OBSMODE STR MD 108 108 OBJECT STR MD04% -
branches/czw_branch/20101203/ippconfig/recipes/ppImage.config
r28043 r30118 4 4 5 5 # List of tasks to perform 6 OVERSCAN BOOL TRUE # Overscan subtraction 6 7 NONLIN BOOL FALSE # Non-linearity correction; not implemented 7 OVERSCAN BOOL TRUE # Overscan subtraction8 8 NOISEMAP BOOL FALSE # Apply read noise map 9 9 BIAS BOOL TRUE # Bias subtraction … … 162 162 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 163 163 OVERSCAN BOOL TRUE # Overscan subtraction 164 NONLIN BOOL FALSE # Non-linearity correction; not implemented 164 165 BIAS BOOL TRUE # Bias subtraction 165 166 DARK BOOL TRUE # Dark subtraction … … 186 187 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 187 188 OVERSCAN BOOL TRUE # Overscan subtraction 189 NONLIN BOOL FALSE # Non-linearity correction; not implemented 188 190 BIAS BOOL TRUE # Bias subtraction 189 191 DARK BOOL TRUE # Dark subtraction … … 209 211 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 210 212 OVERSCAN BOOL TRUE # Overscan subtraction 213 NONLIN BOOL FALSE # Non-linearity correction; not implemented 211 214 BIAS BOOL TRUE # Bias subtraction 212 215 DARK BOOL TRUE # Dark subtraction … … 236 239 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 237 240 OVERSCAN BOOL TRUE # Overscan subtraction 241 NONLIN BOOL FALSE # Non-linearity correction; not implemented 238 242 BIAS BOOL FALSE # Bias subtraction 239 243 DARK BOOL FALSE # Dark subtraction … … 260 264 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 261 265 OVERSCAN BOOL FALSE # Overscan subtraction 266 NONLIN BOOL FALSE # Non-linearity correction; not implemented 262 267 BIAS BOOL FALSE # Bias subtraction 263 268 DARK BOOL FALSE # Dark subtraction … … 283 288 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 284 289 OVERSCAN BOOL FALSE # Overscan subtraction 290 NONLIN BOOL FALSE # Non-linearity correction; not implemented 285 291 BIAS BOOL FALSE # Bias subtraction 286 292 DARK BOOL FALSE # Dark subtraction … … 306 312 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 307 313 OVERSCAN BOOL TRUE # Overscan subtraction 314 NONLIN BOOL FALSE # Non-linearity correction; not implemented 308 315 BIAS BOOL FALSE # Bias subtraction 309 316 DARK BOOL FALSE # Dark subtraction … … 329 336 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 330 337 OVERSCAN BOOL FALSE # Overscan subtraction 338 NONLIN BOOL FALSE # Non-linearity correction; not implemented 331 339 BIAS BOOL TRUE # Bias subtraction 332 340 DARK BOOL FALSE # Dark subtraction … … 345 353 # Dark subtraction only 346 354 PPIMAGE_D METADATA 347 BASE.FITS BOOL TRUE # Save base detrended image? 348 BASE.MASK.FITS BOOL FALSE # Save base detrended image? 349 BASE.VARIANCE.FITS BOOL FALSE # Save base detrended image? 350 CHIP.FITS BOOL FALSE # Save chip-mosaic-ed image? 351 CHIP.MASK.FITS BOOL FALSE # Save chip-mosaic-ed image? 352 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 353 OVERSCAN BOOL FALSE # Overscan subtraction 354 BIAS BOOL FALSE # Bias subtraction 355 DARK BOOL TRUE # Dark subtraction 356 SHUTTER BOOL FALSE # Shutter correction 357 FLAT BOOL FALSE # Flat-field normalisation 358 MASK BOOL FALSE # Mask bad pixels 359 MASK.BUILD BOOL FALSE # Build internal mask? 360 FRINGE BOOL FALSE # Fringe subtraction 361 PHOTOM BOOL FALSE # Source identification and photometry 362 ASTROM.CHIP BOOL FALSE # Astrometry per chip? 363 ASTROM.MOSAIC BOOL FALSE # Astrometry for mosaic? 364 BIN1.FITS BOOL TRUE # Save 1st binned chip image? 365 BIN2.FITS BOOL TRUE # Save 2nd binned chip image? 355 BASE.FITS BOOL TRUE # Save base detrended image? 356 BASE.MASK.FITS BOOL FALSE # Save base detrended image? 357 BASE.VARIANCE.FITS BOOL FALSE # Save base detrended image? 358 CHIP.FITS BOOL FALSE # Save chip-mosaic-ed image? 359 CHIP.MASK.FITS BOOL FALSE # Save chip-mosaic-ed image? 360 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 361 OVERSCAN BOOL FALSE # Overscan subtraction 362 NONLIN BOOL FALSE # Non-linearity correction; not implemented 363 BIAS BOOL FALSE # Bias subtraction 364 DARK BOOL TRUE # Dark subtraction 365 SHUTTER BOOL FALSE # Shutter correction 366 FLAT BOOL FALSE # Flat-field normalisation 367 MASK BOOL FALSE # Mask bad pixels 368 MASK.BUILD BOOL FALSE # Build internal mask? 369 FRINGE BOOL FALSE # Fringe subtraction 370 PHOTOM BOOL FALSE # Source identification and photometry 371 ASTROM.CHIP BOOL FALSE # Astrometry per chip? 372 ASTROM.MOSAIC BOOL FALSE # Astrometry for mosaic? 373 BIN1.FITS BOOL TRUE # Save 1st binned chip image? 374 BIN2.FITS BOOL TRUE # Save 2nd binned chip image? 366 375 END 367 376 … … 375 384 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 376 385 OVERSCAN BOOL FALSE # Overscan subtraction 386 NONLIN BOOL FALSE # Non-linearity correction; not implemented 377 387 BIAS BOOL FALSE # Bias subtraction 378 388 DARK BOOL FALSE # Dark subtraction … … 398 408 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 399 409 OVERSCAN BOOL FALSE # Overscan subtraction 410 NONLIN BOOL FALSE # Non-linearity correction; not implemented 400 411 BIAS BOOL FALSE # Bias subtraction 401 412 DARK BOOL FALSE # Dark subtraction … … 421 432 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 422 433 OVERSCAN BOOL FALSE # Overscan subtraction 434 NONLIN BOOL FALSE # Non-linearity correction; not implemented 423 435 BIAS BOOL FALSE # Bias subtraction 424 436 DARK BOOL FALSE # Dark subtraction … … 444 456 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 445 457 OVERSCAN BOOL FALSE # Overscan subtraction 458 NONLIN BOOL FALSE # Non-linearity correction; not implemented 446 459 BIAS BOOL FALSE # Bias subtraction 447 460 DARK BOOL FALSE # Dark subtraction … … 467 480 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 468 481 OVERSCAN BOOL FALSE # Overscan subtraction 482 NONLIN BOOL FALSE # Non-linearity correction; not implemented 469 483 BIAS BOOL FALSE # Bias subtraction 470 484 DARK BOOL FALSE # Dark subtraction … … 490 504 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 491 505 OVERSCAN BOOL FALSE # Overscan subtraction 506 NONLIN BOOL FALSE # Non-linearity correction; not implemented 492 507 BIAS BOOL FALSE # Bias subtraction 493 508 DARK BOOL FALSE # Dark subtraction … … 513 528 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 514 529 OVERSCAN BOOL TRUE # Overscan subtraction 530 NONLIN BOOL FALSE # Non-linearity correction; not implemented 515 531 BIAS BOOL TRUE # Bias subtraction 516 532 DARK BOOL FALSE # Dark subtraction … … 536 552 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 537 553 OVERSCAN BOOL TRUE # Overscan subtraction 554 NONLIN BOOL FALSE # Non-linearity correction; not implemented 538 555 BIAS BOOL TRUE # Bias subtraction 539 556 DARK BOOL TRUE # Dark subtraction … … 559 576 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 560 577 OVERSCAN BOOL TRUE # Overscan subtraction 578 NONLIN BOOL FALSE # Non-linearity correction; not implemented 561 579 BIAS BOOL TRUE # Bias subtraction 562 580 DARK BOOL TRUE # Dark subtraction … … 589 607 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 590 608 OVERSCAN BOOL TRUE # Overscan subtraction 609 NONLIN BOOL FALSE # Non-linearity correction; not implemented 591 610 BIAS BOOL TRUE # Bias subtraction 592 611 DARK BOOL TRUE # Dark subtraction … … 619 638 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 620 639 OVERSCAN BOOL TRUE # Overscan subtraction 640 NONLIN BOOL FALSE # Non-linearity correction; not implemented 621 641 BIAS BOOL TRUE # Bias subtraction 622 642 DARK BOOL TRUE # Dark subtraction … … 642 662 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 643 663 OVERSCAN BOOL TRUE # Overscan subtraction 664 NONLIN BOOL FALSE # Non-linearity correction; not implemented 644 665 BIAS BOOL TRUE # Bias subtraction 645 666 DARK BOOL TRUE # Dark subtraction … … 672 693 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 673 694 OVERSCAN BOOL TRUE # Overscan subtraction 695 NONLIN BOOL FALSE # Non-linearity correction; not implemented 674 696 BIAS BOOL TRUE # Bias subtraction 675 697 DARK BOOL TRUE # Dark subtraction … … 695 717 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 696 718 OVERSCAN BOOL TRUE # Overscan subtraction 719 NONLIN BOOL FALSE # Non-linearity correction; not implemented 697 720 BIAS BOOL TRUE # Bias subtraction 698 721 DARK BOOL TRUE # Dark subtraction … … 729 752 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 730 753 OVERSCAN BOOL TRUE # Overscan subtraction 754 NONLIN BOOL FALSE # Non-linearity correction; not implemented 731 755 BIAS BOOL TRUE # Bias subtraction 732 756 DARK BOOL TRUE # Dark subtraction … … 752 776 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 753 777 OVERSCAN BOOL TRUE # Overscan subtraction 778 NONLIN BOOL FALSE # Non-linearity correction; not implemented 754 779 BIAS BOOL TRUE # Bias subtraction 755 780 DARK BOOL TRUE # Dark subtraction … … 775 800 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 776 801 OVERSCAN BOOL TRUE # Overscan subtraction 802 NONLIN BOOL FALSE # Non-linearity correction; not implemented 777 803 BIAS BOOL TRUE # Bias subtraction 778 804 DARK BOOL TRUE # Dark subtraction … … 798 824 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 799 825 OVERSCAN BOOL TRUE # Overscan subtraction 826 NONLIN BOOL FALSE # Non-linearity correction; not implemented 800 827 BIAS BOOL TRUE # Bias subtraction 801 828 DARK BOOL TRUE # Dark subtraction … … 827 854 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 828 855 OVERSCAN BOOL TRUE # Overscan subtraction 856 NONLIN BOOL FALSE # Non-linearity correction; not implemented 829 857 BIAS BOOL TRUE # Bias subtraction 830 858 DARK BOOL TRUE # Dark subtraction … … 856 884 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 857 885 OVERSCAN BOOL TRUE # Overscan subtraction 886 NONLIN BOOL FALSE # Non-linearity correction; not implemented 858 887 BIAS BOOL TRUE # Bias subtraction 859 888 DARK BOOL TRUE # Dark subtraction … … 879 908 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 880 909 OVERSCAN BOOL FALSE # Overscan subtraction 910 NONLIN BOOL FALSE # Non-linearity correction; not implemented 881 911 BIAS BOOL FALSE # Bias subtraction 882 912 DARK BOOL FALSE # Dark subtraction … … 896 926 PPIMAGE_JPEG METADATA 897 927 OVERSCAN BOOL FALSE # Overscan subtraction 928 NONLIN BOOL FALSE # Non-linearity correction; not implemented 898 929 BIAS BOOL FALSE # Bias subtraction 899 930 DARK BOOL FALSE # Dark subtraction … … 916 947 BIN1.JPEG BOOL TRUE # Save 1st binned jpeg? 917 948 BIN2.JPEG BOOL TRUE # Save 2nd binned jpeg? 949 MASK.SATURATED BOOL FALSE # DO NOT Mask the saturated pixels 950 MASK.LOW BOOL FALSE # DO NOT Mask the saturated pixels 918 951 END 919 952 … … 921 954 PPIMAGE_J1 METADATA 922 955 OVERSCAN BOOL FALSE # Overscan subtraction 956 NONLIN BOOL FALSE # Non-linearity correction; not implemented 923 957 BIAS BOOL FALSE # Bias subtraction 924 958 DARK BOOL FALSE # Dark subtraction … … 945 979 BIN2.XBIN S32 1 # Image is already binned 946 980 BIN2.YBIN S32 1 # Image is already binned 981 MASK.SATURATED BOOL FALSE # DO NOT Mask the saturated pixels 982 MASK.LOW BOOL FALSE # DO NOT Mask the saturated pixels 947 983 END 948 984 … … 950 986 PPIMAGE_J2 METADATA 951 987 OVERSCAN BOOL FALSE # Overscan subtraction 988 NONLIN BOOL FALSE # Non-linearity correction; not implemented 952 989 BIAS BOOL FALSE # Bias subtraction 953 990 DARK BOOL FALSE # Dark subtraction … … 974 1011 BIN2.XBIN S32 1 # Image is already binned 975 1012 BIN2.YBIN S32 1 # Image is already binned 1013 MASK.SATURATED BOOL FALSE # DO NOT Mask the saturated pixels 1014 MASK.LOW BOOL FALSE # DO NOT Mask the saturated pixels 976 1015 END 977 1016 … … 979 1018 PPIMAGE_OA METADATA 980 1019 OVERSCAN BOOL TRUE # Overscan subtraction 1020 NONLIN BOOL FALSE # Non-linearity correction; not implemented 981 1021 BIAS BOOL FALSE # Bias subtraction 982 1022 DARK BOOL FALSE # Dark subtraction … … 998 1038 PPIMAGE_OP METADATA 999 1039 OVERSCAN BOOL TRUE # Overscan subtraction 1040 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1000 1041 BIAS BOOL FALSE # Bias subtraction 1001 1042 DARK BOOL FALSE # Dark subtraction … … 1023 1064 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1024 1065 OVERSCAN BOOL FALSE # Overscan subtraction 1066 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1025 1067 BIAS BOOL FALSE # Bias subtraction 1026 1068 DARK BOOL FALSE # Dark subtraction … … 1043 1085 PPIMAGE_J1_RESID_B METADATA 1044 1086 OVERSCAN BOOL FALSE # Overscan subtraction 1087 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1045 1088 BIAS BOOL FALSE # Bias subtraction 1046 1089 DARK BOOL FALSE # Dark subtraction … … 1079 1122 PPIMAGE_J2_RESID_B METADATA 1080 1123 OVERSCAN BOOL FALSE # Overscan subtraction 1124 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1081 1125 BIAS BOOL FALSE # Bias subtraction 1082 1126 DARK BOOL FALSE # Dark subtraction … … 1115 1159 PPIMAGE_J1_RESID_F METADATA 1116 1160 OVERSCAN BOOL FALSE # Overscan subtraction 1161 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1117 1162 BIAS BOOL FALSE # Bias subtraction 1118 1163 DARK BOOL FALSE # Dark subtraction … … 1151 1196 PPIMAGE_J2_RESID_F METADATA 1152 1197 OVERSCAN BOOL FALSE # Overscan subtraction 1198 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1153 1199 BIAS BOOL FALSE # Bias subtraction 1154 1200 DARK BOOL FALSE # Dark subtraction … … 1187 1233 PPIMAGE_J1_RESID_R METADATA 1188 1234 OVERSCAN BOOL FALSE # Overscan subtraction 1235 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1189 1236 BIAS BOOL FALSE # Bias subtraction 1190 1237 DARK BOOL FALSE # Dark subtraction … … 1223 1270 PPIMAGE_J2_RESID_R METADATA 1224 1271 OVERSCAN BOOL FALSE # Overscan subtraction 1272 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1225 1273 BIAS BOOL FALSE # Bias subtraction 1226 1274 DARK BOOL FALSE # Dark subtraction … … 1260 1308 PPIMAGE_J1_IMAGE_B METADATA 1261 1309 OVERSCAN BOOL FALSE # Overscan subtraction 1310 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1262 1311 BIAS BOOL FALSE # Bias subtraction 1263 1312 DARK BOOL FALSE # Dark subtraction … … 1296 1345 PPIMAGE_J2_IMAGE_B METADATA 1297 1346 OVERSCAN BOOL FALSE # Overscan subtraction 1347 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1298 1348 BIAS BOOL FALSE # Bias subtraction 1299 1349 DARK BOOL FALSE # Dark subtraction … … 1332 1382 PPIMAGE_J1_IMAGE_F METADATA 1333 1383 OVERSCAN BOOL FALSE # Overscan subtraction 1384 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1334 1385 BIAS BOOL FALSE # Bias subtraction 1335 1386 DARK BOOL FALSE # Dark subtraction … … 1368 1419 PPIMAGE_J2_IMAGE_F METADATA 1369 1420 OVERSCAN BOOL FALSE # Overscan subtraction 1421 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1370 1422 BIAS BOOL FALSE # Bias subtraction 1371 1423 DARK BOOL FALSE # Dark subtraction … … 1404 1456 PPIMAGE_J1_IMAGE_R METADATA 1405 1457 OVERSCAN BOOL FALSE # Overscan subtraction 1458 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1406 1459 BIAS BOOL FALSE # Bias subtraction 1407 1460 DARK BOOL FALSE # Dark subtraction … … 1440 1493 PPIMAGE_J2_IMAGE_R METADATA 1441 1494 OVERSCAN BOOL FALSE # Overscan subtraction 1495 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1442 1496 BIAS BOOL FALSE # Bias subtraction 1443 1497 DARK BOOL FALSE # Dark subtraction … … 1476 1530 PPIMAGE_J1_IMAGE_M METADATA 1477 1531 OVERSCAN BOOL FALSE # Overscan subtraction 1532 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1478 1533 BIAS BOOL FALSE # Bias subtraction 1479 1534 DARK BOOL FALSE # Dark subtraction … … 1512 1567 PPIMAGE_J2_IMAGE_M METADATA 1513 1568 OVERSCAN BOOL FALSE # Overscan subtraction 1569 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1514 1570 BIAS BOOL FALSE # Bias subtraction 1515 1571 DARK BOOL FALSE # Dark subtraction … … 1548 1604 PPIMAGE_J1_RESID_M METADATA 1549 1605 OVERSCAN BOOL FALSE # Overscan subtraction 1606 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1550 1607 BIAS BOOL FALSE # Bias subtraction 1551 1608 DARK BOOL FALSE # Dark subtraction … … 1584 1641 PPIMAGE_J2_RESID_M METADATA 1585 1642 OVERSCAN BOOL FALSE # Overscan subtraction 1643 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1586 1644 BIAS BOOL FALSE # Bias subtraction 1587 1645 DARK BOOL FALSE # Dark subtraction … … 1621 1679 PPIMAGE_MOSAIC METADATA 1622 1680 OVERSCAN BOOL FALSE # Overscan subtraction 1681 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1623 1682 BIAS BOOL FALSE # Bias subtraction 1624 1683 DARK BOOL FALSE # Dark subtraction … … 1652 1711 PPIMAGE_CHIPMOSAIC METADATA 1653 1712 OVERSCAN BOOL FALSE # Overscan subtraction 1713 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1654 1714 BIAS BOOL FALSE # Bias subtraction 1655 1715 DARK BOOL FALSE # Dark subtraction … … 1688 1748 CHIP.MASK.FITS BOOL FALSE # Save chip-mosaic-ed image? 1689 1749 CHIP.VARIANCE.FITS BOOL FALSE # Save chip-mosaic-ed image? 1690 OVERSCAN BOOL FALSE # Overscan subtraction1691 1750 OVERSCAN BOOL TRUE # Overscan subtraction 1751 NONLIN BOOL FALSE # Non-linearity correction; not implemented 1692 1752 BIAS BOOL TRUE # Bias subtraction 1693 1753 DARK BOOL TRUE # Dark subtraction … … 1732 1792 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1733 1793 OVERSCAN BOOL TRUE # Overscan subtraction 1794 NONLIN BOOL FALSE # Overscan subtraction 1734 1795 BIAS BOOL TRUE # Bias subtraction 1735 1796 DARK BOOL TRUE # Dark subtraction … … 1762 1823 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1763 1824 OVERSCAN BOOL TRUE # Overscan subtraction 1825 NONLIN BOOL FALSE # Overscan subtraction 1764 1826 BIAS BOOL TRUE # Bias subtraction 1765 1827 DARK BOOL TRUE # Dark subtraction … … 1785 1847 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1786 1848 OVERSCAN BOOL TRUE # Overscan subtraction 1849 NONLIN BOOL FALSE # Overscan subtraction 1787 1850 BIAS BOOL FALSE # Bias subtraction 1788 1851 DARK BOOL TRUE # Dark subtraction … … 1813 1876 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1814 1877 OVERSCAN BOOL TRUE # Overscan subtraction 1878 NONLIN BOOL FALSE # Overscan subtraction 1815 1879 BIAS BOOL TRUE # Bias subtraction 1816 1880 DARK BOOL TRUE # Dark subtraction … … 1840 1904 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1841 1905 OVERSCAN BOOL TRUE # Overscan subtraction 1906 NONLIN BOOL FALSE # Overscan subtraction 1842 1907 BIAS BOOL TRUE # Bias subtraction 1843 1908 DARK BOOL TRUE # Dark subtraction … … 1865 1930 CHIP.VARIANCE.FITS BOOL TRUE # Save chip-mosaic-ed image? 1866 1931 OVERSCAN BOOL TRUE # Overscan subtraction 1932 NONLIN BOOL FALSE # Overscan subtraction 1867 1933 BIAS BOOL TRUE # Bias subtraction 1868 1934 DARK BOOL TRUE # Dark subtraction -
branches/czw_branch/20101203/ippconfig/recipes/ppSub.config
r29617 r30118 72 72 PHOTOMETRY BOOL FALSE # Perform photometry? 73 73 74 FORCED.PHOTOMETRY.BOTH BOOL FALSE # forced photometry on input sources? 75 FORCED.PHOTOMETRY.INPUT1 BOOL FALSE # forced photometry on input sources? 76 FORCED.PHOTOMETRY.INPUT2 BOOL FALSE # forced photometry on input sources? 74 77 75 78 # Recipe overrides for STACK … … 112 115 PHOTOMETRY BOOL TRUE # Perform photometry? 113 116 CONVOLVE.TARGET STR SINGLE2 # convolution direction 117 END 118 119 # Difference of warp - stack 120 WARPSTACK_FORCED METADATA 121 DUAL BOOL FALSE # Dual convolution? 122 INVERSE BOOL FALSE # Generate inverse subtraction? 123 PHOTOMETRY BOOL TRUE # Perform photometry? 124 CONVOLVE.TARGET STR SINGLE2 # convolution direction 125 FORCED.PHOTOMETRY.BOTH BOOL TRUE # forced photometry on input sources 114 126 END 115 127 -
branches/czw_branch/20101203/ippconfig/recipes/psastro.config
r28641 r30118 238 238 MOPS.TEST METADATA 239 239 END 240 241 SAS_REFERENCE METADATA 242 END 243 -
branches/czw_branch/20101203/ippconfig/recipes/psphot.config
r29609 r30118 49 49 PEAKS_NMAX S32 5000 # on first pass, only keep NMAX peaks (0 == all) 50 50 PEAKS_MIN_GAUSS F32 0.5 # On quick convolution, mask pixels for which the 51 PEAKS_POS2_NSIGMA_LIMIT F32 25.0 # peak signficance threshold for POS2 sources. (ppSub) 51 52 # input pixels contribute less than this fraction of the flux 52 53 # parameters which adjust the footprint analysis -
branches/czw_branch/20101203/ippconfig/recipes/reductionClasses.mdc
r29766 r30118 173 173 WARPSTACK METADATA 174 174 DIFF_PPSUB STR WARPSTACK 175 DIFF_PSPHOT STR DIFF 176 JPEG_BIN1 STR PPIMAGE_J1 177 JPEG_BIN2 STR PPIMAGE_J2 178 END 179 180 # reduction class specifically for warpstack diffs: 181 WARPSTACK_FORCED METADATA 182 DIFF_PPSUB STR WARPSTACK_FORCED 175 183 DIFF_PSPHOT STR DIFF 176 184 JPEG_BIN1 STR PPIMAGE_J1 … … 535 543 END 536 544 545 SAS_REFERENCE METADATA 546 CHIP_PPIMAGE STR CHIP 547 CHIP_PSPHOT STR CHIP 548 WARP_PSWARP STR WARP 549 STACK_PPSTACK STR STACK 550 STACK_PPSUB STR STACK 551 STACK_PSPHOT STR STACK 552 DIFF_PPSUB STR DIFF 553 DIFF_PSPHOT STR DIFF 554 JPEG_BIN1 STR PPIMAGE_J1 555 JPEG_BIN2 STR PPIMAGE_J2 556 FAKEPHOT STR FAKEPHOT 557 ADDSTAR STR ADDSTAR 558 PSASTRO STR SAS_REFERENCE 559 STACKPHOT STR STACKPHOT 560 END 561 -
branches/czw_branch/20101203/ippconfig/simtest/camera.config
r29902 r30118 80 80 81 81 # don't censor any masked pixels when making postage stamps 82 # MASK.NO.CENSOR U32 0xFFFFFFFF -- need to fix the MDC parser(s) to handle hex values 82 83 MASK.NO.CENSOR U32 4294967295 -
branches/czw_branch/20101203/pedestal/src/pedestal.c
r15639 r30118 29 29 psFitsMoveExtName(inFile, extname); 30 30 psArray *cube = psFitsReadImageCube(inFile, psRegionSet(0, 0, 0, 0)); // Image cube 31 assert(cube); 31 32 assert(cube->n == 2); // We checked NAXIS3 earlier 32 33 -
branches/czw_branch/20101203/ppConfigDump/src/ppConfigDump.c
r24187 r30118 26 26 void dump(const char *filename, // Filename to which to dump 27 27 const char *description, // Description of what's being dumped 28 psMetadata *md // Metadata to dump 29 ) 28 psMetadata *md, // Metadata to dump 29 const char *compressMode 30 ) 30 31 { 31 32 if (!filename || strlen(filename) == 0) { … … 38 39 die(PS_EXIT_SYS_ERROR); 39 40 } 40 fprintf(stdout, "%s", string); 41 42 if (compressMode) { 43 if (strlen(compressMode) > 2) { 44 psErrorStackPrint(stderr, "invalid compression options %s!\n", compressMode); 45 die(PS_EXIT_CONFIG_ERROR); 46 } 47 char modeString[4]; 48 snprintf (modeString, 4, "w%s", compressMode); 49 50 gzFile file = gzdopen (STDOUT_FILENO, modeString); 51 if (file == Z_NULL) { 52 psErrorStackPrint(stderr, "Failed to open file\n"); 53 die(PS_EXIT_SYS_ERROR); 54 } 55 int nbytes = gzwrite (file, string, strlen(string)); 56 if (nbytes != strlen(string)) { 57 psErrorStackPrint(stderr, "Failed to write contents of configuration file %s", filename); 58 psFree(string); 59 gzclose(file); 60 die(PS_EXIT_SYS_ERROR); 61 } 62 psFree(string); 63 if (gzclose(file) != Z_OK) { 64 psErrorStackPrint(stderr, "Failed to close file, %s\n", filename); 65 die(PS_EXIT_SYS_ERROR); 66 } 67 } else { 68 fprintf(stdout, "%s", string); 69 } 41 70 psFree(string); 42 } else if (!psMetadataConfigWrite(md, filename)) { 43 psErrorStackPrint(stderr, "Can't write %s to %s\n", description, filename); 44 die(PS_EXIT_SYS_ERROR); 71 } else { 72 if (!psMetadataConfigWrite(md, filename, compressMode)) { 73 psErrorStackPrint(stderr, "Can't write %s to %s\n", description, filename); 74 die(PS_EXIT_SYS_ERROR); 75 } 45 76 } 46 77 } … … 62 93 arguments = psMetadataAlloc(); 63 94 psMetadataAddStr(arguments, PS_LIST_TAIL, "-file", 0, "FITS file to use for camera determination", NULL); 95 psMetadataAddStr(arguments, PS_LIST_TAIL, "-compress", 0, "output compression mode", NULL); 96 psMetadataAddBool(arguments, PS_LIST_TAIL, "-z", 0, "default compression", false); 64 97 psMetadataAddStr(arguments, PS_LIST_TAIL, "-dump-user", 0, "Filename for user configuration", NULL); 65 98 psMetadataAddStr(arguments, PS_LIST_TAIL, "-dump-site", 0, "Filename for site configuration", NULL); … … 84 117 psArgumentHelp(arguments); 85 118 die(PS_EXIT_CONFIG_ERROR); 119 } 120 121 const char *defaultCompressMode = "7f"; 122 const char *compressMode = psMetadataLookupStr(NULL, arguments, "-compress"); // compression 123 bool defaultCompression = psMetadataLookupBool(NULL, arguments, "-z"); // compression? 124 if (!compressMode && defaultCompression) { 125 compressMode = defaultCompressMode; 86 126 } 87 127 … … 122 162 123 163 const char *userName = psMetadataLookupStr(NULL, arguments, "-dump-user"); // User filename 124 dump(userName, "user configuration", config->user );164 dump(userName, "user configuration", config->user, compressMode); 125 165 126 166 const char *siteName = psMetadataLookupStr(NULL, arguments, "-dump-site"); // Site filename 127 dump(siteName, "site configuration", config->site );167 dump(siteName, "site configuration", config->site, compressMode); 128 168 129 169 const char *systemName = psMetadataLookupStr(NULL, arguments, "-dump-system"); // System filename 130 dump(systemName, "system configuration", config->system );170 dump(systemName, "system configuration", config->system, compressMode); 131 171 132 172 const char *camName = psMetadataLookupStr(NULL, arguments, "-dump-camera"); // Camera filename 133 dump(camName, "camera configuration", config->camera );173 dump(camName, "camera configuration", config->camera, compressMode); 134 174 135 175 const char *formatName = psMetadataLookupStr(NULL, arguments, "-dump-format"); // Format filename 136 dump(formatName, "camera format", config->format );176 dump(formatName, "camera format", config->format, compressMode); 137 177 138 178 const char *recipesName = psMetadataLookupStr(NULL, arguments, "-dump-recipes"); // Recipes filename 139 dump(recipesName, "recipes", config->recipes );179 dump(recipesName, "recipes", config->recipes, compressMode); 140 180 141 181 recipeArgs = psMetadataLookupMetadata(NULL, arguments, "-dump-recipe"); … … 148 188 } 149 189 const char *recipeFile = psMetadataLookupStr(NULL, recipeArgs, "filename"); // Filename for recipe 150 dump(recipeFile, "recipe", recipe );190 dump(recipeFile, "recipe", recipe, compressMode); 151 191 } 152 192 -
branches/czw_branch/20101203/ppImage/src/ppImageDetrendReadout.c
r29833 r30118 62 62 // Non-linearity correction 63 63 if (options->doNonLin) { 64 // linearity = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.LINEARITY");65 64 if (!ppImageDetrendNonLinear(input,detview,config)) { 66 65 psError(PS_ERR_UNKNOWN, false, "Unable to correct NonLinearity"); … … 68 67 return(false); 69 68 } 70 /* ppImageDetrendNonLinear(detrend->input, input, options); */71 69 } 72 70 -
branches/czw_branch/20101203/ppImage/src/ppImageOptions.c
r29833 r30118 216 216 217 217 // for these images, even if not required otherwise 218 options->doMaskBuild = psMetadataLookupBool(NULL, recipe, "MASK.BUILD");219 options->doMaskSat = psMetadataLookupBool(NULL, recipe, "MASK.SATURATED");220 options->doMaskLow = psMetadataLookupBool(NULL, recipe, "MASK.LOW");221 options->doMaskBurntool = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL");218 options->doMaskBuild = psMetadataLookupBool(NULL, recipe, "MASK.BUILD"); 219 options->doMaskSat = psMetadataLookupBool(NULL, recipe, "MASK.SATURATED"); 220 options->doMaskLow = psMetadataLookupBool(NULL, recipe, "MASK.LOW"); 221 options->doMaskBurntool = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL"); 222 222 options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD"); 223 223 … … 301 301 options->checkCTE = psMetadataLookupBool(NULL, recipe, "CHECK.CTE"); 302 302 303 // even if not requested explicitly, if any of these are set, build an internal mask and variance: 304 if (options->doNoiseMap || options->doBias || options->doOverscan || options->doDark || options->doShutter || options->doFlat || 305 options->doPhotom) { 303 /* doMaskBuild : there are some cases where we require a mask, so we force doMaskBuild to be set even if the user specified 'FALSE' 304 * 305 * doPhotom : a mask is required because it is used to mark the locations of stars 306 * 307 * doNoiseMap : no reason this needs to trigger a mask? 308 * doBias : no reason this needs to trigger a mask? 309 * doOverscan : no reason this needs to trigger a mask? 310 * doDark : no reason this needs to trigger a mask? 311 * doShutter : no reason this needs to trigger a mask? 312 * doFlat : no reason this needs to trigger a mask? 313 */ 314 315 // if the variance image is requested, build it (if not supplied) 316 if (options->BaseVarianceFITS || options->ChipVarianceFITS) { 317 options->doVarianceBuild = true; 318 } 319 // photometry and noisemap both require a variance image 320 if (options->doNoiseMap || options->doPhotom) { 321 options->doVarianceBuild = true; 322 } 323 324 // we need a mask if we are going to apply these things: 325 if (options->doMaskSat || options->doMaskLow || options->doMaskBurntool || options->doMaskStats) { 306 326 options->doMaskBuild = true; 307 options->doVarianceBuild = true; 308 } else if (options->doMask || options->doBG) { 327 } 328 // photometry, mask, and background all require a mask image 329 if (options->doMask || options->doBG || options->doPhotom) { 309 330 options->doMaskBuild = true; 310 331 } -
branches/czw_branch/20101203/ppImage/src/ppImagePhotom.c
r28375 r30118 11 11 pmCell *cell; 12 12 pmReadout *readout; 13 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 13 14 14 psphotInit(); 15 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 15 16 16 // find or define a pmFPAfile PSPHOT.INPUT 17 17 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); … … 20 20 return false; 21 21 } 22 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 22 23 23 // we make a new copy of the output chip to keep psphot from modifying the output image 24 24 pmChip *oldChip = pmFPAviewThisChip (view, input->src); 25 25 pmChip *newChip = pmFPAviewThisChip (view, input->fpa); 26 26 pmChipCopy (newChip, oldChip); 27 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 27 28 28 // iterate over the cells and readout for this chip 29 29 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { … … 34 34 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 35 35 if (! readout->data_exists) { continue; } 36 printf("%x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 36 37 37 // run the actual photometry analysis 38 if (!psphotReadout (config, view )) {38 if (!psphotReadout (config, view, "PSPHOT.INPUT")) { 39 39 // This is likely a data quality issue 40 40 // XXX Split into multiple cases using error codes? … … 60 60 ppImageMemoryDump("photom"); 61 61 62 // the PSPHOT.INPUT file is a temporary file used to carry PPIMAGE.CHIP to psphotReadout63 // XXX not sure that this is needed...64 // pmFPAfileActivate (config->files, false, "PSPHOT.INPUT");65 66 62 return true; 67 63 } 68 69 // XXX do we need to deactivate all files and activate the psphot ones explicitly? -
branches/czw_branch/20101203/ppImage/src/ppImageStatsOutput.c
r27064 r30118 28 28 return false; 29 29 } 30 if (!psMetadataConfigWrite(stats, resolved)) { 30 31 // check for Metadata compression options: 32 char *compressMode = NULL; 33 bool status = false; 34 if (config->camera) { 35 // XXX use a different config variable for this output? 36 compressMode = psMetadataLookupStr(&status, config->camera, "METADATA.COMPRESSION"); 37 } 38 39 if (!psMetadataConfigWrite(stats, resolved, compressMode)) { 31 40 psError(psErrorCodeLast(), false, "Unable to serialize stats metadata.\n"); 32 41 psFree(resolved); -
branches/czw_branch/20101203/ppStack/src/ppStackPhotometry.c
r27343 r30118 54 54 psImageMaskType maskValue = pmConfigMaskGet("BLANK", config); // Bits to mask 55 55 psImageMaskType markValue = pmConfigMaskGet("MARK.VALUE", config); // Bits to use for marking 56 psMetadataAddImageMask(psphot, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, 57 "Bits to mask", maskValue); 58 psMetadataAddImageMask(psphot, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, 59 "Bits to use for mark", markValue); 56 psMetadataAddImageMask(psphot, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "Bits to mask", maskValue); 57 psMetadataAddImageMask(psphot, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "Bits to use for mark", markValue); 60 58 61 59 psArray *inSources = options->sources; … … 67 65 68 66 pmModelClassSetLimits(PM_MODEL_LIMITS_LAX); 69 if (!psphotReadoutKnownSources(config, photView, inSources)) {67 if (!psphotReadoutKnownSources(config, photView, "PSPHOT.INPUT", inSources)) { 70 68 // This is likely a data quality issue 71 69 // XXX Split into multiple cases using error codes? -
branches/czw_branch/20101203/ppSub/src/Makefile.am
r29003 r30118 38 38 ppSubLoop.c \ 39 39 ppSubDefineOutput.c \ 40 ppSubInputDetections.c \ 40 41 ppSubExtras.c \ 41 42 ppSubFlagNeighbors.c \ … … 46 47 ppSubReadoutJpeg.c \ 47 48 ppSubReadoutPhotometry.c \ 49 ppSubReadoutForcedPhot.c \ 48 50 ppSubReadoutStats.c \ 49 51 ppSubReadoutSubtract.c \ -
branches/czw_branch/20101203/ppSub/src/ppSub.h
r29003 r30118 45 45 bool photometry; // Perform photometry? 46 46 bool inverse; // Output inverse subtraction as well? 47 bool forcedPhot1; // perform forced photometry? 48 bool forcedPhot2; // perform forced photometry? 47 49 bool saveInConv; // Save convolved input? 48 50 bool saveRefConv; // Save convolved reference? … … 105 107 ppSubData *data ///< Processing data 106 108 ); 109 110 bool ppSubInputDetections (bool *foundDetections, const char *sourcesName, const char *imageName, ppSubData *data); 111 bool ppSubReadoutForcedPhot(const char *outputName, const char *targetName, const char *sourceName, ppSubData *data); 112 bool psphotCopyResults (bool *foundDetections, pmFPAfile *target, pmFPAfile *source, pmFPAview *view); 107 113 108 114 /// Higher-order background subtraction -
branches/czw_branch/20101203/ppSub/src/ppSubArguments.c
r27596 r30118 86 86 psMetadataAddS32(arguments, PS_LIST_TAIL, "-convolve", 0, "Image to convolve [1 or 2]", 0); 87 87 psMetadataAddBool(arguments, PS_LIST_TAIL, "-photometry", 0, "Perform photometry?", NULL); 88 psMetadataAddBool(arguments, PS_LIST_TAIL, "-forced-phot", 0, "Perform forced photometry?", NULL); 89 psMetadataAddBool(arguments, PS_LIST_TAIL, "-forced-input1", 0, "Perform forced photometry?", NULL); 90 psMetadataAddBool(arguments, PS_LIST_TAIL, "-forced-input2", 0, "Perform forced photometry?", NULL); 88 91 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp", 0, "Zero point for photometry", NAN); 89 92 psMetadataAddBool(arguments, PS_LIST_TAIL, "-inverse", 0, "Generate inverse subtractions?", false); -
branches/czw_branch/20101203/ppSub/src/ppSubBackground.c
r29003 r30118 37 37 pmFPAview *view = ppSubViewReadout(); // View to readout 38 38 pmReadout *outRO = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); // Output image 39 pmReadout *modelRO = pmFPAfileThisReadout(config->files, view, "PSPHOT.BACKMDL"); // Background model40 39 41 // Generate the background model, if required 40 // Generate the background model 41 if (!psphotModelBackground(config, view, "PPSUB.OUTPUT")) { 42 psError(psErrorCodeLast(), false, "Unable to model background"); 43 psFree(view); 44 return false; 45 } 46 47 // select the model readout (should now exist) 48 pmReadout *modelRO = pmFPAfileThisReadout(config->files, view, "PSPHOT.BACKMDL"); 42 49 if (!modelRO) { 43 // Create the background model 44 if (!psphotModelBackgroundReadoutFileIndex(config, view, "PPSUB.OUTPUT", 0)) { 45 psError(psErrorCodeLast(), false, "Unable to model background"); 46 psFree(view); 47 return false; 48 } 49 // select the model readout (should now exist) 50 modelRO = pmFPAfileThisReadout(config->files, view, "PSPHOT.BACKMDL"); 51 if (!modelRO) { 52 psError(psErrorCodeLast(), false, "Unable to find background model"); 53 psFree(view); 54 return false; 55 } 50 psError(psErrorCodeLast(), false, "Unable to find background model"); 51 psFree(view); 52 return false; 56 53 } 57 54 psFree(view); 58 55 59 psImageBinning *binning = psMetadataLookupPtr(&mdok, modelRO->analysis, 60 "PSPHOT.BACKGROUND.BINNING"); // Binning for model 56 psImageBinning *binning = psMetadataLookupPtr(&mdok, modelRO->analysis, "PSPHOT.BACKGROUND.BINNING"); // Binning for model 61 57 psImage *modelImage = modelRO->image; // Background model 62 58 psImage *image = outRO->image; // Image of interest … … 83 79 } 84 80 85 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL");86 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV");87 88 81 return true; 89 82 } -
branches/czw_branch/20101203/ppSub/src/ppSubCamera.c
r27661 r30118 221 221 "Generate inverse subtractions?", true); 222 222 } 223 224 data->inverse = psMetadataLookupBool(NULL, recipe, "INVERSE"); 225 data->photometry = psMetadataLookupBool(NULL, recipe, "PHOTOMETRY"); 223 if (psMetadataLookupBool(NULL, config->arguments, "-forced-phot")) { 224 psMetadataAddBool(recipe, PS_LIST_TAIL, "FORCED.PHOTOMETRY.BOTH", PS_META_REPLACE, "Perform forced photometry?", true); 225 } 226 if (psMetadataLookupBool(NULL, config->arguments, "-forced-input1")) { 227 psMetadataAddBool(recipe, PS_LIST_TAIL, "FORCED.PHOTOMETRY.INPUT1", PS_META_REPLACE, "Perform forced photometry?", true); 228 } 229 if (psMetadataLookupBool(NULL, config->arguments, "-forced-input2")) { 230 psMetadataAddBool(recipe, PS_LIST_TAIL, "FORCED.PHOTOMETRY.INPUT2", PS_META_REPLACE, "Perform forced photometry?", true); 231 } 232 233 data->inverse = psMetadataLookupBool(NULL, recipe, "INVERSE"); 234 data->photometry = psMetadataLookupBool(NULL, recipe, "PHOTOMETRY"); 235 data->forcedPhot1 = psMetadataLookupBool(NULL, recipe, "FORCED.PHOTOMETRY.BOTH") || psMetadataLookupBool(NULL, recipe, "FORCED.PHOTOMETRY.INPUT1"); 236 data->forcedPhot2 = psMetadataLookupBool(NULL, recipe, "FORCED.PHOTOMETRY.BOTH") || psMetadataLookupBool(NULL, recipe, "FORCED.PHOTOMETRY.INPUT2"); 226 237 227 238 // Convolved input image … … 363 374 return false; 364 375 } 365 // specify the number of psphot input images366 psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);367 376 pmFPAfileActivate(config->files, false, "PSPHOT.INPUT"); 368 377 … … 405 414 invSources->save = true; 406 415 } 416 417 // files need to do the forced photometry on the positions of sources in the positive images 418 if (data->forcedPhot1) { 419 // this pmFPAfile is used to carry sources detected in the positive image #1 420 pmFPAfile *posSources1 = defineOutputFile(config, input, true, "PPSUB.POS1.SOURCES", PM_FPA_FILE_CMF); 421 if (!posSources1) { 422 psError(psErrorCodeLast(), false, "Unable to set up forced source file."); 423 return false; 424 } 425 posSources1->save = true; 426 427 // this pmFPAfile is used to carry sources detected in the diff image @ the positions from positive image #1 428 pmFPAfile *frcSources1 = defineOutputFile(config, input, true, "PPSUB.FORCED1.SOURCES", PM_FPA_FILE_CMF); 429 if (!frcSources1) { 430 psError(psErrorCodeLast(), false, "Unable to set up forced source file."); 431 return false; 432 } 433 frcSources1->save = true; 434 } 435 436 if (data->forcedPhot2) { 437 // this pmFPAfile is used to carry sources detected in the positive image #2 438 pmFPAfile *posSources2 = defineOutputFile(config, ref, true, "PPSUB.POS2.SOURCES", PM_FPA_FILE_CMF); 439 if (!posSources2) { 440 psError(psErrorCodeLast(), false, "Unable to set up forced source file."); 441 return false; 442 } 443 posSources2->save = true; 444 445 // this pmFPAfile is used to carry sources detected in the diff image @ the positions from positive image #2 446 pmFPAfile *frcSources2 = defineOutputFile(config, ref, true, "PPSUB.FORCED2.SOURCES", PM_FPA_FILE_CMF); 447 if (!frcSources2) { 448 psError(psErrorCodeLast(), false, "Unable to set up forced source file."); 449 return false; 450 } 451 frcSources2->save = true; 452 } 407 453 } 408 454 -
branches/czw_branch/20101203/ppSub/src/ppSubFlagNeighbors.c
r29003 r30118 235 235 src = sources->data[Imin]; 236 236 237 fprintf (stderr, "j: %d, Imin: %d, obj x,y: %f, %f src x,y: %f, %f, SN: %f, ID: %d\n", j, Imin, obj->x, obj->y, src->peak->xf, src->peak->yf, src->peak->SN, src->id);237 // fprintf (stderr, "j: %d, Imin: %d, obj x,y: %f, %f src x,y: %f, %f, SN: %f, ID: %d\n", j, Imin, obj->x, obj->y, src->peak->xf, src->peak->yf, src->peak->SN, src->id); 238 238 239 239 // add source to object -
branches/czw_branch/20101203/ppSub/src/ppSubLoop.c
r29003 r30118 36 36 psAssert(config, "Require configuration."); 37 37 38 bool success = true; 39 38 40 pmConfigCamerasCull(config, NULL); 39 41 pmConfigRecipesCull(config, "PPSUB,PPSTATS,PSPHOT,PSASTRO,MASKS,JPEG"); … … 57 59 } 58 60 61 if (data->forcedPhot1) { 62 bool foundDetections = false; 63 if (!ppSubInputDetections(&foundDetections, "PPSUB.POS1.SOURCES", "PPSUB.INPUT", data)) { 64 psError(psErrorCodeLast(), false, "Unable to measure positive detections (1)"); 65 success = false; 66 goto ESCAPE; 67 } 68 // if nothing was found, don't bother doing the forced photometry below 69 if (!foundDetections) { 70 psWarning ("no sources found in positive image 1, skipping forced photometry"); 71 data->forcedPhot1 = false; 72 } 73 } 74 if (data->forcedPhot2) { 75 // Change the recipe to use a higher nsigma limit and quit after pass1 76 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE); 77 78 psF32 nsigma_peak_save = psMetadataLookupF32 (NULL, recipe, "PEAKS_NSIGMA_LIMIT"); 79 char *breakPt_save = psMetadataLookupStr (NULL, recipe, "BREAK_POINT"); 80 81 bool mdok; 82 psF32 pos2_nsigma_peak = psMetadataLookupF32 (&mdok, recipe, "PEAKS_POS2_NSIGMA_LIMIT"); 83 if (!mdok) { 84 psWarning("PEAKS_POS2_NSIGMA_LIMIT not found in recipe. Will use 25.\n"); 85 pos2_nsigma_peak = 25.; 86 } 87 psMetadataAddF32(recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", pos2_nsigma_peak); 88 psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", "PASS1"); 89 90 bool foundDetections = false; 91 if (!ppSubInputDetections(&foundDetections, "PPSUB.POS2.SOURCES", "PPSUB.REF", data)) { 92 psError(psErrorCodeLast(), false, "Unable to measure positive detections (2)"); 93 psMetadataAddF32(recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", nsigma_peak_save); 94 psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", breakPt_save); 95 success = false; 96 goto ESCAPE; 97 } 98 psMetadataAddF32(recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", nsigma_peak_save); 99 psMetadataAddStr(recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_REPLACE, "", breakPt_save); 100 // if nothing was found, don't bother doing the forced photometry below 101 if (!foundDetections) { 102 psWarning ("no sources found in positive image 2, skipping forced photometry"); 103 data->forcedPhot2 = false; 104 } 105 } 106 107 // XXX if it exists, use the POS1, POS2 successs for the FWHMs 59 108 if (!ppSubMatchPSFs(data)) { 60 109 psError(psErrorCodeLast(), false, "Unable to match PSFs."); 61 return false; 110 success = false; 111 goto ESCAPE; 62 112 } 63 113 if (data->quality) { 64 114 // Can't do anything at all 65 return true; 115 success = false; 116 goto ESCAPE; 66 117 } 67 118 // generate the residual stamp grid for visualization 68 119 if (!ppSubResidualSampleJpeg(config)) { 69 120 psError(psErrorCodeLast(), false, "Unable to update."); 70 return false; 71 } 121 success = false; 122 goto ESCAPE; 123 } 124 125 // XXX add in a positive image detection step here (if needed) 126 72 127 73 128 psMetadataAddF32(data->stats, PS_LIST_TAIL, "TIME_MATCH", 0, "Time to match PSFs", … … 77 132 if (!ppSubFilesIterateUp(config, PPSUB_FILES_INPUT)) { 78 133 psError(PPSUB_ERR_IO, false, "Unable to close input files."); 79 return false; 134 success = false; 135 goto ESCAPE; 80 136 } 81 137 82 138 if (!ppSubLowThreshold(data)) { 83 139 psError(psErrorCodeLast(), false, "Unable to threshold images."); 84 return false; 140 success = false; 141 goto ESCAPE; 85 142 } 86 143 … … 88 145 if (!ppSubFilesIterateDown(config, PPSUB_FILES_SUB)) { 89 146 psError(PPSUB_ERR_IO, false, "Unable to set up subtraction files."); 90 return false; 147 success = false; 148 goto ESCAPE; 91 149 } 92 150 93 151 if (!ppSubDefineOutput("PPSUB.OUTPUT", config)) { 94 152 psError(psErrorCodeLast(), false, "Unable to define output."); 95 return false; 153 success = false; 154 goto ESCAPE; 96 155 } 97 156 98 157 if (!data->quality && !ppSubMakePSF(data)) { 99 158 psError(psErrorCodeLast(), false, "Unable to generate PSF."); 100 return false; 159 success = false; 160 goto ESCAPE; 101 161 } 102 162 … … 113 173 if (!ppSubReadoutSubtract(config)) { 114 174 psError(psErrorCodeLast(), false, "Unable to subtract images."); 115 return false; 175 success = false; 176 goto ESCAPE; 116 177 } 117 178 // dumpout(config, "diff.1.fits"); … … 120 181 if (!ppSubFilesIterateUp(config, PPSUB_FILES_PSF | PPSUB_FILES_CONV)) { 121 182 psError(PPSUB_ERR_IO, false, "Unable to close input files."); 122 return false; 183 success = false; 184 goto ESCAPE; 123 185 } 124 186 // dumpout(config, "diff.2a.fits"); … … 127 189 if (!ppSubBackground(config)) { 128 190 psError(psErrorCodeLast(), false, "Unable to subtract background."); 129 return false; 191 success = false; 192 goto ESCAPE; 130 193 } 131 194 // dumpout(config, "diff.2b.fits"); … … 134 197 if (!ppSubVarianceRescale(config, data)) { 135 198 psError(psErrorCodeLast(), false, "Unable to rescale variance."); 136 return false; 199 success = false; 200 goto ESCAPE; 137 201 } 138 202 // dumpout(config, "diff.2c.fits"); … … 140 204 if (data->quality) { 141 205 // Done all we can do up to this point 142 return true; 206 success = false; 207 goto ESCAPE; 143 208 } 144 209 145 210 if (!ppSubFilesIterateDown(config, PPSUB_FILES_PHOT_SUB)) { 146 211 psError(PPSUB_ERR_IO, false, "Unable to set up photometry files."); 147 return false; 212 success = false; 213 goto ESCAPE; 148 214 } 149 215 150 216 if (!data->quality && !ppSubReadoutPhotometry("PPSUB.OUTPUT", data)) { 151 217 psError(psErrorCodeLast(), false, "Unable to perform photometry."); 152 return false; 218 success = false; 219 goto ESCAPE; 153 220 } 154 221 // dumpout(config, "diff.3.fits"); 222 223 // forced photometry for positive image 1 224 if (data->forcedPhot1 && !data->quality) { 225 if (!ppSubReadoutForcedPhot("PPSUB.FORCED1.SOURCES", "PPSUB.OUTPUT", "PPSUB.POS1.SOURCES", data)) { 226 psError(psErrorCodeLast(), false, "Unable to perform photometry."); 227 success = false; 228 goto ESCAPE; 229 } 230 } 231 232 // forced photometry for positive image 2 233 if (data->forcedPhot2 && !data->quality) { 234 if (!ppSubReadoutForcedPhot("PPSUB.FORCED2.SOURCES", "PPSUB.OUTPUT", "PPSUB.POS2.SOURCES", data)) { 235 psError(psErrorCodeLast(), false, "Unable to perform photometry."); 236 success = false; 237 goto ESCAPE; 238 } 239 } 155 240 156 241 if (!ppSubFilesIterateUp(config, PPSUB_FILES_PHOT_SUB)) { 157 242 psError(PPSUB_ERR_IO, false, "Unable to set up photometry files."); 158 return false; 243 success = false; 244 goto ESCAPE; 159 245 } 160 246 … … 162 248 if (!ppSubReadoutStats(data)) { 163 249 psError(psErrorCodeLast(), false, "Unable to collect statistics"); 164 return false; 250 success = false; 251 goto ESCAPE; 165 252 } 166 253 // Do Mask Stats … … 169 256 if (!ppSubMaskStats(config, view,data->stats)) { 170 257 psError(psErrorCodeLast(), false, "Unable to generate mask statistics"); 171 return(false); 258 success = false; 259 goto ESCAPE; 172 260 } 173 261 } … … 177 265 if (!ppSubReadoutJpeg(config)) { 178 266 psError(psErrorCodeLast(), false, "Unable to update."); 179 return false; 267 success = false; 268 goto ESCAPE; 180 269 } 181 270 … … 184 273 if (!ppSubFilesIterateDown(config, PPSUB_FILES_INV)) { 185 274 psError(PPSUB_ERR_IO, false, "Unable to set up inverse files."); 186 return false; 275 success = false; 276 goto ESCAPE; 187 277 } 188 278 189 279 if (data->inverse && !ppSubDefineOutput("PPSUB.INVERSE", config)) { 190 280 psError(psErrorCodeLast(), false, "Unable to define inverse."); 191 return false; 281 success = false; 282 goto ESCAPE; 192 283 } 193 284 194 285 if (!ppSubReadoutInverse(config)) { 195 286 psError(psErrorCodeLast(), false, "Unable to invert images."); 196 return false; 287 success = false; 288 goto ESCAPE; 197 289 } 198 290 … … 200 292 if (!ppSubFilesIterateUp(config, PPSUB_FILES_SUB)) { 201 293 psError(PPSUB_ERR_IO, false, "Unable to close subtraction files."); 202 return false; 294 success = false; 295 goto ESCAPE; 203 296 } 204 297 205 298 if (!ppSubFilesIterateDown(config, PPSUB_FILES_PHOT_INV)) { 206 299 psError(PPSUB_ERR_IO, false, "Unable to set up inverse files."); 207 return false; 300 success = false; 301 goto ESCAPE; 208 302 } 209 303 210 304 if (!data->quality && !ppSubReadoutPhotometry("PPSUB.INVERSE", data)) { 211 305 psError(psErrorCodeLast(), false, "Unable to perform photometry."); 212 return false; 306 success = false; 307 goto ESCAPE; 213 308 } 214 309 … … 216 311 if (!ppSubFilesIterateUp(config, PPSUB_FILES_INV | PPSUB_FILES_PHOT_INV)) { 217 312 psError(PPSUB_ERR_IO, false, "Unable to close subtraction files."); 218 return false; 313 success = false; 314 goto ESCAPE; 219 315 } 220 316 } else { … … 223 319 if (!ppSubFilesIterateUp(config, PPSUB_FILES_SUB)) { 224 320 psError(PPSUB_ERR_IO, false, "Unable to close subtraction files."); 225 return false; 226 } 227 } 228 229 return true; 321 success = false; 322 goto ESCAPE; 323 } 324 } 325 326 ESCAPE: 327 pmFPAfileDropInternal(config->files, "PSPHOT.BACKGND"); 328 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL"); 329 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV"); 330 331 return success; 230 332 } -
branches/czw_branch/20101203/ppSub/src/ppSubMakePSF.c
r28049 r30118 35 35 36 36 psTimerStart("PPSUB_PHOT"); 37 38 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSub39 psAssert(recipe, "We checked this earlier, so it should be here.");40 41 if (!psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {42 return true;43 }44 37 45 38 bool reverse = psMetadataLookupBool(NULL, config->arguments, "REVERSE"); // Reverse sense of subtraction? … … 93 86 // use flags to toss totally bogus entries? 94 87 psArray *goodSources = ppSubSelectPSFSources (sources); 95 if (!psphotReadoutFindPSF(config, view, goodSources)) {88 if (!psphotReadoutFindPSF(config, view, "PSPHOT.INPUT", goodSources)) { 96 89 // This is likely a data quality issue 97 90 // XXX Split into multiple cases using error codes? -
branches/czw_branch/20101203/ppSub/src/ppSubMatchPSFs.c
r29593 r30118 72 72 // Extract the loaded sources from the associated readout, and generate PSF 73 73 // Here, we assume the image is background-subtracted 74 if (!psphotReadoutFindPSF(config, view, sources)) {74 if (!psphotReadoutFindPSF(config, view, "PSPHOT.INPUT", sources)) { 75 75 psErrorStackPrint(stderr, "Unable to determine PSF"); 76 76 psWarning("Unable to determine PSF."); -
branches/czw_branch/20101203/ppSub/src/ppSubReadoutPhotometry.c
r29003 r30118 31 31 32 32 if (!data->photometry) { 33 return true;34 }35 36 // Look up recipe values37 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim38 psAssert(recipe, "We checked this earlier, so it should be here.");39 40 if (!psMetadataLookupBool(NULL, recipe, "PHOTOMETRY")) {41 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL");42 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV");43 33 return true; 44 34 } … … 81 71 } 82 72 83 if (!psphotReadoutMinimal(config, view )) {73 if (!psphotReadoutMinimal(config, view, "PSPHOT.INPUT")) { 84 74 // This is likely a data quality issue 85 75 // XXX Split into multiple cases using error codes? … … 90 80 91 81 // If no sources were found, there's no error, but we want to trigger 'bad quality' 82 psWarning("no sources found: why is this being set to bad quality??"); 92 83 pmDetections *detections = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.DETECTIONS"); // Sources 93 84 if (!detections) { … … 136 127 } 137 128 } 138 139 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL");140 pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV");141 129 142 130 return true; -
branches/czw_branch/20101203/psLib/src/fits/psFitsImage.c
r28509 r30118 900 900 901 901 if (nAxis == 2) { 902 psImage *image = psFitsReadImage(fits, region, 0); 903 if (!image) { 904 psFitsError(status, true, "Could not read image into cube"); 905 return NULL; 906 } 902 907 psArray *images = psArrayAlloc(1); // Single image plane 903 images->data[0] = psFitsReadImage(fits, region, 0);908 images->data[0] = image; 904 909 return images; 905 910 } -
branches/czw_branch/20101203/psLib/src/imageops
-
Property svn:mergeinfo
set to
/branches/eam_branches/ipp-20101103/psLib/src/imageops merged eligible /branches/eam_branches/ipp-20101205/psLib/src/imageops merged eligible /trunk/psLib/src/imageops merged eligible
-
Property svn:mergeinfo
set to
-
branches/czw_branch/20101203/psLib/src/imageops/psImageMapFit.c
r25753 r30118 48 48 49 49 // map defines the output image dimensions and scaling. 50 bool psImageMapFit( psImageMap *map, const psVector *mask, psVectorMaskType maskValue,50 bool psImageMapFit(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 51 51 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 52 52 { 53 53 // XXX Add Asserts 54 55 *pGoodFit = false; 54 56 55 57 // dimensions of the output map image … … 81 83 map->map->data.F32[0][0] = psStatsGetValue(map->stats, mean); 82 84 map->error->data.F32[0][0] = psStatsGetValue(map->stats, stdev); 85 if (isfinite(map->map->data.F32[0][0]) && isfinite( map->error->data.F32[0][0])) { 86 *pGoodFit = true; 87 } 83 88 return true; 84 89 } … … 86 91 if (Nx == 1) { 87 92 bool status; 88 status = psImageMapFit1DinY ( map, mask, maskValue, x, y, f, df);93 status = psImageMapFit1DinY (pGoodFit, map, mask, maskValue, x, y, f, df); 89 94 return status; 90 95 } 91 96 if (Ny == 1) { 92 97 bool status; 93 status = psImageMapFit1DinX ( map, mask, maskValue, x, y, f, df);98 status = psImageMapFit1DinX (pGoodFit, map, mask, maskValue, x, y, f, df); 94 99 return status; 95 100 } … … 310 315 311 316 if (!psMatrixGJSolve(A, B)) { 312 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations. Returning NULL.\n");313 317 psFree (A); 314 318 psFree (B); 315 return false;319 return true; 316 320 } 317 321 … … 337 341 psFree (Empty); 338 342 343 *pGoodFit = true; 339 344 return true; 340 345 } 341 346 342 347 // measure residuals on each pass and clip outliers based on stats 343 bool psImageMapClipFit( psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue,348 bool psImageMapClipFit(bool *pGoodFit, psImageMap *map, psStats *stats, psVector *inMask, psVectorMaskType maskValue, 344 349 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 345 350 { … … 351 356 psAssert(f, "impossible"); 352 357 358 *pGoodFit = false; 359 353 360 // the user supplies one of various stats option pairs, 354 361 // determine the desired mean and stdev STATS options: … … 393 400 psTrace("psLib.imageops", 6, "Loop iteration %d. Calling psImageMapFit()\n", N); 394 401 psS32 Nkeep = 0; 395 if (!psImageMapFit( map, mask, maskValue, x, y, f, df)) {402 if (!psImageMapFit(pGoodFit, map, mask, maskValue, x, y, f, df)) { 396 403 psError(PS_ERR_UNKNOWN, false, "Could not fit image map.\n"); 397 404 psFree(resid); … … 399 406 return false; 400 407 } 408 if (!*pGoodFit) { 409 psWarning ("bad fit to image map, try something else"); 410 return true; 411 } 401 412 402 413 psVector *fit = psImageMapEvalVector(map, mask, maskValue, x, y); … … 454 465 psFree(resid); 455 466 if (!inMask) psFree (mask); 467 *pGoodFit = true; // XXX probably don't need to set this (set by psImageMapFit) 456 468 return true; 457 469 } 458 470 459 471 // map defines the output image dimensions and scaling. 460 bool psImageMapFit1DinY( psImageMap *map, const psVector *mask, psVectorMaskType maskValue,472 bool psImageMapFit1DinY(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 461 473 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 462 474 { 463 475 // XXX Add Asserts 464 476 assert (map->binning->nXruff == 1); 477 478 *pGoodFit = false; 465 479 466 480 // dimensions of the output map image … … 578 592 579 593 if (!psMatrixGJSolve(A, B)) { 580 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations.\n");581 594 psFree (A); 582 595 psFree (B); 583 596 psFree (Empty); 584 return false;597 return true; 585 598 } 586 599 … … 602 615 psFree (Empty); 603 616 617 *pGoodFit = true; 604 618 return true; 605 619 } 606 620 607 621 // map defines the output image dimensions and scaling. 608 bool psImageMapFit1DinX( psImageMap *map, const psVector *mask, psVectorMaskType maskValue,622 bool psImageMapFit1DinX(bool *pGoodFit, psImageMap *map, const psVector *mask, psVectorMaskType maskValue, 609 623 const psVector *x, const psVector *y, const psVector *f, const psVector *df) 610 624 { 611 625 // XXX Add Asserts 612 626 assert (map->binning->nYruff == 1); 627 628 *pGoodFit = false; 613 629 614 630 // dimensions of the output map image … … 726 742 727 743 if (!psMatrixGJSolve(A, B)) { 728 psError(PS_ERR_UNKNOWN, false, "Could not solve linear equations..\n");729 744 psFree (A); 730 745 psFree (B); 731 746 psFree (Empty); 732 return false;747 return true; 733 748 } 734 749 … … 750 765 psFree (Empty); 751 766 767 *pGoodFit = true; 752 768 return true; 753 769 } -
branches/czw_branch/20101203/psLib/src/imageops/psImageMapFit.h
r25753 r30118 8 8 9 9 // fit the image map to a set of points 10 bool psImageMapFit(psImageMap *map, 10 bool psImageMapFit(bool *pGoodFit, 11 psImageMap *map, 11 12 const psVector *mask, 12 13 psVectorMaskType maskValue, // … … 18 19 19 20 // fit the image map to a set of points 20 bool psImageMapClipFit(psImageMap *map, 21 bool psImageMapClipFit(bool *pGoodFit, 22 psImageMap *map, 21 23 psStats *stats, 22 24 psVector *mask, // WARNING: Mask is modified! … … 28 30 ); 29 31 30 bool psImageMapFit1DinY(psImageMap *map, 32 bool psImageMapFit1DinY(bool *pGoodFit, 33 psImageMap *map, 31 34 const psVector *mask, 32 35 psVectorMaskType maskValue, … … 37 40 ); 38 41 39 bool psImageMapFit1DinX(psImageMap *map, 42 bool psImageMapFit1DinX(bool *pGoodFit, 43 psImageMap *map, 40 44 const psVector *mask, 41 45 psVectorMaskType maskValue, -
branches/czw_branch/20101203/psLib/src/jpeg/psImageJpeg.c
r29542 r30118 167 167 int dy = image->numRows; 168 168 169 bDrawBuffer *bdbuf = bDrawBufferCreate(dx, dy); 169 int Npalette; 170 png_color *palette = KapaPNGPalette (&Npalette); 171 172 bDrawBuffer *bdbuf = bDrawBufferCreate(dx, dy, 1, palette, Npalette); 170 173 171 174 return bdbuf; … … 180 183 int dy = bdbuf->Ny; 181 184 182 int Npalette; 183 png_color *palette = KapaPNGPalette (&Npalette); 185 png_color *palette = bdbuf->palette; 184 186 bDrawColor white = KapaColorByName ("white"); 185 187 for (int j = 0; j < dy; j++) { … … 336 338 337 339 // set the scalebar labels 340 int Npalette; 341 png_color *palette = KapaPNGPalette (&Npalette); 342 338 343 char string[64]; 339 bDrawBuffer *labels = bDrawBufferCreate(dx, PS_JPEG_LABELPAD );344 bDrawBuffer *labels = bDrawBufferCreate(dx, PS_JPEG_LABELPAD, 1, palette, Npalette); 340 345 SetRotFont ("helvetica", 8); 341 bDrawSetBuffer(labels);342 346 sprint_double (string, options->min); 343 bDrawRotText( 2, 2, string, 2, 0.0);347 bDrawRotText(labels, 2, 2, string, 2, 0.0); 344 348 sprint_double (string, options->max); 345 bDrawRotText( dx - 2, 2, string, 0, 0.0);349 bDrawRotText(labels, dx - 2, 2, string, 0, 0.0); 346 350 sprint_double (string, 0.5*(options->min + options->max)); 347 bDrawRotText( 0.5*dx, 2, string, 1, 0.0);351 bDrawRotText(labels, 0.5*dx, 2, string, 1, 0.0); 348 352 psImageJpegOverlayDraw(jpegImage, labels, 0, offset); 353 bDrawBufferFree(labels); 349 354 } 350 355 -
branches/czw_branch/20101203/psLib/src/math/psStats.c
r28998 r30118 827 827 // values; nearly bi-modal distribution). if so, keep only points within 5? 10? 828 828 // bins of that excess bin: 829 int nMaxBin = 0;829 int nMaxBin = histogram->nums->data.F32[0]; 830 830 int iMaxBin = 0; 831 831 for (long i = 1; i < histogram->nums->n; i++) { … … 843 843 if (mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & maskVal) continue; 844 844 bool invalid = false; 845 invalid |= (myVector->data.F32[i] < =minKeep);846 invalid |= (myVector->data.F32[i] > =maxKeep);845 invalid |= (myVector->data.F32[i] < minKeep); 846 invalid |= (myVector->data.F32[i] > maxKeep); 847 847 invalid |= (!isfinite(myVector->data.F32[i])); 848 848 if (!invalid) continue; … … 852 852 853 853 if (nInvalid) { 854 psTrace(TRACE, 6, "data is concentrated in a single bin, masking %d extreme outliers and retrying\n", nInvalid); 854 psTrace(TRACE, 6, "data is concentrated in a single bin (%d = %f - %f), masking %d extreme outliers and retrying\n", 855 iMaxBin, histogram->bounds->data.F32[iMaxBin], histogram->bounds->data.F32[iMaxBin+1], nInvalid); 855 856 psFree(histogram); 856 857 psFree(cumulative); … … 1108 1109 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1109 1110 if (isnan(stats->robustMedian)) { 1110 stats->fittedStdev = NAN; 1111 stats->fittedStdev = NAN; 1111 stats->fittedMean = NAN; 1112 stats->fittedStdev = NAN; 1113 stats->results |= PS_STAT_FITTED_MEAN; 1114 stats->results |= PS_STAT_FITTED_STDEV; 1115 return true; 1116 } 1117 1118 if (stats->robustStdev <= FLT_EPSILON) { 1119 stats->fittedMean = stats->robustMedian; 1120 stats->fittedStdev = stats->robustStdev; 1121 stats->results |= PS_STAT_FITTED_MEAN; 1122 stats->results |= PS_STAT_FITTED_STDEV; 1112 1123 return true; 1113 1124 } … … 1289 1300 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1290 1301 if (isnan(stats->robustMedian)) { 1291 stats->fittedStdev = NAN; 1292 stats->fittedStdev = NAN; 1293 psTrace(TRACE, 4, "---- %s() end ----\n", __func__); 1302 stats->fittedMean = NAN; 1303 stats->fittedStdev = NAN; 1304 stats->results |= PS_STAT_FITTED_MEAN_V2; 1305 stats->results |= PS_STAT_FITTED_STDEV_V2; 1306 return true; 1307 } 1308 1309 if (stats->robustStdev <= FLT_EPSILON) { 1310 stats->fittedMean = stats->robustMedian; 1311 stats->fittedStdev = stats->robustStdev; 1312 stats->results |= PS_STAT_FITTED_MEAN_V2; 1313 stats->results |= PS_STAT_FITTED_STDEV_V2; 1294 1314 return true; 1295 1315 } … … 1486 1506 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1487 1507 if (isnan(stats->robustMedian)) { 1488 stats->fittedStdev = NAN; 1489 stats->fittedStdev = NAN; 1490 psTrace(TRACE, 4, "---- %s() end ----\n", __func__); 1508 stats->fittedMean = NAN; 1509 stats->fittedStdev = NAN; 1510 stats->results |= PS_STAT_FITTED_MEAN_V3; 1511 stats->results |= PS_STAT_FITTED_STDEV_V3; 1512 return true; 1513 } 1514 1515 if (stats->robustStdev <= FLT_EPSILON) { 1516 stats->fittedMean = stats->robustMedian; 1517 stats->fittedStdev = stats->robustStdev; 1518 stats->results |= PS_STAT_FITTED_MEAN_V3; 1519 stats->results |= PS_STAT_FITTED_STDEV_V3; 1491 1520 return true; 1492 1521 } … … 1782 1811 1783 1812 // If the mean is NAN, then generate a warning and set the stdev to NAN. 1784 if (isnan(stats->robustMedian)) goto escape; 1813 if (isnan(stats->robustMedian)) { 1814 stats->fittedMean = NAN; 1815 stats->fittedStdev = NAN; 1816 stats->results |= PS_STAT_FITTED_MEAN_V4; 1817 stats->results |= PS_STAT_FITTED_STDEV_V4; 1818 return true; 1819 } 1820 1821 if (stats->robustStdev <= FLT_EPSILON) { 1822 stats->fittedMean = stats->robustMedian; 1823 stats->fittedStdev = stats->robustStdev; 1824 stats->results |= PS_STAT_FITTED_MEAN_V4; 1825 stats->results |= PS_STAT_FITTED_STDEV_V4; 1826 return true; 1827 } 1785 1828 1786 1829 float guessStdev = stats->robustStdev; // pass the guess sigma -
branches/czw_branch/20101203/psLib/src/sys/psSlurp.c
r12072 r30118 27 27 #include "psMemory.h" 28 28 29 #define SLURP_SIZE 4096 29 # define SLURP_SIZE 4096 30 31 # if (PS_SLURP_GZIP) 32 33 psString psSlurpFD(int fd) { 34 35 gzFile file = gzdopen (fd, "r"); 36 if (file == Z_NULL) { 37 psError(PS_ERR_IO, true, "Failed to open file\n"); 38 return NULL; 39 } 40 41 psString str = psSlurpGZIP(file); 42 43 return str; 44 } 45 46 # else 30 47 31 48 psString psSlurpFD(int fd) … … 38 55 // increase the allocated string size 39 56 size += SLURP_SIZE; 40 str = ps Realloc(str, size);57 str = psStringRealloc(str, size); 41 58 42 59 // read a block from the stream … … 59 76 return str; 60 77 } 78 # endif 61 79 80 # if (PS_SLURP_GZIP) 81 psString psSlurpGZIP(gzFile fd) 82 { 83 psString str = NULL; // String to which to write 84 size_t size = 1; // bytes allocated - make sure there is room for '\0' 85 size_t used = 0; // bytes actually used 86 ssize_t bytes; // Number of bytes read 87 do { 88 // increase the allocated string size 89 size += SLURP_SIZE; 90 str = psStringRealloc(str, size); 91 92 // read a block from the stream 93 bytes = gzread(fd, str + used, SLURP_SIZE); 94 if (bytes < 0) { 95 // it's an error 96 psError(PS_ERR_IO, true, "slurp failed on read"); 97 psFree(str); 98 return NULL; 99 } 100 101 // Increase the size of the known string 102 used += bytes; 103 104 } while (bytes != 0); 105 106 // append '\0' to the end of the string 107 str[used] = '\0'; 108 109 return str; 110 } 111 # endif 62 112 63 113 psString psSlurpFile(FILE *stream) … … 70 120 { 71 121 PS_ASSERT_PTR_NON_NULL(filename, NULL); 122 123 # if (PS_SLURP_GZIP) 124 gzFile fd = gzopen(filename, "r"); 125 if (fd == Z_NULL) { 126 psError(PS_ERR_IO, true, "Failed to open specified file, %s\n", filename); 127 return NULL; 128 } 129 psString text = psSlurpGZIP(fd); 130 131 if (gzclose(fd) != Z_OK) { 132 psError(PS_ERR_IO, true, "Failed to close specified file, %s\n", filename); 133 psFree(text); 134 return NULL; 135 } 136 137 # else 72 138 73 139 int fd = open(filename, O_RDONLY); … … 76 142 return NULL; 77 143 } 78 79 144 psString text = psSlurpFD(fd); 80 145 … … 84 149 return NULL; 85 150 } 151 # endif 86 152 87 153 return text; -
branches/czw_branch/20101203/psLib/src/sys/psSlurp.h
r15410 r30118 12 12 13 13 #include <psString.h> 14 15 # define PS_SLURP_GZIP 1 16 17 # if (PS_SLURP_GZIP) 18 # include <zlib.h> 19 # endif 14 20 15 21 /// @addtogroup FileIO Input/Output … … 31 37 ); 32 38 39 # if (PS_SLURP_GZIP) 40 psString psSlurpGZIP(gzFile fd); 41 # endif 42 33 43 /// @} 34 44 #endif -
branches/czw_branch/20101203/psLib/src/sys/psString.c
r19070 r30118 48 48 psString string = p_psAlloc(file, lineno, func, nChar + 1); 49 49 psMemSetDeallocator(string, (psFreeFunc)stringFree); 50 51 return string; 52 } 53 54 55 psString p_psStringRealloc(const char *file, 56 unsigned int lineno, 57 const char *func, 58 psString string, 59 size_t nChar) 60 { 61 if (!string) { 62 string = p_psAlloc(file, lineno, func, nChar + 1); 63 psMemSetDeallocator(string, (psFreeFunc)stringFree); 64 } else { 65 string = p_psRealloc(file, lineno, func, string, nChar + 1); 66 } 50 67 51 68 return string; -
branches/czw_branch/20101203/psLib/src/sys/psString.h
r15523 r30118 40 40 #define PS_FILE_LINE p_psFileLine(__FILE__,__LINE__) 41 41 42 43 42 /** Allocates a new psString. 44 43 * … … 60 59 #endif // ifdef DOXYGEN 61 60 61 /** Reallocate an existing psString (or alloc if not existent) 62 * 63 * @return psString: string of length n. 64 */ 65 #ifdef DOXYGEN 66 psString psStringRealloc( 67 psString string, 68 size_t nChar ///< Size of psString to allocate. 69 ); 70 #else // ifdef DOXYGEN 71 psString p_psStringRealloc( 72 const char *file, ///< File of caller 73 unsigned int lineno, ///< Line number of caller 74 const char *func, ///< Function name of caller 75 psString string, ///< supplied string or NULL 76 size_t nChar ///< Size of psString to allocate. 77 ) PS_ATTR_MALLOC; 78 #define psStringRealloc(string, nChar) \ 79 p_psStringRealloc(__FILE__, __LINE__, __func__, string, nChar) 80 #endif // ifdef DOXYGEN 62 81 63 82 /** Checks the type of a particular pointer. -
branches/czw_branch/20101203/psLib/src/types/psMetadata.c
r29833 r30118 1371 1371 break; 1372 1372 case PS_DATA_S64: 1373 fprintf(fd, "% jd\n", item->data.S64);1373 fprintf(fd, "%" PRId64 "\n", item->data.S64); 1374 1374 break; 1375 1375 case PS_DATA_U8: … … 1383 1383 break; 1384 1384 case PS_DATA_U64: 1385 fprintf(fd, "% ju\n", item->data.U64);1385 fprintf(fd, "%" PRIu64 "\n", item->data.U64); 1386 1386 break; 1387 1387 case PS_DATA_F32: … … 1458 1458 fprintf(fd, "U64 "); 1459 1459 for (int i = 0; i < vector->n; i++) { 1460 fprintf(fd, "% ju ", vector->data.U64[i]);1460 fprintf(fd, "%" PRIu64, vector->data.U64[i]); 1461 1461 } 1462 1462 fprintf(fd, "\n"); … … 1486 1486 fprintf(fd, "S64 "); 1487 1487 for (int i = 0; i < vector->n; i++) { 1488 fprintf(fd, "% jd ", vector->data.S64[i]);1488 fprintf(fd, "%" PRId64, vector->data.S64[i]); 1489 1489 } 1490 1490 fprintf(fd, "\n"); -
branches/czw_branch/20101203/psLib/src/types/psMetadataConfig.c
r27056 r30118 1630 1630 } 1631 1631 1632 1633 bool psMetadataConfigWrite(psMetadata *md, 1634 const char *filename) 1635 { 1636 PS_ASSERT_METADATA_NON_NULL(md, NULL); 1637 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 1638 FILE *file; 1639 if ( !(file = fopen(filename, "w")) ) { 1640 psError(PS_ERR_IO, true, 1641 "Failed to open specified file, %s\n", filename); 1642 return false; 1643 } 1644 psString fileString = NULL; 1645 fileString = psMetadataConfigFormat(md); 1646 if (fileString == NULL) { 1647 psError(PS_ERR_BAD_PARAMETER_NULL, false, 1648 "psMetadataConfigFormat returned NULL.\n"); 1649 return false; 1650 } 1651 if (fprintf(file, "%s", fileString) != strlen(fileString)) { 1652 psError(PS_ERR_IO, true, "Failed to write contents of configuration file %s", filename); 1653 psFree(fileString); 1654 fclose(file); 1655 return false; 1632 bool psMetadataConfigWrite(psMetadata *md, const char *filename, const char *compress) 1633 { 1634 PS_ASSERT_METADATA_NON_NULL(md, NULL); 1635 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 1636 1637 psString fileString = NULL; 1638 fileString = psMetadataConfigFormat(md); 1639 if (fileString == NULL) { 1640 psError(PS_ERR_BAD_PARAMETER_NULL, false, "psMetadataConfigFormat returned NULL.\n"); 1641 return false; 1642 } 1643 1644 if (compress) { 1645 if (strlen(compress) > 2) { 1646 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "invalid compression options %s", compress); 1647 psFree(fileString); 1648 return false; 1649 } 1650 char modeString[4]; 1651 snprintf (modeString, 4, "w%s", compress); 1652 1653 gzFile file = gzopen(filename, modeString); 1654 if (file == Z_NULL) { 1655 psError(PS_ERR_IO, true, "Failed to open specified file, %s\n", filename); 1656 psFree(fileString); 1657 return false; 1658 } 1659 1660 int nbytes = gzwrite (file, fileString, strlen(fileString)); 1661 if (nbytes != strlen(fileString)) { 1662 psError(PS_ERR_IO, true, "Failed to write contents of configuration file %s", filename); 1663 psFree(fileString); 1664 gzclose(file); 1665 return false; 1666 } 1667 psFree(fileString); 1668 if (gzclose(file) != Z_OK) { 1669 psError(PS_ERR_IO, true, "Failed to close file, %s\n", filename); 1670 return false; 1671 } 1672 } else { 1673 FILE *file = fopen(filename, "w"); 1674 if (file == NULL) { 1675 psError(PS_ERR_IO, true, "Failed to open specified file, %s\n", filename); 1676 psFree(fileString); 1677 return false; 1678 } 1679 1680 int nbytes = fwrite(fileString, 1, strlen(fileString), file); 1681 if (nbytes != strlen(fileString)) { 1682 psError(PS_ERR_IO, true, "Failed to write contents of configuration file %s", filename); 1683 psFree(fileString); 1684 fclose(file); 1685 return false; 1656 1686 } 1657 1687 psFree(fileString); 1658 1688 if (fclose(file) == EOF) { 1659 psError(PS_ERR_IO, true,1660 "Failed to close file, %s\n", filename);1661 return false;1662 }1663 return true;1689 psError(PS_ERR_IO, true, "Failed to close file, %s\n", filename); 1690 return false; 1691 } 1692 } 1693 return true; 1664 1694 } 1665 1695 -
branches/czw_branch/20101203/psLib/src/types/psMetadataConfig.h
r11248 r30118 33 33 * a string, the formatting command must also be for a string. If the 34 34 * metadata type is any other data type, printing is not allowed. 35 * Currently, this function does not compress the output file 35 36 * 36 37 * @return psMetadataItem* : Pointer metadata item. … … 85 86 bool psMetadataConfigWrite( 86 87 psMetadata *md, ///< The metadata to convert 87 const char *filename ///< Name of file to write 88 const char *filename, ///< Name of file to write 89 const char *compress ///< Output compression options 88 90 ); 89 91 90 92 /** Converts a psMetadata structure (including any nested psMetadata) into a 91 93 * configuration file formatted string that is written a file stream. 94 * Currently, this function does not compress the output file 92 95 * 93 96 * @return bool: True if successful, otherwise false. -
branches/czw_branch/20101203/psLib/test/imageops
- Property svn:ignore
-
old new 27 27 convolutionBench 28 28 tap_psImageInterpolate2 29 tap_psImageInterpolate3 29 30 tap_psImageGeomManip 30 31 tap_psImageMaskOps
-
- Property svn:ignore
-
branches/czw_branch/20101203/psLib/test/imageops/Makefile.am
r14926 r30118 22 22 tap_psImagePixelExtract \ 23 23 tap_psImageInterpolate2 \ 24 tap_psImageInterpolate3 \ 24 25 tap_psImageMap \ 25 26 tap_psImageMapFit \ -
branches/czw_branch/20101203/psLib/test/math
-
Property svn:mergeinfo
set to
/branches/eam_branches/ipp-20101103/psLib/test/math merged eligible /branches/eam_branches/ipp-20101205/psLib/test/math merged eligible /trunk/psLib/test/math merged eligible
-
Property svn:mergeinfo
set to
-
branches/czw_branch/20101203/psLib/test/math/tap_psStats_Sample_01.c
r12513 r30118 487 487 }; 488 488 489 static float yraw_04[] = { 490 -1.000000, 0.000000, 0.000000, 0.000000, 0.000000, -1.000000, -1.000000, -1.000000, 491 0.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, 492 -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -0.963289, 493 -1.000000, 0.000000, -1.000000, -1.000000, -0.915174, -1.000000, -1.000000, -1.000000, 494 -1.000000, -1.000000, 0.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, 495 -1.000000, -1.000000, -1.000000, -0.853025, 0.000000, -1.000000, -1.000000, -1.000000, 496 -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -0.989926, -1.000000, -1.000000, 497 -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -0.834902, -1.000000, -1.000000, 498 -0.942985, -1.000000, -1.000000, 0.000000, -1.000000, -1.000000, -1.000000, -1.000000, 499 -1.000000, -1.000000, -0.990081, -1.000000, -0.990456, -0.814654, -1.000000, -1.000000, 500 -1.000000, -1.000000, 0.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, 501 -0.968021, -1.000000, -1.000000, 0.000000, -1.000000, -1.000000, -0.993967, -0.957540, 502 -0.894533, -0.958363, -1.000000, -1.000000, -1.000000, -0.988915, -1.000000, -1.000000, 503 -1.000000, -1.000000, -1.000000, -1.000000, -0.985367, -1.000000, -0.972040, -1.000000, 504 -1.000000, -1.000000, 0.000000, -1.000000, -0.882278, -1.000000, -1.000000, -1.000000, 505 -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, 506 -1.000000, -0.962575, -0.976843, -0.998926, -1.000000, -0.914090, 0.000000, -0.957808, 507 -1.000000, -1.000000, -1.000000, 0.000000, -0.902593, -1.000000, -1.000000, -1.000000, 508 -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -0.975404, 509 -1.000000, 0.000000, -0.984627, -1.000000, -0.969547, -0.851295, -1.000000, -0.988146, 510 -1.000000, 0.000000, -1.000000, -0.993753, -0.861851, -1.000000, -0.980836, -0.979644, 511 -1.000000, -1.000000, -1.000000, -0.995401, -1.000000, -1.000000, -1.000000, -1.000000, 512 -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, 513 0.000000, -1.000000, -0.990123, -0.944934, -1.000000, 0.000000, -1.000000, -0.952198, 514 -1.000000, -1.000000, -0.960814, -1.000000, -1.000000, -1.000000, -0.956806, -1.000000, 515 0.000000, -0.991778, -1.000000, -1.000000, -1.000000, -1.000000, 0.000000, -1.000000, 516 -0.977640, -1.000000, -1.000000, 0.000000, -1.000000, -0.977630, -1.000000, -0.974242, 517 -1.000000, -1.000000, -0.940085, -0.930729, -1.000000, -1.000000, 0.000000, -1.000000, 518 -1.000000, -0.933695, -1.000000, -0.932306, -1.000000, -1.000000, -1.000000, -0.836774, 519 -0.931762, -0.926990, -0.861895, -1.000000, -0.922505, -1.000000, -0.956420, -0.998768, 520 -0.974626, -0.964573, -1.000000, -0.933995, -1.000000, -0.995117, -1.000000, -1.000000, 521 0.000000, 0.000000, -1.000000, -0.955537, -0.996360, -0.988015, -1.000000, -1.000000, 522 -0.963953, -0.920429, -0.955252, -0.950946, -1.000000, -1.000000, -1.000000, -0.979526, 523 -1.000000, -1.000000, -0.997193, -1.000000, -1.000000, 0.000000, -1.000000, -1.000000, 524 -1.000000, -0.893445, -1.000000, -1.000000, -0.997704, -1.000000, -1.000000, -0.952295, 525 -1.000000, 0.000000, -0.928042, -1.000000, -1.000000, -0.994029, -0.919350, -1.000000, 526 -1.000000, -1.000000, -1.000000, -0.958966, -0.806458, -0.903843, -1.000000, -1.000000, 527 -1.000000, -1.000000, -1.000000, -1.000000, 0.000000, -0.989002, 0.000000, -0.999874, 528 -1.000000, 0.000000, -1.000000, 0.000000, -0.923556, -0.906242, -0.923497, -0.997873, 529 -1.000000, -1.000000, 0.000000, -0.960376, -0.998760, -1.000000, 0.000000, -1.000000, 530 -0.852141, -1.000000, -0.957442, -0.942000, -1.000000, -1.000000, -1.000000, -1.000000, 531 -1.000000, -1.000000, -0.996748, -0.997676, -0.976159, -0.951572, -1.000000, -0.993083, 532 -0.715375, -0.997984, -1.000000, -0.962484, -0.996733, -1.000000, -1.000000, -0.953423, 533 -1.000000, -0.882232, -1.000000, -1.000000, -0.944493, -1.000000, -0.979617, -1.000000, 534 -0.990002, -1.000000, -0.844745, -0.945080, -1.000000, -1.000000, -0.904816, -1.000000, 535 -0.986999, -1.000000, -0.854941, -1.000000, -0.946096, -0.977678, -1.000000, -0.955933, 536 -0.979545, -1.000000, -1.000000, -0.863616, -0.973953, -0.996599, -0.990304, -0.978263, 537 -1.000000, -0.967798, -0.912566, 0.000000, -1.000000, -1.000000, -0.990321, -0.995921, 538 -1.000000, -1.000000, -1.000000, -0.927030, -0.886393, -0.987297, -1.000000, -1.000000, 539 -0.987206, -0.978084, -1.000000, -0.923876, -0.957539, -0.991587, -0.819295, -1.000000, 540 -0.985077, -1.000000, 0.000000, -1.000000, -1.000000, -0.822353, -1.000000, -1.000000, 541 -0.987783, -1.000000, -0.909520, -1.000000, -0.932334, -0.991847, -1.000000, -0.885318, 542 -0.945695, -0.977144, -0.989444, -0.887085, -0.891662, -0.894193, -1.000000, 0.000000, 543 -1.000000, -0.917484, -1.000000, -0.892801, -1.000000, -0.963580, -0.869279, -0.965420, 544 -0.906966, -0.929646, -0.981315, -1.000000, -1.000000, -0.749674, -1.000000, -0.886804, 545 -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -0.970826, -0.909766, 546 -1.000000, -0.910406, -0.983636, -1.000000, -0.961209, -0.935273, -1.000000, -0.989806, 547 0.000000, -0.981563, -0.989701, -0.915626, -0.997493, -0.981429, -1.000000, -0.964583, 548 -1.000000, -0.930216, -0.737797, -1.000000, -0.944314, -0.999998, -0.999611, -0.945788, 549 -0.773886, -0.848979, -0.980186, -1.000000, -1.000000, 0.000000, -0.951392, -0.993398, 550 -0.931889, -0.991680, -0.959021, -0.904240, -1.000000, -0.983561, -0.821324, 0.000000, 551 0.000000, -1.000000, -0.925782, -0.841267, -1.000000, -0.907313, -1.000000, -0.990704, 552 -1.000000, -1.000000, -0.936372, -0.885059 553 }; 554 489 555 int main (void) 490 556 { 491 557 plan_tests(21); 492 558 493 // diag("psStats Tests with sample SDSS data from RHL and Megacam from EAM");494 // diag("this file does not yet define a specific test"); 495 // diag("the fitted mean is currently wrong for these two data sets"); 496 497 { 559 // float **yraw = {yraw_01, yraw_02, yraw_03, yraw_04, NULL}; 560 561 if (1) { 562 diag("sample 1 : problem with integer-binned data driven to tiny sigma values"); 563 498 564 psMemId id = psMemGetId(); 499 565 500 // diag("sample 1 : problem with integer-binned data driven to tiny sigma values");501 566 psStats *stats = psStatsAlloc (PS_STAT_FITTED_MEAN | PS_STAT_FITTED_STDEV | 502 567 PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV | … … 505 570 PS_STAT_SAMPLE_STDEV | PS_STAT_USE_BINSIZE); 506 571 stats->binsize = 1.0; 507 508 572 509 573 // copy data in static array … … 533 597 534 598 535 {599 if (1) { 536 600 psMemId id = psMemGetId(); 537 601 538 //diag("sample 2");602 diag("sample 2"); 539 603 psStats *stats = psStatsAlloc (PS_STAT_FITTED_MEAN | PS_STAT_FITTED_STDEV | 540 604 PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV | … … 568 632 } 569 633 570 {634 if (1) { 571 635 psMemId id = psMemGetId(); 572 636 573 //diag("sample 3");637 diag("sample 3"); 574 638 psStats *stats = psStatsAlloc (PS_STAT_FITTED_MEAN | PS_STAT_FITTED_STDEV | 575 639 PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV | 576 640 PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV | 577 641 PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_MEDIAN | 578 PS_STAT_SAMPLE_STDEV | PS_STAT_USE_BINSIZE); 579 stats->binsize = 1.0; 580 642 PS_STAT_SAMPLE_STDEV); 581 643 582 644 // copy data in static array … … 605 667 } 606 668 669 { 670 psMemId id = psMemGetId(); 671 672 // psTraceSetLevel("psLib.math.vectorRobustStats", 6); 673 674 diag("sample 4"); 675 psStats *stats = psStatsAlloc (PS_STAT_FITTED_MEAN | PS_STAT_FITTED_STDEV | 676 PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV | 677 PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV | 678 PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_MEDIAN | 679 PS_STAT_SAMPLE_STDEV); 680 681 // copy data in static array 682 int nPts = sizeof(yraw_04) / sizeof (float); 683 psVector *y = psVectorAlloc (nPts, PS_TYPE_F32); 684 for (int i = 0; i < y->n; i++) { 685 y->data.F32[i] = yraw_04[i]; 686 } 687 688 psVectorStats (stats, y, NULL, NULL, 1); 689 ok (1, "sample mean %f, stdev %f", stats->sampleMean, stats->sampleStdev); 690 ok (1, "sample median %f, stdev %f", stats->sampleMedian, stats->sampleStdev); 691 ok (1, "clipped mean %f, stdev %f", stats->clippedMean, stats->clippedStdev); 692 ok (1, "robust median %f, stdev %f", stats->robustMedian, stats->robustStdev); 693 ok (1, "fitted mean %f, stdev %f", stats->fittedMean, stats->fittedStdev); 694 psFree (stats); 695 696 stats = psStatsAlloc (PS_STAT_FITTED_MEAN_V2 | PS_STAT_FITTED_STDEV_V2 | PS_STAT_USE_BINSIZE); 697 stats->binsize = 1.0; 698 psVectorStats (stats, y, NULL, NULL, 1); 699 ok (1, "fitted mean v2 %f, stdev %f", stats->fittedMean, stats->fittedStdev); 700 psFree (stats); 701 702 psFree (y); 703 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 704 } 705 607 706 return exit_status(); 608 707 } 708 -
branches/czw_branch/20101203/psLib/test/types/tap_psMetadataConfigWrite.c
r17515 r30118 25 25 { 26 26 psMemId id = psMemGetId(); 27 ok( !psMetadataConfigWrite(NULL, "mdcfg.wrt" ),27 ok( !psMetadataConfigWrite(NULL, "mdcfg.wrt", NULL), 28 28 "return false for NULL metadata input."); 29 29 ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks"); … … 35 35 psMemId id = psMemGetId(); 36 36 psMetadata *md = psMetadataAlloc(); 37 ok( !psMetadataConfigWrite(md, NULL ),37 ok( !psMetadataConfigWrite(md, NULL, NULL), 38 38 "return false for NULL filename input."); 39 39 psFree(md); … … 46 46 psMemId id = psMemGetId(); 47 47 psMetadata *md = psMetadataAlloc(); 48 ok( !psMetadataConfigWrite(md, "." ),48 ok( !psMetadataConfigWrite(md, ".", NULL), 49 49 "return false for invalid filename input."); 50 50 psFree(md); … … 57 57 psMemId id = psMemGetId(); 58 58 psMetadata *md = psMetadataAlloc(); 59 ok(psMetadataConfigWrite(md, "mdcfg.wrt" ), "return false for empty metadata input.");59 ok(psMetadataConfigWrite(md, "mdcfg.wrt", NULL), "return false for empty metadata input."); 60 60 psFree(md); 61 61 ok(!psMemCheckLeaks(id, NULL, NULL, false), "no memory leaks"); … … 68 68 psMetadata *md = psMetadataAlloc(); 69 69 psMetadataAddBool(md, PS_LIST_TAIL, "item1-1", 0, "I am a boolean", true); 70 ok( psMetadataConfigWrite(md, "mdcfg.wrt" ),70 ok( psMetadataConfigWrite(md, "mdcfg.wrt", NULL), 71 71 "return true for valid inputs."); 72 72 char configTest[61]; -
branches/czw_branch/20101203/psModules/src/camera/pmFPAFlags.c
r15477 r30118 49 49 } 50 50 51 bool pmReadoutSetFileStatus(pmReadout *readout, bool status) 52 { 53 PS_ASSERT_PTR_NON_NULL(readout, false); 54 55 readout->file_exists = status; 56 return true; 57 } 58 59 bool pmFPAviewSetFileStatus (pmFPA *fpa, const pmFPAview *view, bool status) { 60 61 PS_ASSERT_PTR_NON_NULL(fpa, false); 62 PS_ASSERT_PTR_NON_NULL(view, false); 63 64 if (view->chip == -1) { 65 bool set = pmFPASetFileStatus (fpa, status); 66 return set; 67 } 68 69 if (view->chip >= fpa->chips->n) { 70 psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n); 71 return false; 72 } 73 pmChip *chip = fpa->chips->data[view->chip]; 74 75 if (view->cell == -1) { 76 bool set = pmChipSetFileStatus (chip, status); 77 return set; 78 } 79 80 if (view->cell >= chip->cells->n) { 81 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n); 82 return false; 83 } 84 pmCell *cell = chip->cells->data[view->cell]; 85 86 if (view->readout == -1) { 87 bool set = pmCellSetFileStatus (cell, status); 88 return set; 89 } 90 91 if (view->readout >= cell->readouts->n) { 92 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n); 93 return false; 94 } 95 pmReadout *readout = cell->readouts->data[view->readout]; 96 97 bool set = pmReadoutSetFileStatus (readout, status); 98 return set; 99 } 100 51 101 bool pmFPACheckFileStatus(const pmFPA *fpa) 52 102 { … … 125 175 for (int i = 0; i < cell->readouts->n; i++) { 126 176 pmReadout *readout = cell->readouts->data[i]; 127 readout->data_exists = status; 128 } 129 return true; 177 pmReadoutSetDataStatus(readout, status); 178 } 179 return true; 180 } 181 182 bool pmReadoutSetDataStatus (pmReadout *readout, bool status) 183 { 184 PS_ASSERT_PTR_NON_NULL(readout, false); 185 186 readout->data_exists = status; 187 return true; 188 } 189 190 bool pmFPAviewSetDataStatus (pmFPA *fpa, const pmFPAview *view, bool status) { 191 192 PS_ASSERT_PTR_NON_NULL(fpa, false); 193 PS_ASSERT_PTR_NON_NULL(view, false); 194 195 if (view->chip == -1) { 196 bool set = pmFPASetDataStatus (fpa, status); 197 return set; 198 } 199 200 if (view->chip >= fpa->chips->n) { 201 psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n); 202 return false; 203 } 204 pmChip *chip = fpa->chips->data[view->chip]; 205 206 if (view->cell == -1) { 207 bool set = pmChipSetDataStatus (chip, status); 208 return set; 209 } 210 211 if (view->cell >= chip->cells->n) { 212 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n); 213 return false; 214 } 215 pmCell *cell = chip->cells->data[view->cell]; 216 217 if (view->readout == -1) { 218 bool set = pmCellSetDataStatus (cell, status); 219 return set; 220 } 221 222 if (view->readout >= cell->readouts->n) { 223 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n); 224 return false; 225 } 226 pmReadout *readout = cell->readouts->data[view->readout]; 227 228 bool set = pmReadoutSetDataStatus (readout, status); 229 return set; 130 230 } 131 231 -
branches/czw_branch/20101203/psModules/src/camera/pmFPAFlags.h
r13190 r30118 34 34 ); 35 35 36 bool pmReadoutSetFileStatus(pmReadout *readout, bool status); 37 38 bool pmFPAviewSetFileStatus (pmFPA *fpa, const pmFPAview *view, bool status); 39 36 40 // Functions to check the file_exists flags 37 41 … … 65 69 ); 66 70 71 bool pmReadoutSetDataStatus (pmReadout *readout, bool status); 72 73 bool pmFPAviewSetDataStatus (pmFPA *fpa, const pmFPAview *view, bool status); 67 74 68 75 // Functions the check the data_exists flags -
branches/czw_branch/20101203/psModules/src/camera/pmFPAfile.c
r29833 r30118 36 36 return; 37 37 } 38 psTrace ("pmFPAfileFree", 5, "freeing %s % ld\n", file->name,(psU64)file->fits);38 psTrace ("pmFPAfileFree", 5, "freeing %s %p\n", file->name, file->fits); 39 39 psAssert(!fpaFileFreeStrict || file->fits == NULL, "File %s wasn't closed.", file->name); 40 40 -
branches/czw_branch/20101203/psModules/src/camera/pmFPAfileIO.c
r29833 r30118 135 135 PS_ASSERT_PTR_NON_NULL(view, false); 136 136 137 // an internal file should not be sent here (should not be left on config->files)138 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false);139 140 137 // skip the following states 141 138 if (file->state & PM_FPA_STATE_INACTIVE) { … … 143 140 return true; 144 141 } 142 143 // an active internal file should not be sent here (should not be left on config->files) 144 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 145 145 146 if (file->mode != PM_FPA_MODE_READ) { 146 147 psTrace("psModules.camera", 6, "skip read for %s, mode is not READ", file->name); … … 258 259 return true; 259 260 } 261 262 // an active internal file should not be returned to here 263 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 264 260 265 if (file->mode != PM_FPA_MODE_WRITE) { 261 266 psTrace("psModules.camera", 6, "skip create for non-write file %s", file->name); 262 267 return true; 263 268 } 264 265 // an internal file should not be returned to here266 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false);267 269 268 270 // get the current level … … 335 337 } 336 338 339 // an ACTIVE internal file should not be sent here 340 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 341 337 342 if (file->mode != PM_FPA_MODE_WRITE) { 338 343 psTrace("psModules.camera", 6, "skip write for %s, mode is not WRITE", file->name); 339 344 return true; 340 }341 342 // an internal file should not be returned to here343 if (file->mode == PM_FPA_MODE_INTERNAL) {344 psError(PS_ERR_IO, true, "File is mode PM_FPA_MODE_INTERNAL");345 return false;346 345 } 347 346 … … 523 522 PS_ASSERT_PTR_NON_NULL(view, false); 524 523 525 // an internal file should not be sent here (should not be left on config->files)526 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false);527 528 524 // skip the following states 529 525 if (file->state & PM_FPA_STATE_INACTIVE) { … … 531 527 return true; 532 528 } 529 533 530 if (file->state == PM_FPA_STATE_CLOSED) { 534 531 psTrace("psModules.camera", 6, "skip close for %s, files is closed", file->name); 535 532 return true; 536 533 } 534 535 // an active internal file should not be sent here (should not be left on config->files) 536 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 537 537 538 538 // is current level == open level? … … 596 596 PS_ASSERT_PTR_NON_NULL(view, false); 597 597 598 // an internal file should not be sent here (should not be left on config->files)599 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false);600 601 598 if (file->state & PM_FPA_STATE_INACTIVE) { 602 599 psTrace("psModules.camera", 6, "skip free for %s, files is inactive", file->name); 603 600 return true; 604 601 } 602 603 // an active internal file should not be sent here (should not be left on config->files) 604 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 605 605 606 606 // get the current level … … 746 746 } 747 747 748 // these are programming errors748 // an ACTIVE internal file should not be sent here 749 749 PS_ASSERT(file->mode != PM_FPA_MODE_NONE, false); 750 750 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); -
branches/czw_branch/20101203/psModules/src/concepts/pmConceptsAverage.c
r29603 r30118 136 136 return average; 137 137 } 138 float medianWithDropouts (psList *sources, char *name) { 139 140 bool status; 141 142 psListIterator *sourcesIter = psListIteratorAlloc(sources, PS_LIST_HEAD, false); // Iterator for sources 143 pmCell *cell = NULL; // Source cell from iteration 144 145 psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN); 146 psVector *values = psVectorAlloc(sources->n, PS_TYPE_F32); 147 int nvalues = 0; 148 while ((cell = psListGetAndIncrement(sourcesIter))) { 149 if (!cell) { 150 continue; 151 } 152 153 float value = psMetadataLookupF32(&status, cell->concepts, name); 154 if (!status) continue; 155 if (!isfinite(value)) continue; 156 157 values->data.F32[nvalues++] = value; 158 } 159 psFree (sourcesIter); 160 if (!nvalues) { 161 psWarning("no valid values found for %s\n", name); 162 psFree(values); 163 psFree(stats); 164 return INFINITY; 165 } 166 if (!(values = psVectorRealloc(values, nvalues))) { 167 psWarning("failed to reallocate values vector for %s\n", name); 168 psFree(stats); 169 return INFINITY; 170 } 171 if (!psVectorStats(stats, values, NULL, NULL, 0)) { 172 psWarning("psVectorStats failed for %s\n", name); 173 psFree(values); 174 psFree(stats); 175 return INFINITY; 176 } 177 178 psF32 median = psStatsGetValue(stats, PS_STAT_SAMPLE_MEDIAN); 179 180 psFree(values); 181 psFree(stats); 182 183 return median; 184 } 138 185 139 186 // Set a variety of concepts in a cell by averaging over several … … 145 192 PS_ASSERT_INT_POSITIVE(sources->n, false); 146 193 147 float saturation = INFINITY; // Saturation level148 194 float bad = -INFINITY; // Bad level 149 195 double time = 0.0; // Time of observation … … 158 204 float exposure = averageWithDropouts (sources, "CELL.EXPOSURE"); 159 205 float darktime = averageWithDropouts (sources, "CELL.DARKTIME"); 206 float saturation = medianWithDropouts(sources, "CELL.SATURATION"); 160 207 161 208 // other concepts are a bit more "special" … … 221 268 } 222 269 223 float cellSaturation = psMetadataLookupF32(NULL, cell->concepts, "CELL.SATURATION");224 if (cellSaturation > 10000) {225 // do not allow invalid values to polute this calculation226 // XXX really need to do this on the basis of the fraction of the cell that contributes..227 // if a cell is completely masked, it should not be included.228 if (cellSaturation < saturation) {229 saturation = cellSaturation;230 }231 }232 270 float cellBad = psMetadataLookupF32(NULL, cell->concepts, "CELL.BAD"); 233 271 if (cellBad > bad) { -
branches/czw_branch/20101203/psModules/src/config/pmConfigDump.c
r27147 r30118 150 150 } 151 151 152 if (!psMetadataConfigWrite(config->user, resolved)) { 152 // check for Metadata compression options: 153 char *compressMode = NULL; 154 bool status = false; 155 if (config->camera) { 156 compressMode = psMetadataLookupStr(&status, config->camera, "METADATA.COMPRESSION"); 157 } 158 159 if (!psMetadataConfigWrite(config->user, resolved, compressMode)) { 153 160 psError(psErrorCodeLast(), false, "Unable to dump configuration to %s", filename); 154 161 psFree(resolved); -
branches/czw_branch/20101203/psModules/src/detrend/pmNonLinear.c
r29833 r30118 332 332 return(0.0); 333 333 } 334 /* if (flux > correction_fluxes->data.F32[bin]) { */335 /* return(0.0); */336 /* } */337 334 338 335 for (int i = 0; i < correction_fluxes->n - 1; i++) { … … 347 344 } 348 345 349 /* PS_BIN_FOR_VALUE(bin,correction_fluxes,flux); */350 /* if ((bin < 0)||(bin > correction_fluxes->n)) { */351 /* return(1.0); */352 /* } */353 354 /* PS_BIN_INTERPOLATE(result,correction_fluxes,correction_factors,bin,flux); */355 346 if (!isfinite(result)) { 356 347 result = 0.0; 357 348 } 358 /* if (result <= 0) { */359 /* result = 1.0; */360 /* } */361 349 return(result); 362 350 } … … 372 360 return(0.0); 373 361 } 374 /* if (flux > correction_fluxes->data.F32[bin]) { */375 /* return(0.0); */376 /* } */377 362 378 363 for (int i = 0; i < correction_fluxes->n - 1; i++) { … … 389 374 } 390 375 391 /* PS_BIN_FOR_VALUE(bin,correction_fluxes,flux); */392 /* if ((bin < 0)||(bin > correction_fluxes->n)) { */393 /* return(1.0); */394 /* } */395 396 /* PS_BIN_INTERPOLATE(result,correction_fluxes,correction_factors,bin,flux); */397 376 if (!isfinite(result)) { 398 377 result = 0.0; 399 378 } 400 /* if (result <= 0) { */401 /* result = 1.0; */402 /* } */403 379 return(result); 404 380 } 405 406 407 -
branches/czw_branch/20101203/psModules/src/objects
-
Property svn:mergeinfo
set to
/branches/eam_branches/ipp-20101103/psModules/src/objects merged eligible /branches/eam_branches/ipp-20101205/psModules/src/objects merged eligible /trunk/psModules/src/objects merged eligible
-
Property svn:mergeinfo
set to
-
branches/czw_branch/20101203/psModules/src/objects/pmPSF_IO.c
r29004 r30118 62 62 #include "pmSourceIO.h" 63 63 64 bool pmPSFmodelReadPSFClump (psMetadata *analysis, psMetadata *header); 65 64 66 bool pmPSFmodelCheckDataStatusForView (const pmFPAview *view, const pmFPAfile *file) 65 67 { … … 851 853 852 854 // read the psf clump data for each region 855 status = false; 853 856 if (roAnalysis) { 854 int nRegions = psMetadataLookupS32 (&status, header, "PSF_CLN"); 855 if (!status) { 856 // read old-style psf clump data 857 858 char regionName[64]; 859 snprintf (regionName, 64, "PSF.CLUMP.REGION.000"); 860 psMetadataAddS32 (roAnalysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS", PS_META_REPLACE, "psf clump regions", 1); 861 862 psMetadata *regionMD = psMetadataLookupPtr (&status, roAnalysis, regionName); 863 if (!regionMD) { 864 regionMD = psMetadataAlloc(); 865 psMetadataAddMetadata (roAnalysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD); 866 psFree (regionMD); 867 } 868 869 // psf clump data 870 pmPSFClump psfClump; 871 872 psfClump.X = psMetadataLookupF32 (&status, header, "PSF_CLX" ); assert(status); 873 psfClump.Y = psMetadataLookupF32 (&status, header, "PSF_CLY" ); assert(status); 874 psfClump.dX = psMetadataLookupF32 (&status, header, "PSF_CLDX"); assert(status); 875 psfClump.dY = psMetadataLookupF32 (&status, header, "PSF_CLDY"); assert(status); 876 877 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X", PS_META_REPLACE, "psf clump center", psfClump.X); 878 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y", PS_META_REPLACE, "psf clump center", psfClump.Y); 879 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DX", PS_META_REPLACE, "psf clump center", psfClump.dX); 880 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY); 881 } else { 882 psMetadataAddS32 (roAnalysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS", PS_META_REPLACE, "psf clump regions", nRegions); 883 884 for (int i = 0; i < nRegions; i++) { 885 char key[10]; 886 char regionName[64]; 887 snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", i); 888 889 psMetadata *regionMD = psMetadataLookupPtr (&status, roAnalysis, regionName); 890 if (!regionMD) { 891 regionMD = psMetadataAlloc(); 892 psMetadataAddMetadata (roAnalysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD); 893 psFree (regionMD); 894 } 895 896 // psf clump data 897 pmPSFClump psfClump; 898 899 snprintf (key, 9, "CLX_%03d", i); 900 psfClump.X = psMetadataLookupF32 (&status, header, key); assert(status); 901 snprintf (key, 9, "CLY_%03d", i); 902 psfClump.Y = psMetadataLookupF32 (&status, header, key); assert(status); 903 snprintf (key, 9, "CLDX_%03d", i); 904 psfClump.dX = psMetadataLookupF32 (&status, header, key); assert(status); 905 snprintf (key, 9, "CLDY_%03d", i); 906 psfClump.dY = psMetadataLookupF32 (&status, header, key); assert(status); 907 908 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X", PS_META_REPLACE, "psf clump center", psfClump.X); 909 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y", PS_META_REPLACE, "psf clump center", psfClump.Y); 910 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DX", PS_META_REPLACE, "psf clump center", psfClump.dX); 911 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY); 912 } 913 } 857 status = pmPSFmodelReadPSFClump (roAnalysis, header); 858 if (!status) { 859 psMetadataAddS32 (roAnalysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS", PS_META_REPLACE, "psf clump regions", 0); 860 } 861 } 862 if (!roAnalysis || !status) { 863 psWarning ("no PSF.CLUMP data available for PSF model"); 914 864 } 915 865 … … 1123 1073 } 1124 1074 1125 // XXX pmPSF to/from Metadata functions were defined for 1.22 and earlier, but were dropped 1075 bool pmPSFmodelReadPSFClump (psMetadata *analysis, psMetadata *header) { 1076 1077 bool status = false;; 1078 1079 int nRegions = psMetadataLookupS32 (&status, header, "PSF_CLN"); 1080 if (!status) { 1081 // read old-style psf clump data 1082 1083 char regionName[64]; 1084 snprintf (regionName, 64, "PSF.CLUMP.REGION.000"); 1085 psMetadata *regionMD = psMetadataLookupPtr (&status, analysis, regionName); 1086 1087 if (!regionMD) { 1088 regionMD = psMetadataAlloc(); 1089 psMetadataAddMetadata (analysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD); 1090 psFree (regionMD); 1091 } 1092 1093 // psf clump data 1094 pmPSFClump psfClump; 1095 psfClump.X = psMetadataLookupF32 (&status, header, "PSF_CLX" ); if (!status) return false; 1096 psfClump.Y = psMetadataLookupF32 (&status, header, "PSF_CLY" ); if (!status) return false; 1097 psfClump.dX = psMetadataLookupF32 (&status, header, "PSF_CLDX"); if (!status) return false; 1098 psfClump.dY = psMetadataLookupF32 (&status, header, "PSF_CLDY"); if (!status) return false; 1099 1100 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X", PS_META_REPLACE, "psf clump center", psfClump.X); 1101 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y", PS_META_REPLACE, "psf clump center", psfClump.Y); 1102 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DX", PS_META_REPLACE, "psf clump center", psfClump.dX); 1103 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY); 1104 psMetadataAddS32 (analysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS", PS_META_REPLACE, "psf clump regions", 1); 1105 } else { 1106 for (int i = 0; i < nRegions; i++) { 1107 char key[10]; 1108 char regionName[64]; 1109 snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", i); 1110 1111 psMetadata *regionMD = psMetadataLookupPtr (&status, analysis, regionName); 1112 if (!regionMD) { 1113 regionMD = psMetadataAlloc(); 1114 psMetadataAddMetadata (analysis, PS_LIST_TAIL, regionName, PS_META_REPLACE, "psf clump region", regionMD); 1115 psFree (regionMD); 1116 } 1117 1118 // psf clump data 1119 pmPSFClump psfClump; 1120 1121 snprintf (key, 9, "CLX_%03d", i); 1122 psfClump.X = psMetadataLookupF32 (&status, header, key); if (!status) return false; 1123 snprintf (key, 9, "CLY_%03d", i); 1124 psfClump.Y = psMetadataLookupF32 (&status, header, key); if (!status) return false; 1125 snprintf (key, 9, "CLDX_%03d", i); 1126 psfClump.dX = psMetadataLookupF32 (&status, header, key); if (!status) return false; 1127 snprintf (key, 9, "CLDY_%03d", i); 1128 psfClump.dY = psMetadataLookupF32 (&status, header, key); if (!status) return false; 1129 1130 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X", PS_META_REPLACE, "psf clump center", psfClump.X); 1131 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.Y", PS_META_REPLACE, "psf clump center", psfClump.Y); 1132 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DX", PS_META_REPLACE, "psf clump center", psfClump.dX); 1133 psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.DY", PS_META_REPLACE, "psf clump center", psfClump.dY); 1134 } 1135 psMetadataAddS32 (analysis, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS", PS_META_REPLACE, "psf clump regions", nRegions); 1136 } 1137 return true; 1138 } -
branches/czw_branch/20101203/psModules/src/objects/pmPSFtry.h
r25754 r30118 100 100 bool pmPSFtryFitEXT (pmPSFtry *psfTry, pmPSFOptions *options, psImageMaskType maskVal, psImageMaskType markVal); 101 101 102 bool pmPSFtryMakePSF ( pmPSFtry *psfTry);102 bool pmPSFtryMakePSF (bool *pGoodFit, pmPSFtry *psfTry); 103 103 104 104 bool pmPSFtryFitPSF (pmPSFtry *psfTry, pmPSFOptions *options, psImageMaskType maskVal, psImageMaskType markVal); … … 123 123 ); 124 124 125 bool pmPSFFitShapeParams ( pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask);125 bool pmPSFFitShapeParams (bool *pGoodFit, pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask); 126 126 127 127 float psVectorSystematicError (psVector *residuals, psVector *errors, float clipFraction); -
branches/czw_branch/20101203/psModules/src/objects/pmPSFtryMakePSF.c
r29004 r30118 50 50 Note: some of the array entries may be NULL (failed fits); ignore them. 51 51 *****************************************************************************/ 52 bool pmPSFtryMakePSF ( pmPSFtry *psfTry)52 bool pmPSFtryMakePSF (bool *pGoodFit, pmPSFtry *psfTry) 53 53 { 54 54 PS_ASSERT_PTR_NON_NULL(psfTry, false); … … 74 74 75 75 // fit the shape parameters (SXX, SYY, SXY) as a function of position 76 if (!pmPSFFitShapeParams (p sf, psfTry->sources, x, y, srcMask)) {76 if (!pmPSFFitShapeParams (pGoodFit, psf, psfTry->sources, x, y, srcMask)) { 77 77 psFree(x); 78 78 psFree(y); 79 79 return false; 80 } 81 if (!*pGoodFit) { 82 psWarning ("poor fit to PSF shape parameters for trend order %d, %d, skipping\n", psf->trendNx, psf->trendNy); 83 psFree(x); 84 psFree(y); 85 return true; 80 86 } 81 87 … … 115 121 // the mask is carried from previous steps and updated with this operation 116 122 // the weight is either the flux error or NULL, depending on 'psf->poissonErrorParams' 117 if (!pmTrend2DFit ( trend, srcMask, 0xff, x, y, z, NULL)) {123 if (!pmTrend2DFit (pGoodFit, trend, srcMask, 0xff, x, y, z, NULL)) { 118 124 psError(PS_ERR_UNKNOWN, false, "failed to build psf model for parameter %d", i); 119 125 psFree(x); … … 122 128 return false; 123 129 } 130 if (!*pGoodFit) { 131 // if we do not get a good fit (but do not actually hit an error), 132 // tell the calling program to try something else 133 psWarning ("poor fit to PSF parameter %d for trend order %d, %d, skipping\n", i, psf->trendNx, psf->trendNy); 134 psFree(x); 135 psFree(y); 136 psFree(z); 137 return true; 138 } 124 139 if (trend->mode == PM_TREND_MAP) { 125 140 // p_psImagePrint (2, trend->map->map, "param N Before"); // XXX TEST: … … 139 154 140 155 pmModel *modelPSF = pmModelFromPSF (source->modelEXT, psf); 156 if (!modelPSF) { 157 fprintf(f, "modelPSF is NULL\n"); 158 break; 159 } 160 if (!source->modelEXT) { 161 fprintf(f, "source->modelEXT is NULL\n"); 162 break; 163 } 141 164 142 165 fprintf (f, "%f %f : ", source->modelEXT->params->data.F32[PM_PAR_XPOS], source->modelEXT->params->data.F32[PM_PAR_YPOS]); … … 163 186 164 187 // fit the shape parameters using the supplied order (pmPSF->trendNx,trendNy) 165 bool pmPSFFitShapeParams ( pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask) {188 bool pmPSFFitShapeParams (bool *pGoodFit, pmPSF *psf, psArray *sources, psVector *x, psVector *y, psVector *srcMask) { 166 189 167 190 // we are doing a robust fit. after each pass, we drop points which are more deviant than … … 219 242 trend = psf->params->data[PM_PAR_E0]; 220 243 trend->stats->clipIter = 1; // in allocation, this value is set to the value of nIter, but we should use 1 here 221 status &= pmTrend2DFit (trend, srcMask, 0xff, x, y, e0, NULL); 244 status &= pmTrend2DFit (pGoodFit, trend, srcMask, 0xff, x, y, e0, NULL); 245 if (!*pGoodFit) { 246 psFree (e0); 247 psFree (e1); 248 psFree (e2); 249 return true; 250 } 222 251 mean = psStatsGetValue (trend->stats, meanOption); 223 252 stdev = psStatsGetValue (trend->stats, stdevOption); … … 228 257 trend = psf->params->data[PM_PAR_E1]; 229 258 trend->stats->clipIter = 1; // in allocation, this value is set to the value of nIter, but we should use 1 here 230 status &= pmTrend2DFit (trend, srcMask, 0xff, x, y, e1, NULL); 259 status &= pmTrend2DFit (pGoodFit, trend, srcMask, 0xff, x, y, e1, NULL); 260 if (!*pGoodFit) { 261 psFree (e0); 262 psFree (e1); 263 psFree (e2); 264 return true; 265 } 231 266 mean = psStatsGetValue (trend->stats, meanOption); 232 267 stdev = psStatsGetValue (trend->stats, stdevOption); … … 237 272 trend = psf->params->data[PM_PAR_E2]; 238 273 trend->stats->clipIter = 1; // in allocation, this value is set to the value of nIter, but we should use 1 here 239 status &= pmTrend2DFit (trend, srcMask, 0xff, x, y, e2, NULL); 274 status &= pmTrend2DFit (pGoodFit, trend, srcMask, 0xff, x, y, e2, NULL); 275 if (!*pGoodFit) { 276 psFree (e0); 277 psFree (e1); 278 psFree (e2); 279 return true; 280 } 240 281 mean = psStatsGetValue (trend->stats, meanOption); 241 282 stdev = psStatsGetValue (trend->stats, stdevOption); … … 246 287 if (!status) { 247 288 psError (PS_ERR_UNKNOWN, true, "failed to fit PSF shape params"); 289 psFree (e0); 290 psFree (e1); 291 psFree (e2); 248 292 return false; 249 293 } -
branches/czw_branch/20101203/psModules/src/objects/pmPSFtryModel.c
r29004 r30118 136 136 137 137 // stage 2: construct a psf (pmPSF) from this collection of model fits, including the 2D variation 138 if (!pmPSFtryMakePSF (psfTry)) { 138 bool goodFit = false; 139 if (!pmPSFtryMakePSF (&goodFit, psfTry)) { 139 140 psError(PS_ERR_UNKNOWN, false, "failed to construct a psf model from collection of sources"); 140 141 psFree(psfTry); 141 142 return NULL; 142 143 } 144 if (!goodFit) { 145 psWarning ("poor psf fit for order %d, skipping\n", i); 146 continue; 147 } 143 148 144 149 // stage 3: refit with fixed shape parameters, measure pmPSFtry->metric … … 169 174 } 170 175 psFree (srcMask); 176 177 if (!minPSF) { 178 psError(PS_ERR_UNKNOWN, false, "failed to construct a valid psf model from the sources"); 179 psFree(psfTry); 180 return NULL; 181 } 171 182 172 183 // keep the ones matching the min systematic error: -
branches/czw_branch/20101203/psModules/src/objects/pmSource.c
r29546 r30118 189 189 // pixels. Modifying these pixels (ie, subtracting the model) will affect the pixels seen 190 190 // by all copies. 191 source->pixels = psImageCopyView(NULL, in->pixels);192 source->variance = psImageCopyView(NULL, in->variance);191 source->pixels = in->pixels ? psImageCopyView(NULL, in->pixels) : NULL; 192 source->variance = in->variance ? psImageCopyView(NULL, in->variance) : NULL; 193 193 source->maskView = in->maskView ? psImageCopyView(NULL, in->maskView) : NULL; 194 194 -
branches/czw_branch/20101203/psModules/src/objects/pmSourcePhotometry.c
r29546 r30118 107 107 // XXX handle negative flux, low-significance 108 108 if (model->dparams->data.F32[PM_PAR_I0] > 0) { 109 SN = model->params->data.F32[PM_PAR_I0] / model->dparams->data.F32[PM_PAR_I0];109 SN = fabs(model->params->data.F32[PM_PAR_I0] / model->dparams->data.F32[PM_PAR_I0]); 110 110 source->errMag = 1.0 / SN; 111 111 } else { … … 331 331 } 332 332 if (apFluxOut) *apFluxOut = apFlux; 333 if (apFluxErr) *apFluxErr = sqrt( apFluxVar);333 if (apFluxErr) *apFluxErr = sqrt(fabs(apFluxVar)); 334 334 335 335 if (apFlux <= 0) { -
branches/czw_branch/20101203/psModules/src/objects/pmTrend2D.c
r25754 r30118 179 179 } 180 180 181 bool pmTrend2DFit( pmTrend2D *trend, psVector *mask, psVectorMaskType maskVal, const psVector *x,181 bool pmTrend2DFit(bool *pGoodFit, pmTrend2D *trend, psVector *mask, psVectorMaskType maskVal, const psVector *x, 182 182 const psVector *y, const psVector *f, const psVector *df) 183 183 { … … 188 188 PS_ASSERT_VECTOR_NON_NULL(f, false); 189 189 190 bool status; 190 bool status = false; 191 *pGoodFit = false; 192 // for the psImageMap fit, it is possible to have valid data but no valid solution for 193 // example, an isolated cell may not be reached from other cells, making the solution 194 // degenerate. psImageMapFit should probably handle this case, but until it does, we allow 195 // it to fail on the result, but not yield an error (pGoodFit = false). 196 // psVectorClipFitPolynomial2D can not fail in this way (really?), so pGoodFit is always 197 // true 198 191 199 switch (trend->mode) { 192 200 case PM_TREND_POLY_ORD: … … 196 204 // of points in the image, and potentially based on the fractional range of the 197 205 // data? 206 *pGoodFit = true; 198 207 break; 199 208 … … 201 210 // XXX supply fraction from trend elements 202 211 // XXX need to add the API which adjusts the scale 203 status = psImageMapClipFit( trend->map, trend->stats, mask, maskVal, x, y, f, df);212 status = psImageMapClipFit(pGoodFit, trend->map, trend->stats, mask, maskVal, x, y, f, df); 204 213 break; 205 214 -
branches/czw_branch/20101203/psModules/src/objects/pmTrend2D.h
r29004 r30118 76 76 ); 77 77 78 bool pmTrend2DFit(pmTrend2D *trend, 78 bool pmTrend2DFit(bool *goodFit, 79 pmTrend2D *trend, 79 80 psVector *mask, // Warning: mask is modified! 80 81 psVectorMaskType maskVal, -
branches/czw_branch/20101203/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20101103/psphot (added) merged: 29660,29824-29825,29904,29914,29918,29920
- Property svn:mergeinfo changed
-
branches/czw_branch/20101203/psphot/src/Makefile.am
r29004 r30118 103 103 psphotCleanup.c 104 104 105 106 107 # # psphot analysis of the detectability of specified positions108 # psphotDetect_SOURCES = \109 # psphotDetect.c \110 # psphotDetectArguments.c \111 # psphotDetectParseCamera.c \112 # psphotDetectImageLoop.c \113 # psphotDetectReadout.c \114 # psphotMosaicChip.c \115 # psphotCleanup.c116 117 105 # psphotTest_SOURCES = \ 118 106 # psphotTest.c … … 137 125 psphotReadoutFindPSF.c \ 138 126 psphotReadoutKnownSources.c \ 127 psphotReadoutForcedKnownSources.c \ 139 128 psphotReadoutMinimal.c \ 140 129 psphotModelBackground.c \ -
branches/czw_branch/20101203/psphot/src/psphot.h
r29608 r30118 24 24 bool psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe); 25 25 bool psphotInit (void); 26 bool psphotReadout (pmConfig *config, const pmFPAview *view); 27 bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, psArray *inSources); 28 bool psphotReadoutKnownSources(pmConfig *config, const pmFPAview *view, psArray *inSources); 29 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view); 26 bool psphotReadout (pmConfig *config, const pmFPAview *view, const char *filerule); 27 bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources); 28 bool psphotReadoutKnownSources(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources); 29 bool psphotReadoutForcedKnownSources(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources); 30 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view, const char *filerule); 30 31 31 32 bool psphotReadoutCleanup (pmConfig *config, const pmFPAview *view, const char *filerule); … … 219 220 bool psphotFitSummary (void); 220 221 221 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view );222 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view, const char *filerule); 222 223 bool psphotLoadPSFReadout (pmConfig *config, const pmFPAview *view, const char *outFilename, const char *inFilename, int index); 223 224 … … 304 305 pmConfig *psphotForcedArguments(int argc, char **argv); 305 306 bool psphotForcedImageLoop (pmConfig *config); 306 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view );307 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view, const char *filerule); 307 308 308 309 pmConfig *psphotMakePSFArguments(int argc, char **argv); 309 310 bool psphotMakePSFImageLoop (pmConfig *config); 310 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view); 311 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view, const char *filerule); 312 313 int psphotFileruleCount(const pmConfig *config, const char *filerule); 314 315 bool psphotAddKnownSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources); 316 311 317 312 318 /**** psphotStack prototypes ****/ … … 432 438 pmModel *psphotFitPCM (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal, int psfSize); 433 439 440 bool psphotCleanInputs (pmConfig *config, const pmFPAview *view, const char *filerule); 441 434 442 #endif -
branches/czw_branch/20101203/psphot/src/psphotAddNoise.c
r29004 r30118 18 18 psAssert (recipe, "missing recipe?"); 19 19 20 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 21 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 20 int num = psphotFileruleCount(config, filerule); 22 21 23 22 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotApResid.c
- Property svn:mergeinfo set to
r29548 r30118 13 13 psAssert (recipe, "missing recipe?"); 14 14 15 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 16 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 15 int num = psphotFileruleCount(config, filerule); 17 16 18 17 // skip the chisq image (optionally?) … … 72 71 if (!measureAptrend) { 73 72 // save nan values since these were not calculated 74 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_DATA_F32 |PS_META_REPLACE, "aperture residual", NAN);75 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_DATA_F32 |PS_META_REPLACE, "ap residual scatter", NAN);76 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_DATA_S32 |PS_META_REPLACE, "number of apresid stars", 0);77 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_DATA_F32 |PS_META_REPLACE, "aperture loss (mag)", NAN);73 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_META_REPLACE, "aperture residual", NAN); 74 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_META_REPLACE, "ap residual scatter", NAN); 75 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_META_REPLACE, "number of apresid stars", 0); 76 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_META_REPLACE, "aperture loss (mag)", NAN); 78 77 return true; 79 78 } … … 325 324 326 325 // save results for later output 327 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_DATA_F32 |PS_META_REPLACE, "aperture residual", psf->ApResid);328 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_DATA_F32 |PS_META_REPLACE, "ap residual scatter", psf->dApResid);329 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_DATA_S32 |PS_META_REPLACE, "number of apresid stars", psf->nApResid);330 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_DATA_F32 |PS_META_REPLACE, "aperture loss (mag)", psf->growth ? psf->growth->apLoss : NAN);326 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_META_REPLACE, "aperture residual", psf->ApResid); 327 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_META_REPLACE, "ap residual scatter", psf->dApResid); 328 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_META_REPLACE, "number of apresid stars", psf->nApResid); 329 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_META_REPLACE, "aperture loss (mag)", psf->growth ? psf->growth->apLoss : NAN); 331 330 332 331 psLogMsg ("psphot.apresid", PS_LOG_DETAIL, "aperture residual: %f +/- %f\n", psf->ApResid, psf->dApResid); … … 345 344 escape: 346 345 // save nan values since these were not calculated 347 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_DATA_F32 |PS_META_REPLACE, "aperture residual", NAN);348 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_DATA_F32 |PS_META_REPLACE, "ap residual scatter", NAN);349 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_DATA_S32 |PS_META_REPLACE, "number of apresid stars", 0);350 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_DATA_F32 |PS_META_REPLACE, "aperture loss (mag)", NAN);346 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_META_REPLACE, "aperture residual", NAN); 347 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_META_REPLACE, "ap residual scatter", NAN); 348 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_META_REPLACE, "number of apresid stars", 0); 349 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_META_REPLACE, "aperture loss (mag)", NAN); 351 350 352 351 psFree (xPos); … … 379 378 380 379 // XXX test for errors here 381 if (!pmTrend2DFit (apTrend, mask, 0xff, xPos, yPos, apResid, dMagSoft)) { 380 bool goodFit = false; 381 if (!pmTrend2DFit (&goodFit, apTrend, mask, 0xff, xPos, yPos, apResid, dMagSoft)) { 382 // XXX this is probably a real error, and I should exit 383 psWarning("Failed to fit trend for %d x %d map", Nx, Ny); 384 psFree (apTrend); 385 return NULL; 386 } 387 if (!goodFit) { 382 388 psWarning("Failed to fit trend for %d x %d map", Nx, Ny); 383 389 psFree (apTrend); -
branches/czw_branch/20101203/psphot/src/psphotBasicDeblend.c
r28013 r30118 4 4 bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 bool status = true; 7 8 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 9 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 6 int num = psphotFileruleCount(config, filerule); 10 7 11 8 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotBlendFit.c
r29017 r30118 10 10 psAssert (recipe, "missing recipe?"); 11 11 12 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 13 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 12 int num = psphotFileruleCount(config, filerule); 14 13 15 14 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotChoosePSF.c
r29004 r30118 10 10 psAssert (recipe, "missing recipe?"); 11 11 12 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 13 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 12 int num = psphotFileruleCount(config, filerule); 14 13 15 14 // skip the chisq image (optionally?) … … 250 249 if (!try) { 251 250 // No big deal --- we'll try another model 252 psErrorClear(); 251 if (i < modelNames->n - 1) { 252 psErrorClear(); 253 } 253 254 continue; 254 255 } -
branches/czw_branch/20101203/psphot/src/psphotDeblendSatstars.c
r29606 r30118 4 4 bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 bool status = true; 7 8 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 9 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 6 int num = psphotFileruleCount(config, filerule); 10 7 11 8 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotEfficiency.c
r29902 r30118 164 164 psAssert (recipe, "missing recipe?"); 165 165 166 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 167 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 166 int num = psphotFileruleCount(config, filerule); 168 167 169 168 // skip the chisq image (optionally?) -
branches/czw_branch/20101203/psphot/src/psphotExtendedSourceAnalysis.c
r29027 r30118 22 22 } 23 23 24 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 25 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 24 int num = psphotFileruleCount(config, filerule); 26 25 27 26 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotExtendedSourceAnalysisByObject.c
r29548 r30118 41 41 42 42 // number of images used to define sources 43 int nImages = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 44 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 43 int nImages = psphotFileruleCount(config, filerule); 45 44 46 45 // generate look-up arrays for readouts -
branches/czw_branch/20101203/psphot/src/psphotExtendedSourceFits.c
r29548 r30118 16 16 } 17 17 18 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 19 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 18 int num = psphotFileruleCount(config, filerule); 20 19 21 20 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotFindDetections.c
r29548 r30118 12 12 psAssert (recipe, "missing recipe?"); 13 13 14 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 15 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 14 int num = psphotFileruleCount(config, filerule); 16 15 17 16 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotFitSourcesLinear.c
r29548 r30118 21 21 assert (recipe); 22 22 23 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 24 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 23 int num = psphotFileruleCount(config, filerule); 25 24 26 25 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotForcedImageLoop.c
r25981 r30118 84 84 85 85 // run the actual photometry analysis on this chip/cell/readout 86 if (!psphotForcedReadout (config, view )) {86 if (!psphotForcedReadout (config, view, "PSPHOT.INPUT")) { 87 87 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 88 88 psFree (view); -
branches/czw_branch/20101203/psphot/src/psphotForcedReadout.c
r28013 r30118 1 1 # include "psphotInternal.h" 2 2 3 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view ) {3 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 4 4 5 5 // measure the total elapsed time in psphotReadout. XXX the current threading plan … … 20 20 21 21 // set the photcode for this image 22 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {22 if (!psphotAddPhotcode (config, view, filerule)) { 23 23 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 24 24 return false; … … 30 30 31 31 // Generate the mask and weight images, including the user-defined analysis region of interest 32 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");32 psphotSetMaskAndVariance (config, view, filerule); 33 33 if (!strcasecmp (breakPt, "NOTHING")) { 34 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");34 return psphotReadoutCleanup (config, view, filerule); 35 35 } 36 36 37 37 // generate a background model (median, smoothed image) 38 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {39 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");38 if (!psphotModelBackground (config, view, filerule)) { 39 return psphotReadoutCleanup (config, view, filerule); 40 40 } 41 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {42 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");41 if (!psphotSubtractBackground (config, view, filerule)) { 42 return psphotReadoutCleanup (config, view, filerule); 43 43 } 44 44 if (!strcasecmp (breakPt, "BACKMDL")) { 45 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");45 return psphotReadoutCleanup (config, view, filerule); 46 46 } 47 47 48 if (!psphotLoadPSF (config, view )) {48 if (!psphotLoadPSF (config, view, filerule)) { 49 49 // this only happens if we had a programming error in psphotLoadPSF 50 50 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 51 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");51 return psphotReadoutCleanup (config, view, filerule); 52 52 } 53 53 54 54 // include externally-supplied sources 55 psphotLoadExtSources (config, view, "PSPHOT.INPUT");55 psphotLoadExtSources (config, view, filerule); 56 56 57 57 // construct an initial model for each object, set the radius to fitRadius, set circular fit mask 58 psphotGuessModels (config, view, "PSPHOT.INPUT");58 psphotGuessModels (config, view, filerule); 59 59 60 60 // merge the newly selected sources into the existing list 61 61 // NOTE: merge OLD and NEW 62 psphotMergeSources (config, view, "PSPHOT.INPUT");62 psphotMergeSources (config, view, filerule); 63 63 64 64 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 65 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);65 psphotFitSourcesLinear (config, view, filerule, false); 66 66 67 67 // identify CRs and extended sources … … 71 71 72 72 // calculate source magnitudes 73 psphotMagnitudes(config, view, "PSPHOT.INPUT");73 psphotMagnitudes(config, view, filerule); 74 74 75 75 // XXX do I want to do this? … … 80 80 81 81 // replace background in residual image 82 psphotSkyReplace (config, view, "PSPHOT.INPUT");82 psphotSkyReplace (config, view, filerule); 83 83 84 84 // drop the references to the image pixels held by each source 85 psphotSourceFreePixels (config, view, "PSPHOT.INPUT");85 psphotSourceFreePixels (config, view, filerule); 86 86 87 87 // create the exported-metadata and free local data 88 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");88 return psphotReadoutCleanup (config, view, filerule); 89 89 } -
branches/czw_branch/20101203/psphot/src/psphotGuessModels.c
r29605 r30118 12 12 bool status = true; 13 13 14 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 15 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 14 int num = psphotFileruleCount(config, filerule); 16 15 17 16 // skip the chisq image (optionally?) … … 207 206 float Xc = 0.5*readout->image->numCols; 208 207 float Yc = 0.5*readout->image->numRows; 209 pmModel *modelPSF = pmModelFromPSFforXY(psf, Xc, Yc, Io);208 modelPSF = pmModelFromPSFforXY(psf, Xc, Yc, Io); 210 209 if (modelPSF == NULL) { 211 210 psError(PSPHOT_ERR_PSF, false, "Failed to determine PSF model at center of image"); -
branches/czw_branch/20101203/psphot/src/psphotImageLoop.c
r29548 r30118 109 109 110 110 // run the actual photometry analysis on this chip/cell/readout 111 if (!psphotReadout (config, view )) {111 if (!psphotReadout (config, view, "PSPHOT.INPUT")) { 112 112 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 113 113 psFree (view); -
branches/czw_branch/20101203/psphot/src/psphotImageQuality.c
r28013 r30118 13 13 psAssert (recipe, "missing recipe?"); 14 14 15 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 16 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 15 int num = psphotFileruleCount(config, filerule); 17 16 18 17 // skip the chisq image (optionally?) … … 99 98 // r^2 sin(2t) = r^2 2 cos t sin t = 2 x y 100 99 101 // r^ 2 cos(3t) = r^2 cos^3 t - r^2 3 cos t sin^2 t = (x^3 - 3 x y^2) / r102 // r^ 2 sin(3t) = r^2 3 cos^2 t sin t - sin^3 t = (3 x^2 y - y^3) / r103 104 // r^ 2 cos(4t) = r^2 cos^4 t - r^2 6 cos^2 t sin^2 t + r^2 sin^4 t = (x^4 - 6 x^2 y^2 + y^4) / r^2105 // r^ 2 sin(4t) = r^2 4 cos^3 t sin t - 4 sin^3 t cos t = (4 x^3 y - 4 y^3 x) / r^2100 // r^3 cos(3t) = r^3 cos^3 t - r^2 3 cos t sin^2 t = (x^3 - 3 x y^2) 101 // r^3 sin(3t) = r^3 3 cos^2 t sin t - sin^3 t = (3 x^2 y - y^3) 102 103 // r^4 cos(4t) = r^4 cos^4 t - r^2 6 cos^2 t sin^2 t + r^2 sin^4 t = (x^4 - 6 x^2 y^2 + y^4) 104 // r^4 sin(4t) = r^4 4 cos^3 t sin t - 4 sin^3 t cos t = (4 x^3 y - 4 y^3 x) 106 105 107 106 num++; -
branches/czw_branch/20101203/psphot/src/psphotLoadPSF.c
r26894 r30118 6 6 7 7 // XXX for now (2010.01.27), the supporting programs do not define multiple PSPHOT.PSF.LOAD 8 // files to go with multiple PSPHOT.INPUTfiles. as a result, the implementation below is8 // files to go with multiple input files. as a result, the implementation below is 9 9 // currently going to work for the case of a single input file, but will fail if we try with a 10 10 // stack of images. … … 59 59 } 60 60 61 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view) { 61 // PSPHOT.PSF.LOAD vs input file -- see note at top 62 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view, const char *filerule) { 62 63 63 bool status = false; 64 65 // XXX PSPHOT.PSF.LOAD vs PSPHOT.INPUT -- see note at top 66 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 67 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 64 int num = psphotFileruleCount(config, filerule); 68 65 69 66 // loop over the available readouts … … 71 68 72 69 // Generate the mask and weight images, including the user-defined analysis region of interest 73 if (!psphotLoadPSFReadout (config, view, "PSPHOT.INPUT", "PSPHOT.PSF.LOAD", i)) {70 if (!psphotLoadPSFReadout (config, view, filerule, "PSPHOT.PSF.LOAD", i)) { 74 71 psError (PSPHOT_ERR_CONFIG, false, "failed to load PSF model for PSPHOT.PSF.LOAD entry %d", i); 75 72 return false; -
branches/czw_branch/20101203/psphot/src/psphotMagnitudes.c
r29004 r30118 9 9 psAssert (recipe, "missing recipe?"); 10 10 11 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 12 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 11 int num = psphotFileruleCount(config, filerule); 13 12 14 13 // skip the chisq image (optionally?) -
branches/czw_branch/20101203/psphot/src/psphotMakeFluxScale.c
- Property svn:mergeinfo set to
r25755 r30118 55 55 fPts->n = Npts; 56 56 57 if (!pmTrend2DFit (trend, NULL, 0xff, xPts, yPts, fPts, NULL)) { 57 // XXX we should allow the spatial sampling to decrease if the fit fails 58 bool goodFit = false; 59 if (!pmTrend2DFit (&goodFit, trend, NULL, 0xff, xPts, yPts, fPts, NULL)) { 58 60 psError(PS_ERR_UNKNOWN, false, "Unable to fit trend"); 61 success = false; 62 goto DONE; 63 } 64 if (!goodFit) { 65 psError(PS_ERR_UNKNOWN, false, "poor fit to flux-scale trend"); 59 66 success = false; 60 67 goto DONE; -
branches/czw_branch/20101203/psphot/src/psphotMakePSFImageLoop.c
r25982 r30118 84 84 85 85 // run the actual photometry analysis on this chip/cell/readout 86 if (!psphotMakePSFReadout (config, view )) {86 if (!psphotMakePSFReadout (config, view, "PSPHOT.INPUT")) { 87 87 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 88 88 psFree (view); -
branches/czw_branch/20101203/psphot/src/psphotMakePSFReadout.c
r28013 r30118 1 1 # include "psphotInternal.h" 2 2 3 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view ) {3 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 4 4 5 5 // measure the total elapsed time in psphotReadout. XXX the current threading plan … … 19 19 20 20 // set the photcode for this image 21 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {21 if (!psphotAddPhotcode (config, view, filerule)) { 22 22 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 23 23 return false; … … 29 29 30 30 // Generate the mask and weight images, including the user-defined analysis region of interest 31 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");31 psphotSetMaskAndVariance (config, view, filerule); 32 32 if (!strcasecmp (breakPt, "NOTHING")) { 33 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");33 return psphotReadoutCleanup (config, view, filerule); 34 34 } 35 35 36 36 // generate a background model (median, smoothed image) 37 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {38 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");37 if (!psphotModelBackground (config, view, filerule)) { 38 return psphotReadoutCleanup (config, view, filerule); 39 39 } 40 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {41 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");40 if (!psphotSubtractBackground (config, view, filerule)) { 41 return psphotReadoutCleanup (config, view, filerule); 42 42 } 43 43 if (!strcasecmp (breakPt, "BACKMDL")) { 44 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");44 return psphotReadoutCleanup (config, view, filerule); 45 45 } 46 46 47 psphotLoadExtSources (config, view, "PSPHOT.INPUT");47 psphotLoadExtSources (config, view, filerule); 48 48 49 49 // If sources have been supplied, then these should be used to measure the PSF include … … 53 53 // a text file have no valid SN values, but psphotChoosePSF needs to select the top 54 54 // PSF_MAX_NSTARS to generate the PSF. 55 if (!psphotCheckExtSources (config, view, "PSPHOT.INPUT")) {55 if (!psphotCheckExtSources (config, view, filerule)) { 56 56 psLogMsg ("psphot", 3, "failure to select possible PSF sources (external or internal)"); 57 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");57 return psphotReadoutCleanup (config, view, filerule); 58 58 } 59 59 60 60 // Use bright stellar objects to measure PSF. If we do not have enough stars to generate 61 61 // the PSF, build one from the SEEING guess and model class 62 if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) {62 if (!psphotChoosePSF (config, view, filerule)) { 63 63 psLogMsg ("psphot", 3, "failure to construct a psf model"); 64 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");64 return psphotReadoutCleanup (config, view, filerule); 65 65 } 66 66 67 67 // measure aperture photometry corrections 68 68 # if 0 69 if (!psphotApResid (config, view, "PSPHOT.INPUT")) {69 if (!psphotApResid (config, view, filerule)) { 70 70 psLogMsg ("psphot", 3, "failed on psphotApResid"); 71 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");71 return psphotReadoutCleanup (config, view, filerule); 72 72 } 73 73 # endif 74 74 75 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");75 return psphotReadoutCleanup (config, view, filerule); 76 76 } -
branches/czw_branch/20101203/psphot/src/psphotMaskReadout.c
r28013 r30118 9 9 psAssert (recipe, "missing recipe?"); 10 10 11 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 12 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 11 int num = psphotFileruleCount(config, filerule); 13 12 14 13 // loop over the available readouts … … 17 16 // Generate the mask and weight images, including the user-defined analysis region of interest 18 17 if (!psphotSetMaskAndVarianceReadout (config, view, filerule, i, recipe)) { 19 psError (PSPHOT_ERR_CONFIG, false, "failed to generate mask for PSPHOT.INPUT entry %d", i);18 psError (PSPHOT_ERR_CONFIG, false, "failed to generate mask for %s entry %d", filerule, i); 20 19 return false; 21 20 } -
branches/czw_branch/20101203/psphot/src/psphotMergeSources.c
r28013 r30118 8 8 bool psphotMergeSources (pmConfig *config, const pmFPAview *view, const char *filerule) 9 9 { 10 bool status = true; 11 12 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 13 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 10 int num = psphotFileruleCount(config, filerule); 14 11 15 12 // loop over the available readouts … … 70 67 // XXX This function needs to be updated to loop over set of input files. At the moment, we 71 68 // only expect a single entry for PSPHOT.INPUT.CMF and PSPHOT.SOURCES.TEXT, so we can only 72 // associate input sources with a single entry for PSPHOT.INPUT69 // associate input sources with a single entry for the filerule 73 70 bool psphotLoadExtSources (pmConfig *config, const pmFPAview *view, const char *filerule) { 74 71 … … 166 163 } 167 164 165 // copy the known sources (as external) to the detection list of the given filerule 166 bool psphotAddKnownSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources) { 167 168 bool status = false; 169 170 // select the appropriate recipe information 171 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 172 psAssert (recipe, "missing recipe?"); 173 174 // determine properties (sky, moments) of initial sources 175 float OUTER = psMetadataLookupF32 (&status, recipe, "SKY_OUTER_RADIUS"); 176 psAssert (status, "missing SKY_OUTER_RADIUS in recipe?"); 177 178 // XXX this seems like an arbitrary number... 179 OUTER = PS_MAX(OUTER, 20.0); // XXX Guarantee that we can encompass the max moments radius 180 181 // find the currently selected readout 182 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest 183 psAssert (file, "missing file?"); 184 185 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 186 psAssert (readout, "missing readout?"); 187 188 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 189 if (!detections) { 190 detections = pmDetectionsAlloc(); 191 detections->newSources = psArrayAllocEmpty (100); 192 // save detections on the readout->analysis 193 if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot detections", detections)) { 194 psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout"); 195 return false; 196 } 197 } else { 198 psMemIncrRefCounter(detections); // so we can free the detections below 199 } 200 201 // copy the sources from inSources to the new detection structure 202 for (int i = 0; i < inSources->n; i++) { 203 pmSource *inSource = inSources->data[i]; 204 205 pmSource *newSource = pmSourceCopy(inSource); 206 newSource->mode |= PM_SOURCE_MODE_EXTERNAL; 207 208 // drop the loaded source modelPSF 209 psFree (newSource->modelPSF); 210 // source->modelPSF = NULL; check this! 211 212 // drop the references to the original image pixels: 213 pmSourceFreePixels (newSource); 214 215 // allocate image, weight, mask for the new image for each peak (square of radius OUTER) 216 pmSourceDefinePixels (newSource, readout, newSource->peak->x, newSource->peak->y, OUTER); 217 218 newSource->imageID = 0; 219 // XXX reset the source ID? raised questions about the meaning of this ID... 220 // P_PM_SOURCE_SET_ID(source, i); 221 222 psArrayAdd (detections->newSources, 100, newSource); 223 } 224 psLogMsg ("psphot", 3, "%ld known sources supplied", detections->newSources->n); 225 226 psFree (detections); 227 return true; 228 } 229 168 230 // extract the input sources corresponding to this readout 169 231 // XXX this function needs to be updated to work with the new context of psphot inputs … … 405 467 bool status = true; 406 468 407 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 408 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 469 int num = psphotFileruleCount(config, ruleSrc); 409 470 410 471 // skip the chisq image because it is a duplicate of the detection version -
branches/czw_branch/20101203/psphot/src/psphotModelBackground.c
r28013 r30118 383 383 } 384 384 385 // XXX supply filename or keep PSPHOT.INPUT fixed?386 385 bool psphotModelBackground (pmConfig *config, const pmFPAview *view, const char *filerule) 387 386 { 388 bool status = false; 389 390 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 391 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 387 int num = psphotFileruleCount(config, filerule); 392 388 393 389 // loop over the available readouts 394 390 for (int i = 0; i < num; i++) { 395 391 if (!psphotModelBackgroundReadoutFileIndex(config, view, filerule, i)) { 396 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for PSPHOT.INPUT entry %d", i);392 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for %s entry %d", filerule, i); 397 393 return false; 398 394 } -
branches/czw_branch/20101203/psphot/src/psphotOutput.c
r29902 r30118 1 1 # include "psphotInternal.h" 2 3 // convert filerule to filerule.NUM and look up in the config->arguments metadata 4 int psphotFileruleCount(const pmConfig *config, const char *filerule) { 5 6 bool status = false; 7 8 psString name = NULL; 9 psStringAppend(&name, "%s.NUM", filerule); 10 int num = psMetadataLookupS32 (&status, config->arguments, name); 11 if (!status) { 12 // we only explicitly define (filerule.NUM) if we have more than 1 13 num = 1; 14 } 15 psFree (name); 16 return num; 17 } 2 18 3 19 pmReadout *psphotSelectBackground (pmConfig *config, … … 63 79 fclose (f); 64 80 return true; 65 }66 67 // XXX replace this with a call to a pmConfig function (pmConfigDump...)68 bool psphotDumpConfig (pmConfig *config) {69 70 psMetadataConfigWrite (config->user, "user.md");71 psMetadataConfigWrite (config->camera, "camera.md");72 psMetadataConfigWrite (config->recipes, "recipes.md");73 psMetadataConfigWrite (config->arguments, "arguments.md");74 psMetadataConfigWrite (config->files, "files.md");75 return true;76 81 } 77 82 … … 126 131 } 127 132 133 bool psphotCleanInputsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 134 bool psphotCleanInputs (pmConfig *config, const pmFPAview *view, const char *filerule) { 135 136 int num = psphotFileruleCount(config, filerule); 137 138 // loop over the available readouts 139 for (int i = 0; i < num; i++) { 140 if (!psphotCleanInputsReadout (config, view, filerule, i)) { 141 psError (PSPHOT_ERR_CONFIG, false, "failed to clean inputs for %s entry %d", filerule, i); 142 return false; 143 } 144 } 145 return true; 146 } 147 148 bool psphotCleanInputsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) { 149 150 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 151 PS_ASSERT (file, false); 152 153 pmReadout *readout = pmFPAviewThisReadout (view, file->fpa); 154 155 // XXX anything else to remove? 156 if (psMetadataLookup(readout->analysis, "PSPHOT.DETECTIONS")) { 157 psMetadataRemoveKey(readout->analysis, "PSPHOT.DETECTIONS"); 158 } 159 160 return true; 161 } 162 128 163 bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view, const char *filerule) { 129 164 130 bool status = false; 131 132 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 133 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 165 int num = psphotFileruleCount(config, filerule); 134 166 135 167 // loop over the available readouts 136 168 for (int i = 0; i < num; i++) { 137 169 if (!psphotAddPhotcodeReadout (config, view, filerule, i)) { 138 psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to PSPHOT.INPUT entry %d", i);170 psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to %s entry %d", filerule, i); 139 171 return false; 140 172 } … … 357 389 // XXX need alternative output function 358 390 // psMetadata *psfData = pmPSFtoMetadata (NULL, try->psf); 359 // psMetadataConfigWrite (psfData, "psfmodel.dat" );391 // psMetadataConfigWrite (psfData, "psfmodel.dat", NULL); 360 392 psLogMsg ("psphot.choosePSF", PS_LOG_INFO, "wrote out psf-subtracted image, psf data, exiting\n"); 361 393 -
branches/czw_branch/20101203/psphot/src/psphotParseCamera.c
r26894 r30118 39 39 return NULL; 40 40 } 41 // specify the number of psphot input images42 psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);43 41 44 42 // define the additional input/output files associated with psphot -
branches/czw_branch/20101203/psphot/src/psphotRadialApertures.c
r28013 r30118 18 18 } 19 19 20 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 21 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 20 int num = psphotFileruleCount(config, filerule); 22 21 23 22 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotRadialAperturesByObject.c
r28013 r30118 21 21 22 22 // number of images used to define sources 23 int nImages = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 24 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 23 int nImages = psphotFileruleCount(config, filerule); 25 24 26 25 // radMax stores the upper bounds of the annuli -
branches/czw_branch/20101203/psphot/src/psphotRadiusChecks.c
r29004 r30118 135 135 EXT_FIT_MAX_RADIUS = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MAX_RADIUS"); 136 136 137 float skyMean = psMetadataLookupF32 (&status, readout->analysis, "SKY_MEAN");138 137 float skyStdev = psMetadataLookupF32 (&status, readout->analysis, "SKY_STDEV"); 139 140 fprintf (stderr, "sky: %f +/- %f\n", skyMean, skyStdev);141 138 142 139 EXT_FIT_SKY_SIG = skyStdev; -
branches/czw_branch/20101203/psphot/src/psphotReadout.c
r29004 r30118 9 9 } 10 10 11 bool psphotReadout(pmConfig *config, const pmFPAview *view ) {11 bool psphotReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 12 12 13 13 // measure the total elapsed time in psphotReadout. dtime is the elapsed time used jointly … … 27 27 psAssert (breakPt, "configuration error: set BREAK_POINT"); 28 28 29 // remove cruft from the input analysis structure 30 if (!psphotCleanInputs (config, view, filerule)) { 31 psError (PSPHOT_ERR_PROG, false, "trouble setting up the inputs"); 32 return false; 33 } 34 29 35 // set the photcode for this image 30 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {36 if (!psphotAddPhotcode (config, view, filerule)) { 31 37 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 32 38 return false; … … 34 40 35 41 // Generate the mask and weight images, including the user-defined analysis region of interest 36 if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) {37 return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");42 if (!psphotSetMaskAndVariance (config, view, filerule)) { 43 return psphotReadoutCleanup(config, view, filerule); 38 44 } 39 45 if (!strcasecmp (breakPt, "NOTHING")) { 40 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");46 return psphotReadoutCleanup (config, view, filerule); 41 47 } 42 48 43 49 // generate a background model (median, smoothed image) 44 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {45 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");46 } 47 48 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {49 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");50 if (!psphotModelBackground (config, view, filerule)) { 51 return psphotReadoutCleanup (config, view, filerule); 52 } 53 54 if (!psphotSubtractBackground (config, view, filerule)) { 55 return psphotReadoutCleanup (config, view, filerule); 50 56 } 51 57 if (!strcasecmp (breakPt, "BACKMDL")) { 52 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");58 return psphotReadoutCleanup (config, view, filerule); 53 59 } 54 60 55 61 // load the psf model, if suppled. FWHM_MAJ,FWHM_MIN,etc are determined and saved on 56 // readout->analysis. XXX Note: this function currently only works with a single 57 // PSPHOT.INPUT 58 if (!psphotLoadPSF (config, view)) { // ??? need to supply 2 ? 62 // readout->analysis. NOTE: this function currently only loads from PSPHOT.PSF.LOAD 63 if (!psphotLoadPSF (config, view, filerule)) { // ??? need to supply 2 ? 59 64 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 60 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");65 return psphotReadoutCleanup (config, view, filerule); 61 66 } 62 67 63 68 // find the detections (by peak and/or footprint) in the image. 64 if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 169 if (!psphotFindDetections (config, view, filerule, true)) { // pass 1 65 70 // this only happens if we had an error in psphotFindDetections 66 71 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 67 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");72 return psphotReadoutCleanup (config, view, filerule); 68 73 } 69 74 70 75 // construct sources and measure basic stats (saved on detections->newSources) 71 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 176 if (!psphotSourceStats (config, view, filerule, true)) { // pass 1 72 77 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 73 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");78 return psphotReadoutCleanup (config, view, filerule); 74 79 } 75 80 if (!strcasecmp (breakPt, "PEAKS")) { 76 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");81 return psphotReadoutCleanup (config, view, filerule); 77 82 } 78 83 79 84 // find blended neighbors of very saturated stars (detections->newSources) 80 if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) {85 if (!psphotDeblendSatstars (config, view, filerule)) { 81 86 psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis"); 82 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");87 return psphotReadoutCleanup (config, view, filerule); 83 88 } 84 89 85 90 // mark blended peaks PS_SOURCE_BLEND (detections->newSources) 86 if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {91 if (!psphotBasicDeblend (config, view, filerule)) { 87 92 psError (PSPHOT_ERR_UNKNOWN, false, "failed on deblend analysis"); 88 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");93 return psphotReadoutCleanup (config, view, filerule); 89 94 } 90 95 91 96 // classify sources based on moments, brightness. if a PSF model has been loaded, the PSF 92 97 // clump defined for it is used not measured (detections->newSources) 93 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 198 if (!psphotRoughClass (config, view, filerule)) { // pass 1 94 99 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough classifications"); 95 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");100 return psphotReadoutCleanup (config, view, filerule); 96 101 } 97 102 98 103 // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources) 99 if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1104 if (!psphotImageQuality (config, view, filerule)) { // pass 1 100 105 psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality"); 101 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");106 return psphotReadoutCleanup (config, view, filerule); 102 107 } 103 108 if (!strcasecmp (breakPt, "MOMENTS")) { 104 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");109 return psphotReadoutCleanup (config, view, filerule); 105 110 } 106 111 107 112 // use bright stellar objects to measure PSF if we were supplied a PSF for any input file, 108 113 // this step is skipped 109 if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) { // pass 1114 if (!psphotChoosePSF (config, view, filerule)) { // pass 1 110 115 psLogMsg ("psphot", 3, "failure to construct a psf model"); 111 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");116 return psphotReadoutCleanup (config, view, filerule); 112 117 } 113 118 if (!strcasecmp (breakPt, "PSFMODEL")) { 114 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");119 return psphotReadoutCleanup (config, view, filerule); 115 120 } 116 121 117 122 // include externally-supplied sources 118 123 // XXX fix this in the new multi-input context 119 // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1124 // psphotLoadExtSources (config, view, filerule); // pass 1 120 125 121 126 // construct an initial model for each object, set the radius to fitRadius, set circular 122 127 // fit mask (detections->newSources) 123 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1128 psphotGuessModels (config, view, filerule); // pass 1 124 129 125 130 // merge the newly selected sources into the existing list 126 131 // NOTE: merge OLD and NEW 127 psphotMergeSources (config, view, "PSPHOT.INPUT");132 psphotMergeSources (config, view, filerule); 128 133 129 134 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 130 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources)135 psphotFitSourcesLinear (config, view, filerule, false); // pass 1 (detections->allSources) 131 136 132 137 // identify CRs and extended sources (only unmeasured sources are measured) 133 psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources)138 psphotSourceSize (config, view, filerule, true); // pass 1 (detections->allSources) 134 139 if (!strcasecmp (breakPt, "ENSEMBLE")) { 135 140 goto finish; … … 138 143 // non-linear PSF and EXT fit to brighter sources 139 144 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 140 psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)145 psphotBlendFit (config, view, filerule); // pass 1 (detections->allSources) 141 146 142 147 // replace all sources 143 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)148 psphotReplaceAllSources (config, view, filerule); // pass 1 (detections->allSources) 144 149 145 150 // linear fit to include all sources (subtract again) 146 151 // NOTE : apply to ALL sources (extended + psf) 147 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources)152 psphotFitSourcesLinear (config, view, filerule, true); // pass 2 (detections->allSources) 148 153 149 154 // if we only do one pass, skip to extended source analysis … … 153 158 154 159 // add noise for subtracted objects 155 psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)160 psphotAddNoise (config, view, filerule); // pass 1 (detections->allSources) 156 161 157 162 // find fainter sources 158 163 // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections 159 psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints)164 psphotFindDetections (config, view, filerule, false); // pass 2 (detections->peaks, detections->footprints) 160 165 161 166 // remove noise for subtracted objects (ie, return to normal noise level) 162 167 // NOTE: this needs to operate only on the OLD sources 163 psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)168 psphotSubNoise (config, view, filerule); // pass 1 (detections->allSources) 164 169 165 170 // define new sources based on only the new peaks 166 171 // NOTE: new sources are saved on detections->newSources 167 psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources)172 psphotSourceStats (config, view, filerule, false); // pass 2 (detections->newSources) 168 173 169 174 // set source type 170 175 // NOTE: apply only to detections->newSources 171 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 2 (detections->newSources)176 if (!psphotRoughClass (config, view, filerule)) { // pass 2 (detections->newSources) 172 177 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 173 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");178 return psphotReadoutCleanup (config, view, filerule); 174 179 } 175 180 176 181 // create full input models, set the radius to fitRadius, set circular fit mask 177 182 // NOTE: apply only to detections->newSources 178 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources)183 psphotGuessModels (config, view, filerule); // pass 2 (detections->newSources) 179 184 180 185 // replace all sources so fit below applies to all at once 181 186 // NOTE: apply only to OLD sources (which have been subtracted) 182 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2187 psphotReplaceAllSources (config, view, filerule); // pass 2 183 188 184 189 // merge the newly selected sources into the existing list 185 190 // NOTE: merge OLD and NEW 186 191 // XXX check on free of sources... 187 psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources)192 psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources) 188 193 189 194 // NOTE: apply to ALL sources 190 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources)195 psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources) 191 196 192 197 pass1finish: … … 194 199 // measure source size for the remaining sources 195 200 // NOTE: applies only to NEW (unmeasured) sources 196 psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources)197 198 psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)199 psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)201 psphotSourceSize (config, view, filerule, false); // pass 2 (detections->allSources) 202 203 psphotExtendedSourceAnalysis (config, view, filerule); // pass 1 (detections->allSources) 204 psphotExtendedSourceFits (config, view, filerule); // pass 1 (detections->allSources) 200 205 201 206 finish: … … 205 210 206 211 // measure aperture photometry corrections 207 if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)212 if (!psphotApResid (config, view, filerule)) { // pass 1 (detections->allSources) 208 213 psLogMsg ("psphot", 3, "failed on psphotApResid"); 209 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");214 return psphotReadoutCleanup (config, view, filerule); 210 215 } 211 216 212 217 // calculate source magnitudes 213 if (!psphotMagnitudes(config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)218 if (!psphotMagnitudes(config, view, filerule)) { // pass 1 (detections->allSources) 214 219 psErrorStackPrint(stderr, "Unable to do magnitudes."); 215 220 psErrorClear(); 216 221 } 217 if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1222 if (!psphotEfficiency(config, view, filerule)) { // pass 1 218 223 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 219 224 psErrorClear(); … … 224 229 225 230 // replace background in residual image 226 if (!psphotSkyReplace (config, view, "PSPHOT.INPUT")) { // pass 1231 if (!psphotSkyReplace (config, view, filerule)) { // pass 1 227 232 psErrorStackPrint(stderr, "Unable to replace sky"); 228 233 psErrorClear(); 229 234 230 235 /* psLogMsg("psphot", 3, "failed on psphotSkyReplace"); */ 231 /* return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */236 /* return(psphotReadoutCleanup(config, view, filerule)); */ 232 237 } 233 238 // drop the references to the image pixels held by each source 234 if (!psphotSourceFreePixels (config, view, "PSPHOT.INPUT")) { // pass 1239 if (!psphotSourceFreePixels (config, view, filerule)) { // pass 1 235 240 psErrorStackPrint(stderr, "Unable to free source pixels"); 236 241 psErrorClear(); 237 242 238 243 /* psLogMsg ("psphot", 3, "failed on psphotSourceFreePixels"); */ 239 /* return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */244 /* return(psphotReadoutCleanup(config, view, filerule)); */ 240 245 } 241 246 // create the exported-metadata and free local data 242 return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");247 return psphotReadoutCleanup(config, view, filerule); 243 248 } -
branches/czw_branch/20101203/psphot/src/psphotReadoutCleanup.c
r28013 r30118 19 19 psAssert (recipe, "missing recipe?"); 20 20 21 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 22 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 21 int num = psphotFileruleCount(config, filerule); 23 22 24 23 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotReadoutFindPSF.c
r28013 r30118 3 3 // in this psphotReadout-variant, we are only trying to determine the PSF given an existing set 4 4 // of input source positions to use as initial PSF stars. 5 bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, psArray *inSources) {5 bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources) { 6 6 7 7 psTimerStart ("psphotReadout"); 8 8 9 // set the photcode for the PSPHOT.INPUT10 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {9 // set the photcode for the input 10 if (!psphotAddPhotcode(config, view, filerule)) { 11 11 psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 12 12 return false; … … 14 14 15 15 // Generate the mask and variance images, including the user-defined analysis region of interest 16 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");16 psphotSetMaskAndVariance (config, view, filerule); 17 17 18 18 // Note that in this implementation, we do NOT model the background and we do not 19 19 // attempt to detect the sources in the image 20 20 21 // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF)22 // XXX we assume a single set of input sources is supplied23 if (!psphotDetectionsFromSources (config, view, "PSPHOT.INPUT", inSources)) {21 // include the externally-supplied sources (inSources) 22 // (we assume a single set of input sources is supplied) 23 if (!psphotDetectionsFromSources (config, view, filerule, inSources)) { 24 24 psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars"); 25 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");25 return psphotReadoutCleanup (config, view, filerule); 26 26 } 27 27 28 28 // construct detections->newSources and measure basic stats (moments, local sky) 29 if (!psphotSourceStats(config, view, "PSPHOT.INPUT", true)) {29 if (!psphotSourceStats(config, view, filerule, true)) { 30 30 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 31 31 return false; … … 33 33 34 34 // peak flux is wrong : use the peak measured in the moments analysis: 35 if (!psphotRepairLoadedSources(config, view, "PSPHOT.INPUT")) {35 if (!psphotRepairLoadedSources(config, view, filerule)) { 36 36 psError(PSPHOT_ERR_UNKNOWN, false, "failure to repair sources"); 37 37 return false; … … 39 39 40 40 // classify sources based on moments, brightness (psf is not known) 41 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) {41 if (!psphotRoughClass (config, view, filerule)) { 42 42 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class"); 43 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");43 return psphotReadoutCleanup (config, view, filerule); 44 44 } 45 45 46 if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) {46 if (!psphotImageQuality (config, view, filerule)) { 47 47 psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality"); 48 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");48 return psphotReadoutCleanup (config, view, filerule); 49 49 } 50 50 51 if (!psphotChoosePSF(config, view, "PSPHOT.INPUT")) {51 if (!psphotChoosePSF(config, view, filerule)) { 52 52 psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model"); 53 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");53 return psphotReadoutCleanup (config, view, filerule); 54 54 } 55 55 … … 59 59 // fits from that analysis, or run the linear PSF fit for all objects currently in hand 60 60 // construct an initial model for each object, set the radius to fitRadius, set circular fit mask 61 psphotGuessModels (config, view, "PSPHOT.INPUT");61 psphotGuessModels (config, view, filerule); 62 62 # endif 63 63 64 64 // merge the newly selected sources into the existing list 65 65 // NOTE: merge OLD and NEW 66 psphotMergeSources (config, view, "PSPHOT.INPUT");66 psphotMergeSources (config, view, filerule); 67 67 68 68 # if 0 69 69 // measure aperture photometry corrections 70 if (!psphotApResid (config, view, "PSPHOT.INPUT")) {70 if (!psphotApResid (config, view, filerule)) { 71 71 psLogMsg ("psphot", 3, "failed on psphotApResid"); 72 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");72 return psphotReadoutCleanup (config, view, filerule); 73 73 } 74 74 # endif 75 75 76 76 // drop the references to the image pixels held by each source 77 psphotSourceFreePixels(config, view, "PSPHOT.INPUT");77 psphotSourceFreePixels(config, view, filerule); 78 78 79 79 // create the exported-metadata and free local data 80 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");80 return psphotReadoutCleanup (config, view, filerule); 81 81 } -
branches/czw_branch/20101203/psphot/src/psphotReadoutKnownSources.c
r28013 r30118 3 3 // in this psphotReadout-variant, we are only measuring the photometry for known sources, using 4 4 // a PSF generated for this observation from those sources 5 bool psphotReadoutKnownSources(pmConfig *config, const pmFPAview *view, psArray *inSources) {5 bool psphotReadoutKnownSources(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources) { 6 6 7 7 psTimerStart ("psphotReadout"); 8 8 9 9 // set the photcode for this image 10 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {10 if (!psphotAddPhotcode(config, view, filerule)) { 11 11 psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 12 12 return false; … … 14 14 15 15 // Generate the mask and weight images, including the user-defined analysis region of interest 16 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");16 psphotSetMaskAndVariance (config, view, filerule); 17 17 18 18 // Note that in this implementation, we do NOT model the background and we do not … … 20 20 21 21 // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF) 22 if (!psphotDetectionsFromSources (config, view, "PSPHOT.INPUT", inSources)) {22 if (!psphotDetectionsFromSources (config, view, filerule, inSources)) { 23 23 psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars"); 24 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");24 return psphotReadoutCleanup (config, view, filerule); 25 25 } 26 26 27 27 // construct sources and measure basic stats 28 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) {28 if (!psphotSourceStats (config, view, filerule, true)) { 29 29 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 30 30 return false; … … 32 32 33 33 // peak flux is wrong : use the peak measured in the moments analysis: 34 if (!psphotRepairLoadedSources(config, view, "PSPHOT.INPUT")) {34 if (!psphotRepairLoadedSources(config, view, filerule)) { 35 35 psError(PSPHOT_ERR_UNKNOWN, false, "failure to repair sources"); 36 36 return false; … … 38 38 39 39 // classify sources based on moments, brightness (psf is not known) 40 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) {40 if (!psphotRoughClass (config, view, filerule)) { 41 41 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class"); 42 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");42 return psphotReadoutCleanup (config, view, filerule); 43 43 } 44 44 45 if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) {45 if (!psphotChoosePSF (config, view, filerule)) { 46 46 psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model"); 47 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");47 return psphotReadoutCleanup (config, view, filerule); 48 48 } 49 49 50 50 // construct an initial model for each object 51 psphotGuessModels (config, view, "PSPHOT.INPUT");51 psphotGuessModels (config, view, filerule); 52 52 53 53 // merge the newly selected sources into the existing list 54 54 // NOTE: merge OLD and NEW 55 psphotMergeSources (config, view, "PSPHOT.INPUT");55 psphotMergeSources (config, view, filerule); 56 56 57 57 // linear PSF fit to source peaks 58 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);58 psphotFitSourcesLinear (config, view, filerule, false); 59 59 60 60 // measure aperture photometry corrections 61 if (!psphotApResid (config, view, "PSPHOT.INPUT")) {61 if (!psphotApResid (config, view, filerule)) { 62 62 psLogMsg ("psphot", 3, "failed on psphotApResid"); 63 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");63 return psphotReadoutCleanup (config, view, filerule); 64 64 } 65 65 66 66 // calculate source magnitudes 67 psphotMagnitudes(config, view, "PSPHOT.INPUT");67 psphotMagnitudes(config, view, filerule); 68 68 69 69 // drop the references to the image pixels held by each source 70 psphotSourceFreePixels (config, view, "PSPHOT.INPUT");70 psphotSourceFreePixels (config, view, filerule); 71 71 72 72 // create the exported-metadata and free local data 73 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");73 return psphotReadoutCleanup (config, view, filerule); 74 74 } -
branches/czw_branch/20101203/psphot/src/psphotReadoutMinimal.c
r28013 r30118 7 7 // NOTE: ppSub needs to perform extended source analysis for comets and trails. 8 8 9 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view ) {9 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view, const char *filerule) { 10 10 11 11 // measure the total elapsed time in psphotReadout. XXX the current threading plan … … 18 18 19 19 // set the photcode for this image 20 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {20 if (!psphotAddPhotcode(config, view, filerule)) { 21 21 psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 22 22 return false; … … 24 24 25 25 // Generate the mask and weight images, including the user-defined analysis region of interest 26 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT");26 psphotSetMaskAndVariance (config, view, filerule); 27 27 28 28 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are saved on readout->analysis 29 if (!psphotLoadPSF (config, view )) {29 if (!psphotLoadPSF (config, view, filerule)) { 30 30 psError (PSPHOT_ERR_CONFIG, false, "missing psf model"); 31 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");31 return psphotReadoutCleanup (config, view, filerule); 32 32 } 33 33 34 34 // find the detections (by peak and/or footprint) in the image. (final pass) 35 if (!psphotFindDetections(config, view, "PSPHOT.INPUT", false)) {35 if (!psphotFindDetections(config, view, filerule, false)) { 36 36 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 37 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");37 return psphotReadoutCleanup (config, view, filerule); 38 38 } 39 39 40 40 // construct sources and measure basic stats (saved on detections->newSources) 41 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", false)) { // pass 141 if (!psphotSourceStats (config, view, filerule, false)) { // pass 1 42 42 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 43 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");43 return psphotReadoutCleanup (config, view, filerule); 44 44 } 45 45 46 46 // find blended neighbors of very saturated stars 47 psphotDeblendSatstars (config, view, "PSPHOT.INPUT");47 psphotDeblendSatstars (config, view, filerule); 48 48 49 49 // mark blended peaks PS_SOURCE_BLEND 50 if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {50 if (!psphotBasicDeblend (config, view, filerule)) { 51 51 psLogMsg ("psphot", 3, "failed on deblend analysis"); 52 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");52 return psphotReadoutCleanup (config, view, filerule); 53 53 } 54 54 55 55 // classify sources based on moments, brightness (use supplied psf shape parameters) 56 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) {56 if (!psphotRoughClass (config, view, filerule)) { 57 57 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 58 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");58 return psphotReadoutCleanup (config, view, filerule); 59 59 } 60 60 61 61 // construct an initial model for each object 62 psphotGuessModels (config, view, "PSPHOT.INPUT");62 psphotGuessModels (config, view, filerule); 63 63 64 64 // merge the newly selected sources into the existing list 65 psphotMergeSources (config, view, "PSPHOT.INPUT");65 psphotMergeSources (config, view, filerule); 66 66 67 67 // linear PSF fit to source peaks 68 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);68 psphotFitSourcesLinear (config, view, filerule, false); 69 69 70 70 // XXX eventually, add the extended source fits here 71 71 # if (0) 72 72 // measure source size for the remaining sources 73 psphotSourceSize (config, view, "PSPHOT.INPUT");73 psphotSourceSize (config, view, filerule); 74 74 75 psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT");75 psphotExtendedSourceAnalysis (config, view, filerule); 76 76 77 psphotExtendedSourceFits (config, view, "PSPHOT.INPUT");77 psphotExtendedSourceFits (config, view, filerule); 78 78 # endif 79 79 80 80 // calculate source magnitudes 81 psphotMagnitudes(config, view, "PSPHOT.INPUT");81 psphotMagnitudes(config, view, filerule); 82 82 83 83 // XXX ensure this is measured if the analysis succeeds (even if quality is low) 84 if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) {84 if (!psphotEfficiency(config, view, filerule)) { 85 85 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 86 86 psErrorClear(); … … 88 88 89 89 // drop the references to the image pixels held by each source 90 psphotSourceFreePixels (config, view, "PSPHOT.INPUT");90 psphotSourceFreePixels (config, view, filerule); 91 91 92 92 // create the exported-metadata and free local data 93 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");93 return psphotReadoutCleanup (config, view, filerule); 94 94 } -
branches/czw_branch/20101203/psphot/src/psphotReplaceUnfit.c
r28013 r30118 31 31 psAssert (recipe, "missing recipe?"); 32 32 33 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 34 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 33 int num = psphotFileruleCount(config, filerule); 35 34 36 35 // loop over the available readouts 37 36 for (int i = 0; i < num; i++) { 38 37 if (!psphotReplaceAllSourcesReadout (config, view, filerule, i, recipe)) { 39 psError (PSPHOT_ERR_CONFIG, false, "failed to replace all sources for PSPHOT.INPUT entry %d", i);38 psError (PSPHOT_ERR_CONFIG, false, "failed to replace all sources for %s entry %d", filerule, i); 40 39 return false; 41 40 } -
branches/czw_branch/20101203/psphot/src/psphotRoughClass.c
r28425 r30118 16 16 psAssert (recipe, "missing recipe?"); 17 17 18 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 19 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 18 int num = psphotFileruleCount(config, filerule); 20 19 21 20 // skip the chisq image (optionally?) -
branches/czw_branch/20101203/psphot/src/psphotSkyReplace.c
r28013 r30118 5 5 bool status = true; 6 6 7 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 8 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 7 int num = psphotFileruleCount(config, filerule); 9 8 10 9 // skip the chisq image (optionally?) -
branches/czw_branch/20101203/psphot/src/psphotSourceFreePixels.c
r28013 r30118 3 3 bool psphotSourceFreePixels (pmConfig *config, const pmFPAview *view, const char *filerule) 4 4 { 5 bool status = true; 6 7 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 8 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 5 int num = psphotFileruleCount(config, filerule); 9 6 10 7 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotSourceMatch.c
r29548 r30118 6 6 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule) 7 7 { 8 bool status = true;9 10 8 psArray *objects = psArrayAllocEmpty(100); 11 9 12 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 13 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 10 int num = psphotFileruleCount(config, filerule); 14 11 15 12 // loop over the available readouts 16 13 for (int i = 0; i < num; i++) { 17 14 if (!psphotMatchSourcesReadout (objects, config, view, filerule, i)) { 18 psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for PSPHOT.INPUT entry %d", i);15 psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for %s entry %d", filerule, i); 19 16 psFree (objects); 20 17 return NULL; … … 162 159 psAssert (status, "missing SKY_OUTER_RADIUS in recipe?"); 163 160 164 int nImages = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 165 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 161 int nImages = psphotFileruleCount(config, filerule); 166 162 167 163 // generate look-up arrays for detections and readouts -
branches/czw_branch/20101203/psphot/src/psphotSourceSize.c
r29610 r30118 49 49 psAssert (recipe, "missing recipe?"); 50 50 51 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 52 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 51 int num = psphotFileruleCount(config, filerule); 53 52 54 53 // skip the chisq image (optionally?) … … 60 59 if (i == chisqNum) continue; // skip chisq image 61 60 if (!psphotSourceSizeReadout (config, view, filerule, i, recipe, getPSFsize)) { 62 psError (PSPHOT_ERR_CONFIG, false, "failed on source size analysis for PSPHOT.INPUT entry %d", i);61 psError (PSPHOT_ERR_CONFIG, false, "failed on source size analysis for %s entry %d", filerule, i); 63 62 return false; 64 63 } -
branches/czw_branch/20101203/psphot/src/psphotSourceStats.c
r29604 r30118 14 14 psAssert (recipe, "missing recipe?"); 15 15 16 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 17 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 16 int num = psphotFileruleCount(config, filerule); 18 17 19 18 // skip the chisq image (optionally?) -
branches/czw_branch/20101203/psphot/src/psphotStackChisqImage.c
r28013 r30118 8 8 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *ruleDet, const char *ruleCnv) 9 9 { 10 bool status = false;11 12 10 psTimerStart ("psphot.chisq.image"); 13 11 … … 17 15 pmReadout *chiReadout = NULL; 18 16 19 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 20 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 17 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 21 18 22 19 // loop over the available readouts … … 28 25 } 29 26 } 30 31 num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");32 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");33 27 34 28 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "PSPHOT.CHISQ.NUM", PS_META_REPLACE, "", num); … … 125 119 psAssert (status, "programming error: must define PSPHOT.CHISQ.NUM"); 126 120 127 int inputNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 128 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 121 int inputNum = psphotFileruleCount(config, "PSPHOT.INPUT"); 129 122 130 123 pmFPAfileRemoveSingle (config->files, filerule, chisqNum); -
branches/czw_branch/20101203/psphot/src/psphotStackImageLoop.c
r28013 r30118 105 105 bool GetAstrometryFPA (pmConfig *config, pmFPAview *view) { 106 106 107 bool status = false;108 109 107 bool foundAstrometry = false; 110 108 bool bilevelAstrometry = false; 111 109 112 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 113 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 110 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 114 111 115 112 // loop over the available readouts … … 158 155 bool GetAstrometryChip (pmConfig *config, pmFPAview *view, bool bilevelAstrometry) { 159 156 160 bool status = false; 161 162 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 163 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 157 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 164 158 165 159 // loop over the available readouts … … 220 214 bool SetAstrometryFPA (pmConfig *config, pmFPAview *view, bool bilevelAstrometry) { 221 215 222 bool status = false;223 224 216 if (!bilevelAstrometry) return true; 225 217 226 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 227 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 218 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 228 219 229 220 // loop over the available readouts -
branches/czw_branch/20101203/psphot/src/psphotStackMatchPSFs.c
r29548 r30118 8 8 psAssert(recipe, "We've thrown an error on this before."); 9 9 10 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 11 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 10 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 12 11 13 12 // 'options' carries info needed to perform the stack matching -
branches/czw_branch/20101203/psphot/src/psphotStackReadout.c
r29548 r30118 52 52 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are determined and saved on 53 53 // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT 54 if (!psphotLoadPSF (config, view )) {54 if (!psphotLoadPSF (config, view, STACK_RAW)) { 55 55 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 56 56 return psphotReadoutCleanup (config, view, STACK_OUT); -
branches/czw_branch/20101203/psphot/src/psphotSubtractBackground.c
r28013 r30118 132 132 psAssert (recipe, "missing recipe?"); 133 133 134 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 135 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 134 int num = psphotFileruleCount(config, filerule); 136 135 137 136 // loop over the available readouts 138 137 for (int i = 0; i < num; i++) { 139 138 if (!psphotSubtractBackgroundReadout (config, view, filerule, i, recipe)) { 140 psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for PSPHOT.INPUT entry %d", i);139 psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for %s entry %d", filerule, i); 141 140 return false; 142 141 } -
branches/czw_branch/20101203/psphot/src/psphotTest.c
r28405 r30118 137 137 psMetadataItem *mdi; 138 138 139 psMetadataConfigWrite (header, argv[2] );139 psMetadataConfigWrite (header, argv[2], NULL); 140 140 141 141 // attempt to write image with NAXIS = 0 -
branches/czw_branch/20101203/pstamp/scripts/pstamp_job_run.pl
r29885 r30118 277 277 # silently skip them if they don't exist. Perhaps this should be 278 278 # detected in pstampparse so that the user can be notified with 279 # a message in parse_error.txt ("warp do not have a background model") 280 my $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF); 279 # a message in parse_error.txt ("warp does not have a background model") 281 280 my $psf_file = $params->{psf} if ($options & $PSTAMP_SELECT_PSF); 282 281 my $backmdl_file = $params->{backmdl} if ($options & $PSTAMP_SELECT_BACKMDL); 283 282 my $pattern_file = $params->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL); 283 my $cmf_file; 284 if ($stage ne 'chip') { 285 # we don't ship chip stage cmf files because they may not be censored 286 $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF); 287 } 284 288 285 289 my $outdir = dirname($output_base); -
branches/czw_branch/20101203/pstamp/scripts/pstampparse.pl
r29578 r30118 126 126 } 127 127 128 # Adjust the label for requests coming in over the web interaface 129 130 my $label_changed = 0; 131 if ($label and $label eq "WEB.UP") { 132 my $lcname = lc($req_name); 133 if ($lcname =~ /pitt/) { 134 $label = "PITT"; 135 $label_changed = 1; 136 } elsif ($lcname =~ /cfa/) { 137 $label = "CFA"; 138 $label_changed = 1; 139 } elsif ($lcname =~ /durham/) { 140 $label = "DURHAM"; 141 $label_changed = 1; 142 } elsif ($lcname =~ /qub/) { 143 $label = "QUB"; 144 $label_changed = 1; 145 } 146 print "Setting label for $req_name to $label\n" if $label_changed; 147 } 148 149 128 150 if ($req_id and !$no_update) { 129 151 # update the database with the request name. This will be used as the … … 131 153 my $command = "$pstamptool -updatereq -req_id $req_id -set_name $req_name"; 132 154 $command .= " -set_outProduct $product"; 155 $command .= " -set_label $label" if $label_changed; 133 156 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 134 157 run(command => $command, verbose => $verbose); -
branches/czw_branch/20101203/pstamp/src/ppstampMakeStamp.c
r29885 r30118 320 320 } 321 321 if (readout->mask) { 322 outReadout->mask = extractStamp(readout->mask, extractRegion, 0); 322 psImageMaskType maskInitValue = pmConfigMaskGet("BLANK", config); 323 outReadout->mask = extractStamp(readout->mask, extractRegion, maskInitValue); 323 324 if (!outReadout->mask) { 324 325 psError(PS_ERR_UNKNOWN, false, "failed to create postage stamp mask image\n"); -
branches/czw_branch/20101203/pswarp/src/pswarpLoop.c
r28043 r30118 384 384 385 385 // measure the PSF using these sources 386 if (!psphotReadoutFindPSF(config, view, sources)) {386 if (!psphotReadoutFindPSF(config, view, "PSPHOT.INPUT", sources)) { 387 387 // This is likely a data quality issue 388 388 // XXX Split into multiple cases using error codes? -
branches/czw_branch/20101203/tools/czarplot.pl
r29862 r30118 126 126 127 127 128 my $plotter = new czartool::Plotter( 129 $gpc1Db, 130 $czarDb, 131 "%Y%m%d-%H%M%S", 132 $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", 133 $path, 134 $save_temps); 128 my $plotter = undef; 129 if ($savingToFile) { 130 131 $plotter = czartool::Plotter->new_file( 132 $gpc1Db, 133 $czarDb, 134 $path, 135 $save_temps); 136 } 137 else { 138 139 $plotter = czartool::Plotter->new_display( 140 $gpc1Db, 141 $czarDb, 142 $save_temps); 143 } 135 144 136 145 # sort out times … … 168 177 elsif ($nebulous) {$plotter->plotDiskUsageHistogram();} 169 178 if ($magicMask) { 170 179 171 180 if ($exposureId) {$plotter->plotMagicMaskFractionForThisExposure($exposureId);} 172 181 else {$plotter->plotMagicMaskFraction($begin, $end);} -
branches/czw_branch/20101203/tools/czarpoll.pl
r29861 r30118 14 14 use czartool::Burntool; 15 15 use czartool::DayMetrics; 16 16 use czartool::MetricsIndex; 17 17 18 18 my $period = 60; … … 29 29 my $nebulous = new czartool::Nebulous($czarDb); 30 30 my $pantasks = new czartool::Pantasks(); 31 my $plotter = new czartool::Plotter($gpc1Db, $czarDb, "%Y%m%d-%H%M%S", "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8", "/tmp", $save_temps); # TODO hardcoded font path31 my $plotter = czartool::Plotter->new_file($gpc1Db, $czarDb, "/tmp", $save_temps); 32 32 my $burntool = new czartool::Burntool(); 33 33 … … 108 108 my $newState = undef; 109 109 my $nsStatus = undef; 110 my $lastDay = strftime('%Y-%m-%d', localtime);111 110 my $today = undef; 112 my $doneMetricsToday = 1; 113 111 my $yesterday = undef; 112 my $newDayTime = "18:00"; 113 my $lastDayDailyTasks = "2010-01-01"; 114 115 # main polling loop 114 116 while (1) { 115 117 116 # check whether day has changed. if so, cleanup tables from previous day and optimize118 # sort out times 117 119 $today = strftime('%Y-%m-%d', localtime); 118 if ($czarDb->isBefore($lastDay, $today)) { 119 120 $yesterday = $czarDb->subtractInterval($today, "1 DAY"); 121 $end = $czarDb->getNowTimestamp(); 122 123 # if before 18:00 today, then start plots from 18:00 yesterday 124 if ($czarDb->isBefore($end, "$today $newDayTime")) {$begin = "$yesterday $newDayTime";} 125 # if after 18:00 today, then perform some daily tasks and start plots from 18:00 today 126 else { 127 128 $begin = "$today $newDayTime"; 129 130 # check whether yesterday was cleaned. if not, cleanup tables and optimize 131 if ($lastDayDailyTasks ne $yesterday) { 132 133 print "* performing daily tasks (clean-up, metrics)"; 134 135 # create metrics for last 24 hours 136 print "* Creating metrics for last 24 hours\n"; 137 # TODO hardcoded path needs to be in config 138 my $dayMetrics = new czartool::DayMetrics($gpc1Db, 139 $czarDb, 140 "/data/ipp004.0/ipp/ippMetrics/", 141 1, 0, $today); 142 $dayMetrics->writeHTML(); 143 144 # now update metrics index page 145 my $metricsIndex = new czartool::MetricsIndex($gpc1Db, 146 $czarDb, 147 "/data/ipp004.0/ipp/ippMetrics/", 148 1, 0); 149 $metricsIndex->writeHTML(); 150 151 # now cleanup tables from yesterday and optimize 120 152 print "* New day - performing cleanup\n"; 121 $czarDb->cleanupDateRange($ lastDay, $lastDay, "30 MINUTE");153 $czarDb->cleanupDateRange($yesterday, $yesterday, "30 MINUTE"); 122 154 $czarDb->optimize(); 123 $lastDay = $today; 124 $doneMetricsToday = 0; 125 } 126 127 # sort out times 128 $begin = strftime('%Y-%m-%d 06:35', localtime); 129 $end = $czarDb->getNowTimestamp(); 130 131 # if time now is after 06:35am, then create metrics for past 24 hours 132 if (!$doneMetricsToday && $czarDb->isBefore($begin, $end)) { 133 134 print "* Creating metrics for last 24 hours\n"; 135 my $yesterday = $czarDb->subtractInterval($today, "1 DAY"); 136 # TODO hardcoded path needs to be in config 137 my $dayMetrics = new czartool::DayMetrics($gpc1Db, $czarDb, "/data/ipp004.0/ipp/ippMetrics/", 1, 0, $yesterday); 138 $dayMetrics->writeHTML(); 139 $doneMetricsToday = 1; 140 } 141 142 # if time now is before 06:35am, include data from previous day 143 if ($czarDb->isBefore($end, $begin)) { 144 145 $begin = $czarDb->subtractInterval($begin, "1 DAY"); 155 $lastDayDailyTasks = $yesterday; 156 } 146 157 } 147 158 … … 237 248 238 249 $plotter->createLogAndLinearTimeSeries($allServerLabels, $stage, $begin, $end); # TODO must be a neater way... 239 $plotter->createRateTimeSeries($allServerLabels, $stage, $begin, $end, undef, 0);250 $plotter->createRateTimeSeries($allServerLabels, $stage, $begin, $end, undef, 0); 240 251 } 241 252 } … … 261 272 my $server = undef; 262 273 my $state = undef; 263 274 264 275 foreach $stage (@stages) { 265 276 -
branches/czw_branch/20101203/tools/czartool/DayMetrics.pm
r29863 r30118 37 37 $self->{day} = $_[6]; 38 38 39 my $yesterday = $self->{czarDb}->subtractInterval($self->{day}, "1 DAY"); 40 39 41 # sort out times 40 $self->{begin} = "$ self->{day} 06:00";42 $self->{begin} = "$yesterday 18:00"; 41 43 $self->{end} = $self->{czarDb}->addInterval($self->{begin}, "1 DAY"); 42 44 $self->{burntoolEnd} = $self->{czarDb}->addInterval($self->{begin}, "12 HOUR"); -
branches/czw_branch/20101203/tools/czartool/Metrics.pm
r29867 r30118 35 35 36 36 # instantiate a plotter object 37 $self->{plotter} = new czartool::Plotter(37 $self->{plotter} = czartool::Plotter->new_file( 38 38 $self->{gpc1Db}, 39 39 $self->{czarDb}, 40 "%Y%m%d-%H%M%S",41 "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8",42 40 ".", 43 41 $self->{save_temps}); -
branches/czw_branch/20101203/tools/czartool/Plotter.pm
r29864 r30118 10 10 my @allStages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); 11 11 12 13 ########################################################################### 14 # 15 # Constructor 12 ########################################################################### 13 # 14 # Main constructor with all arguments 16 15 # 17 16 ########################################################################### … … 30 29 return $self; 31 30 } 31 32 ########################################################################### 33 # 34 # Constructor sending all plots to file 35 # 36 ########################################################################### 37 sub new_file { 38 my $class = shift; 39 my $self = { 40 _gpc1Db => shift, 41 _czarDb => shift, 42 _outputPath => shift, 43 _save_temps => shift, 44 }; 45 46 $self->{_dateFormat} = "%Y%m%d-%H%M%S"; 47 $self->{_outputFormat} = "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8"; # TODO path needs to be in config 48 49 bless $self, $class; 50 return $self; 51 } 52 53 ########################################################################### 54 # 55 # Constructor sending all plots to an X window 56 # 57 ########################################################################### 58 sub new_display { 59 my $class = shift; 60 my $self = { 61 _gpc1Db => shift, 62 _czarDb => shift, 63 _save_temps => shift, 64 }; 65 66 $self->{_dateFormat} = "%Y%m%d-%H%M%S"; 67 $self->{_outputFormat} = "X11"; 68 $self->{_outputPath} = undef; 69 70 bless $self, $class; 71 return $self; 72 } 73 74 32 75 33 76 ########################################################################### -
branches/czw_branch/20101203/tools/makedistdest
r29237 r30118 13 13 14 14 my $prod_name; 15 my $dbhost; 15 16 16 17 GetOptions( 17 18 'prod_name=s' => \$prod_name, 19 'dbhost=s' => \$dbhost, 18 20 ) or pod2usage( 2 ); 19 21 20 22 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 21 pod2usage( -msg => "Required options: --prod_name ",23 pod2usage( -msg => "Required options: --prod_name --dbhost", 22 24 -exitval => 3) 23 unless defined $prod_name; 25 unless defined $prod_name 26 and defined $dbhost; 24 27 25 28 my $cmd = "dsprodtool --add $prod_name --type ipp-dist --description $prod_name"; … … 31 34 die "dsprodtool failed: $rc" if $rc; 32 35 33 $cmd = "disttool -dbname gpc1 -definedestination -ds_dbname ippRequestServer -ds_dbhost ippdb02-name $prod_name";36 $cmd = "disttool -dbname gpc1 -definedestination -ds_dbname ippRequestServer -ds_dbhost $dbhost -name $prod_name"; 34 37 35 38 $rc = system $cmd;
Note:
See TracChangeset
for help on using the changeset viewer.
