Changeset 37807
- Timestamp:
- Jan 11, 2015, 2:14:39 PM (12 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 304 edited
- 133 copied
-
. (modified) (1 prop)
-
Makefile.in (modified) (1 diff)
-
configure.tcsh (modified) (2 diffs)
-
src/addstar/Makefile (modified) (5 diffs)
-
src/addstar/include/WISE.h (modified) (1 diff)
-
src/addstar/include/addstar.h (modified) (3 diffs)
-
src/addstar/include/loadICRF.h (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/include/loadICRF.h )
-
src/addstar/include/loadstarpar.h (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/include/loadstarpar.h )
-
src/addstar/src/LoadData.c (modified) (1 diff)
-
src/addstar/src/LoadDataPMM.c (modified) (2 diffs)
-
src/addstar/src/LoadStars.c (modified) (1 diff)
-
src/addstar/src/NewImage.c (modified) (1 diff)
-
src/addstar/src/ReadImageHeader.c (modified) (3 diffs)
-
src/addstar/src/ReadStarsSDSS.c (modified) (1 diff)
-
src/addstar/src/UpdateDatabase_Image.c (modified) (1 diff)
-
src/addstar/src/addstar.c (modified) (3 diffs)
-
src/addstar/src/args.c (modified) (1 diff)
-
src/addstar/src/args_client.c (modified) (1 diff)
-
src/addstar/src/args_loadICRF.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/args_loadICRF.c )
-
src/addstar/src/args_loadstarpar.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/args_loadstarpar.c )
-
src/addstar/src/args_loadwise.c (modified) (1 diff)
-
src/addstar/src/build_links.c (modified) (1 diff)
-
src/addstar/src/coord_transforms.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/coord_transforms.c )
-
src/addstar/src/fakeimage.c (modified) (5 diffs)
-
src/addstar/src/find_matches.c (modified) (2 diffs)
-
src/addstar/src/find_matches_ICRF.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_ICRF.c )
-
src/addstar/src/find_matches_closest.c (modified) (2 diffs)
-
src/addstar/src/find_matches_closest_refstars.c (modified) (2 diffs)
-
src/addstar/src/find_matches_refstars.c (modified) (1 diff)
-
src/addstar/src/find_matches_starpar.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_matches_starpar.c )
-
src/addstar/src/find_missing.c (modified) (2 diffs)
-
src/addstar/src/loadICRF.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF.c )
-
src/addstar/src/loadICRF_catalog.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF_catalog.c )
-
src/addstar/src/loadICRF_client.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF_client.c )
-
src/addstar/src/loadICRF_io.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF_io.c )
-
src/addstar/src/loadICRF_make_subset.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF_make_subset.c )
-
src/addstar/src/loadICRF_readstars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF_readstars.c )
-
src/addstar/src/loadICRF_remote_hosts.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF_remote_hosts.c )
-
src/addstar/src/loadICRF_save_remote.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF_save_remote.c )
-
src/addstar/src/loadICRF_table.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadICRF_table.c )
-
src/addstar/src/loadstarpar.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar.c )
-
src/addstar/src/loadstarpar_catalog.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_catalog.c )
-
src/addstar/src/loadstarpar_client.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_client.c )
-
src/addstar/src/loadstarpar_io.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_io.c )
-
src/addstar/src/loadstarpar_make_subset.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_make_subset.c )
-
src/addstar/src/loadstarpar_readstars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_readstars.c )
-
src/addstar/src/loadstarpar_remote_hosts.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_remote_hosts.c )
-
src/addstar/src/loadstarpar_save_remote.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_save_remote.c )
-
src/addstar/src/loadstarpar_table.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_table.c )
-
src/addstar/src/loadsupercos_plates.c (modified) (2 diffs)
-
src/addstar/src/loadwise.c (modified) (1 diff)
-
src/addstar/src/loadwise_rawdata.c (modified) (2 diffs)
-
src/addstar/src/mkcmf.c (modified) (3 diffs)
-
src/addstar/src/resort_catalog.c (modified) (3 diffs)
-
src/addstar/src/sky_tessalation.c (modified) (8 diffs)
-
src/addstar/test/relphot.parallel.dvo (modified) (11 diffs)
-
src/checkastro/src/ImageOps.c (modified) (2 diffs)
-
src/checkastro/src/bcatalog.c (modified) (1 diff)
-
src/checkastro/src/load_images.c (modified) (1 diff)
-
src/checkastro/src/select_images.c (modified) (2 diffs)
-
src/delstar/src/ImageOpsFixLAP.c (modified) (1 diff)
-
src/delstar/src/delete_duplicate_measures.c (modified) (4 diffs)
-
src/delstar/src/delete_imagename.c (modified) (2 diffs)
-
src/delstar/src/delete_times.c (modified) (2 diffs)
-
src/dvomerge/Makefile (modified) (3 diffs)
-
src/dvomerge/include/dvomerge.h (modified) (3 diffs)
-
src/dvomerge/include/dvoutils.h (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/include/dvoutils.h )
-
src/dvomerge/src/ImageOps.c (modified) (1 diff)
-
src/dvomerge/src/LoadCatalog.c (modified) (1 diff)
-
src/dvomerge/src/ReadDeleteListExternID.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/ReadDeleteListExternID.c )
-
src/dvomerge/src/args.c (modified) (3 diffs)
-
src/dvomerge/src/build_links.c (modified) (1 diff)
-
src/dvomerge/src/dvo_image_merge_dbs.c (modified) (1 diff)
-
src/dvomerge/src/dvomergeUpdate_catalogs.c (modified) (4 diffs)
-
src/dvomerge/src/dvorepair.c (modified) (2 diffs)
-
src/dvomerge/src/dvorepairCPT.c (modified) (1 diff)
-
src/dvomerge/src/dvorepairDeleteImageList.c (modified) (2 diffs)
-
src/dvomerge/src/dvorepairDeleteImagesByExternID.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvorepairDeleteImagesByExternID.c )
-
src/dvomerge/src/dvorepairFixImages.c (modified) (3 diffs)
-
src/dvomerge/src/dvorepairFixTables.c (modified) (1 diff)
-
src/dvomerge/src/dvoutils.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvoutils.c )
-
src/dvomerge/src/dvoutils_args.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvoutils_args.c )
-
src/dvomerge/src/dvoutils_load_image_index.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvoutils_load_image_index.c )
-
src/dvomerge/src/dvoutils_uniq_images.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvoutils_uniq_images.c )
-
src/dvomerge/src/dvoverify_utils.c (modified) (1 diff)
-
src/dvomerge/src/merge_catalogs_new.c (modified) (3 diffs)
-
src/dvomerge/src/merge_catalogs_old.c (modified) (15 diffs)
-
src/dvomerge/src/myIndex.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/myIndex.c )
-
src/dvopsps/src/insert_detections_dvopsps_catalog.c (modified) (1 diff)
-
src/dvopsps/src/insert_objects_dvopsps_catalog.c (modified) (1 diff)
-
src/dvosplit/include/dvosplit.h (modified) (1 diff)
-
src/dvosplit/src/args.c (modified) (1 diff)
-
src/dvosplit/src/split_averages.c (modified) (4 diffs)
-
src/dvosplit/src/split_measures.c (modified) (4 diffs)
-
src/fakeastro (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro )
-
src/fakeastro/Makefile (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/Makefile )
-
src/fakeastro/doc (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/doc )
-
src/fakeastro/doc/example.sh (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/doc/example.sh )
-
src/fakeastro/include (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/include )
-
src/fakeastro/include/fakeastro.h (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/include/fakeastro.h )
-
src/fakeastro/src (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src )
-
src/fakeastro/src/AstromOffsetMapOps.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/AstromOffsetMapOps.c )
-
src/fakeastro/src/ConfigInit.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/ConfigInit.c )
-
src/fakeastro/src/SetSignals.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/SetSignals.c )
-
src/fakeastro/src/Shutdown.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/Shutdown.c )
-
src/fakeastro/src/StarOps.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/StarOps.c )
-
src/fakeastro/src/airmass.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/airmass.c )
-
src/fakeastro/src/args.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/args.c )
-
src/fakeastro/src/fakeastro.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro.c )
-
src/fakeastro/src/fakeastro_2mass.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_2mass.c )
-
src/fakeastro/src/fakeastro_client.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_client.c )
-
src/fakeastro/src/fakeastro_galaxy.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_galaxy.c )
-
src/fakeastro/src/fakeastro_images.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_images.c )
-
src/fakeastro/src/fakeastro_images_region.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakeastro_images_region.c )
-
src/fakeastro/src/fakestar_catalog.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakestar_catalog.c )
-
src/fakeastro/src/fakestar_io.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fakestar_io.c )
-
src/fakeastro/src/fit_fake_stars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fit_fake_stars.c )
-
src/fakeastro/src/fitpoly.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/fitpoly.c )
-
src/fakeastro/src/gaussian.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/gaussian.c )
-
src/fakeastro/src/get_image_patch.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/get_image_patch.c )
-
src/fakeastro/src/initialize.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/initialize.c )
-
src/fakeastro/src/insert_fakestar.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/insert_fakestar.c )
-
src/fakeastro/src/load_fake_stars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/load_fake_stars.c )
-
src/fakeastro/src/load_template_images.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/load_template_images.c )
-
src/fakeastro/src/make_2mass_measures.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_2mass_measures.c )
-
src/fakeastro/src/make_fake_images.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_images.c )
-
src/fakeastro/src/make_fake_stars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars.c )
-
src/fakeastro/src/make_fake_stars_catalog.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fake_stars_catalog.c )
-
src/fakeastro/src/make_fakeqsos.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fakeqsos.c )
-
src/fakeastro/src/make_fakestars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_fakestars.c )
-
src/fakeastro/src/make_subset.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/make_subset.c )
-
src/fakeastro/src/match_fake_stars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/match_fake_stars.c )
-
src/fakeastro/src/remote_hosts.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/remote_hosts.c )
-
src/fakeastro/src/save_fake_stars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/save_fake_stars.c )
-
src/fakeastro/src/save_fakestars.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/fakeastro/src/save_fakestars.c )
-
src/fixcat/src/gcatstats.c (modified) (1 diff)
-
src/gastro/src/gfitpoly.c (modified) (2 diffs)
-
src/gastro/src/gstars.c (modified) (1 diff)
-
src/gastro2/src/gproject2.c (modified) (1 diff)
-
src/gastro2/src/gstars2.c (modified) (1 diff)
-
src/getstar (modified) (1 prop)
-
src/getstar/include/dvoImageOverlaps.h (modified) (1 diff)
-
src/getstar/src/MatchCoords.c (modified) (1 diff)
-
src/getstar/src/MatchImages.c (modified) (2 diffs)
-
src/getstar/src/ReadImageFiles.c (modified) (1 diff)
-
src/getstar/src/ReadImageHeader.c (modified) (3 diffs)
-
src/getstar/src/WriteImages.c (modified) (3 diffs)
-
src/imregister/imphot/dumpfits.c (modified) (1 diff)
-
src/imregister/imphot/modify.c (modified) (1 diff)
-
src/kapa2/include/constants.h (modified) (1 diff)
-
src/kapa2/include/structures.h (modified) (1 diff)
-
src/kapa2/src/CreatePicture.c (modified) (1 diff)
-
src/kapa2/src/CursorOps.c (modified) (2 diffs)
-
src/kapa2/src/Graphs.c (modified) (1 diff)
-
src/kapa2/src/Image.c (modified) (2 diffs)
-
src/kapa2/src/InterpretKeys.c (modified) (1 diff)
-
src/kapa2/src/LoadPicture.c (modified) (1 diff)
-
src/kapa2/src/Reconfig.c (modified) (1 diff)
-
src/kapa2/src/Remap32.c (modified) (6 diffs)
-
src/kapa2/src/SetChannel.c (modified) (2 diffs)
-
src/kapa2/src/UpdateStatusBox.c (modified) (1 diff)
-
src/libautocode/Makefile.Targets (modified) (12 diffs)
-
src/libautocode/README (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/README )
-
src/libautocode/def/AstromOffsetMap_Disk.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/AstromOffsetMap_Disk.d )
-
src/libautocode/def/average-ps1-sim.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/average-ps1-sim.d )
-
src/libautocode/def/average-ps1-v5.d (modified) (2 diffs)
-
src/libautocode/def/average.d (modified) (2 diffs)
-
src/libautocode/def/coords-disk.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/coords-disk.d )
-
src/libautocode/def/coords.d (modified) (1 diff)
-
src/libautocode/def/image-elixir.d (modified) (1 diff)
-
src/libautocode/def/image-loneos.d (modified) (1 diff)
-
src/libautocode/def/image-panstarrs-dev-0.d (modified) (1 diff)
-
src/libautocode/def/image-panstarrs-dev-1.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-dev-1.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-dev-2.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-dev-3.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-ref.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-sim.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/image-ps1-sim.d )
-
src/libautocode/def/image-ps1-v1.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-v2.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-v3.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-v4.d (modified) (1 diff)
-
src/libautocode/def/image-ps1-v5.d (modified) (1 diff)
-
src/libautocode/def/image.d (modified) (4 diffs)
-
src/libautocode/def/lensing-ps1-v5-alt.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/lensing-ps1-v5-alt.d )
-
src/libautocode/def/lensing-ps1-v5.d (modified) (1 diff)
-
src/libautocode/def/lensing.d (modified) (1 diff)
-
src/libautocode/def/lensobj-ps1-v5.d (modified) (1 diff)
-
src/libautocode/def/lensobj.d (modified) (1 diff)
-
src/libautocode/def/measure-ps1-sim.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/measure-ps1-sim.d )
-
src/libautocode/def/secfilt-ps1-sim.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/secfilt-ps1-sim.d )
-
src/libautocode/def/starpar-ps1-sim.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-sim.d )
-
src/libautocode/def/starpar-ps1-v5.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-v5.d )
-
src/libautocode/def/starpar.d (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar.d )
-
src/libautocode/doc/autocode.txt (modified) (2 diffs)
-
src/libautocode/generate (modified) (4 diffs)
-
src/libdvo/Makefile (modified) (3 diffs)
-
src/libdvo/include/dvo.h (modified) (23 diffs)
-
src/libdvo/include/dvodb.h (modified) (7 diffs)
-
src/libdvo/include/libdvo_astro.h (modified) (2 diffs)
-
src/libdvo/include/ps1_sim_defs.h (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libdvo/include/ps1_sim_defs.h )
-
src/libdvo/include/ps1_v5_defs.h (modified) (1 diff)
-
src/libdvo/src/AstromOffsetMapIO.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/AstromOffsetMapIO.c )
-
src/libdvo/src/AstromOffsetMapOps.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/AstromOffsetMapOps.c )
-
src/libdvo/src/AstromOffsetMapUtils.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/AstromOffsetMapUtils.c )
-
src/libdvo/src/BoundaryTree.c (modified) (1 diff)
-
src/libdvo/src/HostTable.c (modified) (9 diffs)
-
src/libdvo/src/ImageMetadata.c (modified) (1 diff)
-
src/libdvo/src/ImageMetadataSelection.c (modified) (1 diff)
-
src/libdvo/src/ImageOps.c (modified) (2 diffs)
-
src/libdvo/src/ImageSelection.c (modified) (3 diffs)
-
src/libdvo/src/LoadImages.c (modified) (4 diffs)
-
src/libdvo/src/RegionHostTable.c (modified) (1 diff)
-
src/libdvo/src/astrom_maps.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/astrom_maps.c )
-
src/libdvo/src/coord_systems.c (modified) (5 diffs)
-
src/libdvo/src/coordops.c (modified) (9 diffs)
-
src/libdvo/src/dbExtractAverages.c (modified) (5 diffs)
-
src/libdvo/src/dbExtractImages.c (modified) (9 diffs)
-
src/libdvo/src/dbExtractMeasures.c (modified) (8 diffs)
-
src/libdvo/src/dbFields.c (modified) (8 diffs)
-
src/libdvo/src/dvo_catalog.c (modified) (17 diffs)
-
src/libdvo/src/dvo_catalog_create.c (modified) (3 diffs)
-
src/libdvo/src/dvo_catalog_mef.c (modified) (7 diffs)
-
src/libdvo/src/dvo_catalog_raw.c (modified) (8 diffs)
-
src/libdvo/src/dvo_catalog_split.c (modified) (32 diffs)
-
src/libdvo/src/dvo_convert.c (modified) (16 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_1.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_2.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_3.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_REF.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_SIM.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c )
-
src/libdvo/src/dvo_convert_PS1_V1.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V2.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V3.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V4.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V5.c (modified) (9 diffs)
-
src/libdvo/src/dvo_convert_elixir.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_loneos.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_panstarrs_DEV_0.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_panstarrs_DEV_1.c (modified) (2 diffs)
-
src/libdvo/src/dvo_image.c (modified) (4 diffs)
-
src/libdvo/src/dvo_image_raw.c (modified) (2 diffs)
-
src/libdvo/src/dvo_photcode_ops.c (modified) (1 diff)
-
src/libdvo/src/dvo_tiny_values.c (modified) (1 diff)
-
src/libdvo/src/dvo_util.c (modified) (1 diff)
-
src/libdvo/src/flatcorr_io.c (modified) (2 diffs)
-
src/libdvo/src/galaxy_model.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/galaxy_model.c )
-
src/libdvo/src/mosaic_astrom.c (modified) (4 diffs)
-
src/libdvo/src/skyregion_gsc.c (modified) (1 diff)
-
src/libdvo/src/skyregion_ops.c (modified) (2 diffs)
-
src/libfits/Makefile (modified) (1 diff)
-
src/libfits/header/F_find_H.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libfits/header/F_find_H.c )
-
src/libfits/header/F_free_H.c (modified) (1 diff)
-
src/libfits/include/gfitsio.h (modified) (3 diffs)
-
src/libfits/table/F_read_T.c (modified) (3 diffs)
-
src/libfits/table/F_write_T.c (modified) (1 diff)
-
src/libkapa/src/KapaWindow.c (modified) (1 diff)
-
src/libohana/Makefile (modified) (2 diffs)
-
src/libohana/doc/gsl.txt (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libohana/doc/gsl.txt )
-
src/libohana/include/gsl_utils.h (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libohana/include/gsl_utils.h )
-
src/libohana/include/ohana.h (modified) (4 diffs)
-
src/libohana/src/gaussj.c (modified) (7 diffs)
-
src/libohana/src/glockfile.c (modified) (2 diffs)
-
src/libohana/src/gsl_gamma.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libohana/src/gsl_gamma.c )
-
src/libohana/src/gsl_utils.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libohana/src/gsl_utils.c )
-
src/libohana/src/legendre.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libohana/src/legendre.c )
-
src/libohana/src/ohana_allocate.c (modified) (1 diff)
-
src/libohana/src/spherical.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libohana/src/spherical.c )
-
src/libohana/src/vstats.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/libohana/src/vstats.c )
-
src/markrock/src/gcatstats.c (modified) (1 diff)
-
src/markstar/src/gcatstats.c (modified) (1 diff)
-
src/mosastro/src/chips.c (modified) (1 diff)
-
src/mosastro/src/fakefield.c (modified) (2 diffs)
-
src/mosastro/src/field.c (modified) (6 diffs)
-
src/mosastro/src/fitpoly.c (modified) (2 diffs)
-
src/mosastro/src/mkobs.c (modified) (2 diffs)
-
src/mosastro/src/mkstandards.c (modified) (1 diff)
-
src/mosastro/src/testcoords.c (modified) (1 diff)
-
src/opihi/cmd.astro/Makefile (modified) (1 diff)
-
src/opihi/cmd.astro/cdensify.c (modified) (1 diff)
-
src/opihi/cmd.astro/coords.c (modified) (1 diff)
-
src/opihi/cmd.astro/csystem.c (modified) (1 diff)
-
src/opihi/cmd.astro/fitplx.c (modified) (1 diff)
-
src/opihi/cmd.astro/fitpm.c (modified) (1 diff)
-
src/opihi/cmd.astro/gauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/getcoords.c (modified) (2 diffs)
-
src/opihi/cmd.astro/init.c (modified) (2 diffs)
-
src/opihi/cmd.astro/objload.c (modified) (1 diff)
-
src/opihi/cmd.astro/region.c (modified) (4 diffs)
-
src/opihi/cmd.astro/shimage.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.astro/shimage.c )
-
src/opihi/cmd.astro/vshimage.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.astro/vshimage.c )
-
src/opihi/cmd.data/Makefile (modified) (2 diffs)
-
src/opihi/cmd.data/center.c (modified) (1 diff)
-
src/opihi/cmd.data/dft2d.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/dft2d.c )
-
src/opihi/cmd.data/dimenup.c (modified) (1 diff)
-
src/opihi/cmd.data/erase.c (modified) (1 diff)
-
src/opihi/cmd.data/fit2d.c (modified) (1 diff)
-
src/opihi/cmd.data/init.c (modified) (5 diffs)
-
src/opihi/cmd.data/load.c (modified) (1 diff)
-
src/opihi/cmd.data/point.c (modified) (1 diff)
-
src/opihi/cmd.data/read_vectors.c (modified) (9 diffs)
-
src/opihi/cmd.data/relocate.c (modified) (1 diff)
-
src/opihi/cmd.data/resize.c (modified) (1 diff)
-
src/opihi/cmd.data/save.c (modified) (1 diff)
-
src/opihi/cmd.data/shapply.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/shapply.c )
-
src/opihi/cmd.data/shdot.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/shdot.c )
-
src/opihi/cmd.data/shfit.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/shfit.c )
-
src/opihi/cmd.data/shterms.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/shterms.c )
-
src/opihi/cmd.data/tv.c (modified) (1 diff)
-
src/opihi/cmd.data/tvchannel.c (modified) (1 diff)
-
src/opihi/cmd.data/tvcontour.c (modified) (1 diff)
-
src/opihi/cmd.data/tvgrid.c (modified) (1 diff)
-
src/opihi/cmd.data/vload.c (modified) (1 diff)
-
src/opihi/cmd.data/vsh.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/vsh.c )
-
src/opihi/cmd.data/vshfit.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.data/vshfit.c )
-
src/opihi/cmd.data/vzload.c (modified) (1 diff)
-
src/opihi/dvo/Makefile (modified) (1 diff)
-
src/opihi/dvo/avextract.c (modified) (5 diffs)
-
src/opihi/dvo/avmatch.c (modified) (3 diffs)
-
src/opihi/dvo/catname.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/catname.c )
-
src/opihi/dvo/cmpload.c (modified) (1 diff)
-
src/opihi/dvo/dvo_host_utils.c (modified) (1 diff)
-
src/opihi/dvo/find_matches.c (modified) (2 diffs)
-
src/opihi/dvo/gimages.c (modified) (3 diffs)
-
src/opihi/dvo/images.c (modified) (5 diffs)
-
src/opihi/dvo/imbox.c (modified) (1 diff)
-
src/opihi/dvo/imdata.c (modified) (2 diffs)
-
src/opihi/dvo/imdense.c (modified) (2 diffs)
-
src/opihi/dvo/imextract.c (modified) (1 diff)
-
src/opihi/dvo/imlist.c (modified) (4 diffs)
-
src/opihi/dvo/imstats.c (modified) (2 diffs)
-
src/opihi/dvo/init.c (modified) (2 diffs)
-
src/opihi/dvo/mextract.c (modified) (3 diffs)
-
src/opihi/dvo/mmatch.c (modified) (3 diffs)
-
src/opihi/dvo/mmextract.c (modified) (2 diffs)
-
src/opihi/dvo/objectcoverage.c (modified) (2 diffs)
-
src/opihi/dvo/showtile.c (modified) (1 diff)
-
src/opihi/dvo/simage.c (modified) (1 diff)
-
src/opihi/dvo/skycoverage.c (modified) (4 diffs)
-
src/opihi/dvo/subpix.c (modified) (2 diffs)
-
src/opihi/include/astro.h (modified) (1 diff)
-
src/opihi/include/data.h (modified) (1 diff)
-
src/opihi/include/dvomath.h (modified) (1 diff)
-
src/opihi/lib.shell/BufferOps.c (modified) (1 diff)
-
src/opihi/pantasks/controller_status.c (modified) (2 diffs)
-
src/opihi/pantasks/test/runmacro.sh (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/pantasks/test/runmacro.sh )
-
src/opihi/pantasks/test/trange.sh (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/opihi/pantasks/test/trange.sh )
-
src/opihi/pcontrol/Makefile (modified) (1 diff)
-
src/opihi/pcontrol/status.c (modified) (1 diff)
-
src/photdbc/include/photdbc.h (modified) (2 diffs)
-
src/photdbc/src/CopyToHostLocation.c (modified) (1 diff)
-
src/photdbc/src/args.c (modified) (5 diffs)
-
src/photdbc/src/copy_images.c (modified) (2 diffs)
-
src/photdbc/src/find_images.c (modified) (1 diff)
-
src/photdbc/src/join_stars.c (modified) (1 diff)
-
src/photdbc/src/photdbc.c (modified) (1 diff)
-
src/photdbc/src/photdbc_catalogs.c (modified) (3 diffs)
-
src/photdbc/src/select_images.c (modified) (3 diffs)
-
src/relastro/Makefile (modified) (5 diffs)
-
src/relastro/doc/pv2.txt (modified) (1 diff)
-
src/relastro/include/relastro.h (modified) (14 diffs)
-
src/relastro/src/BrightCatalog.c (modified) (10 diffs)
-
src/relastro/src/ConfigInit.c (modified) (2 diffs)
-
src/relastro/src/FitChip.c (modified) (6 diffs)
-
src/relastro/src/FrameCorrection.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FrameCorrection.c )
-
src/relastro/src/FrameCorrectionIO.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FrameCorrectionIO.c )
-
src/relastro/src/FrameCorrectionUtils.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FrameCorrectionUtils.c )
-
src/relastro/src/ICRF.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ICRF.c )
-
src/relastro/src/ICRFobjIO.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ICRFobjIO.c )
-
src/relastro/src/ImageOps.c (modified) (14 diffs)
-
src/relastro/src/ImagePosIO.c (modified) (7 diffs)
-
src/relastro/src/MeasPosIO.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/MeasPosIO.c )
-
src/relastro/src/StarMaps.c (modified) (1 diff)
-
src/relastro/src/UpdateChips.c (modified) (13 diffs)
-
src/relastro/src/UpdateMeasures.c (modified) (2 diffs)
-
src/relastro/src/UpdateObjectOffsets.c (modified) (3 diffs)
-
src/relastro/src/UpdateObjects.c (modified) (16 diffs)
-
src/relastro/src/args.c (modified) (5 diffs)
-
src/relastro/src/assign_images.c (modified) (4 diffs)
-
src/relastro/src/bcatalog.c (modified) (10 diffs)
-
src/relastro/src/client_logger.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/client_logger.c )
-
src/relastro/src/fitpoly.c (modified) (5 diffs)
-
src/relastro/src/high_speed_objects.c (modified) (3 diffs)
-
src/relastro/src/high_speed_utils.c (modified) (2 diffs)
-
src/relastro/src/hpm_objects.c (modified) (4 diffs)
-
src/relastro/src/initialize.c (modified) (2 diffs)
-
src/relastro/src/launch_region_hosts.c (modified) (5 diffs)
-
src/relastro/src/liststats.c (modified) (1 diff)
-
src/relastro/src/load_catalogs.c (modified) (4 diffs)
-
src/relastro/src/load_images.c (modified) (3 diffs)
-
src/relastro/src/markObjects.c (modified) (1 diff)
-
src/relastro/src/relastroVisual.c (modified) (2 diffs)
-
src/relastro/src/relastro_client.c (modified) (1 diff)
-
src/relastro/src/relastro_images.c (modified) (7 diffs)
-
src/relastro/src/relastro_objects.c (modified) (1 diff)
-
src/relastro/src/relastro_parallel_images.c (modified) (7 diffs)
-
src/relastro/src/relastro_parallel_regions.c (modified) (3 diffs)
-
src/relastro/src/select_images.c (modified) (4 diffs)
-
src/relastro/src/share_icrf_obj.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/share_icrf_obj.c )
-
src/relastro/src/share_images_pos.c (modified) (4 diffs)
-
src/relastro/src/share_meas_pos.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/share_meas_pos.c )
-
src/relastro/src/testparallax.c (modified) (1 diff)
-
src/relphot/doc/timeline.txt (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/relphot/doc/timeline.txt )
-
src/relphot/include/relphot.h (modified) (1 diff)
-
src/relphot/src/BoundaryTreeOps.c (modified) (1 diff)
-
src/relphot/src/ImageOps.c (modified) (4 diffs)
-
src/relphot/src/ImageTable.c (modified) (1 diff)
-
src/relphot/src/MosaicOps.c (modified) (5 diffs)
-
src/relphot/src/assign_images.c (modified) (3 diffs)
-
src/relphot/src/load_images.c (modified) (1 diff)
-
src/relphot/src/reload_catalogs.c (modified) (6 diffs)
-
src/relphot/src/relphot.c (modified) (3 diffs)
-
src/relphot/src/relphot_objects.c (modified) (1 diff)
-
src/relphot/src/relphot_parallel_regions.c (modified) (2 diffs)
-
src/relphot/src/select_images.c (modified) (5 diffs)
-
src/relphot/src/setMrelCatalog.c (modified) (9 diffs)
-
src/uniphot/Makefile (modified) (6 diffs)
-
src/uniphot/include/setastrom.h (modified) (2 diffs)
-
src/uniphot/include/setgalmodel.h (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/include/setgalmodel.h )
-
src/uniphot/src/astrom_correction.c (modified) (1 diff)
-
src/uniphot/src/dcr_correction.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/dcr_correction.c )
-
src/uniphot/src/find_image_sgroups.c (modified) (3 diffs)
-
src/uniphot/src/galmodel_correction.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/galmodel_correction.c )
-
src/uniphot/src/initialize_setastrom.c (modified) (6 diffs)
-
src/uniphot/src/initialize_setgalmodel.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/initialize_setgalmodel.c )
-
src/uniphot/src/kh_correction.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/kh_correction.c )
-
src/uniphot/src/load_zpt_table.c (modified) (5 diffs)
-
src/uniphot/src/match_zpts_to_images.c (modified) (1 diff)
-
src/uniphot/src/setgalmodel.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/setgalmodel.c )
-
src/uniphot/src/setgalmodel_client.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/setgalmodel_client.c )
-
src/uniphot/src/update_catalog_setastrom.c (modified) (4 diffs)
-
src/uniphot/src/update_catalog_setastrom_dcr.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/update_catalog_setastrom_dcr.c )
-
src/uniphot/src/update_catalog_setastrom_kh.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/update_catalog_setastrom_kh.c )
-
src/uniphot/src/update_catalog_setgalmodel.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/update_catalog_setgalmodel.c )
-
src/uniphot/src/update_dvo_setastrom.c (modified) (5 diffs)
-
src/uniphot/src/update_dvo_setgalmodel.c (copied) (copied from branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/update_dvo_setgalmodel.c )
-
src/uniphot/src/update_dvo_uniphot.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
-
trunk/Ohana/Makefile.in
r35110 r37807 34 34 dvopsps \ 35 35 elixir \ 36 fakeastro \ 36 37 gastro \ 37 38 gastro2 \ -
trunk/Ohana/configure.tcsh
r34088 r37807 240 240 set needlibs = "$needlibs X11" 241 241 set needlibs = "$needlibs pthread" 242 set needlibs = "$needlibs gsl" 243 set needlibs = "$needlibs gslcblas" 242 244 set needlibs = "$needlibs m" 243 245 … … 269 271 set needincs = "$needincs png.h" 270 272 set needincs = "$needincs pthread.h" 273 set needincs = "$needincs gsl/gsl_sf_legendre.h" 271 274 set needincs = "$needincs readline/history.h" 272 275 set needincs = "$needincs readline/readline.h" -
trunk/Ohana/src/addstar/Makefile
r37357 r37807 24 24 sedstar : $(BIN)/sedstar.$(ARCH) 25 25 load2mass : $(BIN)/load2mass.$(ARCH) 26 loadstarpar : $(BIN)/loadstarpar.$(ARCH) 27 loadstarpar_client : $(BIN)/loadstarpar_client.$(ARCH) 28 loadICRF : $(BIN)/loadICRF.$(ARCH) 29 loadICRF_client : $(BIN)/loadICRF_client.$(ARCH) 26 30 loadwise : $(BIN)/loadwise.$(ARCH) 27 31 dumpskycells : $(BIN)/dumpskycells.$(ARCH) … … 31 35 mkcmf : $(BIN)/mkcmf.$(ARCH) 32 36 33 all: addstar addstar_client sedstar load2mass skycells mkcmf loadwise loadsupercos dumpskycells findskycell34 35 INSTALL = addstar addstar_client sedstar load2mass skycells mkcmf loadwise loadsupercos dumpskycells findskycell37 all: addstar addstar_client sedstar load2mass loadstarpar loadstarpar_client loadICRF loadICRF_client skycells mkcmf loadwise loadsupercos dumpskycells findskycell 38 39 INSTALL = addstar addstar_client sedstar load2mass loadstarpar loadstarpar_client loadICRF loadICRF_client skycells mkcmf loadwise loadsupercos dumpskycells findskycell 36 40 37 41 # I need to fix the client/server version of addstar now that I have dropped Stars … … 241 245 $(SRC)/psps_ids.$(ARCH).o 242 246 247 LOAD-STARPAR = \ 248 $(SRC)/loadstarpar.$(ARCH).o \ 249 $(SRC)/ConfigInit.$(ARCH).o \ 250 $(SRC)/SetSignals.$(ARCH).o \ 251 $(SRC)/Shutdown.$(ARCH).o \ 252 $(SRC)/SkyRegionUtils.$(ARCH).o \ 253 $(SRC)/args_loadstarpar.$(ARCH).o \ 254 $(SRC)/find_matches_starpar.$(ARCH).o \ 255 $(SRC)/loadstarpar_catalog.$(ARCH).o \ 256 $(SRC)/loadstarpar_io.$(ARCH).o \ 257 $(SRC)/loadstarpar_make_subset.$(ARCH).o \ 258 $(SRC)/loadstarpar_readstars.$(ARCH).o \ 259 $(SRC)/loadstarpar_remote_hosts.$(ARCH).o \ 260 $(SRC)/loadstarpar_save_remote.$(ARCH).o \ 261 $(SRC)/loadstarpar_table.$(ARCH).o \ 262 $(SRC)/psps_ids.$(ARCH).o 263 264 LOAD-STARPAR-CLIENT = \ 265 $(SRC)/loadstarpar_client.$(ARCH).o \ 266 $(SRC)/ConfigInit.$(ARCH).o \ 267 $(SRC)/SetSignals.$(ARCH).o \ 268 $(SRC)/Shutdown.$(ARCH).o \ 269 $(SRC)/SkyRegionUtils.$(ARCH).o \ 270 $(SRC)/args_loadstarpar.$(ARCH).o \ 271 $(SRC)/find_matches_starpar.$(ARCH).o \ 272 $(SRC)/loadstarpar_catalog.$(ARCH).o \ 273 $(SRC)/loadstarpar_io.$(ARCH).o \ 274 $(SRC)/loadstarpar_make_subset.$(ARCH).o \ 275 $(SRC)/loadstarpar_readstars.$(ARCH).o \ 276 $(SRC)/loadstarpar_remote_hosts.$(ARCH).o \ 277 $(SRC)/loadstarpar_save_remote.$(ARCH).o \ 278 $(SRC)/loadstarpar_table.$(ARCH).o \ 279 $(SRC)/psps_ids.$(ARCH).o 280 281 LOAD-ICRF = \ 282 $(SRC)/loadICRF.$(ARCH).o \ 283 $(SRC)/ConfigInit.$(ARCH).o \ 284 $(SRC)/SetSignals.$(ARCH).o \ 285 $(SRC)/Shutdown.$(ARCH).o \ 286 $(SRC)/SkyRegionUtils.$(ARCH).o \ 287 $(SRC)/args_loadICRF.$(ARCH).o \ 288 $(SRC)/find_matches_ICRF.$(ARCH).o \ 289 $(SRC)/loadICRF_catalog.$(ARCH).o \ 290 $(SRC)/loadICRF_io.$(ARCH).o \ 291 $(SRC)/loadICRF_make_subset.$(ARCH).o \ 292 $(SRC)/loadICRF_readstars.$(ARCH).o \ 293 $(SRC)/loadICRF_remote_hosts.$(ARCH).o \ 294 $(SRC)/loadICRF_save_remote.$(ARCH).o \ 295 $(SRC)/loadICRF_table.$(ARCH).o \ 296 $(SRC)/psps_ids.$(ARCH).o 297 298 LOAD-ICRF-CLIENT = \ 299 $(SRC)/loadICRF_client.$(ARCH).o \ 300 $(SRC)/ConfigInit.$(ARCH).o \ 301 $(SRC)/SetSignals.$(ARCH).o \ 302 $(SRC)/Shutdown.$(ARCH).o \ 303 $(SRC)/SkyRegionUtils.$(ARCH).o \ 304 $(SRC)/args_loadICRF.$(ARCH).o \ 305 $(SRC)/find_matches_ICRF.$(ARCH).o \ 306 $(SRC)/loadICRF_catalog.$(ARCH).o \ 307 $(SRC)/loadICRF_io.$(ARCH).o \ 308 $(SRC)/loadICRF_make_subset.$(ARCH).o \ 309 $(SRC)/loadICRF_readstars.$(ARCH).o \ 310 $(SRC)/loadICRF_remote_hosts.$(ARCH).o \ 311 $(SRC)/loadICRF_save_remote.$(ARCH).o \ 312 $(SRC)/loadICRF_table.$(ARCH).o \ 313 $(SRC)/psps_ids.$(ARCH).o 314 243 315 LOAD-WISE = \ 244 316 $(SRC)/loadwise.$(ARCH).o \ … … 309 381 $(SRC)/Shutdown.$(ARCH).o 310 382 311 $(ADDSTARC) : $(INC)/addstar.h 312 $(ADDSTARD) : $(INC)/addstar.h 313 $(ADDSTART) : $(INC)/addstar.h 314 $(ADDSTAR) : $(INC)/addstar.h 315 $(ADDSTAR_CLIENT) : $(INC)/addstar.h 316 $(SKYCELLS) : $(INC)/addstar.h 317 $(DUMPSKYCELLS) : $(INC)/addstar.h 318 $(FINDSKYCELL) : $(INC)/addstar.h 319 $(LOAD-2MASS) : $(INC)/addstar.h $(INC)/2mass.h 320 $(LOAD-WISE) : $(INC)/addstar.h $(INC)/WISE.h 321 $(MKCMF) : $(INC)/mkcmf.h 383 $(ADDSTARC) : $(INC)/addstar.h 384 $(ADDSTARD) : $(INC)/addstar.h 385 $(ADDSTART) : $(INC)/addstar.h 386 $(ADDSTAR) : $(INC)/addstar.h 387 $(ADDSTAR_CLIENT) : $(INC)/addstar.h 388 $(SKYCELLS) : $(INC)/addstar.h 389 $(DUMPSKYCELLS) : $(INC)/addstar.h 390 $(FINDSKYCELL) : $(INC)/addstar.h 391 $(LOAD-2MASS) : $(INC)/addstar.h $(INC)/2mass.h 392 $(LOAD-STARPAR) : $(INC)/addstar.h $(INC)/loadstarpar.h 393 $(LOAD-STARPAR-CLIENT) : $(INC)/addstar.h $(INC)/loadstarpar.h 394 $(LOAD-ICRF) : $(INC)/addstar.h $(INC)/loadICRF.h 395 $(LOAD-ICRF-CLIENT) : $(INC)/addstar.h $(INC)/loadICRF.h 396 $(LOAD-WISE) : $(INC)/addstar.h $(INC)/WISE.h 397 $(MKCMF) : $(INC)/mkcmf.h 322 398 323 399 $(BIN)/addstar.$(ARCH) : $(ADDSTAR) … … 330 406 $(BIN)/load2mass.$(ARCH) : $(LOAD-2MASS) 331 407 $(BIN)/loadwise.$(ARCH) : $(LOAD-WISE) 408 $(BIN)/loadstarpar.$(ARCH) : $(LOAD-STARPAR) 409 $(BIN)/loadstarpar_client.$(ARCH) : $(LOAD-STARPAR-CLIENT) 410 $(BIN)/loadICRF.$(ARCH) : $(LOAD-ICRF) 411 $(BIN)/loadICRF_client.$(ARCH): $(LOAD-ICRF-CLIENT) 332 412 $(BIN)/loadsupercos.$(ARCH) : $(LOAD-SUPERCOS) 333 413 $(BIN)/skycells.$(ARCH) : $(SKYCELLS) -
trunk/Ohana/src/addstar/include/WISE.h
r33963 r37807 21 21 short WISE_W1, WISE_W2, WISE_W3, WISE_W4; 22 22 23 int ALLSKY; 23 enum {MODE_NONE, MODE_ALLWISE, MODE_ALLSKY, MODE_PRELIM}; 24 int MODE; 24 25 25 26 AddstarClientOptions args_loadwise (int argc, char **argv, AddstarClientOptions options); 26 27 27 int loadwise_rawdata (SkyList *skytable, char *filename, AddstarClientOptions options , int ALLSKY);28 int loadwise_rawdata (SkyList *skytable, char *filename, AddstarClientOptions options); 28 29 29 30 int getWISE_setup (); -
trunk/Ohana/src/addstar/include/addstar.h
r37357 r37807 20 20 # define IN_REGION(R,D) ( \ 21 21 ((D) >= region[0].Dmin) && ((D) < region[0].Dmax) && \ 22 ((R) >= region[0].Rmin) && ((R) < region[0].Rmax))22 ((R) >= region[0].Rmin) && ((R) < region[0].Rmax)) 23 23 24 24 /* grab named photcode */ … … 31 31 # define dCOS(A) ((double) cos ((double)RAD_DEG*A)) 32 32 # define dSIN(A) ((double) sin ((double)RAD_DEG*A)) 33 34 # define myAbortF(FORMAT,...) { fprintf (stderr, FORMAT, __VA_ARGS__); abort(); } 33 35 34 36 typedef struct { … … 326 328 int strextend (char *input, char *format,...); 327 329 330 void initMosaicCoords (); 331 void saveMosaicCoords (Coords *input); 332 333 328 334 /** 329 335 there is an inconsistency to be resolved: fixed structures (like Image) -
trunk/Ohana/src/addstar/src/LoadData.c
r37357 r37807 33 33 // we need to perform that analysis here 34 34 GetZeroPointExposure (headers, headerSets, Nimages); 35 36 if (!options[0].mosaic) { 37 // we are requiring a single set of N x WRPs + 1 DIS per file set. 38 // NOTE: if the -mosaic was supplied, do not reset the mosaic coords here 39 initMosaicCoords (); 40 } 35 41 36 42 // now run through the images, interpret the headers and read the stars -
trunk/Ohana/src/addstar/src/LoadDataPMM.c
r36485 r37807 193 193 194 194 // XXX for now, we define a totally fake coordinate system centered on the plate center 195 strcpy (image[0].coords.ctype, "DEC--TAN");195 InitCoords (&image[0].coords, "DEC--TAN"); 196 196 197 197 image[0].coords.crval1 = pmm_get_ra (RA); … … 203 203 image[0].coords.crpix2 = 0.5*PLATE_NY; 204 204 image[0].coords.cdelt1 = image[0].coords.cdelt2 = 0.9 / 3600.0; 205 206 image[0].coords.pc1_1 = 0.0;207 image[0].coords.pc1_2 = 1.0;208 image[0].coords.pc2_1 = 1.0;209 image[0].coords.pc2_2 = 0.0;210 211 image[0].coords.Npolyterms = 0;212 memset (image[0].coords.polyterms, 0, 2*7*sizeof(float));213 205 214 206 image[0].NX = PLATE_NX; -
trunk/Ohana/src/addstar/src/LoadStars.c
r28241 r37807 88 88 exit (1); 89 89 } 90 /* supplied photcode is incompatible with multi-chip images */ 91 if ((NheaderSets > 1) && options[0].mosaic) { 92 fprintf (stderr, "ERROR: -mosaic cannot be supplied to multiple images\n"); 93 exit (1); 94 } 90 95 91 96 // if these are SDSS data, load with SDSS-specific wrapper -
trunk/Ohana/src/addstar/src/NewImage.c
r10939 r37807 33 33 goto reject; 34 34 } 35 saveMosaicCoords (mosaic); 35 36 } 36 37 -
trunk/Ohana/src/addstar/src/ReadImageHeader.c
r37036 r37807 1 1 # include "addstar.h" 2 3 // for DIS/WRP sets, we need to save the DIS set and supply it to the WRP entries 4 static Coords *mosaic = NULL; 5 6 void initMosaicCoords () { 7 mosaic = NULL; 8 } 9 10 void saveMosaicCoords (Coords *input) { 11 ALLOCATE (mosaic, Coords, 1); 12 memcpy (mosaic, input, sizeof(Coords)); 13 } 2 14 3 15 /* read an image header corresponding to a CMF / CMP data block */ … … 54 66 /* only load astrometry, NAXIS1,2, and time if this is a MOSAIC_PHU (ctype is ....-DIS) */ 55 67 if (!strcmp (&image[0].coords.ctype[4], "-DIS")) { 56 RegisterMosaic(&image[0].coords);68 saveMosaicCoords (&image[0].coords); 57 69 return (TRUE); 58 70 } … … 79 91 } 80 92 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 81 if (! isRegisteredMosaic()) {93 if (!mosaic) { 82 94 fprintf (stderr, "no mosaic for WRP image (use -mosaic)\n"); 83 95 return (FALSE); 84 96 } 97 image[0].coords.mosaic = mosaic; 85 98 } else { 86 99 /* force image to lie in 0-360 range */ -
trunk/Ohana/src/addstar/src/ReadStarsSDSS.c
r36485 r37807 201 201 202 202 // XXX for now, we define a totally fake coordinate system centered on the first listed star 203 strcpy (images[N].coords.ctype, "DEC--TAN"); 204 203 InitCoords (&images[N].coords, "DEC--TAN"); 205 204 images[N].coords.crval1 = stars[0].average.R; 206 205 images[N].coords.crval2 = stars[0].average.D; 207 208 206 images[N].coords.crpix1 = stars[0].measure.Xccd; 209 207 images[N].coords.crpix2 = stars[0].measure.Yccd; 210 208 images[N].coords.cdelt1 = images[N].coords.cdelt2 = 0.4 / 3600.0; 211 212 images[N].coords.pc1_1 = 0.0;213 images[N].coords.pc1_2 = 1.0;214 images[N].coords.pc2_1 = 1.0;215 images[N].coords.pc2_2 = 0.0;216 217 images[N].coords.Npolyterms = 0;218 memset (images[N].coords.polyterms, 0, 2*7*sizeof(float));219 209 220 210 images[N].NX = 2048; -
trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c
r27435 r37807 21 21 22 22 /* find correpsonding regions for image */ 23 RegisterMosaic (mosaic);24 23 skylist = NULL; 25 24 newlist = NULL; -
trunk/Ohana/src/addstar/src/addstar.c
r37357 r37807 132 132 } 133 133 } 134 MARKTIME ("load cpt: %f sec\n", dtime); RESETTIME;134 if (VERBOSE) MARKTIME ("load cpt: %f sec\n", dtime); RESETTIME; 135 135 136 136 // Naves_disk == 0 implies an empty catalog file … … 163 163 break; 164 164 } 165 MARKTIME ("match stars: %f sec\n", dtime); RESETTIME;165 if (VERBOSE) MARKTIME ("match stars: %f sec\n", dtime); RESETTIME; 166 166 167 167 /* report total updated values */ … … 183 183 dvo_catalog_unlock (&catalog); 184 184 dvo_catalog_free (&catalog); 185 MARKTIME ("save cpt: %f sec\n", dtime); RESETTIME;185 if (VERBOSE) MARKTIME ("save cpt: %f sec\n", dtime); RESETTIME; 186 186 187 187 if (options.mode == ADDSTAR_MODE_REFCAT) free (stars); -
trunk/Ohana/src/addstar/src/args.c
r37357 r37807 175 175 exit (1); 176 176 } 177 RegisterMosaic(&MOSAIC);177 saveMosaicCoords (&MOSAIC); 178 178 remove_argument (N, &argc, argv); 179 179 gfits_free_header (&header); -
trunk/Ohana/src/addstar/src/args_client.c
r33963 r37807 83 83 exit (1); 84 84 } 85 RegisterMosaic(&MOSAIC);85 saveMosaicCoords (&MOSAIC); 86 86 remove_argument (N, &argc, argv); 87 87 gfits_free_header (&header); -
trunk/Ohana/src/addstar/src/args_loadwise.c
r33963 r37807 53 53 } 54 54 55 enum {MODE_NONE, MODE_ALLWISE, MODE_ALLSKY, MODE_PRELIM}; 56 int MODE; 57 55 58 /* load the prelim data dump */ 56 ALLSKY = TRUE; 57 if ((N = get_argument (argc, argv, "-prelim"))) { 58 ALLSKY = FALSE; 59 MODE = MODE_ALLWISE; 60 if ((N = get_argument (argc, argv, "-mode"))) { 61 MODE = MODE_NONE; 62 remove_argument (N, &argc, argv); 63 if (!strcasecmp(argv[N], "allwise")) MODE = MODE_ALLWISE; 64 if (!strcasecmp(argv[N], "allsky")) MODE = MODE_ALLSKY; 65 if (!strcasecmp(argv[N], "prelim")) MODE = MODE_PRELIM; 66 if (MODE == MODE_NONE) { 67 fprintf (stderr, "invalid mode: %s\n", argv[N]); 68 exit (2); 69 } 59 70 remove_argument (N, &argc, argv); 60 71 } -
trunk/Ohana/src/addstar/src/build_links.c
r37334 r37807 1 1 # include "addstar.h" 2 3 # define myAbortF(FORMAT,...) { fprintf (stderr, FORMAT, __VA_ARGS__); abort(); }4 2 5 3 /* -
trunk/Ohana/src/addstar/src/fakeimage.c
r37036 r37807 3 3 Image *fakeimage (char *rootname, off_t *Nimage, int photcode) { 4 4 5 int i, j,Nx, Ny, Nchips;5 int i, Nx, Ny, Nchips; 6 6 double pltscale, pixscale; 7 7 double Rmin, Rmax, Dmin, Dmax; … … 33 33 34 34 /* create a mosaic distortion structure */ 35 strcpy (MOSAIC.ctype, "DEC--DIS");35 InitCoords (&MOSAIC, "DEC--DIS"); 36 36 MOSAIC.crval1 = FAKE_RA; 37 37 MOSAIC.crval2 = FAKE_DEC; 38 39 MOSAIC.crpix1 = MOSAIC.crpix2 = 0.0;40 38 41 39 /* mosaic 'pixels' are millimeters */ … … 49 47 50 48 MOSAIC.Npolyterms = 3; 51 for (i = 0; i < 7; i++) {52 MOSAIC.polyterms[i][0] = 0;53 MOSAIC.polyterms[i][1] = 0;54 }55 49 ScanConfig (config, "DPLATE_X", "%lf", 0, &pltscale); 56 50 MOSAIC.polyterms[3][0] = pltscale; // L : X^3 Y^0 … … 59 53 MOSAIC.polyterms[4][1] = pltscale; // M : X^0 Y^0 60 54 MOSAIC.polyterms[6][1] = pltscale; // M : X^2 Y^0 61 62 RegisterMosaic (&MOSAIC);63 55 64 56 /* some basic data about the chisp */ … … 85 77 strcpy (image[i+1].name, name); 86 78 87 strcpy (image[i+1].coords.ctype, "DEC--WRP");79 InitCoords (&image[i+1].coords, "DEC--WRP"); 88 80 89 81 image[i+1].coords.crval1 = dX*pixscale; 90 82 image[i+1].coords.crval2 = dY*pixscale; 91 92 image[i+1].coords.crpix1 = image[i+1].coords.crpix2 = 0.0; 83 93 84 image[i+1].coords.cdelt1 = image[i+1].coords.cdelt2 = pixscale; 94 85 95 image[i+1].coords.pc1_1 = 1.0; 96 image[i+1].coords.pc1_2 = 0.0; 97 image[i+1].coords.pc2_1 = 0.0; 98 image[i+1].coords.pc2_2 = 1.0; 99 100 image[i+1].coords.Npolyterms = 0; 101 for (j = 0; j < 7; j++) { 102 image[i+1].coords.polyterms[j][0] = 0; 103 image[i+1].coords.polyterms[j][1] = 0; 104 } 86 image[i+1].coords.mosaic = &MOSAIC; 105 87 106 88 image[i+1].sidtime = 0.0; -
trunk/Ohana/src/addstar/src/find_matches.c
r37036 r37807 53 53 * coordops.update.c). We use the center of the region (catalog) for crval1,2. 54 54 */ 55 InitCoords (&tcoords, "DEC--ARC"); 55 56 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 56 57 if (region[0].Dmax < 90) { … … 59 60 tcoords.crval2 = 90.0; 60 61 } 61 tcoords.crpix1 = 0;62 tcoords.crpix2 = 0;63 62 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 64 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;65 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;66 tcoords.Npolyterms = 1;67 strcpy (tcoords.ctype, "DEC--ARC");68 63 69 64 /* build spatial index (RA sort) referencing input array sequence */ -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r37036 r37807 53 53 * far from the projection pole. We use the center of the region (catalog) for crval1,2. 54 54 */ 55 InitCoords (&tcoords, "DEC--ARC"); 55 56 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 56 57 if (region[0].Dmax < 90) { … … 59 60 tcoords.crval2 = 90.0; 60 61 } 61 tcoords.crpix1 = 0;62 tcoords.crpix2 = 0;63 62 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 64 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;65 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;66 tcoords.Npolyterms = 1;67 strcpy (tcoords.ctype, "DEC--ARC");68 63 69 64 /* build spatial index (RA sort) referencing input array sequence */ -
trunk/Ohana/src/addstar/src/find_matches_closest_refstars.c
r37036 r37807 47 47 * far from the projection pole. We use the center of the region (catalog) for crval1,2. 48 48 */ 49 InitCoords (&tcoords, "DEC--ARC"); 49 50 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 50 51 if (region[0].Dmax < 90) { … … 53 54 tcoords.crval2 = 90.0; 54 55 } 55 tcoords.crpix1 = 0.0;56 tcoords.crpix2 = 0.0;57 56 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 58 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;59 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;60 tcoords.Npolyterms = 0;61 strcpy (tcoords.ctype, "DEC--ARC");62 57 63 58 /* build spatial index (RA sort) referencing input array sequence */ -
trunk/Ohana/src/addstar/src/find_matches_refstars.c
r37036 r37807 51 51 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ 52 52 /* reference for coords is catalog center */ 53 InitCoords (&tcoords, "DEC--ZEA"); 53 54 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 54 55 tcoords.crval2 = 0.5*(region[0].Dmin + region[0].Dmax); 55 tcoords.crpix1 = tcoords.crpix2 = 0.0;56 56 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 57 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;58 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;59 strcpy (tcoords.ctype, "DEC--ZEA");60 tcoords.Npolyterms = 0;61 57 62 58 for (i = 0; i < Nstars; i++) { -
trunk/Ohana/src/addstar/src/find_missing.c
r10937 r37807 14 14 REALLOCATE (catalog[0].missing, Missing, NMISS); 15 15 } 16 if (!FindMosaicForImage (overlap, Noverlap, j)) continue;17 16 if (!in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j])) continue; 18 17 add_miss_link (&catalog[0].average[Nave], next_miss, Nmiss); … … 27 26 /* add reference for undetected catalog stars */ 28 27 /* XXX allow this option only for single images? */ 29 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (mosaic);28 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) image[0].coords = mosaic; 30 29 for (j = 0; (j < Nave) && !options.skip_missed; j++) { 31 30 n = N2[j]; -
trunk/Ohana/src/addstar/src/loadsupercos_plates.c
r37472 r37807 118 118 119 119 // for now, we define a fake coordinate system based on the boresite center 120 strcpy (image[Nimage].coords.ctype, "DEC--TAN");120 InitCoords (&image[Nimage].coords, "DEC--TAN"); 121 121 122 122 image[Nimage].coords.crval1 = RAo; … … 126 126 image[Nimage].coords.crpix2 = 0.5*image[Nimage].NY; 127 127 image[Nimage].coords.cdelt1 = image[Nimage].coords.cdelt2 = scale; 128 129 image[Nimage].coords.pc1_1 = 0.0;130 image[Nimage].coords.pc1_2 = 1.0;131 image[Nimage].coords.pc2_1 = 1.0;132 image[Nimage].coords.pc2_2 = 0.0;133 134 image[Nimage].coords.Npolyterms = 0;135 memset (image[Nimage].coords.polyterms, 0, 2*7*sizeof(float));136 128 137 129 Nimage ++; -
trunk/Ohana/src/addstar/src/loadwise.c
r33963 r37807 40 40 for (i = 1; i < argc; i++) { 41 41 fprintf (stderr, "loading %s\n", argv[i]); 42 loadwise_rawdata (skylist, argv[i], options , ALLSKY);42 loadwise_rawdata (skylist, argv[i], options); 43 43 } 44 44 exit (0); -
trunk/Ohana/src/addstar/src/loadwise_rawdata.c
r34088 r37807 10 10 # define DEBUG 0 11 11 12 int loadwise_rawdata (SkyList *skytable, char *filename, AddstarClientOptions options , int ALLSKY) {12 int loadwise_rawdata (SkyList *skytable, char *filename, AddstarClientOptions options) { 13 13 14 14 int i, j, verbose; … … 159 159 stars[Nstars+3][0].average.D = tstars[j].D; 160 160 161 if (ALLSKY) { 162 loadwise_star_allsky (&stars[Nstars], &buffer[offset], Nbyte - offset); 163 } else { 164 loadwise_star_prelim (&stars[Nstars], &buffer[offset], Nbyte - offset); 161 switch (MODE) { 162 case MODE_PRELIM: 163 loadwise_star_prelim (&stars[Nstars], &buffer[offset], Nbyte - offset); 164 break; 165 case MODE_ALLSKY: 166 loadwise_star_allsky (&stars[Nstars], &buffer[offset], Nbyte - offset); 167 break; 168 case MODE_ALLWISE: 169 default: 170 // loadwise_star_allwise (&stars[Nstars], &buffer[offset], Nbyte - offset); 171 break; 165 172 } 166 173 -
trunk/Ohana/src/addstar/src/mkcmf.c
r37246 r37807 200 200 201 201 /* bore site center guess */ 202 strcpy (coords.ctype, "DEC--TAN");202 InitCoords (&coords, "DEC--TAN"); 203 203 coords.crval1 = RA; 204 204 coords.crval2 = DEC; … … 208 208 coords.cdelt1 = 0.25/3600.0; 209 209 coords.cdelt2 = 0.25/3600.0; 210 211 coords.pc1_1 = 1;212 coords.pc2_2 = 1;213 coords.pc1_2 = 0;214 coords.pc2_1 = 0;215 coords.Npolyterms = 1;216 210 217 211 // load stars and generate complete output fields … … 300 294 gfits_modify (&header, "NASTRO", "%d", 1, 100); 301 295 302 if (imageID == -1) imageID = 1000 .0*drand48();303 if (sourceID == -1) sourceID = 100 .0*drand48();296 if (imageID == -1) imageID = 100000.0*drand48(); 297 if (sourceID == -1) sourceID = 1000.0*drand48(); 304 298 gfits_modify (&header, "IMAGEID", "%d", 1, imageID); 305 299 gfits_modify (&header, "SOURCEID", "%d", 1, sourceID); -
trunk/Ohana/src/addstar/src/resort_catalog.c
r37334 r37807 4 4 void resort_catalog_measure (Catalog *catalog); 5 5 void resort_catalog_lensing (Catalog *catalog); 6 void resort_catalog_starpar (Catalog *catalog); 6 7 7 8 void resort_catalog_old (Catalog *catalog) { … … 38 39 resort_catalog_measure (catalog); 39 40 resort_catalog_lensing (catalog); 41 resort_catalog_starpar (catalog); 40 42 } 41 43 … … 335 337 } 336 338 339 void resort_catalog_starpar (Catalog *catalog) { 340 341 off_t Naverage, Nstarpar; 342 StarPar *starpar; 343 Average *average; 344 off_t i, j, N, currentAve; 345 346 off_t *starparSeq = NULL; 347 off_t *averageSeq = NULL; 348 StarPar *starparTMP = NULL; 349 350 // struct timeval start, stop; 351 // gettimeofday (&start, NULL); 352 353 /* internal counters */ 354 Nstarpar = catalog[0].Nstarpar; 355 Naverage = catalog[0].Naverage; 356 357 if (!Nstarpar) return; 358 359 starpar = catalog[0].starpar; 360 average = catalog[0].average; 361 362 // we have a table of average objects and an unsorted table of measurements. each measurement 363 // has a reference to the average object sequence (as well as an ID) 364 // starpar[i].averef -> average[averef] 365 // starpar[i].objID = average[averef].objID 366 // starpar[i].catID = average[averef].catID 367 368 // we want a sorted starpar array with all averef entries in sequence 369 370 ALLOCATE (starparSeq, off_t, Nstarpar); 371 ALLOCATE (averageSeq, off_t, Nstarpar); 372 373 for (i = 0; i < Nstarpar; i++) { 374 starparSeq[i] = i; 375 averageSeq[i] = starpar[i].averef; 376 377 if (catalog[0].catformat >= DVO_FORMAT_PS1_V1) { 378 // earlier formats did not carry the objID or catID, so they are not available (we could assign on load, but we don't) 379 myAssert(average[averageSeq[i]].catID == starpar[starparSeq[i]].catID, "object / detection mismatch"); 380 # if (1) 381 myAssert(average[averageSeq[i]].objID == starpar[starparSeq[i]].objID, "object / detection mismatch"); 382 # else 383 // for reasons I do not understand, the mini dvodbs generated on stsci1X had a handful of detections with an inconsistency between averef and objID. 384 // this happened for 28 detections in the dbs on /data/stsci1?.0/eugene/dvo3pi.20130616, but not at all (as far as I know) in the rest of LAP DVO 385 if (average[averageSeq[i]].objID != starpar[starparSeq[i]].objID) { 386 fprintf (stderr, "R"); 387 starpar[starparSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this... 388 } 389 # endif 390 } 391 } 392 393 // check that averageSeq is now in order 394 // for (i = 1; i < Nstarpar; i++) { 395 // if (averageSeq[i] < averageSeq[i-1]) { 396 // fprintf (stderr, "%d ", (int) i); 397 // } 398 // } 399 // fprintf (stderr, "\n"); 400 401 SortAveMatch(starparSeq, averageSeq, Nstarpar); 402 // MARKTIME("sort : %f sec\n", dtime); 403 404 // check that averageSeq is now in order 405 // for (i = 1; i < Nstarpar; i++) { 406 // if (averageSeq[i] < averageSeq[i-1]) { 407 // fprintf (stderr, "%d ", (int) i); 408 // } 409 // } 410 // fprintf (stderr, "\n"); 411 412 // copy the starpar entries in the sorted order 413 ALLOCATE (starparTMP, StarPar, Nstarpar); 414 for (i = 0; i < Nstarpar; i++) { 415 j = starparSeq[i]; 416 starparTMP[i] = starpar[j]; 417 } 418 // MARKTIME("assign starpar : %f sec\n", dtime); 419 420 // update the values of average.starparOffset and average.Nstarpar 421 FREE(starpar); 422 catalog[0].starpar = starparTMP; 423 424 N = 0; 425 currentAve = averageSeq[0]; 426 average[currentAve].starparOffset = 0; 427 for (i = 0; i < Nstarpar; i++) { 428 if (averageSeq[i] != currentAve) { 429 // we have hit the next entry in the list 430 average[currentAve].Nstarpar = N; 431 N = 0; 432 currentAve = averageSeq[i]; 433 average[currentAve].starparOffset = i; 434 } 435 N++; 436 } 437 // N++; 438 average[currentAve].Nstarpar = N; 439 // MARKTIME("update Nstarpar : %f sec\n", dtime); 440 441 int NstarparTotal = 0; 442 int starparOffsetOK = TRUE; 443 for (i = 0; i < Naverage; i++) { 444 NstarparTotal += catalog[0].average[i].Nstarpar; 445 if (VERBOSE && !(NstarparTotal <= catalog[0].Nstarpar)) { 446 fprintf (stderr, "too few starpar: %d %d %d\n", (int) i, NstarparTotal, (int) catalog[0].Nstarpar); 447 } 448 starparOffsetOK &= (catalog[0].average[i].starparOffset < catalog[0].Nstarpar); 449 if (VERBOSE && !(catalog[0].average[i].starparOffset < catalog[0].Nstarpar)) { 450 fprintf (stderr, "offset too large: %d %d %d\n", (int) i, catalog[0].average[i].Nstarpar, (int) catalog[0].Nstarpar); 451 } 452 starparOffsetOK &= (catalog[0].average[i].starparOffset + catalog[0].average[i].Nstarpar <= catalog[0].Nstarpar); 453 if (VERBOSE && !(catalog[0].average[i].starparOffset + catalog[0].average[i].Nstarpar <= catalog[0].Nstarpar)) { 454 fprintf (stderr, "orrset + Nstarpar too large: %d + %d > %d %d\n", (int) i, catalog[0].average[i].starparOffset, catalog[0].average[i].Nstarpar, (int) catalog[0].Nstarpar); 455 } 456 } 457 458 if (!starparOffsetOK) { 459 fprintf (stderr, "ERROR: catalog %s has an invalid starparOffset\n", catalog[0].filename); 460 } 461 462 if (NstarparTotal != catalog[0].Nstarpar) { 463 fprintf (stderr, "ERROR: catalog %s has an invalid Nstarpar\n", catalog[0].filename); 464 } 465 466 // MARKTIME(" match time %9.4f sec for %7lld starpars, %6lld average\n", dtime, (long long) Nstarpar, (long long) Naverage); 467 468 catalog[0].sorted = TRUE; 469 470 FREE (starparSeq); 471 FREE (averageSeq); 472 473 return; 474 } 475 337 476 // sort the measure or lensing Sequence based on the average Sequence entries 338 477 void SortAveMatch (off_t *MEAS, off_t *AVE, off_t N) { -
trunk/Ohana/src/addstar/src/sky_tessalation.c
r36485 r37807 581 581 582 582 memset (rectangle, 0, sizeof(SkyRectangle)); 583 584 InitCoords (&rectangle[0].coords, "DEC--TAN"); 585 583 586 rectangle[0].coords.crval1 = CENTER_RA; 584 587 rectangle[0].coords.crval2 = CENTER_DEC; … … 609 612 rectangle[0].coords.cdelt2 = SCALE / 3600.0; 610 613 611 strcpy (rectangle[0].coords.ctype, "DEC--TAN");612 613 614 rectangle[0].NX = NX; 614 615 rectangle[0].NY = NY; … … 699 700 for (i = 0; i < nRA; i++) { 700 701 memset (&ring[i], 0, sizeof(SkyRectangle)); 701 memset (&ring[i].coords, 0, sizeof(Coords)); 702 703 InitCoords (&ring[i].coords, "DEC--TAN"); 702 704 ring[i].coords.crval1 = i*dRA; 703 705 ring[i].coords.crval2 = dec; 704 706 705 707 ring[i].coords.pc1_1 = +1.0 * X_PARITY; 706 ring[i].coords.pc1_2 = +0.0;707 ring[i].coords.pc2_1 = -0.0;708 ring[i].coords.pc2_2 = +1.0;709 708 710 709 // range values are in projected degrees … … 718 717 ring[i].coords.cdelt1 = SCALE / 3600.0; 719 718 ring[i].coords.cdelt2 = SCALE / 3600.0; 720 721 strcpy (ring[i].coords.ctype, "DEC--TAN");722 719 723 720 ring[i].NX = NX*(1.0 + PADDING); … … 771 768 772 769 memset (&ring[N], 0, sizeof(SkyRectangle)); 773 memset (&ring[N].coords, 0, sizeof(Coords));770 InitCoords (&ring[N].coords, "DEC--TAN"); 774 771 775 772 ring[N].coords.crval1 = ra / d2r; … … 779 776 780 777 ring[N].coords.pc1_1 = +1.0 * X_PARITY; 781 ring[N].coords.pc1_2 = +0.0;782 ring[N].coords.pc2_1 = -0.0;783 ring[N].coords.pc2_2 = +1.0;784 778 785 779 // range values are in projected degrees … … 793 787 ring[N].coords.cdelt1 = SCALE / 3600.0; 794 788 ring[N].coords.cdelt2 = SCALE / 3600.0; 795 796 strcpy (ring[N].coords.ctype, "DEC--TAN");797 789 798 790 ring[N].NX = NX*(1.0 + PADDING); … … 1099 1091 1100 1092 ALLOCATE (refcoords, Coords, 1); 1101 refcoords[0].crval1 = refcoords[0].crval2 = 0.0; 1102 refcoords[0].crpix1 = refcoords[0].crpix2 = 0.0; 1093 InitCoords (refcoords, "DEC--TAN"); 1103 1094 refcoords[0].cdelt1 = refcoords[0].cdelt2 = scale / 3600; 1104 refcoords[0].pc1_1 = refcoords[0].pc2_2 = 1.0;1105 refcoords[0].pc1_2 = refcoords[0].pc2_1 = 0.0;1106 refcoords[0].Npolyterms = 0;1107 memset (refcoords[0].polyterms, 0, 14*sizeof(float));1108 strcpy (refcoords[0].ctype, "DEC--TAN");1109 1095 return (TRUE); 1110 1096 } -
trunk/Ohana/src/addstar/test/relphot.parallel.dvo
r33653 r37807 25 25 if (not($?VERBOSE)) set VERBOSE = 0 26 26 27 # images are loaded into dvo with GPC1 photcodes, so we need to get the nominal zps for those filters 28 $zpt_nominal:g = 24.58 29 $zpt_nominal:r = 24.80 30 $zpt_nominal:i = 24.74 31 $zpt_nominal:z = 24.26 32 $zpt_nominal:y = 23.41 33 34 # klam is negative, so klam*(airmass - 1) increase the zero point 35 $klam_nominal:g = -0.15 36 $klam_nominal:r = -0.10 37 $klam_nominal:i = -0.04 38 $klam_nominal:z = -0.03 39 $klam_nominal:y = -0.03 27 # images are loaded into dvo with GPC1 photcodes, so we need to get the nominal zps for those filters 28 # $zpt_nominal:g = 24.58 29 # $zpt_nominal:r = 24.80 30 # $zpt_nominal:i = 24.74 31 # $zpt_nominal:z = 24.26 32 # $zpt_nominal:y = 23.41 33 34 # klam is negative, so klam*(airmass - 1) increase the zero point 35 # $klam_nominal:g = -0.15 36 # $klam_nominal:r = -0.10 37 # $klam_nominal:i = -0.04 38 # $klam_nominal:z = -0.03 39 # $klam_nominal:y = -0.03 40 41 $zpt_nominal:g = 24.563; $klam_nominal:g = -0.147 42 $zpt_nominal:r = 24.750; $klam_nominal:r = -0.085 43 $zpt_nominal:i = 24.611; $klam_nominal:i = -0.044 44 $zpt_nominal:z = 24.250; $klam_nominal:z = -0.033 45 $zpt_nominal:y = 23.320; $klam_nominal:y = -0.073 40 46 41 47 # we have two sets of images: ubercaled and not-ubercaled … … 111 117 mksequence $fileroot $catdir 112 118 for i 0 mjd_nc[] 113 ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw 119 ckexposure $catdir mjd_nc[$i] zpt_nc[$i] exptime_nc[$i] airmass_nc[$i] $filt_nc:$i raw 0 114 120 end 115 121 … … 121 127 122 128 # run relphot on the serial db and check that the images now match the expected values 123 exec relphot g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal-D IMAGE_OFFSET 0.5 -update >& log.relphot.s0129 exec relphot -images g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update >& log.relphot.s0 124 130 125 131 for i 0 mjd_nc[] … … 128 134 # matching the mean zp of photometric data, which we calculate in 129 135 # 'init' 130 ckexposure $catdir mjd_nc[$i] $zpt_nc_$filt_nc:$i exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc 136 ckexposure $catdir mjd_nc[$i] $zpt_nc_$filt_nc:$i exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc 0 131 137 end 132 138 133 139 # run relphot on the parallel db and check that the images now match the expected values 134 exec relphot -parallel g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir.p0 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -keep-ubercal -D IMAGE_OFFSET 0.5 -update >& log.relphot.p0 135 136 exec dvodist -in $catdir.p0 >& log.dvodist.in 140 exec relphot -images -parallel g,r,i -v -region 9.5 10.5 19.5 20.5 -D CATDIR $catdir.p0 -D STAR_TOOFEW 1 -D SIGMA_LIM 0.07 -statmode WT_MEAN -cloud-limit 0.5 -D IMAGE_OFFSET 0.5 -update >& log.relphot.p0 137 141 138 142 for i 0 mjd_nc[] … … 141 145 # matching the mean zp of photometric data, which we calculate in 142 146 # 'init' 143 ckexposure $catdir.p0 mjd_nc[$i] $zpt_nc_$filt_nc:$i exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc 147 ckexposure $catdir.p0 mjd_nc[$i] $zpt_nc_$filt_nc:$i exptime_nc[$i] airmass_nc[$i] $filt_nc:$i relphot_nc 1 144 148 end 145 149 … … 148 152 149 153 macro ckexposure 150 if ($0 != 8)151 echo "ckexposure (catdir) (mjd) (zpt) (exptime) (airmass) (filter) (mode) "154 if ($0 != 9) 155 echo "ckexposure (catdir) (mjd) (zpt) (exptime) (airmass) (filter) (mode) (isParallel)" 152 156 echo " mode == raw or corr" 153 157 break … … 163 167 $FILTER = $6 164 168 $MODE = $7 169 $PARALLEL = 170 if ($8) 171 $PARALLEL = "-parallel" 172 end 165 173 166 174 # XXX need a function to extract the nominal zpt for a given filter / photcode from the db … … 182 190 183 191 skyregion {$RA_CENTER - 0.2/dcos($DEC_CENTER)} {$RA_CENTER + 0.2/dcos($DEC_CENTER)} {$DEC_CENTER - 0.2} {$DEC_CENTER + 0.2} 184 mextract ra dec mag xccd yccd where (abs(time - $MJD_IMAGE) < 0.0001)192 mextract $PARALLEL ra dec mag xccd yccd where (abs(time - $MJD_IMAGE) < 0.0001) 185 193 if (not(ra[])) 186 194 echo "no matching data for MJD = $MJD_IMAGE" … … 344 352 # the fake images have inconsistent ra,dec and airmass,sidtime values 345 353 if ($VERBOSE) echo addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass 346 exec addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass >& /dev/null354 exec addstar $ROOT.$ix.$iy.cmf -D CATDIR $CATDIR -D CAMERA gpc1 -quick-airmass >& log.addstar 347 355 # costs 10/36 sec / chip 348 356 end … … 432 440 $catdir = $tmp1/$tmp2 433 441 442 if ($VERBOSE) echo rsync -auv $catdir/ $catdir.p0/ 434 443 exec rsync -auv $catdir/ $catdir.p0/ >& log.rsync 435 444 mkdir $catdir.d1 … … 442 451 exec echo "3 $hostname $catdir.d3" >> $catdir.p0/HostTable.dat 443 452 453 if ($VERBOSE) echo dvodist -out $catdir.p0 444 454 exec dvodist -out $catdir.p0 >& log.dvodist.out 445 455 end -
trunk/Ohana/src/checkastro/src/ImageOps.c
r36833 r37807 130 130 } 131 131 132 BuildChipMatch (image, Nimage);133 134 132 char output[128]; 135 133 snprintf (output, 128, "checkastrom.%+3.0f.%+3.0f.%03.0f.%03.0f.dat", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); … … 148 146 name = GetPhotcodeNamebyCode (image[i].photcode); 149 147 150 off_t myMosaic = FindMosaicForImage (image, Nimage, i);151 152 148 /* only check exposure center */ 153 149 double Rexp = NAN, Dexp = NAN, Rccd = NAN, Dccd = NAN; 154 150 155 if (myMosaic) { 156 myMosaic --; 157 XY_to_RD (&Rccd, &Dccd, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 158 XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &image[myMosaic].coords); 159 } 151 XY_to_RD (&Rccd, &Dccd, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 152 XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &image[i].parent->coords); 160 153 161 154 char *date = ohana_sec_to_date(image[i].tzero); -
trunk/Ohana/src/checkastro/src/bcatalog.c
r36833 r37807 191 191 /* project coordinates to a plane centered on the object with units of arcsec */ 192 192 Coords coords; 193 InitCoords (&coords, "DEC--SIN"); 193 194 coords.crval1 = Rc; 194 195 coords.crval2 = Dc; 195 coords.crpix1 = 0;196 coords.crpix2 = 0;197 196 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 198 coords.pc1_1 = coords.pc2_2 = 1.0;199 coords.pc1_2 = coords.pc2_1 = 0.0;200 coords.Npolyterms = 1;201 strcpy (coords.ctype, "DEC--SIN");202 197 203 198 // convert all average R,D values to X,Y: -
trunk/Ohana/src/checkastro/src/load_images.c
r36833 r37807 17 17 MARKTIME(" convert image table: %f sec\n", dtime); 18 18 19 BuildChipMatch (image, Nimage); 20 19 21 // select the images which overlap the selected sky regions 20 22 subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset); -
trunk/Ohana/src/checkastro/src/select_images.c
r36833 r37807 43 43 44 44 if (VERBOSE) fprintf (stderr, "finding images\n"); 45 BuildChipMatch (timage, Ntimage);46 MARKTIME("build chip match: %f sec\n", dtime);47 45 48 46 nimage = 0; … … 83 81 } 84 82 85 // this adds 1.3 sec for 3M images86 off_t myMosaic = FindMosaicForImage (timage, Ntimage, i);87 if (!myMosaic) {88 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);89 continue;90 }91 myMosaic --;92 93 83 /* only check exposure center */ 94 84 if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) { 95 85 XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &timage[i].coords); 96 86 } else { 97 XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &timage[ myMosaic].coords);87 XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &timage[i].parent->coords); 98 88 } 99 89 Rexp = ohana_normalize_angle_to_midpoint (Rexp, RmidSkyRegion); -
trunk/Ohana/src/delstar/src/ImageOpsFixLAP.c
r37040 r37807 320 320 if ((Nimage_valid[i] + Nimage_invalid[i] == 0) || (found_ratio < 0.995)) { 321 321 double r, d; 322 if (! FindMosaicForImage (image, Nimage, i)) {323 fprintf (stderr, "failed to get astrometry for %s\n", image[i].name);322 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) { 323 XY_to_RD (&r, &d, 0.0, 0.0, &image[i].coords); 324 324 } else { 325 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) { 326 XY_to_RD (&r, &d, 0.0, 0.0, &image[i].coords); 327 } else { 328 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 329 } 325 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 330 326 } 331 327 char *date = ohana_sec_to_date (image[i].tzero); -
trunk/Ohana/src/delstar/src/delete_duplicate_measures.c
r35758 r37807 61 61 } 62 62 63 delete_duplicate_measures_catalog (&catalog); 64 65 if (UPDATE) { 66 // XXX skip if nothing was deleted 67 dvo_catalog_save_complete (&catalog, VERBOSE2); 63 if (delete_duplicate_measures_catalog (&catalog)) { 64 // skip if nothing was deleted 65 if (UPDATE) { 66 if (!dvo_catalog_backup (&catalog, TRUE)) { 67 fprintf (stderr, "ERROR: failed to make backup for catalog %s\n", catalog.filename); 68 exit (1); 69 } 70 dvo_catalog_save_complete (&catalog, VERBOSE2); 71 } 68 72 } 69 73 … … 234 238 measureDrop[j] = TRUE; 235 239 off_t N = measure[j].averef; 236 fprintf (stderr, "0x%08x 0x%08x %8.4f %8.4f %5d\n", measure[j].imageID, measure[j].detID, average[N].R, average[N].D, measure[j].photcode);240 if (VERBOSE) fprintf (stderr, "0x%08x 0x%08x %8.4f %8.4f %5d\n", measure[j].imageID, measure[j].detID, average[N].R, average[N].D, measure[j].photcode); 237 241 } 238 242 … … 385 389 off_t NdelAves = Naverage - catalog[0].Naverage; 386 390 off_t NdelMeas = Nmeasure - catalog[0].Nmeasure; 391 387 392 if (NdelAves || NdelMeas) { 388 393 fprintf (stderr, "deleting "OFF_T_FMT" measures and "OFF_T_FMT" averages : %s\n", NdelMeas, NdelAves, catalog[0].filename); … … 404 409 FREE (measureAveOut); 405 410 406 return TRUE; 411 if (NdelAves || NdelMeas) return TRUE; 412 return FALSE; 407 413 } 408 414 -
trunk/Ohana/src/delstar/src/delete_imagename.c
r34749 r37807 24 24 } 25 25 26 BuildChipMatch (image, Nimage); 27 26 28 /* find image in db by name */ 27 29 imlist = find_images_name (db, IMAGENAME, &Nimlist); … … 33 35 if (VERBOSE) fprintf (stderr, "deleting %s\n", image[j].name); 34 36 35 // XXX EAM : need to handle failure36 FindMosaicForImage (image, Nimage, j);37 37 skylist = SkyListByImage (sky, -1, &image[j]); 38 38 -
trunk/Ohana/src/delstar/src/delete_times.c
r29001 r37807 31 31 } 32 32 33 BuildChipMatch (image, Nimage); 34 33 35 /* find images for time range, delete each image */ 34 36 imlist = find_images_time (db, START, END, PHOTCODE, &Nimlist); … … 39 41 if (VERBOSE) fprintf (stderr, "finding regions for %s\n", image[j].name); 40 42 41 // XXX EAM : need to handle failure42 FindMosaicForImage (image, Nimage, j);43 43 skyset = SkyListByImage (sky, -1, &image[j]); 44 44 -
trunk/Ohana/src/dvomerge/Makefile
r35416 r37807 23 23 dvoverify_client : $(BIN)/dvoverify_client.$(ARCH) 24 24 25 all: dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvoverify dvoverify_client 25 dvoutils : $(BIN)/dvoutils.$(ARCH) 26 27 all: dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvorepair dvoverify dvoverify_client dvoutils 26 28 27 29 # $(SRC)/dvomergeContinue.$(ARCH).o … … 120 122 $(SRC)/dvorepairImagesVsMeasures.$(ARCH).o \ 121 123 $(SRC)/dvorepairDeleteImageList.$(ARCH).o \ 124 $(SRC)/dvorepairDeleteImagesByExternID.$(ARCH).o \ 125 $(SRC)/dvorepairDeleteImagesByExternID.$(ARCH).o \ 122 126 $(SRC)/dvorepairFixImages.$(ARCH).o \ 123 127 $(SRC)/psps_ids.$(ARCH).o \ 124 128 $(SRC)/LoadImages.$(ARCH).o \ 125 129 $(SRC)/ReadDeleteList.$(ARCH).o \ 130 $(SRC)/ReadDeleteListExternID.$(ARCH).o \ 131 $(SRC)/myIndex.$(ARCH).o \ 126 132 $(SRC)/match_image.$(ARCH).o \ 127 133 $(SRC)/help.$(ARCH).o \ … … 149 155 $(BIN)/dvoverify_client.$(ARCH) : $(DVOVERIFY_CLIENT) 150 156 151 INSTALL = dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvorepair dvoverify dvoverify_client 157 DVOUTILS = \ 158 $(SRC)/dvoutils.$(ARCH).o \ 159 $(SRC)/dvoutils_args.$(ARCH).o \ 160 $(SRC)/dvoutils_uniq_images.$(ARCH).o \ 161 $(SRC)/dvoutils_load_image_index.$(ARCH).o 162 163 $(DVOUTILS) : $(INC)/dvoutils.h 164 $(BIN)/dvoutils.$(ARCH) : $(DVOUTILS) 165 166 INSTALL = dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvorepair dvoverify dvoverify_client dvoverify 152 167 153 168 # dependancy rules for binary code ######################### -
trunk/Ohana/src/dvomerge/include/dvomerge.h
r37116 r37807 41 41 int REPLACE_BY_PHOTCODE; 42 42 int FORCE_MERGE; 43 char *UPDATE_CATFORMAT; 44 45 int MATCHED_TABLES; 43 46 44 47 char *SINGLE_CPT; 45 48 SkyRegion UserPatch; // used by MODE CAT 49 50 # ifndef MAX_INT 51 # define MAX_INT 2147483647 52 # endif 53 54 typedef struct { 55 int minID; 56 int maxID; 57 int *index; 58 int Nindex; 59 int NINDEX; 60 } myIndexType; 46 61 47 62 typedef struct { … … 138 153 int add_lens_link PROTO((Average *average, off_t *next, off_t Nlensing, off_t NLENSING)); 139 154 Lensing *sort_lensing PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing, off_t *next)); 155 156 off_t *build_starpar_links PROTO((Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar)); 157 off_t *init_starpar_links PROTO((Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar)); 158 int add_star_link PROTO((Average *average, off_t *next, off_t Nstarpar, off_t NSTARPAR)); 159 StarPar *sort_starpar PROTO((Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar, off_t *next)); 140 160 141 161 off_t *init_missing_links PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing)); … … 200 220 int dvoCreateID (char *catdir); 201 221 222 myIndexType *myIndexInit (); 223 int myIndexFree (myIndexType *myIndex); 224 int myIndexUpdateLimits (myIndexType *myIndex, int value); 225 int myIndexSetRange (myIndexType *myIndex); 226 int myIndexSetEntry (myIndexType *myIndex, int value, int entry); 227 int myIndexGetEntry (myIndexType *myIndex, int value); 228 229 int dvorepairDeleteImagesByExternID (int argc, char **argv); 230 int RepairTableCPT_V1(char *cptFilenameSrc, char *cptFilenameTgt, char *cpsFilenameSrc, char *cpsFilenameTgt, Measure *measure, off_t Nmeasure, Image *image, off_t Nimage, myIndexType *imageIDindex, char catformat); 231 int *ReadDeleteListExternID(char *filename, int *nindex); -
trunk/Ohana/src/dvomerge/src/ImageOps.c
r29938 r37807 18 18 } 19 19 if (m == -1) return (NULL); 20 if (!FindMosaicForImage (image, Nimage, m)) return (NULL);21 20 return (&image[m]); 22 21 } -
trunk/Ohana/src/dvomerge/src/LoadCatalog.c
r37116 r37807 8 8 9 9 // always load all of the data (if any exists) 10 catalog[0].catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING | LOAD_LENSOBJ ;10 catalog[0].catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING | LOAD_LENSOBJ | LOAD_STARPAR; 11 11 12 12 catalog[0].catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data -
trunk/Ohana/src/dvomerge/src/args.c
r35765 r37807 37 37 } 38 38 39 /* extra error messages */ 40 MATCHED_TABLES = FALSE; 41 if ((N = get_argument (*argc, argv, "-matched-tables"))) { 42 MATCHED_TABLES = TRUE; 43 remove_argument (N, argc, argv); 44 } 45 39 46 /* use a different photcode file to define mean values */ 40 47 if ((N = get_argument (*argc, argv, "-photcode-file"))) { … … 48 55 if ((N = get_argument (*argc, argv, "-force-merge"))) { 49 56 FORCE_MERGE = TRUE; 57 remove_argument (N, argc, argv); 58 } 59 60 UPDATE_CATFORMAT = NULL; 61 if ((N = get_argument (*argc, argv, "-update-catformat"))) { 62 remove_argument (N, argc, argv); 63 UPDATE_CATFORMAT = strcreate (argv[N]); 50 64 remove_argument (N, argc, argv); 51 65 } … … 185 199 } 186 200 201 /* extra error messages */ 202 MATCHED_TABLES = FALSE; 203 if ((N = get_argument (*argc, argv, "-matched-tables"))) { 204 MATCHED_TABLES = TRUE; 205 remove_argument (N, argc, argv); 206 } 207 187 208 /* replace measurement, don't duplicate */ 188 209 REPLACE_BY_PHOTCODE = FALSE; -
trunk/Ohana/src/dvomerge/src/build_links.c
r37762 r37807 382 382 } 383 383 384 384 /******** StarPar ********************************************************************************/ 385 386 /* build the initial links assuming the table is sorted, 387 not partial, and has a correct set of average[].starparOffset,Nstarpar values */ 388 off_t *init_starpar_links (Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar) { 389 390 off_t i, j, N; 391 off_t *next_star; 392 393 N = 0; 394 395 ALLOCATE (next_star, off_t, Nstarpar); 396 for (i = 0; i < Naverage; i++) { 397 if (!average[i].Nstarpar) continue; 398 for (j = 0; j < average[i].Nstarpar - 1; j++, N++) { 399 next_star[N] = N + 1; 400 if (N >= Nstarpar) { 401 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 402 } 403 } 404 next_star[N] = -1; 405 if (N >= Nstarpar) { 406 fprintf (stderr, "WARNING: N out of bounds (2)\n"); 407 } 408 409 if (N >= Nstarpar) { 410 fprintf (stderr, "overflow in init_starpar_links\n"); 411 abort (); 412 } 413 N++; 414 } 415 return (next_star); 416 } 417 418 /* construct starpar links which are valid FOR THIS LOAD 419 * - if we have a full load, we will get links which can 420 * be used by other programs (eg, relphot, etc) 421 * - if we have a partial load, the links are only valid 422 * for that partial load 423 */ 424 425 off_t *build_starpar_links (Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar) { 426 427 off_t i, m, k, Nm, averef; 428 off_t *next_star; 429 430 ALLOCATE (next_star, off_t, Nstarpar); 431 432 /* reset the Nm, offset values for average */ 433 for (i = 0; i < Naverage; i++) { 434 average[i].starparOffset = -1; 435 average[i].Nstarpar = 0; 436 } 437 438 for (Nm = 0; Nm < Nstarpar; Nm++) { 439 averef = starpar[Nm].averef; 440 m = average[averef].starparOffset; 441 next_star[Nm] = -1; 442 443 if (m == -1) { /* no links yet for source */ 444 average[averef].starparOffset = Nm; 445 average[averef].Nstarpar = 1; 446 continue; 447 } 448 449 for (k = 0; next_star[m] != -1; k++) { 450 m = next_star[m]; 451 if (m >= Nstarpar) { 452 fprintf (stderr, "WARNING: m out of bounds (1)\n"); 453 } 454 } 455 456 average[averef].Nstarpar = k + 2; 457 next_star[m] = Nm; 458 if (m >= Nstarpar) { 459 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 460 } 461 } 462 return (next_star); 463 } 464 465 /* average[].starparOffset, average[].Nstarpar are valid within an addstar run */ 466 int add_star_link (Average *average, off_t *next_star, off_t Nstarpar, off_t NSTARPAR) { 467 468 off_t k, m; 469 470 /* if we have trouble, check validity of next_star[m] : m < Nstarpar */ 471 m = average[0].starparOffset; 472 473 for (k = 0; k < average[0].Nstarpar - 1; k++) { 474 m = next_star[m]; 475 if (m >= NSTARPAR) { 476 fprintf (stderr, "WARNING: m out of bounds (3)\n"); 477 } 478 } 479 480 /* set up references */ 481 next_star[Nstarpar] = -1; 482 if (Nstarpar >= NSTARPAR) { 483 fprintf (stderr, "WARNING: Nstarpar out of bounds (1)\n"); 484 } 485 486 if (m == -1) { 487 average[0].starparOffset = Nstarpar; 488 } else { 489 next_star[m] = Nstarpar; 490 if (m >= NSTARPAR) { 491 fprintf (stderr, "WARNING: m out of bounds (4)\n"); 492 } 493 } 494 495 return (TRUE); 496 } 497 498 StarPar *sort_starpar (Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar, off_t *next_star) { 499 500 off_t i, k, n, np, N; 501 StarPar *tmpstarpar; 502 503 /* 504 for (i = 0; i < Naverage; i++) { 505 if (average[i].Nstarpar != 4) { 506 fprintf (stderr, "check %d %d %d\n", (int) i, (int) average[i].Nstarpar, (int) average[i].starparOffset); 507 } 508 } 509 */ 510 511 /* fix order of StarPar (memory intensive, but fast) */ 512 N = 0; 513 ALLOCATE (tmpstarpar, StarPar, Nstarpar); 514 for (i = 0; i < Naverage; i++) { 515 if (!average[i].Nstarpar) continue; 516 n = average[i].starparOffset; 517 average[i].starparOffset = N; 518 for (k = 0; k < average[i].Nstarpar; k++, N++) { 519 if (n == -1) { 520 fprintf (stderr, "entry after %d has a problem\n", (int) np); 521 abort(); 522 } 523 tmpstarpar[N] = starpar[n]; 524 if (starpar[n].averef != i) abort(); 525 tmpstarpar[N].averef = i; 526 np = n; 527 n = next_star[n]; 528 } 529 } 530 free (starpar); 531 return (tmpstarpar); 532 } 533 534 -
trunk/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c
r37360 r37807 113 113 create_IDmap_lookup (IDmap); 114 114 115 if (!out[0].swapped) {116 gfits_convert_Image ((Image *) out[0].ftable.buffer, sizeof(Image), Nout);117 out[0].swapped = TRUE;118 }119 120 115 Nout += Nimages; 121 116 IDstart += Nimages; -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
r37116 r37807 58 58 } 59 59 60 # ifdef OLD_CODE 61 // NOTE: i was having trouble dropping objects on edges with the option below. Since an object can move outside the catalog grab the neighbors. 60 62 // SkyListByBounds will return neighbor catalogs if the boundaries exactly match (due to rounding). Since the regions are not infinitely small, 61 63 // compare to a slightly reduced footprint 62 64 float dPos = 2.0/3600.0; 63 65 outlist = SkyListByBounds (outsky, -1, inlist[0].regions[i][0].Rmin + dPos, inlist[0].regions[i][0].Rmax - dPos, inlist[0].regions[i][0].Dmin + dPos, inlist[0].regions[i][0].Dmax - dPos); 66 # endif 67 68 if (MATCHED_TABLES) { 69 // if we know the output will have the same depth / layout as the input, just choose the matched table 70 outlist = SkyRegionByIndex (outsky, inlist[0].regions[i][0].index); 71 } else { 72 // Since an object can move outside the catalog grab the neighbors. 73 float dPos = 2.0/3600.0; 74 outlist = SkyListByBounds (outsky, -1, inlist[0].regions[i][0].Rmin - dPos, inlist[0].regions[i][0].Rmax + dPos, inlist[0].regions[i][0].Dmin - dPos, inlist[0].regions[i][0].Dmax + dPos); 75 } 64 76 65 77 OutputStatus *outstat = OutputStatusInit (outlist->Nregions); … … 163 175 LoadCatalog (&outcatalog, outlist[0].regions[j], outcatalog.filename, "w", NsecfiltOutput); 164 176 165 // if no catalog already exists, use the input catalog to define the format 177 // if no catalog already exists, use the input catalog to define the format or the specified format 166 178 if (outcatalog.Naves_disk == 0) { 167 outcatalog.catformat = incatalog.catformat; 179 if (UPDATE_CATFORMAT) { 180 outcatalog.catformat = dvo_catalog_catformat (UPDATE_CATFORMAT); 181 } else { 182 outcatalog.catformat = incatalog.catformat; 183 } 168 184 } 169 185 … … 187 203 SetProtect (FALSE); 188 204 205 if (!dvo_catalog_unlock (&outcatalog)) { 206 fprintf (stderr, "ERROR: failed to unlock catalog %s\n", outlist[0].filename[j]); 207 exit (1); 208 } 209 189 210 if (!dvo_catalog_unlink_backup (&outcatalog, TRUE)) { 190 211 fprintf (stderr, "WARNING: failed to remove backup for catalog %s\n", outlist[0].filename[j]); 191 212 } 192 213 193 dvo_catalog_unlock (&outcatalog);194 214 dvo_catalog_free (&outcatalog); 195 215 … … 256 276 if (PARALLEL_INPUT) { snprintf (tmpline, DVO_MAX_PATH, "%s -parallel-input", command); strcpy (command, tmpline); } 257 277 if (FORCE_MERGE) { snprintf (tmpline, DVO_MAX_PATH, "%s -force-merge", command); strcpy (command, tmpline); } 278 if (MATCHED_TABLES) { snprintf (tmpline, DVO_MAX_PATH, "%s -matched-tables", command); strcpy (command, tmpline); } 258 279 259 280 // add some config variables: -
trunk/Ohana/src/dvomerge/src/dvorepair.c
r37046 r37807 3 3 int main (int argc, char **argv) { 4 4 5 fprintf (stderr, "this program needs to be updated to load old format Measure tables (pre PV1_V5) in which dR,dD are saved, not R,D\n");6 fprintf (stderr, "reminder: relastro can re-construct R,D from X,Y; FtableToMeasure and vice versa could just NAN those values\n");7 exit (2);5 // fprintf (stderr, "this program needs to be updated to load old format Measure tables (pre PV1_V5) in which dR,dD are saved, not R,D\n"); 6 // fprintf (stderr, "reminder: relastro can re-construct R,D from X,Y; FtableToMeasure and vice versa could just NAN those values\n"); 7 // exit (2); 8 8 9 9 dvorepair_help(argc, argv); … … 13 13 if (!strcmp(argv[1], "-images-vs-measures")) dvorepairImagesVsMeasures(argc, argv); 14 14 if (!strcmp(argv[1], "-delete-image-list")) dvorepairDeleteImageList(argc, argv); 15 if (!strcmp(argv[1], "-delete-images-by-extern-id")) dvorepairDeleteImagesByExternID(argc, argv); 15 16 if (!strcmp(argv[1], "-fix-images")) dvorepairFixImages(argc, argv); 16 17 dvorepair_help(0, NULL); -
trunk/Ohana/src/dvomerge/src/dvorepairCPT.c
r37046 r37807 119 119 thisImage = MatchImage (image, Nimage, measure[i].t, measure[i].photcode, measure[i].imageID); 120 120 XY_to_RD (&average[Nave].R, &average[Nave].D, measure[i].Xccd, measure[i].Yccd, &thisImage[0].coords); 121 average[Nave].R = ohana_normalize_angle (average[Nave].R); 121 122 122 123 average[Nave].Nmeasure = 1; -
trunk/Ohana/src/dvomerge/src/dvorepairDeleteImageList.c
r37046 r37807 114 114 index = deleteIDs[i]; 115 115 seq = imageIdx[index]; 116 if (!FindMosaicForImage (image, Nimage, seq)) {117 fprintf (stderr, "cannot find mosaic for %s, skipping\n", image[seq].name);118 continue;119 }120 116 121 117 XY_to_RD(&Rthis, &Dthis, 0, 0, &image[seq].coords); … … 404 400 thisImage = MatchImage (image, Nimage, measure[i].t, measure[i].photcode, measure[i].imageID); 405 401 XY_to_RD (&average[Nave].R, &average[Nave].D, measure[i].Xccd, measure[i].Yccd, &thisImage[0].coords); 402 average[Nave].R = ohana_normalize_angle (average[Nave].R); 406 403 407 404 average[Nave].Nmeasure = 1; -
trunk/Ohana/src/dvomerge/src/dvorepairFixImages.c
r29938 r37807 130 130 int MarkMosaicsToDelete(Image *image, off_t Nimage, int *deleteIndex) { 131 131 132 myAbort ("this function needs to be redone with a concept to match the old BuildChipMatch"); 133 134 # if (0) 135 132 136 off_t i; 133 137 … … 140 144 marked. Now find all WRP images for which none/some/all images are to be deleted. 141 145 */ 146 147 142 148 143 149 // make a copy of the ChipMatch table (generated by BuildChipMatch, see libdvo/src/mosaic_astrom.c) … … 237 243 free (ChipByMosaicID); 238 244 245 # endif 246 239 247 return TRUE; 240 248 } -
trunk/Ohana/src/dvomerge/src/dvorepairFixTables.c
r37046 r37807 259 259 thisImage = MatchImage (image, Nimage, measure[i].t, measure[i].photcode, measure[i].imageID); 260 260 XY_to_RD (&average[Nave].R, &average[Nave].D, measure[i].Xccd, measure[i].Yccd, &thisImage[0].coords); 261 average[Nave].R = ohana_normalize_angle (average[Nave].R); 261 262 262 263 average[Nave].Nmeasure = 1; -
trunk/Ohana/src/dvomerge/src/dvoverify_utils.c
r37360 r37807 238 238 } 239 239 // lensingOffset needs to be in range for each object 240 lensingOffsetOK &= ( catalog.average[i].lensingOffset < catalog.Nlensing);241 if (VERBOSE && !(catalog.average[i].lensingOffset < catalog.Nlensing)) {240 lensingOffsetOK &= (!catalog.Nlensing || (catalog.average[i].lensingOffset < catalog.Nlensing)); 241 if (VERBOSE && catalog.Nlensing && !(catalog.average[i].lensingOffset < catalog.Nlensing)) { 242 242 fprintf (stderr, "lensingOffset >= catalog.Nlensing: %d %d %d\n", i, catalog.average[i].lensingOffset, (int) catalog.Nlensing); 243 243 } -
trunk/Ohana/src/dvomerge/src/merge_catalogs_new.c
r37472 r37807 11 11 12 12 off_t i, j, offset; 13 off_t NAVERAGE, NMEASURE, NLENSING, N average, Nmeasure, Nlensing, NsecfiltIn, NsecfiltOut, Nm;13 off_t NAVERAGE, NMEASURE, NLENSING, NSTARPAR, Naverage, Nmeasure, Nlensing, Nstarpar, NsecfiltIn, NsecfiltOut, Nm; 14 14 15 15 Naverage = output[0].Naverage; … … 81 81 output[0].average[Naverage].Nlensing = Nm; 82 82 83 Nm = 0; 84 for (j = 0; j < input[0].average[i].Nstarpar; j++) { 85 offset = input[0].average[i].starparOffset + j; 86 87 output[0].starpar[Nstarpar] = input[0].starpar[offset]; 88 output[0].starpar[Nstarpar].averef = Naverage; 89 90 Nstarpar ++; 91 Nm ++; 92 if (Nstarpar == NSTARPAR) { 93 NSTARPAR += 1000; 94 REALLOCATE (output[0].starpar, StarPar, NSTARPAR); 95 } 96 } 97 output[0].average[Naverage].Nstarpar = Nm; 98 83 99 Naverage ++; 84 100 if (Naverage == NAVERAGE) { … … 91 107 REALLOCATE (output[0].measure, Measure, MAX (Nmeasure, 1)); 92 108 REALLOCATE (output[0].lensing, Lensing, MAX (Nlensing, 1)); 109 REALLOCATE (output[0].starpar, StarPar, MAX (Nstarpar, 1)); 93 110 REALLOCATE (output[0].secfilt, SecFilt, NsecfiltOut*MAX (Naverage, 1)); 94 111 output[0].Naverage = Naverage; 95 112 output[0].Nlensing = Nlensing; 113 output[0].Nstarpar = Nstarpar; 96 114 output[0].Nsecf_mem = Naverage * NsecfiltOut; 97 115 -
trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c
r37116 r37807 4 4 # define IN_REGION(R,D) ( \ 5 5 ((D) >= region[0].Dmin) && ((D) < region[0].Dmax) && \ 6 ((R) >= region[0].Rmin) && ((R) < region[0].Rmax))6 ((R) >= region[0].Rmin) && ((R) < region[0].Rmax)) 7 7 8 8 // merge the input data into the output catalog … … 14 14 double *X1, *Y1, *X2, *Y2; 15 15 double dX, dY, dR; 16 off_t *N1, *N2, *next_meas, *next_lens ;17 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch, Nlens, NLENS ;16 off_t *N1, *N2, *next_meas, *next_lens, *next_star; 17 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch, Nlens, NLENS, Nstar, NSTAR; 18 18 int NsecfiltIn; 19 19 int NsecfiltOut; … … 53 53 NMEAS = Nmeas = output[0].Nmeasure; 54 54 NLENS = Nlens = output[0].Nlensing; 55 NSTAR = Nstar = output[0].Nstarpar; 55 56 56 57 // current max obj ID for this catalog … … 64 65 * coordops.update.c). We use the center of the region (catalog) for crval1,2. 65 66 */ 67 68 InitCoords (&tcoords, "DEC--ARC"); 66 69 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 67 70 if (region[0].Dmax < 90) { … … 70 73 tcoords.crval2 = 90.0; 71 74 } 72 tcoords.crpix1 = 0;73 tcoords.crpix2 = 0;74 75 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 75 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;76 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;77 tcoords.Npolyterms = 1;78 strcpy (tcoords.ctype, "DEC--ARC");79 76 80 77 if (VERBOSE) fprintf (stderr, "merging %s into %s\n", input[0].filename, output[0].filename); … … 120 117 next_meas = init_measure_links (output[0].average, Nave, output[0].measure, Nmeas); 121 118 next_lens = init_lensing_links (output[0].average, Nave, output[0].lensing, Nlens); 119 next_star = init_starpar_links (output[0].average, Nave, output[0].starpar, Nstar); 122 120 } else { 123 121 next_meas = build_measure_links (output[0].average, Nave, output[0].measure, Nmeas); 124 122 next_lens = build_lensing_links (output[0].average, Nave, output[0].lensing, Nlens); 123 next_star = build_starpar_links (output[0].average, Nave, output[0].starpar, Nstar); 125 124 } 126 125 … … 184 183 REALLOCATE (output[0].measure, Measure, NMEAS); 185 184 } 186 if (Nlens + input[0].average[N].N measure>= NLENS) {187 NLENS = Nlens + input[0].average[N].N measure+ 1000;185 if (Nlens + input[0].average[N].Nlensing >= NLENS) { 186 NLENS = Nlens + input[0].average[N].Nlensing + 1000; 188 187 REALLOCATE (next_lens, off_t, NLENS); 189 188 REALLOCATE (output[0].lensing, Lensing, NLENS); 189 } 190 if (Nstar + input[0].average[N].Nstarpar >= NSTAR) { 191 NSTAR = Nstar + input[0].average[N].Nstarpar + 1000; 192 REALLOCATE (next_star, off_t, NSTAR); 193 REALLOCATE (output[0].starpar, StarPar, NSTAR); 190 194 } 191 195 … … 274 278 } 275 279 280 // if lensing measurements exist, add them too 281 if (output[0].starpar) { 282 for (Nin = 0; Nin < input[0].average[N].Nstarpar; Nin++) { 283 /* add to end of lensing list */ 284 add_star_link (&output[0].average[n], next_star, Nstar, NSTAR); 285 286 // set the new starpar 287 off_t staroff = input[0].average[N].starparOffset + Nin; 288 output[0].starpar[Nstar] = input[0].starpar[staroff]; 289 290 output[0].starpar[Nstar].averef = n; 291 output[0].starpar[Nstar].objID = output[0].average[n].objID; 292 output[0].starpar[Nstar].catID = output[0].catID; 293 output[0].average[n].Nstarpar ++; 294 Nstar ++; 295 } 296 } 297 276 298 // update the average properties to reflect the incoming entries: 277 299 // if the original value is NAN but the input value is not, accept the input: … … 319 341 REALLOCATE (output[0].lensing, Lensing, NLENS); 320 342 } 343 if (Nstar + input[0].average[N].Nstarpar >= NSTAR) { 344 NSTAR = Nstar + input[0].average[N].Nstarpar + 1000; 345 REALLOCATE (next_star, off_t, NSTAR); 346 REALLOCATE (output[0].starpar, StarPar, NSTAR); 347 } 321 348 if (Nave >= NAVE) { 322 349 NAVE = Nave + 1000; … … 326 353 327 354 if (input[0].found_t[N] >= 0) continue; 328 if (!IN_REGION (input[0].average[N].R, input[0].average[N].D)) continue; 355 356 // if we are using MATCHED_TABLES, we are going to leave the edge cases in their 357 // source catalog, even if they have leaked beyond the edge 358 if (!MATCHED_TABLES && !IN_REGION (input[0].average[N].R, input[0].average[N].D)) continue; 329 359 330 360 // XXX should we accept the input measurements for these fields? … … 413 443 } 414 444 445 /** add starpar for this input average object **/ 446 if (output[0].starpar) { 447 output[0].average[Nave].starparOffset = Nstar; 448 for (Nin = 0; Nin < input[0].average[N].Nstarpar; Nin ++) { 449 // supply the starpar values from this detection 450 off_t staroff = input[0].average[N].starparOffset + Nin; 451 output[0].starpar[Nstar] = input[0].starpar[staroff]; 452 453 // the following starpar elements cannot be set until here: 454 output[0].starpar[Nstar].averef = Nave; 455 output[0].starpar[Nstar].objID = output[0].average[Nave].objID; 456 output[0].starpar[Nstar].catID = output[0].catID; 457 458 // as we add starpar, update Nstarpar to match 459 output[0].average[Nave].Nstarpar ++; 460 461 /* we set next[Nstar] to -1 here, and update correctly below */ 462 next_star[Nstar] = -1; 463 Nstar ++; 464 } 465 int Ngroup = input[0].average[N].Nstarpar; 466 for (j = 0; j < Ngroup - 1; j++) { 467 next_star[Nstar - Ngroup + j] = Nstar - Ngroup + j + 1; 468 } 469 } 470 415 471 Nave ++; 416 472 } … … 421 477 REALLOCATE (output[0].measure, Measure, Nmeas); 422 478 REALLOCATE (output[0].lensing, Lensing, Nlens); 479 REALLOCATE (output[0].starpar, StarPar, Nstar); 423 480 424 481 # define NOSORT 0 … … 429 486 output[0].measure = sort_measure (output[0].average, Nave, output[0].measure, Nmeas, next_meas); 430 487 output[0].lensing = sort_lensing (output[0].average, Nave, output[0].lensing, Nlens, next_lens); 488 output[0].starpar = sort_starpar (output[0].average, Nave, output[0].starpar, Nstar, next_star); 431 489 } 432 490 … … 445 503 output[0].Nmeasure = Nmeas; 446 504 output[0].Nlensing = Nlens; 505 output[0].Nstarpar = Nstar; 447 506 output[0].Nsecf_mem = Nave*NsecfiltOut; 448 507 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nlens: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n", Nstars, Nave, Nmeas, Nlens, Nmatch); … … 450 509 free (next_meas); 451 510 free (next_lens); 511 free (next_star); 452 512 453 513 free (X2); -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r37361 r37807 239 239 } 240 240 241 PrintIOBuffer (buffer, "(%lu, ", detection->objID); // objID 242 PrintIOBuffer (buffer, "%lu, ", detection->detectID); // detectID 243 PrintIOBuffer (buffer, "%lu, ", detection->ippObjID); // ippObjID 241 // XXX I needed OFF_T_FMT on my 32bit ubuntu laptop; ok on 64bit? 242 PrintIOBuffer (buffer, "("OFF_T_FMT", ", detection->objID); // objID 243 PrintIOBuffer (buffer, OFF_T_FMT", ", detection->detectID); // detectID 244 PrintIOBuffer (buffer, OFF_T_FMT", ", detection->ippObjID); // ippObjID 244 245 PrintIOBuffer (buffer, "%u, ", detection->ippDetectID); // ippDetectID 245 246 PrintIOBuffer (buffer, "%d, ", detection->imageID); // imageID -
trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c
r37246 r37807 256 256 // XXX this bit could/should be autocoded... 257 257 PrintIOBuffer (ave_buffer, " ("); 258 PrintIOBuffer (ave_buffer, "%lu, ", average->extID);258 PrintIOBuffer (ave_buffer, OFF_T_FMT", ", average->extID); 259 259 PrintIOBuffer (ave_buffer, "%u, ", average->objID); 260 260 PrintIOBuffer (ave_buffer, "%u, ", average->catID); -
trunk/Ohana/src/dvosplit/include/dvosplit.h
r33656 r37807 22 22 } AveLinks; 23 23 24 int FULL_TABLE; 24 25 int VERBOSE; 25 26 char *OUTDIR; -
trunk/Ohana/src/dvosplit/src/args.c
r33656 r37807 57 57 } 58 58 59 // override input catalog format (PS1_V1, PS1_REF, etc) 60 FULL_TABLE = FALSE; 61 if ((N = get_argument (argc, argv, "-full-table"))) { 62 remove_argument (N, &argc, argv); 63 FULL_TABLE = TRUE; 64 } 65 59 66 /* extra error messages */ 60 67 VERBOSE = FALSE; -
trunk/Ohana/src/dvosplit/src/split_averages.c
r37043 r37807 27 27 incatalog[0].catflags = LOAD_AVES | LOAD_SECF; 28 28 29 if ( incatalog[0].catmode == DVO_MODE_SPLIT) {29 if ((incatalog[0].catmode == DVO_MODE_SPLIT) && !FULL_TABLE) { 30 30 Nblocks = incatalog[0].Naves_disk / NROWS; 31 31 if (incatalog[0].Naves_disk % NROWS) Nblocks ++; … … 36 36 for (block = 0; block < Nblocks; block++) { 37 37 38 if ( incatalog[0].catmode == DVO_MODE_SPLIT) {38 if ((incatalog[0].catmode == DVO_MODE_SPLIT) && !FULL_TABLE) { 39 39 // read up to NROWS at a time 40 40 dvo_catalog_load_segment (incatalog, VERBOSE, block*NROWS, NROWS); 41 41 fprintf (stderr, "splitting %s (averages) .. %d of %d\n", incatalog[0].filename, block, Nblocks); 42 assert (block*NROWS == incatalog[0].Naves_off); 42 43 } else { 43 44 dvo_catalog_load (incatalog, VERBOSE); 44 45 fprintf (stderr, "splitting %s (averages)\n", incatalog[0].filename); 45 46 } 46 47 assert (block*NROWS == incatalog[0].Naves_off);48 47 49 48 // distribute data to the output catalogs … … 54 53 inD = incatalog[0].average[ave].D; 55 54 55 if (incatalog[0].average[ave].Nmeasure == 0) { 56 fprintf (stderr, "WARNING: object with no measurements, skipping %d (%f, %f)\n", averef, inR, inD); 57 continue; 58 } 56 59 // which of the outcatalogs contains this coordinate? 57 60 … … 98 101 99 102 // write out the new values 100 for (cat = 0; cat < outlist[0].Nregions; cat++) { 101 outcatalogs[cat].catflags = LOAD_AVES | LOAD_SECF; 103 if (!FULL_TABLE) { 104 for (cat = 0; cat < outlist[0].Nregions; cat++) { 105 outcatalogs[cat].catflags = LOAD_AVES | LOAD_SECF; 102 106 103 dvo_catalog_save (&outcatalogs[cat], VERBOSE);104 // fprintf (stderr, "secfilt: %d %d %d %d\n", outcatalogs[cat].Nsecf_mem, outcatalogs[cat].Nsecf_disk, outcatalogs[cat].Nsecf_off, outcatalogs[cat].Naverage, outcatalogs[cat].Nsecfilt);107 dvo_catalog_save (&outcatalogs[cat], VERBOSE); 108 // fprintf (stderr, "secfilt: %d %d %d %d\n", outcatalogs[cat].Nsecf_mem, outcatalogs[cat].Nsecf_disk, outcatalogs[cat].Nsecf_off, outcatalogs[cat].Naverage, outcatalogs[cat].Nsecfilt); 105 109 106 // advance the pointers and free the current data107 // XXX these should be done within save segment:108 outcatalogs[cat].Naves_disk += outcatalogs[cat].Naverage;109 outcatalogs[cat].Naves_off += outcatalogs[cat].Naverage;110 outcatalogs[cat].Nsecf_disk += outcatalogs[cat].Nsecfilt * outcatalogs[cat].Naverage;111 outcatalogs[cat].Nsecf_off += outcatalogs[cat].Nsecfilt * outcatalogs[cat].Naverage;112 outcatalogs[cat].Nsecfilt = Nsecfilt;110 // advance the pointers and free the current data 111 // XXX these should be done within save segment: 112 outcatalogs[cat].Naves_disk += outcatalogs[cat].Naverage; 113 outcatalogs[cat].Naves_off += outcatalogs[cat].Naverage; 114 outcatalogs[cat].Nsecf_disk += outcatalogs[cat].Nsecfilt * outcatalogs[cat].Naverage; 115 outcatalogs[cat].Nsecf_off += outcatalogs[cat].Nsecfilt * outcatalogs[cat].Naverage; 116 outcatalogs[cat].Nsecfilt = Nsecfilt; 113 117 114 outcatalogs[cat].Naverage = 0; 115 outcatalogs[cat].Nsecf_mem = 0; 118 outcatalogs[cat].Naverage = 0; 119 outcatalogs[cat].Nsecf_mem = 0; 120 } 116 121 } 117 122 } 118 123 119 for (cat = 0; cat < outlist[0].Nregions; cat++) { 120 dvo_catalog_free_data (&outcatalogs[cat]); 124 if (!FULL_TABLE) { 125 for (cat = 0; cat < outlist[0].Nregions; cat++) { 126 dvo_catalog_free_data (&outcatalogs[cat]); 127 } 121 128 } 122 129 -
trunk/Ohana/src/dvosplit/src/split_measures.c
r37043 r37807 27 27 // } 28 28 29 if ( incatalog[0].catmode == DVO_MODE_SPLIT) {29 if ((incatalog[0].catmode == DVO_MODE_SPLIT) && !FULL_TABLE) { 30 30 Nblocks = incatalog[0].Nmeas_disk / NROWS; 31 31 if (incatalog[0].Nmeas_disk % NROWS) Nblocks ++; … … 37 37 38 38 // read up to NROWS at a time 39 if ( incatalog[0].catmode == DVO_MODE_SPLIT) {39 if ((incatalog[0].catmode == DVO_MODE_SPLIT) && !FULL_TABLE) { 40 40 dvo_catalog_load_segment (incatalog, VERBOSE, block*NROWS, NROWS); 41 41 fprintf (stderr, "splitting %s (measures) .. %d of %d\n", incatalog[0].filename, block, Nblocks); 42 assert (block*NROWS == incatalog[0].Nmeas_off); 42 43 } else { 43 44 dvo_catalog_load (incatalog, VERBOSE); 44 45 fprintf (stderr, "splitting %s (measures)\n", incatalog[0].filename); 45 46 } 46 47 assert (block*NROWS == incatalog[0].Nmeas_off);48 47 49 48 for (meas = 0; meas < incatalog[0].Nmeasure; meas++) { … … 52 51 Ncat = outcat[averef]; 53 52 53 int averef_out = outref[averef]; 54 if (averef_out >= outcatalogs[Ncat].Naverage) { 55 fprintf (stderr, "mismatch 1\n"); 56 abort(); 57 } 58 54 59 Nout = outcatalogs[Ncat].Nmeasure; 55 60 outcatalogs[Ncat].measure[Nout] = incatalog[0].measure[meas]; 56 61 outcatalogs[Ncat].measure[Nout].averef = outref[averef]; 62 57 63 outcatalogs[Ncat].Nmeasure++; 58 64 … … 64 70 dvo_catalog_free_data (incatalog); 65 71 72 if (!FULL_TABLE) { 73 for (cat = 0; cat < outlist[0].Nregions; cat++) { 74 outcatalogs[cat].catflags = LOAD_MEAS; 75 dvo_catalog_save (&outcatalogs[cat], VERBOSE); 76 77 outcatalogs[cat].Nmeas_disk += outcatalogs[cat].Nmeasure; 78 outcatalogs[cat].Nmeas_off += outcatalogs[cat].Nmeasure; 79 outcatalogs[cat].Nmeasure = 0; 80 } 81 } 82 } 83 84 if (FULL_TABLE) { 66 85 for (cat = 0; cat < outlist[0].Nregions; cat++) { 67 outcatalogs[cat].catflags = LOAD_ MEAS;86 outcatalogs[cat].catflags = LOAD_AVES | LOAD_SECF | LOAD_MEAS; 68 87 dvo_catalog_save (&outcatalogs[cat], VERBOSE); 69 70 outcatalogs[cat].Nmeas_disk += outcatalogs[cat].Nmeasure;71 outcatalogs[cat].Nmeas_off += outcatalogs[cat].Nmeasure;72 outcatalogs[cat].Nmeasure = 0;73 74 88 } 75 89 } -
trunk/Ohana/src/fixcat/src/gcatstats.c
r36481 r37807 46 46 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ 47 47 /* reference for coords is center of field */ 48 InitCoords (&catstats[0].coords, "DEC--TAN"); 48 49 catstats[0].coords.crval1 = RaCenter; 49 50 catstats[0].coords.crval2 = DecCenter; 50 catstats[0].coords.crpix1 = catstats[0].coords.crpix2 = 0.0;51 51 catstats[0].coords.cdelt1 = catstats[0].coords.cdelt2 = 1.0 / 3600.0; 52 catstats[0].coords.pc1_1 = catstats[0].coords.pc2_2 = 1.0;53 catstats[0].coords.pc1_2 = catstats[0].coords.pc2_1 = 0.0;54 strcpy (catstats[0].coords.ctype, "DEC--TAN");55 52 56 53 X1 = catstats[0].X; -
trunk/Ohana/src/gastro/src/gfitpoly.c
r27435 r37807 261 261 det = 1.0 / (a1*b2 - a2*b1); 262 262 263 InitCoords (coords, "DEC--PLY"); 264 263 265 coords[0].pc1_1 = p11*a1 + p12*b1*(S2/S1); 264 266 coords[0].pc2_1 = p21*a1 + p22*b1*(S2/S1); … … 273 275 274 276 coords[0].Npolyterms = NORDER; 275 strcpy (coords[0].ctype, "DEC--PLY");276 277 277 278 /* generate higher order terms from vector */ -
trunk/Ohana/src/gastro/src/gstars.c
r36481 r37807 79 79 if (!strcasecmp (ROUGH_ASTROMETRY, "config")) { 80 80 /* default values for coords */ 81 strcpy (coords[0].ctype, "DEC--TAN");81 InitCoords (coords, "DEC--TAN"); 82 82 coords[0].pc1_1 = CCD_PC1_1; coords[0].pc1_2 = CCD_PC1_2; 83 83 coords[0].pc2_1 = CCD_PC2_1; coords[0].pc2_2 = CCD_PC2_2; 84 84 coords[0].cdelt1 = coords[0].cdelt2 = ASEC_PIX / 3600.0; 85 coords[0].Npolyterms = 0;86 85 coords[0].crpix1 = 0.5*(*NX); 87 86 coords[0].crpix2 = 0.5*(*NY); -
trunk/Ohana/src/gastro2/src/gproject2.c
r12332 r37807 19 19 20 20 /* create Tangent Plane to Sky transformation from input coords */ 21 strcpy (TPtoSky.ctype, coords[0].ctype);21 InitCoords (&TPtoSky, coords[0].ctype); 22 22 TPtoSky.crval1 = coords[0].crval1; 23 23 TPtoSky.crval2 = coords[0].crval2; 24 24 25 TPtoSky.cdelt1 = TPtoSky.cdelt2 = 1;26 TPtoSky.crpix1 = TPtoSky.crpix2 = 0;27 TPtoSky.pc1_1 = TPtoSky.pc2_2 = 1;28 TPtoSky.pc1_2 = TPtoSky.pc2_1 = 0;29 TPtoSky.Npolyterms = 0;30 for (i = 0; i < 7; i++) {31 TPtoSky.polyterms[i][0] = 0;32 TPtoSky.polyterms[i][1] = 0;33 }34 35 25 /* create Focal Plane to Tangent Plane transformation from input coords */ 36 strcpy (FPtoTP.ctype, "FP---PLY"); 37 FPtoTP.crval1 = FPtoTP.crval2 = 0; 38 26 InitCoords (&FPtoTP, "FP---PLY"); 39 27 FPtoTP.cdelt1 = coords[0].cdelt1; 40 28 FPtoTP.cdelt2 = coords[0].cdelt2; -
trunk/Ohana/src/gastro2/src/gstars2.c
r37054 r37807 28 28 29 29 /* default values for coords */ 30 strcpy (Target[0].coords.ctype, "DEC--TAN");30 InitCoords (&Target[0].coords, "DEC--TAN"); 31 31 Target[0].coords.pc1_1 = CCD_PC1_1; Target[0].coords.pc1_2 = CCD_PC1_2; 32 32 Target[0].coords.pc2_1 = CCD_PC2_1; Target[0].coords.pc2_2 = CCD_PC2_2; 33 33 Target[0].coords.cdelt1 = Target[0].coords.cdelt2 = ASEC_PIX / 3600.0; 34 Target[0].coords.Npolyterms = 0;35 34 Target[0].coords.crpix1 = 0.5*NX; 36 35 Target[0].coords.crpix2 = 0.5*NY; -
trunk/Ohana/src/getstar
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20140904/Ohana/src/getstar (added) merged: 37378,37386,37803
- Property svn:mergeinfo changed
-
trunk/Ohana/src/getstar/include/dvoImageOverlaps.h
r27435 r37807 37 37 int edge_check (double *x1, double *y1, double *x2, double *y2); 38 38 double opening_angle (double x1, double y1, double x2, double y2, double x3, double y3); 39 40 void initMosaicCoords (); 41 void saveMosaicCoords (Coords *input); -
trunk/Ohana/src/getstar/src/MatchCoords.c
r31238 r37807 29 29 if (!WITH_PHU && !strcmp (&dbImages[i].coords.ctype[4], "-DIS")) continue; 30 30 if ( SOLO_PHU && strcmp (&dbImages[i].coords.ctype[4], "-DIS")) continue; 31 32 /* if any of these images are WRP images, need to find matching DIS */33 if (!FindMosaicForImage (dbImages, NdbImages, i)) continue;34 31 35 32 /* define image corners */ -
trunk/Ohana/src/getstar/src/MatchImages.c
r36481 r37807 23 23 /* we keep the original crpix1,2 and crref1,2 */ 24 24 /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */ 25 InitCoords (&tcoords, "DEC--TAN"); 25 26 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 26 // if the input image is a mosaic, we need to register that mosaic for the calculations below 27 if (MOSAIC == NULL) { 28 fprintf (stderr, "no mosaic for WRP image (use -mosaic)\n"); 29 return NULL; 30 } 31 RegisterMosaic (MOSAIC); 32 33 tcoords = MOSAIC[0]; 27 myAssert (image[0].coords.mosaic, "should already have tested this"); 28 tcoords = image[0].coords.mosaic[0]; 34 29 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 35 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;36 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;37 tcoords.Npolyterms = 1;38 strcpy (tcoords.ctype, "DEC--TAN");39 30 /* register so image->sky conversions below have correct mosaic */ 40 31 } else { 41 32 tcoords = image[0].coords; 42 33 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 43 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;44 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;45 tcoords.Npolyterms = 1;46 strcpy (tcoords.ctype, "DEC--TAN");47 34 } 48 35 … … 77 64 if (!WITH_PHU && !strcmp (&dbImages[i].coords.ctype[4], "-DIS")) continue; 78 65 if ( SOLO_PHU && strcmp (&dbImages[i].coords.ctype[4], "-DIS")) continue; 79 80 /* if any of these images are WRP images, need to find matching DIS */81 if (!FindMosaicForImage (dbImages, NdbImages, i)) continue;82 66 83 67 /* define image corners */ -
trunk/Ohana/src/getstar/src/ReadImageFiles.c
r36874 r37807 42 42 43 43 mode = GetFileMode (header); 44 45 initMosaicCoords (); 44 46 45 47 /*** load data from a single PHU or a collection of PHU files ***/ -
trunk/Ohana/src/getstar/src/ReadImageHeader.c
r21508 r37807 1 1 # include "dvoImageOverlaps.h" 2 3 // for DIS/WRP sets, we need to save the DIS set and supply it to the WRP entries 4 static Coords *mosaic = NULL; 5 6 void initMosaicCoords () { 7 mosaic = NULL; 8 } 9 10 void saveMosaicCoords (Coords *input) { 11 mosaic = input; 12 } 2 13 3 14 /* read an image header corresponding to a CMF / CMP data block */ … … 44 55 /* only load astrometry, NAXIS1,2, and time if this is a MOSAIC_PHU (ctype is ....-DIS) */ 45 56 if (!strcmp (&image[0].coords.ctype[4], "-DIS")) { 46 MOSAIC = &image[0].coords;57 saveMosaicCoords (&image[0].coords); 47 58 return (TRUE); 48 59 } … … 56 67 } 57 68 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 58 if ( MOSAIC== NULL) {69 if (mosaic == NULL) { 59 70 fprintf (stderr, "no mosaic for WRP image (use -mosaic)\n"); 60 71 return (FALSE); 61 72 } 62 RegisterMosaic (MOSAIC);73 image[0].coords.mosaic = mosaic; 63 74 } else { 64 75 /* force image to lie in 0-360 range */ -
trunk/Ohana/src/getstar/src/WriteImages.c
r27435 r37807 5 5 6 6 int i, N; 7 int nWRP, newWRP,isWRP;7 int isWRP; 8 8 FILE *f; 9 9 … … 16 16 } 17 17 18 nWRP = -1;18 Image *mosaic = NULL; 19 19 isWRP = FALSE; 20 20 for (i = 0; i < Nmatches; i++) { 21 if (!strcmp (&images[0].coords.ctype[4], "-WRP")) { 22 if (!FindMosaicForImage (images, Nimages, i)) { 23 fprintf (stderr, "failed to find matching mosaic\n"); 24 exit (1); 25 } 21 N = matches[i]; 22 if (!strcmp (&images[N].coords.ctype[4], "-WRP")) { 26 23 if (isWRP) { 27 newWRP = GetRegisteredMosaic(); 28 if (newWRP != nWRP) { 24 if (mosaic != images[N].parent) { 29 25 fprintf (stderr, "only one mosaic allowed in an output file\n"); 30 26 exit (1); 31 27 } 32 28 } else { 33 nWRP = GetRegisteredMosaic(); 34 isWRP = TRUE; 29 mosaic = images[N].parent; 35 30 } 36 31 } … … 38 33 39 34 if (isWRP) { 40 WriteImageFITS (f, &images[nWRP]);35 WriteImageFITS (f, mosaic); 41 36 } else { 42 37 // write a blank -
trunk/Ohana/src/imregister/imphot/dumpfits.c
r30617 r37807 34 34 35 35 ftable.header = &theader; 36 gfits_table_set_Image (&ftable, subset, Nmatch);36 // gfits_table_set_Image (&ftable, subset, Nmatch); 37 37 38 38 gfits_fwrite_header (f, &header); -
trunk/Ohana/src/imregister/imphot/modify.c
r27435 r37807 30 30 gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, match, Nmatch); 31 31 for (i = 0; i < Nmatch; i++) { 32 gfits_convert_Image ((Image *) db[0].vtable.buffer[i], sizeof (Image), 1); 32 fprintf (stderr, "need to work with real output format\n"); 33 exit (2); 34 // gfits_convert_Image ((Image *) db[0].vtable.buffer[i], sizeof (Image), 1); 33 35 } 34 36 gfits_db_update (db); -
trunk/Ohana/src/kapa2/include/constants.h
r36084 r37807 10 10 | PointerMotionMask) 11 11 12 # define NCHANNELS 312 # define NCHANNELS 10 13 13 # define NPIXELS_DYNAMIC 128 14 14 -
trunk/Ohana/src/kapa2/include/structures.h
r32695 r37807 217 217 KapaImageChannel *image; 218 218 KapaImageChannel channel[NCHANNELS]; 219 int currentChannel; 219 220 } KapaImageWidget; 220 221 -
trunk/Ohana/src/kapa2/src/CreatePicture.c
r16270 r37807 40 40 41 41 case 24: 42 43 extra = 4 - (image[0].wide.dx * 3) % 4; 44 REALLOCATE (image[0].wide.data, char, image[0].wide.dy*(3*image[0].wide.dx+extra)); 45 46 extra = 4 - (image[0].zoom.dx * 3) % 4; 47 REALLOCATE (image[0].zoom.data, char, image[0].zoom.dy*(3*image[0].zoom.dx+extra)); 48 42 49 extra = 4 - (image[0].picture.dx * 3) % 4; 43 REALLOCATE (image[0].wide.data, char, image[0].wide.dy*(3*image[0].wide.dx+extra));44 REALLOCATE (image[0].zoom.data, char, image[0].zoom.dy*(3*image[0].zoom.dx+extra));45 50 REALLOCATE (image[0].picture.data, char, image[0].picture.dy*(3*image[0].picture.dx+extra)); 46 51 c = (unsigned char *) image[0].picture.data; -
trunk/Ohana/src/kapa2/src/CursorOps.c
r25757 r37807 100 100 // Sx, Sy are the screen coordinates of the Ix,Iy pixel 101 101 Image_to_Picture (&Sx, &Sy, Ix, Iy, picture); 102 103 // Sx,Sy should be forced into the pixel 104 int Sxi = Sx + 0.5; 105 int Syi = Sy + 0.5; 102 106 103 107 // i_start, j_start are now limited to valid screen coordinates 104 *i_start = MIN (MAX (Sx , 0), picture[0].dx);105 *j_start = MIN (MAX (Sy , 0), picture[0].dy);108 *i_start = MIN (MAX (Sxi, 0), picture[0].dx); 109 *j_start = MIN (MAX (Syi, 0), picture[0].dy); 106 110 } 107 111 … … 127 131 Iy = MIN (MAX (Iy, 0), matrix[0].Naxis[1]); 128 132 129 // I_end, J_end are the last displayed image pixel130 // *I_end = Ix;131 // *J_end = Iy;132 133 133 // Sx, Sy are the screen coordinates of the Ix,Iy pixel 134 134 Image_to_Picture (&Sx, &Sy, Ix, Iy, picture); 135 135 136 // Sx,Sy should be forced into the pixel 137 int Sxi = Sx + 0.5; 138 int Syi = Sy + 0.5; 139 140 // double IxTest, IyTest; 141 // Picture_to_Image (&IxTest, &IyTest, Sx, Sy, picture); 142 // fprintf (stderr, "dx,dy: %d,%d : %f,%f : %f,%f : %f:%f\n", picture[0].dx, picture[0].dy, Ix, Iy, Sx, Sy, IxTest, IyTest); 143 136 144 // i_start, j_start are now limited to valid screen coordinates 137 *i_end = MIN (MAX (Sx, 0), picture[0].dx); 138 *j_end = MIN (MAX (Sy, 0), picture[0].dy); 145 // XXX: i_end, j_end *should* be the last valid screen pixel plus 1 146 *i_end = MIN (MAX (Sxi, 0), picture[0].dx); 147 *j_end = MIN (MAX (Syi, 0), picture[0].dy); 139 148 140 149 // round off error can leave us with a small number of extra pixels here. -
trunk/Ohana/src/kapa2/src/Graphs.c
r36487 r37807 57 57 graph[0].data.flipnorth = FALSE; // +North = +Y by default 58 58 59 graph[0].data.coords.pc1_1 = graph[0].data.coords.pc2_2 = 1.0; 60 graph[0].data.coords.pc1_2 = graph[0].data.coords.pc2_1 = 0.0; 61 graph[0].data.coords.crval1 = 0.0; 62 graph[0].data.coords.crval2 = 0.0; 63 graph[0].data.coords.crpix1 = 0.0; 64 graph[0].data.coords.crpix2 = 0.0; 65 graph[0].data.coords.cdelt1 = graph[0].data.coords.cdelt2 = 1.0; 66 strcpy (graph[0].data.coords.ctype, "DEC--LIN"); 59 InitCoords (&graph[0].data.coords, "DEC--LIN"); 67 60 strcpy (graph[0].data.axis, "2222"); 68 61 strcpy (graph[0].data.ticks, "2222"); -
trunk/Ohana/src/kapa2/src/Image.c
r36487 r37807 11 11 channel->slope = 1; 12 12 13 channel->coords.pc1_1 = channel->coords.pc2_2 = 1.0; 14 channel->coords.pc1_2 = channel->coords.pc2_1 = 0.0; 15 channel->coords.crval1 = 0.0; 16 channel->coords.crval2 = 0.0; 17 channel->coords.crpix1 = 0.0; 18 channel->coords.crpix2 = 0.0; 19 channel->coords.cdelt1 = channel->coords.cdelt2 = 1.0; 20 strcpy (channel->coords.ctype, "DEC--LIN"); 21 channel->coords.Npolyterms = 0; 13 InitCoords (&channel->coords, "DEC--LIN"); 22 14 23 15 channel->matrix.datasize = 0; /* a flag to show there is no data in the matrix */ … … 42 34 InitImageChannel (&image[0].channel[i]); 43 35 } 44 image[0].image = &image[0].channel[0]; 36 37 image[0].currentChannel = 0; 38 image[0].image = &image[0].channel[image[0].currentChannel]; 45 39 46 40 image[0].nPixels = 0; -
trunk/Ohana/src/kapa2/src/InterpretKeys.c
r37412 r37807 90 90 switch (keysym) { 91 91 92 case XK_F1: 93 image[0].image = &image[0].channel[0]; 94 SetColorScale (graphic, image); 95 Remap (graphic, image); 96 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 92 # define SET_CHANNEL_CASE(NCHAN) \ 93 case XK_F##NCHAN: \ 94 image[0].currentChannel = NCHAN-1; \ 95 image[0].image = &image[0].channel[NCHAN-1]; \ 96 SetColorScale (graphic, image); \ 97 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); \ 98 Screen_to_Image (&X, &Y, (double)(event[0].x + 0.5), (double)(event[0].y + 0.5), &image[0].picture); \ 99 UpdateStatusBox (graphic, image, X, Y, 0.0, 1); \ 97 100 break; 98 101 99 case XK_F2: 100 image[0].image = &image[0].channel[1]; 101 SetColorScale (graphic, image); 102 Remap (graphic, image); 103 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 104 break; 102 // Remap (graphic, image); 105 103 106 case XK_F3: 107 image[0].image = &image[0].channel[2]; 108 SetColorScale (graphic, image); 109 Remap (graphic, image); 110 Reorient (graphic, image, image[0].picture.Xc, image[0].picture.Yc, 0); 111 break; 104 // the number of entries here must match the value of NCHANNELS in contants.h 105 SET_CHANNEL_CASE(1); 106 SET_CHANNEL_CASE(2); 107 SET_CHANNEL_CASE(3); 108 SET_CHANNEL_CASE(4); 109 SET_CHANNEL_CASE(5); 110 SET_CHANNEL_CASE(6); 111 SET_CHANNEL_CASE(7); 112 SET_CHANNEL_CASE(8); 113 SET_CHANNEL_CASE(9); 114 SET_CHANNEL_CASE(10); 112 115 113 116 case XK_KP_Home: -
trunk/Ohana/src/kapa2/src/LoadPicture.c
r28241 r37807 55 55 // choose expand for wide to guarantee we fit: 56 56 wx = MAX ((header.Naxis[0] / (float) image[0].wide.dx), (header.Naxis[1] / (float) image[0].wide.dy)); 57 if (wx > 1.0) { 58 image[0].wide.expand = -wx; 59 } else { 60 image[0].wide.expand = 1.0 / wx; 61 } 57 58 // -4.002 -> -5 59 // image[0].wide.expand = (wx > 1.0) ? ceil (-wx) : floor (1.0 / wx); 60 image[0].wide.expand = (wx > 1.0) ? floor (-wx) : ceil (1.0 / wx); 61 // fprintf (stderr, "%d : %f\n", image[0].wide.expand, wx); 62 image[0].wide.expand = (wx > 1.0) ? ceil (-wx) : floor (1.0 / wx); 63 62 64 image[0].wide.Xc = 0.5*header.Naxis[0]; 63 65 image[0].wide.Yc = 0.5*header.Naxis[1]; -
trunk/Ohana/src/kapa2/src/Reconfig.c
r21153 r37807 15 15 16 16 // if the new size is the same as the old size, do nothing. 17 if ((graphic->dx == NX) && (graphic->dy == NY)) return (TRUE); 17 if ((graphic->dx == NX) && (graphic->dy == NY)) { 18 if (USE_XWINDOW) XClearWindow (graphic->display, graphic->window); 19 Refresh (); 20 return (TRUE); 21 } 18 22 19 23 // set the new window size -
trunk/Ohana/src/kapa2/src/Remap32.c
r34088 r37807 37 37 swap_client = 0; 38 38 # endif 39 40 39 swap_server = ImageByteOrder (graphic[0].display); 41 40 swap_bytes = !(swap_client ^ swap_server); … … 91 90 in_pix = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)]; 92 91 92 unsigned short *in_base = image[0].pixmap; 93 OUT_TYPE *out_base = (OUT_TYPE *) picture[0].data; 94 95 int Ninmax = matrix[0].Naxis[0] * matrix[0].Naxis[1]; 96 int Noutmax = picture[0].dx * picture[0].dy; 97 93 98 /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/ 94 99 95 100 /**** fill in bottom area ****/ 96 101 for (j = 0; j < dx*j_start; j++, out_pix++) { 102 myAssert (out_pix - out_base < Noutmax, "too far out"); 97 103 *out_pix = back; 98 104 } … … 105 111 out_pix2 = out_pix + jj*dx; 106 112 for (i = 0; i < i_start; i++, out_pix2++) { 113 myAssert (out_pix2 - out_base < Noutmax, "too far out"); 107 114 *out_pix2 = back; 108 115 } … … 114 121 if (expand_out == 1) { 115 122 for (i = i_start; i < i_end; i++, in_pix2 += inDX*expand_in, out_pix++) { 123 myAssert (out_pix - out_base < Noutmax, "too far out"); 124 myAssert (in_pix2 - in_base < Ninmax, "too far in"); 116 125 *out_pix = pixel[*in_pix2]; 117 126 } 118 127 } else { 119 128 for (i = i_start; i < i_end; i+= expand_out, in_pix2 += inDX, out_pix+= expand_out) { 129 myAssert (in_pix2 - in_base < Ninmax, "too far in"); 120 130 pixvalue = pixel[*in_pix2]; 121 131 out_pix2 = out_pix; 122 132 for (jj = 0; (jj < expand_out) && (j + jj < dy); jj++, out_pix2+=(dx-expand_out)) { 123 133 for (ii = 0; ii < expand_out; ii++, out_pix2++) { 134 myAssert (out_pix2 - out_base < Noutmax, "too far out"); 124 135 *out_pix2 = pixvalue; 125 136 } … … 133 144 out_pix2 = out_pix + jj*dx; 134 145 for (i = i_end; i < dx; i++, out_pix2++) { 146 myAssert (out_pix2 - out_base < Noutmax, "too far out"); 135 147 *out_pix2 = back; 136 148 } … … 142 154 for (j = 0; j < dy - j_end; j++) { 143 155 for (i = 0; i < dx; i++, out_pix ++) { 156 myAssert (out_pix - out_base < Noutmax, "too far out"); 144 157 *out_pix = back; 145 158 } -
trunk/Ohana/src/kapa2/src/SetChannel.c
r31665 r37807 21 21 if (Nchannel >= NCHANNELS) return (TRUE); 22 22 23 image[0].image = &image[0].channel[Nchannel]; 23 image[0].currentChannel = Nchannel; 24 image[0].image = &image[0].channel[image[0].currentChannel]; 24 25 SetColorScale (graphic, image); 25 26 … … 61 62 62 63 Refresh (); 63 XFlush (graphic[0].display);64 if (USE_XWINDOW) XFlush (graphic[0].display); 64 65 65 66 return (TRUE); -
trunk/Ohana/src/kapa2/src/UpdateStatusBox.c
r30606 r37807 20 20 21 21 bzero (line, 100); 22 snprintf (line, 100, "(%d x %d) @ %d ",23 image[0].picture.dx, image[0].picture.dy, image[0].picture.expand);22 snprintf (line, 100, "(%d x %d) @ %d ch: %d ", 23 image[0].picture.dx, image[0].picture.dy, image[0].picture.expand, image[0].currentChannel+1); 24 24 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, 25 25 image[0].text_x + PAD1, image[0].text_y + 4*textpad + 4*PAD1, line, 25); -
trunk/Ohana/src/libautocode/Makefile.Targets
r37034 r37807 1 1 AOBJS = \ 2 $(ASRC)/coords.$(ARCH).o \ 2 $(ASRC)/coords-disk.$(ARCH).o \ 3 $(ASRC)/AstromOffsetMap_Disk.$(ARCH).o \ 3 4 $(ASRC)/average.$(ARCH).o \ 4 5 $(ASRC)/average-loneos.$(ARCH).o \ … … 13 14 $(ASRC)/average-ps1-v4.$(ARCH).o \ 14 15 $(ASRC)/average-ps1-v5.$(ARCH).o \ 16 $(ASRC)/average-ps1-sim.$(ARCH).o \ 15 17 $(ASRC)/average-ps1-ref.$(ARCH).o \ 16 18 $(ASRC)/secfilt.$(ARCH).o \ … … 26 28 $(ASRC)/secfilt-ps1-v4.$(ARCH).o \ 27 29 $(ASRC)/secfilt-ps1-v5.$(ARCH).o \ 30 $(ASRC)/secfilt-ps1-sim.$(ARCH).o \ 28 31 $(ASRC)/secfilt-ps1-ref.$(ARCH).o \ 29 32 $(ASRC)/measure.$(ARCH).o \ … … 39 42 $(ASRC)/measure-ps1-v4.$(ARCH).o \ 40 43 $(ASRC)/measure-ps1-v5.$(ARCH).o \ 44 $(ASRC)/measure-ps1-sim.$(ARCH).o \ 41 45 $(ASRC)/measure-ps1-ref.$(ARCH).o \ 42 46 $(ASRC)/lensing.$(ARCH).o \ 43 47 $(ASRC)/lensing-ps1-v5.$(ARCH).o \ 48 $(ASRC)/lensing-ps1-v5-alt.$(ARCH).o \ 44 49 $(ASRC)/lensobj.$(ARCH).o \ 45 50 $(ASRC)/lensobj-ps1-v5.$(ARCH).o \ 51 $(ASRC)/starpar.$(ARCH).o \ 52 $(ASRC)/starpar-ps1-v5.$(ARCH).o \ 53 $(ASRC)/starpar-ps1-sim.$(ARCH).o \ 46 54 $(ASRC)/missing.$(ARCH).o \ 47 55 $(ASRC)/photcode.$(ARCH).o \ … … 56 64 $(ASRC)/photcode-ps1-v5.$(ARCH).o \ 57 65 $(ASRC)/photcode-ps1-ref.$(ARCH).o \ 58 $(ASRC)/image.$(ARCH).o \59 66 $(ASRC)/image-loneos.$(ARCH).o \ 60 67 $(ASRC)/image-elixir.$(ARCH).o \ … … 69 76 $(ASRC)/image-ps1-v4.$(ARCH).o \ 70 77 $(ASRC)/image-ps1-v5.$(ARCH).o \ 78 $(ASRC)/image-ps1-sim.$(ARCH).o \ 71 79 $(ASRC)/image-ps1-ref.$(ARCH).o \ 72 80 $(ASRC)/regimage.$(ARCH).o \ … … 98 106 99 107 AINCS = \ 100 $(AINC)/coords.h \ 108 $(AINC)/coords-disk.h \ 109 $(AINC)/AstromOffsetMap_Disk.h \ 101 110 $(AINC)/average.h \ 102 111 $(AINC)/average-loneos.h \ … … 111 120 $(AINC)/average-ps1-v4.h \ 112 121 $(AINC)/average-ps1-v5.h \ 122 $(AINC)/average-ps1-sim.h \ 113 123 $(AINC)/average-ps1-ref.h \ 114 124 $(AINC)/secfilt.h \ … … 124 134 $(AINC)/secfilt-ps1-v4.h \ 125 135 $(AINC)/secfilt-ps1-v5.h \ 136 $(AINC)/secfilt-ps1-sim.h \ 126 137 $(AINC)/secfilt-ps1-ref.h \ 127 138 $(AINC)/measure.h \ … … 137 148 $(AINC)/measure-ps1-v4.h \ 138 149 $(AINC)/measure-ps1-v5.h \ 150 $(AINC)/measure-ps1-sim.h \ 139 151 $(AINC)/measure-ps1-ref.h \ 140 152 $(AINC)/lensing.h \ 141 153 $(AINC)/lensing-ps1-v5.h \ 154 $(AINC)/lensing-ps1-v5-alt.h \ 142 155 $(AINC)/lensobj.h \ 143 156 $(AINC)/lensobj-ps1-v5.h \ 157 $(AINC)/starpar.h \ 158 $(AINC)/starpar-ps1-v5.h \ 159 $(AINC)/starpar-ps1-sim.h \ 144 160 $(AINC)/missing.h \ 145 161 $(AINC)/photcode.h \ … … 154 170 $(AINC)/photcode-ps1-v5.h \ 155 171 $(AINC)/photcode-ps1-ref.h \ 156 $(AINC)/image.h \157 172 $(AINC)/image-loneos.h \ 158 173 $(AINC)/image-elixir.h \ … … 167 182 $(AINC)/image-ps1-v4.h \ 168 183 $(AINC)/image-ps1-v5.h \ 184 $(AINC)/image-ps1-sim.h \ 169 185 $(AINC)/image-ps1-ref.h \ 170 186 $(AINC)/regimage.h \ -
trunk/Ohana/src/libautocode/def/average-ps1-v5.d
r37246 r37807 47 47 FIELD lensingOffset, OFF_LENSING, int, offset to first lensing obs 48 48 FIELD lensobjOffset, OFF_LENSOBJ, int, offset to mean lensing data 49 FIELD starparOffset, OFF_STARPAR, int, offset to stellar parameter data 49 50 FIELD extendOffset, OFF_EXTEND, int, offset to extended object entry 50 FIELD paramsOffset, OFF_PARAMS, int, offset to stellar parameter data51 51 52 52 FIELD refColorBlue, REF_COLOR_BLUE, float, color of astrometry ref stars … … 57 57 FIELD projectionID, PROJECTION_ID, short, ID of projection for primary skycell 58 58 59 FIELD dummy, DUMMY, int, unassigned bytes 59 FIELD Nstarpar, DUMMY, short, number of stellar parameter entries 60 FIELD dummy, DUMMY, short, unassigned bytes 60 61 61 62 # 'flags' was called 'code' prior to 2009.02.07 -
trunk/Ohana/src/libautocode/def/average.d
r37246 r37807 47 47 FIELD lensingOffset, OFF_LENSING, int, offset to first lensing obs 48 48 FIELD lensobjOffset, OFF_LENSOBJ, int, offset to mean lensing data 49 FIELD starparOffset, OFF_STARPAR, int, offset to stellar parameter data 49 50 FIELD extendOffset, OFF_EXTEND, int, offset to extended object entry 50 FIELD paramsOffset, OFF_PARAMS, int, offset to stellar parameter data51 51 52 52 FIELD refColorBlue, REF_COLOR_BLUE, float, color of astrometry ref stars … … 57 57 FIELD projectionID, PROJECTION_ID, short, ID of projection for primary skycell 58 58 59 FIELD dummy, DUMMY, int, unassigned bytes 59 FIELD Nstarpar, DUMMY, short, number of stellar parameter entries 60 FIELD dummy, DUMMY, short, unassigned bytes 60 61 61 62 # 'flags' was called 'code' prior to 2009.02.07 -
trunk/Ohana/src/libautocode/def/coords.d
r6454 r37807 17 17 FIELD pc2_2, PC2_2, float, rotation matrix 18 18 FIELD polyterms, POLYTERMS, float[7][2], higher order warping terms 19 FIELD ctype, CTYPE, char[15], coordinate type19 FIELD ctype, CTYPE, char[15], coordinate type 20 20 FIELD Npolyterms, NPOLYTERMS, char, order of polynomial 21 FIELD astrom_map_id, ASTROM_MAP_ID, unsigned int, reference to 2D astrometry map -
trunk/Ohana/src/libautocode/def/image-elixir.d
r30604 r37807 6 6 # elements of the image structure 7 7 8 SUBSTRUCT coords, COORDS, Coords ,astrometric data8 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 9 9 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 10 10 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-loneos.d
r30604 r37807 6 6 # elements of the image structure 7 7 8 SUBSTRUCT coords, COORDS, Coords ,astrometric data8 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 9 9 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 10 10 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-panstarrs-dev-0.d
r30604 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-panstarrs-dev-1.d
r30604 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-dev-1.d
r30604 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-dev-2.d
r30604 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-dev-3.d
r30604 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-ref.d
r30604 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-v1.d
r30604 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-v2.d
r36833 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-v3.d
r36833 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-v4.d
r36833 r37807 7 7 # elements of the image structure 8 8 9 SUBSTRUCT coords, COORDS, Coords ,astrometric data9 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 10 10 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 11 11 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image-ps1-v5.d
r37034 r37807 8 8 # careful of 8-byte boundaries 9 9 10 SUBSTRUCT coords, COORDS, Coords ,astrometric data10 SUBSTRUCT coords, COORDS, CoordsDisk, astrometric data 11 11 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel 12 12 SUBFIELD crval2, CRVAL2, double, coordinate at reference pixel -
trunk/Ohana/src/libautocode/def/image.d
r37034 r37807 2 2 EXTNAME DVO_IMAGE 3 3 TYPE BINTABLE 4 SIZE 3 604 SIZE 384 5 5 DESCRIPTION DVO Image Table 6 6 … … 8 8 # careful of 8-byte boundaries 9 9 10 # Coords is an internal structure defined in def/common.h 10 11 SUBSTRUCT coords, COORDS, Coords, astrometric data 11 12 SUBFIELD crval1, CRVAL1, double, coordinate at reference pixel … … 22 23 SUBFIELD ctype, CTYPE, char[15], coordinate type 23 24 SUBFIELD Npolyterms, NPOLYTERMS, char, order of polynomial 24 # 120 bytes 25 SUBFIELD mosaic, MOSAIC, e_void, pointer to parent mosaic 26 SUBFIELD imageMap, IMAGE_MAP, e_void, pointer to image map 27 # 136 bytes 25 28 26 29 # change this to a double? … … 76 79 FIELD photom_map_id, PHOTOM_MAP_ID, unsigned int, reference to 2D zero point map 77 80 FIELD astrom_map_id, ASTROM_MAP_ID, unsigned int, reference to 2D astrometry map 81 82 FIELD *parent, PARENT, e_void, pointer to parent mosaic (not save to disk) 78 83 # nFitPhotom lands on the old location of Mxxxx, which was used to mean nFitPhotom in some cases 79 84 -
trunk/Ohana/src/libautocode/def/lensing-ps1-v5.d
r37356 r37807 30 30 31 31 FIELD F_ApR5, FLUX_AP_R5, float, Flux inside r = 5 32 FIELD dF_ApR5, FLUX_ERR_AP_R5, float, Flux inside r = 533 FIELD sF_ApR5, FLUX_STD_AP_R5, float, Flux inside r = 534 FIELD fF_ApR5, FLUX_FIL_AP_R5, float, Flux inside r = 532 FIELD dF_ApR5, FLUX_ERR_AP_R5, float, error on Flux inside r = 5 33 FIELD sF_ApR5, FLUX_STD_AP_R5, float, stdev of Flux inside r = 5 34 FIELD fF_ApR5, FLUX_FIL_AP_R5, float, fill factor for Flux inside r = 5 35 35 36 36 FIELD F_ApR6, FLUX_AP_R6, float, Flux inside r = 5 37 FIELD dF_ApR6, FLUX_ERR_AP_R6, float, Flux inside r = 538 FIELD sF_ApR6, FLUX_ AP_R6, float,Flux inside r = 539 FIELD fF_ApR6, FLUX_ AP_R6, float,Flux inside r = 537 FIELD dF_ApR6, FLUX_ERR_AP_R6, float, error on Flux inside r = 5 38 FIELD sF_ApR6, FLUX_STD_AP_R6, float, stdev of Flux inside r = 5 39 FIELD fF_ApR6, FLUX_FIL_AP_R6, float, fill factor for Flux inside r = 5 40 40 41 41 FIELD detID, DET_ID, unsigned int, detection ID -
trunk/Ohana/src/libautocode/def/lensing.d
r37356 r37807 29 29 FIELD E2_sh_psf, E2_SH_PSF, float, lensing shear psf stars E2 30 30 31 FIELD F_ApR5,FLUX_AP_R5, float, Flux inside r = 532 FIELD dF_ApR5, FLUX_ERR_AP_R5, float, Flux inside r = 533 FIELD sF_ApR5, FLUX_STD_AP_R5, float, Flux inside r = 534 FIELD fF_ApR5, FLUX_FIL_AP_R5, float, Flux inside r = 531 FIELD F_ApR5, FLUX_AP_R5, float, Flux inside r = 5 32 FIELD dF_ApR5, FLUX_ERR_AP_R5, float, error on Flux inside r = 5 33 FIELD sF_ApR5, FLUX_STD_AP_R5, float, stdev of Flux inside r = 5 34 FIELD fF_ApR5, FLUX_FIL_AP_R5, float, fill factor for Flux inside r = 5 35 35 36 FIELD F_ApR6, FLUX_AP_R6, float, Flux inside r = 637 FIELD dF_ApR6, FLUX_ERR_AP_R6, float, Flux inside r = 638 FIELD sF_ApR6, FLUX_STD_ R6, float, Flux inside r = 639 FIELD fF_ApR6, FLUX_ AP_R6, float, Flux inside r = 636 FIELD F_ApR6, FLUX_AP_R6, float, Flux inside r = 5 37 FIELD dF_ApR6, FLUX_ERR_AP_R6, float, error on Flux inside r = 5 38 FIELD sF_ApR6, FLUX_STD_AP_R6, float, stdev of Flux inside r = 5 39 FIELD fF_ApR6, FLUX_FIL_AP_R6, float, fill factor for Flux inside r = 5 40 40 41 41 FIELD detID, DET_ID, int, detection ID -
trunk/Ohana/src/libautocode/def/lensobj-ps1-v5.d
r37356 r37807 30 30 31 31 FIELD F_ApR5, FLUX_AP_R5, float, Flux inside r = 5 32 FIELD dF_ApR5, FLUX_ERR_AP_R5, float, Flux inside r = 533 FIELD sF_ApR5, FLUX_STD_AP_R5, float, Flux inside r = 534 FIELD fF_ApR5, FLUX_FIL_AP_R5, float, Flux inside r = 532 FIELD dF_ApR5, FLUX_ERR_AP_R5, float, error on Flux inside r = 5 33 FIELD sF_ApR5, FLUX_STD_AP_R5, float, stdev of Flux inside r = 5 34 FIELD fF_ApR5, FLUX_FIL_AP_R5, float, fill factor for Flux inside r = 5 35 35 36 36 FIELD F_ApR6, FLUX_AP_R6, float, Flux inside r = 5 37 FIELD dF_ApR6, FLUX_ERR_AP_R6, float, Flux inside r = 538 FIELD sF_ApR6, FLUX_ AP_R6, float,Flux inside r = 539 FIELD fF_ApR6, FLUX_ AP_R6, float,Flux inside r = 537 FIELD dF_ApR6, FLUX_ERR_AP_R6, float, error on Flux inside r = 5 38 FIELD sF_ApR6, FLUX_STD_AP_R6, float, stdev of Flux inside r = 5 39 FIELD fF_ApR6, FLUX_FIL_AP_R6, float, fill factor for Flux inside r = 5 40 40 41 41 FIELD gamma, GAMMA, float -
trunk/Ohana/src/libautocode/def/lensobj.d
r37356 r37807 29 29 FIELD E2_sh_psf, E2_SH_PSF, float, mean lensing shear psf stars E2 30 30 31 FIELD F_ApR5,FLUX_AP_R5, float, Flux inside r = 532 FIELD dF_ApR5, FLUX_ERR_AP_R5, float,Flux inside r = 533 FIELD sF_ApR5, FLUX_STD_AP_R5, float,Flux inside r = 534 FIELD fF_ApR5, FLUX_FIL_AP_R5, float,Flux inside r = 531 FIELD F_ApR5, FLUX_AP_R5, float, Flux inside r = 5 32 FIELD dF_ApR5, FLUX_ERR_AP_R5, float, error on Flux inside r = 5 33 FIELD sF_ApR5, FLUX_STD_AP_R5, float, stdev of Flux inside r = 5 34 FIELD fF_ApR5, FLUX_FIL_AP_R5, float, fill factor for Flux inside r = 5 35 35 36 FIELD F_ApR6,FLUX_AP_R6, float, Flux inside r = 537 FIELD dF_ApR6, FLUX_ERR_AP_R6, float,Flux inside r = 538 FIELD sF_ApR6, FLUX_AP_R6, float,Flux inside r = 539 FIELD fF_ApR6, FLUX_AP_R6, float,Flux inside r = 536 FIELD F_ApR6, FLUX_AP_R6, float, Flux inside r = 5 37 FIELD dF_ApR6, FLUX_ERR_AP_R6, float, error on Flux inside r = 5 38 FIELD sF_ApR6, FLUX_STD_AP_R6, float, stdev of Flux inside r = 5 39 FIELD fF_ApR6, FLUX_FIL_AP_R6, float, fill factor for Flux inside r = 5 40 40 41 41 FIELD gamma, GAMMA, float -
trunk/Ohana/src/libautocode/doc/autocode.txt
r21508 r37807 35 35 36 36 - the element name 37 - the element FITS field (in FITS table) 37 38 - the element data type 38 39 - the element description 39 40 - the element physical unit 41 42 SUBFIELD / SUBSTRUCT keywords allows the user to define elements of a 43 structure which are themselves structures. These fields are used as 44 follow: 45 46 Binary / ASCII FITS tables write out the SUBFIELD entries as if they 47 were regular table rows (substructure distinction not visible in FITS 48 table). SUBSTRUCT rows are NOT added to the FITS table. 49 50 In a C-structure, the SUBFIELD rows are skipped and only the SUBSTRUCT 51 row is saved. The definition of the substructure is assumed to be 52 defined elsewhere in the C code. 40 53 41 54 Template File … … 43 56 The template file is a source code in whatever language is desired. 44 57 Within the template, the defined keywords may be used as desired, 45 wherever needed. In addition, there are special directives which 46 invoke additional special behavior. All special directives have the 47 form of comments within their target language. They are replaced with 48 a block of code in that target language, normally one which iterates 49 over the FIELD elements of the schema file. As such, the directive 50 appropriate for one language should not be used within code for a 51 different language. Here is a list of existing special directives: 58 wherever needed. 59 60 In addition, there are special directives which invoke additional 61 special behavior. All special directives have the form of comments 62 within their target language. They are replaced with a block of code 63 in that target language, normally one which iterates over the FIELD 64 elements of the schema file. As such, the directive appropriate for 65 one language should not be used within code for a different language. 66 Here is a list of existing special directives: 52 67 53 68 /** STRUCT DEFINITION **/ -
trunk/Ohana/src/libautocode/generate
r26384 r37807 144 144 if ($type eq "e_time") { $pt1 = "J"; } 145 145 if ($type eq "e_void") { $pt1 = "B"; $Np = 8*$Np; } 146 # if ($type eq "Image") { $pt1 = "B"; $Np = 8*$Np; } 146 147 # e_void is a 64 bit pointer, cast to size_t. its value is not loaded 147 148 # from the table. … … 248 249 if ($type eq "e_time") { $pt1 = sprintf "I%s", $length; } 249 250 if ($type eq "e_void") { $pt1 = sprintf "I%s", $length; } 251 # if ($type eq "Image") { $pt1 = sprintf "I%s", $length; } 250 252 251 253 if (!$pt1) { die "unknown type $type"; } … … 331 333 if ($type eq "e_time") { $T = "WORD"; $n = 4; } 332 334 if ($type eq "e_void") { $T = "DBLE"; $n = 8; } 335 # if ($type eq "Image") { $T = "DBLE"; $n = 8; } 333 336 334 337 if (!$n) { die "unknown type $type"; } … … 375 378 if ($type eq "e_time") { $Nbytes += 4*$Np; $valid = 1; } 376 379 if ($type eq "e_void") { $Nbytes += 8*$Np; $valid = 1; } 380 # if ($type eq "Image") { $Nbytes += 8*$Np; $valid = 1; } 377 381 if (!$valid) { die "unknown type $type"; } 378 382 } -
trunk/Ohana/src/libdvo/Makefile
r37729 r37807 38 38 $(DESTINC)/ps1_v5_defs.h \ 39 39 $(DESTINC)/ps1_ref_defs.h \ 40 $(DESTINC)/ps1_sim_defs.h \ 40 41 $(DESTINC)/cmf-ps1-dv3.h \ 41 42 $(DESTINC)/cmf-ps1-v5.h \ … … 50 51 $(SRC)/version.$(ARCH).o \ 51 52 $(SRC)/coordops.$(ARCH).o \ 53 $(SRC)/galaxy_model.$(ARCH).o \ 52 54 $(SRC)/dvosorts.$(ARCH).o \ 53 55 $(SRC)/dvo_photcode_ops.$(ARCH).o \ … … 84 86 $(SRC)/dvo_convert_PS1_V5.$(ARCH).o \ 85 87 $(SRC)/dvo_convert_PS1_REF.$(ARCH).o \ 88 $(SRC)/dvo_convert_PS1_SIM.$(ARCH).o \ 86 89 $(SRC)/flatcorr_io.$(ARCH).o \ 87 90 $(SRC)/skyregion_io.$(ARCH).o \ 88 91 $(SRC)/skyregion_gsc.$(ARCH).o \ 89 92 $(SRC)/skyregion_ops.$(ARCH).o \ 93 $(SRC)/AstromOffsetMapIO.$(ARCH).o \ 94 $(SRC)/AstromOffsetMapOps.$(ARCH).o \ 95 $(SRC)/AstromOffsetMapUtils.$(ARCH).o \ 90 96 $(SRC)/dvo_set_skyregion.$(ARCH).o \ 91 97 $(SRC)/dvo_set_catdir.$(ARCH).o \ -
trunk/Ohana/src/libdvo/include/dvo.h
r37729 r37807 24 24 DVO_FORMAT_PS1_DEV_3, 25 25 DVO_FORMAT_PS1_REF, 26 DVO_FORMAT_PS1_SIM, 26 27 DVO_FORMAT_PS1_V1, 27 28 DVO_FORMAT_PS1_V2, … … 36 37 37 38 typedef enum {DVO_CAT_OPEN_FAIL, DVO_CAT_OPEN_OK, DVO_CAT_OPEN_EMPTY} DVOCatalogOpenModes; 38 39 typedef enum {40 PROJ_NONE, // undefined41 PROJ_ZEA, // zenithal42 PROJ_ZPL, // zenithal43 PROJ_ARC, // zenithal44 PROJ_STG, // zenithal45 PROJ_SIN, // zenithal46 PROJ_TAN, // zenithal47 PROJ_TNX, // zenithal48 PROJ_DIS, // zenithal (TAN + polyterms)49 PROJ_LIN, // cartesian50 PROJ_PLY, // cartesian51 PROJ_WRP, // cartesian52 PROJ_AIT, // pseudocyl53 PROJ_GLS, // pseudocyl54 PROJ_PAR, // pseudocyl55 } OhanaProjection;56 57 typedef enum {58 PROJ_MODE_NONE,59 PROJ_MODE_CARTESIAN,60 PROJ_MODE_ZENITHAL,61 PROJ_MODE_PSEUDOCYL,62 } OhanaProjectionMode;63 39 64 40 // these are used as NAN for types of int values … … 79 55 80 56 /* catalog values to be loaded */ 81 # define LOAD_NONE 0x000 82 # define LOAD_AVES 0x001 83 # define LOAD_MEAS 0x002 84 # define LOAD_MISS 0x004 85 # define LOAD_SECF 0x008 86 # define SKIP_AVES 0x010 87 # define SKIP_MEAS 0x020 88 # define SKIP_MISS 0x040 89 # define SKIP_SECF 0x080 90 # define LOAD_LENSING 0x100 91 # define LOAD_LENSOBJ 0x200 92 # define SKIP_LENSING 0x400 93 # define SKIP_LENSOBJ 0x800 57 # define LOAD_NONE 0x0000 58 # define LOAD_AVES 0x0001 59 # define LOAD_MEAS 0x0002 60 # define LOAD_MISS 0x0004 61 # define LOAD_SECF 0x0008 62 # define SKIP_AVES 0x0010 63 # define SKIP_MEAS 0x0020 64 # define SKIP_MISS 0x0040 65 # define SKIP_SECF 0x0080 66 # define LOAD_LENSING 0x0100 67 # define LOAD_LENSOBJ 0x0200 68 # define SKIP_LENSING 0x0400 69 # define SKIP_LENSOBJ 0x0800 70 # define LOAD_STARPAR 0x1000 71 # define SKIP_STARPAR 0x2000 94 72 95 73 /* photometry code types */ … … 114 92 ID_IMAGE_ASTROM_FEW = 0x00000100, /* currently too few measurements for astrometry */ 115 93 ID_IMAGE_PHOTOM_UBERCAL = 0x00000200, /* externally-supplied photometry zero point from ubercal analysis */ 94 ID_IMAGE_ASTROM_GMM = 0x00000400, /* image was fitted to positions corrected by the galaxy motion model */ 116 95 } DVOImageFlags; 117 96 … … 136 115 ID_MEAS_STACK_PRIMARY = 0x00010000, // this stack measurement is in the primary skycell 137 116 ID_MEAS_STACK_PHOT_SRC = 0x00020000, // this measurement supplied the stack photometry 117 ID_MEAS_ICRF_QSO = 0x00040000, // this measurement is an ICRF reference position 118 ID_MEAS_IMAGE_EPOCH = 0x00080000, // this measurement is registered to the image epoch (not tied to ref catalog epoch) 138 119 } DVOMeasureFlags; 139 120 … … 152 133 */ 153 134 135 /** these names were previously used for Average flags in old (LONEOS-era) dvo versions 136 ID_BAD_OBJECT = 0x00004000, // if all measurements are bad, set this bit 137 ID_MOVING = 0x00008000, // is a moving object 138 ID_ROCK = 0x0000a000, // 0x8000 + 0x2000 139 ID_GHOST = 0x0000c001, // 0x8000 + 0x4000 + 0x0001 140 ID_TRAIL = 0x0000c002, // 0x8000 + 0x4000 + 0x0002 141 ID_BLEED = 0x0000c003, // 0x8000 + 0x4000 + 0x0003 142 ID_COSMIC = 0x0000c004, // 0x8000 + 0x4000 + 0x0004 143 **/ 144 154 145 /* Average.flags values -- these values are 32 bit (as of PS1_V1) */ 155 146 typedef enum { 156 ID_STAR_FEW = 0x00000001, // used within relphot: skip star 157 ID_STAR_POOR = 0x00000002, // used within relphot: skip star 158 ID_PROPER = 0x00000400, // star with large proper motion 159 ID_TRANSIENT = 0x00001000, // is this mutually exclusive with USNO? 160 ID_VARIABLE = 0x00002000, // not currently set? 161 ID_ASTEROID = 0x00002000, // identified with an asteroid 162 ID_BAD_OBJECT = 0x00004000, // if all measurements are bad, set this bit 163 ID_MOVING = 0x00008000, // is a moving object 164 ID_ROCK = 0x0000a000, // 0x8000 + 0x2000 165 ID_GHOST = 0x0000c001, // 0x8000 + 0x4000 + 0x0001 166 ID_TRAIL = 0x0000c002, // 0x8000 + 0x4000 + 0x0002 167 ID_BLEED = 0x0000c003, // 0x8000 + 0x4000 + 0x0003 168 ID_COSMIC = 0x0000c004, // 0x8000 + 0x4000 + 0x0004 169 ID_STAR_FIT_AVE = 0x00010000, // average position fitted 170 ID_STAR_FIT_PM = 0x00020000, // proper motion fitted 171 ID_STAR_FIT_PAR = 0x00040000, // parallax fitted 172 ID_STAR_USE_AVE = 0x00080000, // average position used (not PM or PAR) 173 ID_STAR_USE_PM = 0x00100000, // proper motion used (not AVE or PAR) 174 ID_STAR_USE_PAR = 0x00200000, // parallax used (not AVE or PM) 175 ID_STAR_NO_ASTROM = 0x00400000, // mean astrometry could not be measured 176 ID_STAR_BAD_PM = 0x00800000, // mean astrometry could not be measured 177 ID_OBJ_EXT = 0x01000000, // extended in our data (eg, PS) 178 ID_OBJ_EXT_ALT = 0x02000000, // extended in external data (eg, 2MASS) 179 ID_OBJ_GOOD = 0x04000000, // good-quality measurement in our data (eg,PS) 180 ID_OBJ_GOOD_ALT = 0x08000000, // good-quality measurement in external data (eg, 2MASS) 181 ID_OBJ_GOOD_STACK = 0x10000000, // good-quality object in the stack (> 1 good stack) 147 ID_STAR_FEW = 0x00000001, // used within relphot: skip star 148 ID_STAR_POOR = 0x00000002, // used within relphot: skip star 149 ID_ICRF_QSO = 0x00000004, // object IDed with known ICRF quasar (may have ICRF position measurement) 150 ID_OTHEF_QSO = 0x00000008, // object IDed with known or suspected quasar, without ICRF reference data 151 ID_PROPER = 0x00000010, // star with large proper motion 152 ID_TRANSIENT = 0x00000020, // identified as a non-periodic (stationary) transient 153 ID_VARIABLE = 0x00000040, // identified as a period variable 154 ID_ASTEROID = 0x00000080, // identified with a known solar-system object (asteroid or other) 155 // bits 0x00000100 - 0x00008000 are currently unused 156 ID_STAR_FIT_AVE = 0x00010000, // average position fitted 157 ID_STAR_FIT_PM = 0x00020000, // proper motion fitted 158 ID_STAR_FIT_PAR = 0x00040000, // parallax fitted 159 ID_STAR_USE_AVE = 0x00080000, // average position used (not PM or PAR) 160 ID_STAR_USE_PM = 0x00100000, // proper motion used (not AVE or PAR) 161 ID_STAR_USE_PAR = 0x00200000, // parallax used (not AVE or PM) 162 ID_STAR_NO_ASTROM = 0x00400000, // mean astrometry could not be measured 163 ID_STAR_BAD_PM = 0x00800000, // mean astrometry could not be measured 164 ID_OBJ_EXT = 0x01000000, // extended in our data (eg, PS) 165 ID_OBJ_EXT_ALT = 0x02000000, // extended in external data (eg, 2MASS) 166 ID_OBJ_GOOD = 0x04000000, // good-quality measurement in our data (eg,PS) 167 ID_OBJ_GOOD_ALT = 0x08000000, // good-quality measurement in external data (eg, 2MASS) 168 ID_OBJ_GOOD_STACK = 0x10000000, // good-quality object in the stack (> 1 good stack) 182 169 ID_OBJ_SUSPECT_STACK = 0x20000000, // suspect object in the stack (> 1 good or suspect stack, < 2 good) 183 ID_OBJ_BAD_STACK = 0x40000000, // good-quality object in the stack (> 1 good stack)170 ID_OBJ_BAD_STACK = 0x40000000, // good-quality object in the stack (> 1 good stack) 184 171 } DVOAverageFlags; 185 172 … … 202 189 } DVOSecfiltFlags; 203 190 191 /* definitions for parallel dvo host information 192 XXX : need better names (safer namespace) 193 */ 194 195 typedef enum { 196 DATA_ON_TGT = 0x01, 197 DATA_ON_BCK = 0x02, 198 DATA_USE_BCK = 0x04, 199 200 DATA_COPY_FAILURE = 0x80, 201 } SkyTableDataFlags; 202 203 typedef enum { 204 HOST_STDIN = 0, 205 HOST_STDOUT = 1, 206 HOST_STDERR = 2, 207 } HostInfoIOfd; 208 204 209 /*** general dvo structures (internal use only / not IO) ***/ 205 210 … … 253 258 } FlatCorrectionTable; 254 259 255 /* definitions for parallel dvo host information256 XXX : need better names (safer namespace)257 */258 259 typedef enum {260 DATA_ON_TGT = 0x01,261 DATA_ON_BCK = 0x02,262 DATA_USE_BCK = 0x04,263 264 DATA_COPY_FAILURE = 0x80,265 } SkyTableDataFlags;266 267 typedef enum {268 HOST_STDIN = 0,269 HOST_STDOUT = 1,270 HOST_STDERR = 2,271 } HostInfoIOfd;272 273 260 typedef struct { 274 261 char *hostname; // name of remote machine … … 289 276 } HostTable; 290 277 278 typedef struct { 279 int Nhosts; 280 HostInfo **hosts; 281 } HostTableGroup; 282 291 283 // A RegionHost processes data for some region in parallel with other regions 292 284 typedef struct RegionHostInfo { … … 314 306 Image *image; 315 307 off_t *imseq; 308 309 AstromOffsetTable *astromTable; 316 310 317 311 int *neighbors; // list of neighbor index values … … 444 438 double R; 445 439 double D; 440 float RoffGAL; 441 float DoffGAL; 446 442 float M; 447 443 float Mcal; … … 645 641 int lensobjOffset; // offset to mean lensing data 646 642 int extendOffset; // offset to extended object entry 647 int paramsOffset;// offset to stellar parameter data643 int starparOffset; // offset to stellar parameter data 648 644 float refColorBlue; // color of astrometry ref stars 649 645 float refColorRed; // color of astrometry ref stars … … 679 675 Lensing *lensing; 680 676 Lensobj *lensobj; 677 StarPar *starpar; 681 678 682 679 int Nsecfilt; /* number of secfilt entries for each average entry */ 683 off_t Naverage, Nmeasure, Nmissing, Nlensing, Nlensobj, Ns ecf_mem; /* current number of each component in memory */684 off_t Naves_disk, Nmeas_disk, Nmiss_disk, Nlensing_disk, Nlensobj_disk, Ns ecf_disk; /* current number of each component on disk */685 off_t Naves_off, Nmeas_off, Nmiss_off, Nlensing_off, Nlensobj_off, Ns ecf_off; /* index of first loaded data value */680 off_t Naverage, Nmeasure, Nmissing, Nlensing, Nlensobj, Nstarpar, Nsecf_mem; /* current number of each component in memory */ 681 off_t Naves_disk, Nmeas_disk, Nmiss_disk, Nlensing_disk, Nlensobj_disk, Nstarpar_disk, Nsecf_disk; /* current number of each component on disk */ 682 off_t Naves_off, Nmeas_off, Nmiss_off, Nlensing_off, Nlensobj_off, Nstarpar_off, Nsecf_off; /* index of first loaded data value */ 686 683 687 684 // note that we use these for the full-sky relphot analysis … … 704 701 struct Catalog *lensing_catalog; /* lensing catalog data (split) */ 705 702 struct Catalog *lensobj_catalog; /* lensobj catalog data (split) */ 703 struct Catalog *starpar_catalog; /* starpar catalog data (split) */ 706 704 707 705 unsigned int objID; … … 739 737 int gfits_db_close PROTO((FITS_DB *db)); 740 738 int gfits_db_free PROTO((FITS_DB *db)); 741 742 /* in coords.c, using libautocode/def/coords.d */743 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords);744 int LM_to_XY (double *x, double *y, double L, double M, Coords *coords);745 int RD_to_LM (double *L, double *M, double ra, double dec, Coords *coords);746 int LM_to_RD (double *ra, double *dec, double L, double M, Coords *coords);747 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords);748 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords);749 int fXY_to_RD (float *ra, float *dec, double x, double y, Coords *coords);750 int fRD_to_XY (float *x, float *y, double ra, double dec, Coords *coords);751 int GetCoords (Coords *coords, Header *header);752 int PutCoords (Coords *coords, Header *header);753 void RegisterMosaic (Coords *coords);754 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch);755 OhanaProjection GetProjection (char *ctype);756 int SetProjection (char *ctype, OhanaProjection proj);757 OhanaProjectionMode GetProjectionMode (OhanaProjection proj);758 739 759 740 char *libdvo_version (void); … … 913 894 Lensing *FtableToLensing (FTable *ftable, off_t *Nlensing, char *format); 914 895 Lensobj *FtableToLensobj (FTable *ftable, off_t *Nlensobj, char *format); 896 StarPar *FtableToStarPar (FTable *ftable, off_t *Nstarpar, char *format); 915 897 int FtableToImage (FTable *ftable, Header *theader, char *format); 916 898 … … 920 902 int LensingToFtable (FTable *ftable, Lensing *lensing, off_t Nlensing, char format); 921 903 int LensobjToFtable (FTable *ftable, Lensobj *lensobj, off_t Nlensobj, char format); 904 int StarParToFtable (FTable *ftable, StarPar *starpar, off_t Nstarpar, char format); 922 905 int ImageToFtable (FTable *ftable, Header *theader, char format); 923 906 int ImageToVtable (VTable *vtable, Header *theader, char format); … … 936 919 # include "ps1_v5_defs.h" 937 920 # include "ps1_ref_defs.h" 921 # include "ps1_sim_defs.h" 938 922 939 923 /*** DVO image db I/O Functions ***/ … … 950 934 void dvo_image_create (FITS_DB *db, double ZeroPoint); 951 935 936 int gfits_table_set_Image (FTable *ftable); 937 int gfits_table_mkheader_Image (Header *header); 938 Image *gfits_table_get_Image (FTable *ftable, off_t *Ndata, char *swapped); 939 952 940 /* flatcorr APIs */ 953 941 FlatCorrectionTable *FlatCorrectionLoad (char *filename, int VERBOSE); … … 963 951 SkyTable *SkyTableLoadOptimal PROTO((char *catdir, char *SKYFILE, char *GSCFILE, int readwrite, int depth, int VERBOSE)); 964 952 int SkyTableSetDepth PROTO((SkyTable *sky, int depth)); 953 SkyList *SkyRegionByIndex PROTO((SkyTable *table, int index)); 965 954 SkyList *SkyRegionByCPT PROTO((SkyTable *table, char *filename)); 966 955 SkyList *SkyRegionByPoint PROTO((SkyTable *table, int depth, double ra, double dec)); … … 1009 998 int HostTableTestHost (SkyRegion *region, int hostID); 1010 999 1000 void InitHost (HostInfo *host); 1001 1002 HostTableGroup *HostTableGroups (HostTable *table, int *ngroups); 1003 int HostTableGroupWaitJobsGetIO (HostTableGroup *table, char *file, int lineno, int VERBOSE); 1004 1011 1005 // functions to support tiny versions of Average and Measure 1012 1006 void CopyAverageToTiny (AverageTiny *averageT, Average *average); … … 1042 1036 void dvo_lensing_init (Lensing *lensing); 1043 1037 void dvo_lensobj_init (Lensobj *lensobj, int toZero); 1038 void dvo_starpar_init (StarPar *starpar); 1044 1039 1045 1040 void InitRegionHosts (RegionHostInfo *hosts, int Nhosts, int NHOSTS); … … 1051 1046 int RegionHostFindNeighbors (RegionHostTable *table, int Nhost); 1052 1047 1048 // galaxy_model: 1049 int TransformProperMotion_radians (double *uR, double *uD, double uL, double uB, double Rrad, double Drad, CoordTransform *transform); 1050 int TransformProperMotion (double *uR, double *uD, double uL, double uB, double R, double D, CoordTransform *transform); 1051 int SolarMotionModel_radians (double *uL_sol, double *uB_sol, double Lrad, double Brad, double distance); 1052 int SolarMotionModel (double *uL_sol, double *uB_sol, double L, double B, double distance); 1053 int GalaxyMotionModel_radians (double *uL_gal, double *uB_gal, double Lrad, double Brad); 1054 int GalaxyMotionModel (double *uL_gal, double *uB_gal, double L, double B); 1055 int InitGalaxyModel (char *version); 1056 1057 # define LENSFIELD(NAME) float LensValue_##NAME (PhotCode *code, Lensobj *lensobj); 1058 1059 LENSFIELD(X11_sm_obj) 1060 LENSFIELD(X12_sm_obj) 1061 LENSFIELD(X22_sm_obj) 1062 LENSFIELD(E1_sm_obj) 1063 LENSFIELD(E2_sm_obj) 1064 1065 LENSFIELD(X11_sh_obj) 1066 LENSFIELD(X12_sh_obj) 1067 LENSFIELD(X22_sh_obj) 1068 LENSFIELD(E1_sh_obj) 1069 LENSFIELD(E2_sh_obj) 1070 1071 LENSFIELD(X11_sm_psf) 1072 LENSFIELD(X12_sm_psf) 1073 LENSFIELD(X22_sm_psf) 1074 LENSFIELD(E1_sm_psf) 1075 LENSFIELD(E2_sm_psf) 1076 1077 LENSFIELD(X11_sh_psf) 1078 LENSFIELD(X12_sh_psf) 1079 LENSFIELD(X22_sh_psf) 1080 LENSFIELD(E1_sh_psf) 1081 LENSFIELD(E2_sh_psf) 1082 1083 # undef LENSFIELD 1084 1053 1085 # endif // DVO_H -
trunk/Ohana/src/libdvo/include/dvodb.h
r37116 r37807 55 55 MAG_OPTION_UC_DIST, 56 56 MAG_OPTION_FLAGS, 57 58 MAG_OPTION_X11_SM_OBJ, 59 MAG_OPTION_X12_SM_OBJ, 60 MAG_OPTION_X22_SM_OBJ, 61 MAG_OPTION_E1_SM_OBJ, 62 MAG_OPTION_E2_SM_OBJ, 63 64 MAG_OPTION_X11_SH_OBJ, 65 MAG_OPTION_X12_SH_OBJ, 66 MAG_OPTION_X22_SH_OBJ, 67 MAG_OPTION_E1_SH_OBJ, 68 MAG_OPTION_E2_SH_OBJ, 69 70 MAG_OPTION_X11_SM_PSF, 71 MAG_OPTION_X12_SM_PSF, 72 MAG_OPTION_X22_SM_PSF, 73 MAG_OPTION_E1_SM_PSF, 74 MAG_OPTION_E2_SM_PSF, 75 76 MAG_OPTION_X11_SH_PSF, 77 MAG_OPTION_X12_SH_PSF, 78 MAG_OPTION_X22_SH_PSF, 79 MAG_OPTION_E1_SH_PSF, 80 MAG_OPTION_E2_SH_PSF, 81 82 MAG_OPTION_F_AP_R5, 83 MAG_OPTION_F_ERR_AP_R5, 84 MAG_OPTION_F_STDEV_AP_R5, 85 MAG_OPTION_F_FILL_AP_R5, 86 87 MAG_OPTION_F_AP_R6, 88 MAG_OPTION_F_ERR_AP_R6, 89 MAG_OPTION_F_STDEV_AP_R6, 90 MAG_OPTION_F_FILL_AP_R6, 57 91 } dvoMagOptionType; 58 92 … … 139 173 MEAS_XFIX, 140 174 MEAS_YFIX, 175 MEAS_XOFF_KH, 176 MEAS_YOFF_KH, 177 MEAS_XOFF_DCR, 178 MEAS_YOFF_DCR, 179 MEAS_ROFF_GAL, 180 MEAS_DOFF_GAL, 141 181 MEAS_POS_SYS_ERR, 142 182 MEAS_XFIELD, … … 162 202 MEAS_FLAT, 163 203 MEAS_CENTER_OFFSET, 164 MEAS_REF_COLOR, 204 MEAS_REF_COLOR_BLUE, 205 MEAS_REF_COLOR_RED, 206 MEAS_X11_SM_OBJ, 207 MEAS_X12_SM_OBJ, 208 MEAS_X22_SM_OBJ, 209 MEAS_E1_SM_OBJ, 210 MEAS_E2_SM_OBJ, 211 MEAS_X11_SH_OBJ, 212 MEAS_X12_SH_OBJ, 213 MEAS_X22_SH_OBJ, 214 MEAS_E1_SH_OBJ, 215 MEAS_E2_SH_OBJ, 216 MEAS_X11_SM_PSF, 217 MEAS_X12_SM_PSF, 218 MEAS_X22_SM_PSF, 219 MEAS_E1_SM_PSF, 220 MEAS_E2_SM_PSF, 221 MEAS_X11_SH_PSF, 222 MEAS_X12_SH_PSF, 223 MEAS_X22_SH_PSF, 224 MEAS_E1_SH_PSF, 225 MEAS_E2_SH_PSF, 226 MEAS_E_BV, // extinction (mags) 227 MEAS_E_BV_ERR, 228 MEAS_DISTANCE_MOD, // distance modulus (mags) 229 MEAS_DISTANCE_MOD_ERR, 230 MEAS_M_R, // absolute mag in r-band 231 MEAS_M_R_ERR, 232 MEAS_FEH, // metallicity 233 MEAS_FEH_ERR, 234 MEAS_URA_GALMODEL, // model pm prediction 235 MEAS_UDEC_GALMODEL, // model pm prediction 236 MEAS_RA_GALMODEL, // model pm prediction 237 MEAS_DEC_GALMODEL, // model pm prediction 165 238 }; 166 239 … … 200 273 AVE_EXTID_HI, 201 274 AVE_EXTID_LO, 202 AVE_REF_COLOR, 275 AVE_REF_COLOR_BLUE, 276 AVE_REF_COLOR_RED, 203 277 AVE_PHOT, // photometry class of values 278 AVE_E_BV, // extinction (mags) 279 AVE_E_BV_ERR, 280 AVE_DISTANCE_MOD, // distance modulus (mags) 281 AVE_DISTANCE_MOD_ERR, 282 AVE_M_R, // absolute mag in r-band 283 AVE_M_R_ERR, 284 AVE_FEH, // metallicity 285 AVE_FEH_ERR, 286 AVE_URA_GALMODEL, // model pm prediction 287 AVE_UDEC_GALMODEL, // model pm prediction 288 AVE_RA_GALMODEL, // model pm prediction 289 AVE_DEC_GALMODEL, // model pm prediction 204 290 }; 205 291 … … 276 362 IMAGE_NLINK_PHOTOM, 277 363 IMAGE_NLINK_ASTROM, 278 IMAGE_REF_COLOR 364 IMAGE_REF_COLOR_BLUE, 365 IMAGE_REF_COLOR_RED 279 366 }; 280 367 … … 368 455 int ParseImageField PROTO((dbField *field, char *fieldName)); 369 456 370 dbValue dbExtractAverages PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field));371 dbValue dbExtractMeasures PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field));457 dbValue dbExtractAverages PROTO((Average *average, SecFilt *secfilt, Measure *measure, Lensobj *lensobj, StarPar *starpar, dbField *field)); 458 dbValue dbExtractMeasures PROTO((Average *average, SecFilt *secfilt, Measure *measure, Lensing *lensing, StarPar *starpar, dbField *field)); 372 459 dbValue dbExtractImages PROTO((Image *image, off_t Nimage, off_t N, dbField *field)); 373 460 … … 376 463 int dbAstroRegionLimits PROTO((dbStack **stack, int *nstack, SkyRegionSelection *selection, int table)); 377 464 char *strfloat PROTO((float value)); 465 466 int dbFieldNeedMeasure (dbField *fields, int Nfields); 467 int dbFieldNeedLensobj (dbField *fields, int Nfields); 468 int dbFieldNeedLensing (dbField *fields, int Nfields); 469 int dbFieldNeedStarpar (dbField *fields, int Nfields, int isAverage); 378 470 379 471 void FreeImageSelection (void); -
trunk/Ohana/src/libdvo/include/libdvo_astro.h
r31635 r37807 1 #ifdef notdef 2 # include "external.h" 3 # include "shell.h" 4 # include "dvomath.h" 5 # include "convert.h" 6 # include "display.h" 7 # include "data.h" 8 #endif 1 # ifndef LIBDVO_ASTRO_H 2 # define LIBDVO_ASTRO_H 9 3 10 # ifndef ASTRO_H 11 # define ASTRO_H 4 typedef enum { 5 COORD_NONE, 6 COORD_CELESTIAL, 7 COORD_GALACTIC, // based on Liu et al 2011 8 COORD_ECLIPTIC, 9 COORD_GALACTIC_REID_2004, // an older definition of the galactic plane 10 } CoordTransformSystem; 12 11 13 void InitAstro (void); 14 void FreeAstro (void); 12 typedef enum { 13 PROJ_NONE, // undefined 14 PROJ_ZEA, // zenithal 15 PROJ_ZPL, // zenithal 16 PROJ_ARC, // zenithal 17 PROJ_STG, // zenithal 18 PROJ_SIN, // zenithal 19 PROJ_TAN, // zenithal 20 PROJ_TNX, // zenithal 21 PROJ_DIS, // zenithal (TAN + polyterms) 22 PROJ_LIN, // cartesian 23 PROJ_PLY, // cartesian (allow polyterms) 24 PROJ_WRP, // cartesian (allow polyterms, require mosaic) 25 PROJ_AIT, // pseudocyl 26 PROJ_GLS, // pseudocyl 27 PROJ_PAR, // pseudocyl 28 } OhanaProjection; 29 30 typedef enum { 31 PROJ_MODE_NONE, 32 PROJ_MODE_CARTESIAN, 33 PROJ_MODE_ZENITHAL, 34 PROJ_MODE_PSEUDOCYL, 35 } OhanaProjectionMode; 15 36 16 37 typedef struct { … … 29 50 } CoordTransform; 30 51 31 typedef enum {COORD_NONE, COORD_CELESTIAL, COORD_GALACTIC, COORD_ECLIPTIC} CoordTransformSystem; 52 typedef struct { 53 int Nx; 54 int Ny; 55 float dX; 56 float dY; 57 float **dXv; 58 float **dYv; 59 unsigned int tableID; 60 unsigned int imageID; 61 int keep; 62 } AstromOffsetMap; 63 64 typedef struct { 65 int Nmap; 66 AstromOffsetMap **map; 67 int *imageIDtoTableSeq; 68 int MaxImageID; 69 int MaxTableID; 70 } AstromOffsetTable; 71 72 /* Internal version of Coords (see CoordsDisk in libautocode/def/coords-disk.d) */ 73 typedef struct Coords { 74 double crval1; // coordinate at reference pixel 75 double crval2; // coordinate at reference pixel 76 float crpix1; // coordinate of reference pixel 77 float crpix2; // coordinate of reference pixel 78 float cdelt1; // degrees per pixel 79 float cdelt2; // degrees per pixel 80 float pc1_1; // rotation matrix 81 float pc1_2; // rotation matrix 82 float pc2_1; // rotation matrix 83 float pc2_2; // rotation matrix 84 float polyterms[7][2]; // higher order warping terms 85 char ctype[15]; // coordinate type 86 char Npolyterms; // order of polynomial 87 struct Coords *mosaic; // pointer to parent mosaic 88 AstromOffsetMap *offsetMap; // pointer to offset map transformation 89 } Coords; 90 91 typedef struct Image { 92 Coords coords; // astrometric data 93 e_time tzero; // readout time (row 0) 94 unsigned int nstar; // number of stars on image 95 float secz; // airmass (mag) 96 unsigned short NX; // image width 97 unsigned short NY; // image height 98 float apmifit; // aperture correction (mag) 99 float dapmifit; // apmifit error (mag) 100 float Mcal; // calibration mag (mag) 101 float dMcal; // error on Mcal (mag) 102 short Xm; // image chisq (10*log(value)) 103 short photcode; // identifier for CCD, 104 float exptime; // exposure time (seconds) 105 float sidtime; // sidereal time of exposure 106 float latitude; // observatory latitude (degrees) 107 float RAo; // image center (degrees) 108 float DECo; // image center (degrees) 109 float Radius; // image radius (degrees) 110 float refColorBlue; // median astrometry ref color 111 float refColorRed; // median astrometry ref color 112 char name[117]; // name of original image 113 unsigned char detection_limit; // detection limit (10*mag) 114 unsigned char saturation_limit; // saturation limit (10*mag) 115 unsigned char cerror; // astrometric error (50*arcsec) 116 unsigned char fwhm_x; // PSF x width (25*arcsec) 117 unsigned char fwhm_y; // PSF y width (25*arcsec) 118 unsigned char trate; // scan rate (100 usec/pixel) 119 unsigned char ccdnum; // CCD ID number 120 unsigned int flags; // image quality flags 121 unsigned int imageID; // internal image ID 122 unsigned int parentID; // associated ref image 123 unsigned int externID; // external image ID 124 unsigned short sourceID; // analysis source ID 125 short nLinkAstrom; // mean number of matched measurements for astrometry 126 short nLinkPhotom; // mean number of matched measurements for astrometry 127 short ubercalDist; // distance to nearest ubercal image 128 float dXpixSys; // systematic astrometry error in X 129 float dYpixSys; // systematic astrometry error in Y 130 float dMagSys; // systematic photometry error 131 unsigned short nFitAstrom; // number of stars used for astrometry cal 132 unsigned short nFitPhotom; // number of stars used for photometry cal 133 unsigned int photom_map_id; // reference to 2D zero point map 134 unsigned int astrom_map_id; // reference to 2D astrometry map 135 struct Image *parent; // pointer to parent mosaic (not save to disk) 136 } Image; 32 137 33 138 CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output); 34 139 int ApplyTransform (double *x, double *y, double X, double Y, CoordTransform *transform); 35 140 141 /* in coords.c */ 142 void InitCoords (Coords *coords, char *projection); 143 void CopyCoords (Coords *tgt, Coords *src); 144 145 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords); 146 int LM_to_XY (double *x, double *y, double L, double M, Coords *coords); 147 int RD_to_LM (double *L, double *M, double ra, double dec, Coords *coords); 148 int LM_to_RD (double *ra, double *dec, double L, double M, Coords *coords); 149 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords); 150 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords); 151 int fXY_to_RD (float *ra, float *dec, double x, double y, Coords *coords); 152 int fRD_to_XY (float *x, float *y, double ra, double dec, Coords *coords); 153 int GetCoords (Coords *coords, Header *header); 154 int PutCoords (Coords *coords, Header *header); 155 void coords_precess (double *ra, double *dec, double in_epoch, double out_epoch); 156 OhanaProjection GetProjection (char *ctype); 157 int SetProjection (char *ctype, OhanaProjection proj); 158 OhanaProjectionMode GetProjectionMode (OhanaProjection proj); 159 160 /* in AstromOffsetMapIO.c */ 161 AstromOffsetTable *AstromOffsetMapLoad (char *filename, int VERBOSE); 162 int AstromOffsetMapSave (AstromOffsetTable *table, char *filename); 163 AstromOffsetTable *AstromOffsetMapToTable(AstromOffsetMap_Disk_6x6 *map_disk, off_t Nmap); 164 AstromOffsetMap_Disk_6x6 *AstromOffsetTableToMap(AstromOffsetTable *table, off_t *Nmap); 165 166 /* in AstromOffsetMapOps.c */ 167 float AstromOffsetMapValue (AstromOffsetMap *map, float x, float y, int xdir); 168 int AstromOffsetMapFit (AstromOffsetMap *map, float *x, float *y, float *f, int Npts, int xdir); 169 170 /* in AstromOffsetMapUtils.c */ 171 AstromOffsetMap *AstromOffsetMapInit (int Nx, int Ny); 172 void AstromOffsetMapFree (AstromOffsetMap *map); 173 174 int AstromOffsetTableNewMap (AstromOffsetTable *table, int Nx, int Ny, Image *image); 175 int AstromOffsetTableMatchChips (Image *images, off_t Nimages, AstromOffsetTable *table); 176 AstromOffsetTable *AstromOffsetTableInit(); 177 void AstromOffsetTableFree(AstromOffsetTable *table); 178 int AstromOffsetTableAddMapFromImage (AstromOffsetTable *table, Image *image); 179 void AstromOffsetMapPrint (AstromOffsetMap *map, char *filename); 180 int AstromOffsetMapRepair (AstromOffsetMap *map, int xdir); 181 AstromOffsetMap *AstromOffsetMapCopy (AstromOffsetMap *map); 182 void AstromOffsetMapCopyData (AstromOffsetMap *tgt, AstromOffsetMap *src); 183 void AstromOffsetMapSetOrder (AstromOffsetMap *map, int Nx, int Ny, Image *image); 184 36 185 # endif -
trunk/Ohana/src/libdvo/include/ps1_v5_defs.h
r37035 r37807 9 9 10 10 Lensing *Lensing_PS1_V5_ToInternal (Lensing_PS1_V5 *in, off_t Nvalues); 11 Lensing *Lensing_PS1_V5_ALT_ToInternal (Lensing_PS1_V5_ALT *in, off_t Nvalues); 11 12 Lensing_PS1_V5 *LensingInternalTo_PS1_V5 (Lensing *in, off_t Nvalues); 12 13 Lensobj *Lensobj_PS1_V5_ToInternal (Lensobj_PS1_V5 *in, off_t Nvalues); 13 14 Lensobj_PS1_V5 *LensobjInternalTo_PS1_V5 (Lensobj *in, off_t Nvalues); 14 15 16 StarPar *StarPar_PS1_V5_ToInternal (StarPar_PS1_V5 *in, off_t Nvalues); 17 StarPar_PS1_V5 *StarParInternalTo_PS1_V5 (StarPar *in, off_t Nvalues); 18 15 19 PhotCode *PhotCode_PS1_V5_To_Internal (PhotCode_PS1_V5 *in, off_t Nvalues); 16 20 PhotCode_PS1_V5 *PhotCode_Internal_To_PS1_V5 (PhotCode *in, off_t Nvalues); -
trunk/Ohana/src/libdvo/src/BoundaryTree.c
r37116 r37807 371 371 int BoundaryTreeCellCoords (BoundaryTree *tree, int *zone, int *band, double ra, double dec) { 372 372 373 ra = ohana_normalize_angle (ra); 374 373 375 // first, find the containing zone 374 376 -
trunk/Ohana/src/libdvo/src/HostTable.c
r35848 r37807 3 3 # include <sys/wait.h> 4 4 5 void InitHost (HostInfo *host) { 6 host->hostname = NULL; 7 host->pathname = NULL; 8 host->results = NULL; 9 host->stdio[HOST_STDIN] = -1; 10 host->stdio[HOST_STDOUT] = -1; 11 host->stdio[HOST_STDERR] = -1; 12 host->pid = 0; 13 return; 14 } 15 5 16 void InitHosts (HostInfo *hosts, int Nhosts, int NHOSTS) { 6 17 7 18 int i; 8 19 for (i = Nhosts; i < NHOSTS; i++) { 9 hosts[i].hostname = NULL; 10 hosts[i].pathname = NULL; 11 hosts[i].results = NULL; 12 hosts[i].stdio[HOST_STDIN] = -1; 13 hosts[i].stdio[HOST_STDOUT] = -1; 14 hosts[i].stdio[HOST_STDERR] = -1; 15 hosts[i].pid = 0; 20 InitHost (&hosts[i]); 16 21 } 17 22 return; … … 36 41 } 37 42 if (table->index) free (table->index); 43 free (table); 44 return; 45 } 46 47 // a HostTableGroup is a pointer set to one or more HostTable entries 48 void FreeTableGroup (HostTableGroup *table) { 49 50 if (!table) return; 51 if (table->hosts) { 52 free (table->hosts); 53 } 38 54 free (table); 39 55 return; … … 136 152 fclose (f); 137 153 return table; 154 } 155 156 // split a host table into Ngroups, each with a unique set of hosts 157 HostTableGroup *HostTableGroups (HostTable *table, int *ngroups) { 158 159 // identify the unique host names and the number of times they each exist 160 // (Host tables are not very large; I can afford to do this in an inefficient way) 161 int i, j, k; 162 163 int Nunique = 0; 164 char **unique_hosts = NULL; // an array of pointers to a set of the names 165 int *Nunique_hosts = NULL; // an array of pointers to the count of each 166 ALLOCATE ( unique_hosts, char *, table->Nhosts); 167 ALLOCATE (Nunique_hosts, int, table->Nhosts); 168 for (i = 0; i < table->Nhosts; i++) Nunique_hosts[i] = 0; 169 170 for (i = 0; i < table->Nhosts; i++) { 171 int found = FALSE; 172 for (j = 0; !found && (j < Nunique); j++) { 173 if (!strcmp(table->hosts[i].hostname, unique_hosts[j])) { 174 Nunique_hosts[j] ++; 175 found = TRUE; 176 } 177 } 178 if (!found) { 179 unique_hosts[Nunique] = table->hosts[i].hostname; 180 Nunique_hosts[Nunique] = 1; 181 Nunique ++; 182 } 183 } 184 185 int Ngroups = 0; 186 for (i = 0; i < Nunique; i++) { 187 Ngroups = MAX (Nunique_hosts[i], Ngroups); 188 } 189 190 HostTableGroup *groups = NULL; 191 int *foundHost = NULL; 192 193 ALLOCATE (foundHost, int, table->Nhosts); 194 ALLOCATE (groups, HostTableGroup, Ngroups); 195 196 for (i = 0; i < table->Nhosts; i++) foundHost[i] = FALSE; 197 198 // in each group, attempt to add one of each unique host 199 for (i = 0; i < Ngroups; i++) { 200 groups[i].Nhosts = 0; 201 ALLOCATE (groups[i].hosts, HostInfo *, Nunique); 202 for (j = 0; j < Nunique; j++) { 203 int found = FALSE; 204 for (k = 0; !found && (k < table->Nhosts); k++) { 205 if (foundHost[k]) continue; 206 if (strcmp(unique_hosts[j], table->hosts[k].hostname)) continue; 207 groups[i].hosts[groups[i].Nhosts] = &table->hosts[k]; 208 groups[i].Nhosts ++; 209 found = TRUE; 210 foundHost[k] = TRUE; 211 } 212 } 213 } 214 *ngroups = Ngroups; 215 return groups; 138 216 } 139 217 … … 255 333 256 334 // this loop has 2 chunks: (a) check for I/O + (b) check for jobs done 257 while ( 1) {335 while (Nfound < Nrunning) { 258 336 259 337 // Wait up to 0.5 second for host to provide I/O … … 284 362 // if (table->hosts[i].stdout.Nbuffer > 0x10000) { 285 363 if (table->hosts[i].stdout.Nbuffer > 0x1000) { 286 int printHead = VERBOSE ||(table->hosts[i].stdout.Nbuffer > 0);364 int printHead = VERBOSE && (table->hosts[i].stdout.Nbuffer > 0); 287 365 if (printHead) fprintf (stdout, "--- stdout from %s --- (%d bytes, v1)\n", table->hosts[i].hostname, table->hosts[i].stdout.Nbuffer); 288 366 int Nout = write (STDOUT_FILENO, table->hosts[i].stdout.buffer, table->hosts[i].stdout.Nbuffer); … … 298 376 // if (table->hosts[i].stderr.Nbuffer > 0x10000) { 299 377 if (table->hosts[i].stderr.Nbuffer > 0x1000) { 300 int printHead = VERBOSE ||(table->hosts[i].stderr.Nbuffer > 0);378 int printHead = VERBOSE && (table->hosts[i].stderr.Nbuffer > 0); 301 379 if (printHead) fprintf (stdout, "--- stderr from %s --- (%d bytes, v1)\n", table->hosts[i].hostname, table->hosts[i].stderr.Nbuffer); 302 380 int Nout = write (STDOUT_FILENO, table->hosts[i].stderr.buffer, table->hosts[i].stderr.Nbuffer); … … 314 392 if (!pid) { 315 393 // fprintf (stderr, "no hosts to harvest\n"); 316 usleep ( 500000);394 usleep (200000); 317 395 break; // no outstanding jobs have finished 318 396 } … … 367 445 } 368 446 } 369 if (!found) { 370 fprintf (stderr, "Programming error: failed to matched finished job to known host!\n"); 371 exit (2); 372 } 373 Nfound ++; 447 if (found) Nfound ++; 448 // we sometimes harvest children not in the list (eg, closed kapa window). just ignore 374 449 if (Nfound == Nrunning) goto escape; // we've harvested all jobs 375 450 } … … 389 464 } 390 465 466 // wait for all children to complete, report output to stdout 467 int HostTableGroupWaitJobsGetIO (HostTableGroup *table, char *file, int lineno, int VERBOSE) { 468 469 // we have launched table->Nhosts jobs; wait for all of them to complete... 470 // if one (N) failed to launch, we will get an ECHILD error from the last (N) calls 471 472 // we need to read any data waiting on stderr or stdout from these jobs, or the overfull 473 // buffers can cause a problem. we alternate between 'select' and 'waitpid' calls with 474 // timeouts for both 475 476 // add all hosts' sockets to the fd_sets 477 fd_set rdSet, wtSet; 478 FD_ZERO (&rdSet); 479 FD_ZERO (&wtSet); 480 481 // XXX can I set the fd_sets once, since I am not actually closing the fd's? 482 483 int globalStatus = TRUE; 484 485 int i; 486 int Nmax = 0; 487 for (i = 0; i < table->Nhosts; i++) { 488 if (!table->hosts[i][0].pid) continue; // any unconnected hosts should be skipped 489 FD_SET (table->hosts[i][0].stdio[HOST_STDIN], &wtSet); 490 Nmax = MAX (Nmax, table->hosts[i][0].stdio[HOST_STDIN]); 491 FD_SET (table->hosts[i][0].stdio[HOST_STDOUT], &rdSet); 492 Nmax = MAX (Nmax, table->hosts[i][0].stdio[HOST_STDOUT]); 493 FD_SET (table->hosts[i][0].stdio[HOST_STDERR], &rdSet); 494 Nmax = MAX (Nmax, table->hosts[i][0].stdio[HOST_STDERR]); 495 } 496 Nmax ++; 497 498 // need the list of connected hosts for exit test below 499 int Nrunning = 0; 500 for (i = 0; i < table->Nhosts; i++) { 501 if (!table->hosts[i][0].pid) continue; // any unconnected hosts should be skipped 502 Nrunning ++; 503 } 504 505 int Nfound = 0; 506 507 // this loop has 2 chunks: (a) check for I/O + (b) check for jobs done 508 while (1) { 509 510 // Wait up to 0.5 second for host to provide I/O 511 // timeout gets mucked: need to reset before each select 512 struct timeval timeout; 513 timeout.tv_sec = 10; 514 timeout.tv_usec = 500000; 515 516 int status = select (Nmax, NULL, &wtSet, NULL, &timeout); 517 if (status == -1) { 518 perror("select()"); 519 exit (2); 520 } 521 522 // we have some sockets to check, check sockets for all hosts 523 for (i = 0; (status > 0) && (i < table->Nhosts); i++) { 524 if (!table->hosts[i][0].pid) continue; // any unconnected hosts should be skipped 525 526 if (FALSE && FD_ISSET (table->hosts[i][0].stdio[HOST_STDIN], &wtSet)) { 527 // this host is waiting for input : this is an error, so exit 528 fprintf (stderr, "host %s is waiting for input\n", table->hosts[i][0].hostname); 529 abort(); 530 } 531 532 if ((table->hosts[i][0].stdio[HOST_STDOUT] > 0) && FD_ISSET (table->hosts[i][0].stdio[HOST_STDOUT], &rdSet)) { 533 // this host has waiting output : read to buffer, and dump if necessary 534 ReadtoIOBuffer (&table->hosts[i][0].stdout, table->hosts[i][0].stdio[HOST_STDOUT]); 535 // if (table->hosts[i][0].stdout.Nbuffer > 0x10000) { 536 if (table->hosts[i][0].stdout.Nbuffer > 0x1000) { 537 int printHead = VERBOSE || (table->hosts[i][0].stdout.Nbuffer > 0); 538 if (printHead) fprintf (stdout, "--- stdout from %s --- (%d bytes, v1)\n", table->hosts[i][0].hostname, table->hosts[i][0].stdout.Nbuffer); 539 int Nout = write (STDOUT_FILENO, table->hosts[i][0].stdout.buffer, table->hosts[i][0].stdout.Nbuffer); 540 if (Nout != table->hosts[i][0].stdout.Nbuffer) { fprintf (stderr, "(error writing log?)\n"); } 541 FlushIOBuffer (&table->hosts[i][0].stdout); 542 if (printHead) fprintf (stdout, "\n"); 543 } 544 } 545 546 if ((table->hosts[i][0].stdio[HOST_STDERR] > 0) && FD_ISSET (table->hosts[i][0].stdio[HOST_STDERR], &rdSet)) { 547 // this host has waiting output : read to buffer, and dump if necessary 548 ReadtoIOBuffer (&table->hosts[i][0].stderr, table->hosts[i][0].stdio[HOST_STDERR]); 549 // if (table->hosts[i][0].stderr.Nbuffer > 0x10000) { 550 if (table->hosts[i][0].stderr.Nbuffer > 0x1000) { 551 int printHead = VERBOSE || (table->hosts[i][0].stderr.Nbuffer > 0); 552 if (printHead) fprintf (stdout, "--- stderr from %s --- (%d bytes, v1)\n", table->hosts[i][0].hostname, table->hosts[i][0].stderr.Nbuffer); 553 int Nout = write (STDOUT_FILENO, table->hosts[i][0].stderr.buffer, table->hosts[i][0].stderr.Nbuffer); 554 if (Nout != table->hosts[i][0].stderr.Nbuffer) { fprintf (stderr, "(error writing log?)\n"); } 555 FlushIOBuffer (&table->hosts[i][0].stderr); 556 if (printHead) fprintf (stdout, "\n"); 557 } 558 } 559 } 560 561 // now check if any children have finished... 562 while (TRUE) { 563 int status = 0; 564 int pid = waitpid (-1, &status, WNOHANG); 565 if (!pid) { 566 // fprintf (stderr, "no hosts to harvest\n"); 567 usleep (500000); 568 break; // no outstanding jobs have finished 569 } 570 if ((pid == -1) && (errno == ECHILD)) goto escape; // no more jobs on which to wait 571 if ((pid == -1) && (errno != ECHILD)) { 572 fprintf (stderr, "programming error (2)? %s %d", file, lineno); 573 exit (2); 574 } 575 576 // find the host which has finished 577 int found = FALSE; 578 for (i = 0; (i < table->Nhosts) && !found; i++) { 579 if (table->hosts[i][0].pid != pid) continue; 580 found = TRUE; 581 582 HostInfo *host = table->hosts[i]; 583 584 // check on the status of this and report any output? 585 if (VERBOSE) fprintf (stdout, "job finished for %s (%d)\n", host->hostname, pid); 586 587 // read stdout 588 int printHead; 589 printHead = VERBOSE || (host->stdout.Nbuffer > 0); 590 EmptyIOBuffer (&host->stdout, 100, host->stdio[HOST_STDOUT]); 591 if (printHead) fprintf (stdout, "--- stdout from %s --- (%d bytes, v2)\n", host->hostname, host->stdout.Nbuffer); 592 int Nout = write (STDOUT_FILENO, host->stdout.buffer, host->stdout.Nbuffer); 593 if (Nout != host->stdout.Nbuffer) { fprintf (stderr, "(error writing log?)\n"); } 594 FlushIOBuffer (&host->stdout); 595 if (printHead) fprintf (stdout, "\n"); 596 597 // read stderr 598 printHead = VERBOSE || (host->stderr.Nbuffer > 0); 599 EmptyIOBuffer (&host->stderr, 100, host->stdio[HOST_STDERR]); 600 if (printHead) fprintf (stdout, "--- stderr from %s --- (%d bytes, v2)\n", host->hostname, host->stderr.Nbuffer); 601 Nout = write (STDOUT_FILENO, host->stderr.buffer, host->stderr.Nbuffer); 602 if (Nout != host->stderr.Nbuffer) { fprintf (stderr, "(error writing log?)\n"); } 603 FlushIOBuffer (&host->stderr); 604 if (printHead) fprintf (stdout, "\n"); 605 606 if (WIFEXITED(status)) { 607 if (VERBOSE) fprintf (stdout, "normal completion, exit status is %d\n", WEXITSTATUS(status)); 608 host->status = WEXITSTATUS(status); 609 if (host->status) { 610 fprintf (stdout, "job failed on %s\n", host->hostname); 611 globalStatus = FALSE; 612 } 613 } else { 614 host->status = -1; 615 fprintf (stdout, "job exited abnormally on %s\n", host->hostname); 616 globalStatus = FALSE; 617 continue; 618 } 619 } 620 if (!found) { 621 fprintf (stderr, "Programming error: failed to matched finished job to known host!\n"); 622 exit (2); 623 } 624 Nfound ++; 625 if (Nfound == Nrunning) goto escape; // we've harvested all jobs 626 } 627 } 628 629 escape: 630 631 // close all opened connections 632 for (i = 0; i < table->Nhosts; i++) { 633 if (!table->hosts[i][0].pid) continue; // any unconnected hosts should be skipped 634 close (table->hosts[i][0].stdio[HOST_STDIN]); 635 close (table->hosts[i][0].stdio[HOST_STDOUT]); 636 close (table->hosts[i][0].stdio[HOST_STDERR]); 637 } 638 639 return globalStatus; 640 } 641 391 642 int HostTableTestHost (SkyRegion *region, int hostID) { 392 643 -
trunk/Ohana/src/libdvo/src/ImageMetadata.c
r37035 r37807 156 156 // assign the storage arrays 157 157 for (i = 0; i < Nimage; i++) { 158 int Nmosaic = FindMosaicForImage (image, Nimage, i); 159 if (!Nmosaic) continue; 160 Nmosaic --; 158 if (!image[i].coords.mosaic) continue; 161 159 imageID[i] = image[i].imageID; 162 160 externID[i] = image[i].externID; 163 crval1[i] = image[Nmosaic].coords.crval1; 164 crval2[i] = image[Nmosaic].coords.crval2; 165 166 theta[i] = DEG_RAD*atan2(image[Nmosaic].coords.pc1_2, image[Nmosaic].coords.pc1_1); 161 Coords *mosaic = image[i].coords.mosaic; 162 163 crval1[i] = mosaic->crval1; 164 crval2[i] = mosaic->crval2; 165 166 theta[i] = DEG_RAD*atan2(mosaic->pc1_2, mosaic->pc1_1); 167 167 168 168 Mcal[i] = image[i].Mcal; -
trunk/Ohana/src/libdvo/src/ImageMetadataSelection.c
r36490 r37807 13 13 14 14 /* field defines a frame with 0,0 at the field center, and 1 arcsec / pixel */ 15 field.crpix1 = field.crpix2 = 0.0;15 InitCoords (&field, "DEC--SIN"); 16 16 field.cdelt1 = field.cdelt2 = 1.0 / 3600; 17 field.pc1_1 = field.pc2_2 = 1.0;18 field.pc1_2 = field.pc2_1 = 0.0;19 field.Npolyterms = 0;20 strcpy (field.ctype, "DEC--SIN");21 17 22 18 /* mosaic defines a frame with 0,0 at the mosaic center, and 1 arcsec / pixel */ 23 mosaic.crpix1 = mosaic.crpix2 = 0.0;19 InitCoords (&mosaic, "DEC--SIN"); 24 20 mosaic.cdelt1 = mosaic.cdelt2 = 1.0 / 3600; 25 mosaic.pc1_1 = mosaic.pc2_2 = 1.0;26 mosaic.pc1_2 = mosaic.pc2_1 = 0.0;27 mosaic.Npolyterms = 0;28 strcpy (mosaic.ctype, "DEC--SIN");29 21 30 22 if ((image = ImageMetadataLoad (filename, &Nimage)) == NULL) return (FALSE); -
trunk/Ohana/src/libdvo/src/ImageOps.c
r34088 r37807 55 55 if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue; 56 56 if (selection->useDisplay) { 57 if (!FindMosaicForImage (image, Nimage, i)) continue;58 57 // first check if region center is in image 59 58 status = RD_to_XY (&X, &Y, Rmid, graph.coords.crval2, &image[i].coords); … … 89 88 } 90 89 if (selection->useSkyregion) { 91 if (!FindMosaicForImage (image, Nimage, i)) continue;92 90 /* project this image to screen display coords */ 93 91 x[0] = 0; y[0] = 0; -
trunk/Ohana/src/libdvo/src/ImageSelection.c
r36490 r37807 22 22 23 23 if (mosaicMode) { 24 /* mosaic defines a frame with 0,0 at the mosaic center, and 1 arcsec / pixel */ 25 mosaic.crpix1 = mosaic.crpix2 = 0.0; 26 mosaic.cdelt1 = mosaic.cdelt2 = 1.0 / 3600; 27 mosaic.pc1_1 = mosaic.pc2_2 = 1.0; 28 mosaic.pc1_2 = mosaic.pc2_1 = 0.0; 29 mosaic.Npolyterms = 0; 30 strcpy (mosaic.ctype, "DEC--SIN"); 24 /* mosaic defines a frame with 0,0 at the mosaic center, and 1 arcsec / pixel */ 25 InitCoords (&mosaic, "DEC--SIN"); 26 mosaic.cdelt1 = mosaic.cdelt2 = 1.0 / 3600; 31 27 } 32 28 … … 64 60 } 65 61 if (m == -1) return (NULL); 66 if (!FindMosaicForImage (image, Nimage, m)) return (NULL);67 62 return (&image[m]); 68 63 } … … 85 80 } 86 81 if (m == -1) return (NULL); 87 if (!FindMosaicForImage (image, Nimage, m)) return (NULL);88 82 return (&image[m]); 89 83 } -
trunk/Ohana/src/libdvo/src/LoadImages.c
r33649 r37807 9 9 static Image *imageCache = NULL; 10 10 static off_t cacheNimage = 0; 11 AstromOffsetTable *table = NULL; 11 12 12 13 static time_t getLastModified(char *filename); … … 39 40 lastModified = 0; 40 41 } 41 42 42 43 43 gfits_db_init (&db); … … 77 77 } 78 78 79 // assign image->parent and image->coords.mosaic 80 BuildChipMatch (image, *Nimage); 81 // MARKTIME("build chip match: %f sec\n", dtime); 82 83 char mapfile[DVO_MAX_PATH]; 84 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", catdir); 85 86 if (table) AstromOffsetTableFree(table); 87 table = AstromOffsetMapLoad (mapfile, FALSE); 88 89 // assign images.coords.offsetMap -> table->map[i] 90 if (table) { 91 AstromOffsetTableMatchChips (image, *Nimage, table); 92 } 93 79 94 return (image); 80 95 } … … 92 107 if (!dvoUseImageCache && (images != NULL)) { 93 108 free(images); 109 AstromOffsetTableFree (table); 94 110 } else { 95 111 // defer free until next LoadImages with a different or modified Images.dat -
trunk/Ohana/src/libdvo/src/RegionHostTable.c
r36630 r37807 31 31 hosts[i].Nneighbors = 0; 32 32 hosts[i].isNeighbor = FALSE; 33 34 hosts[i].astromTable = NULL; 33 35 } 34 36 return; -
trunk/Ohana/src/libdvo/src/coord_systems.c
r31635 r37807 1 1 # include "dvo.h" 2 # include "libdvo_astro.h"3 2 4 3 CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output) { … … 40 39 // \delta^p_J = +27d 07' 41.7087" 41 40 // \theta_J = 122.93192526 deg 41 42 42 // these differ from the above at the several milliarcsec level 43 44 43 45 44 // These values were used in the past, but transform to/from B1950.0 … … 47 46 // transform->Xo = 282.25*RAD_DEG; 48 47 // transform->xo = 33.00; 48 49 break; 50 case COORD_GALACTIC_REID_2004: 51 52 // J2000 FK5 transformation from Reid et al 2004, ApJ 616, 872 53 transform->phi = (27.128336111 - 90.0)*RAD_DEG; // +27d 07' 42.01" (J2000) 54 transform->Xo = (192.859508333 + 90.0)*RAD_DEG; // 12h 51m 26.282s (J2000) 55 transform->xo = 32.932; 56 57 // comments from LSD code (lsd/builtins/misc.py, Mario Juric) 58 // # Appendix of Reid et al. (http://adsabs.harvard.edu/cgi-bin/bib_query?2004ApJ...616..872R) 59 // # This convention is also used by LAMBDA/WMAP (http://lambda.gsfc.nasa.gov/toolbox/tb_coordconv.cfm) 60 61 // _angp = np.radians(192.859508333) # 12h 51m 26.282s (J2000) 62 // _dngp = np.radians(27.128336111) # +27d 07' 42.01" (J2000) 63 // _l0 = np.radians(32.932) 49 64 50 65 break; … … 87 102 switch (output) { 88 103 case COORD_CELESTIAL: 89 // J2000 transformation from Liu et al 2011 ( )104 // J2000 transformation from Liu et al 2011 (A&A 526, A16) 90 105 transform->phi = 62.8717488056*RAD_DEG; 91 106 transform->Xo = 32.9319185700*RAD_DEG; 92 107 transform->xo = 282.8594812080; 108 109 // These values were used in the past, but transform to/from B1950.0 110 // transform->phi = 62.60*RAD_DEG; 111 // transform->Xo = 33.00*RAD_DEG; 112 // transform->xo = 282.25; 113 break; 114 case COORD_GALACTIC: 115 transform->phi = 0.0; 116 transform->Xo = 0.0; 117 transform->xo = 0.0; 118 transform->isIdentity = TRUE; 119 break; 120 case COORD_ECLIPTIC: 121 return NULL; 122 default: 123 abort(); 124 } 125 break; 126 case COORD_GALACTIC_REID_2004: 127 switch (output) { 128 case COORD_CELESTIAL: 129 // J2000 FK5 transformation from Reid et al 2004, ApJ 616, 872 130 transform->phi = (90.0 - 27.128336111)*RAD_DEG; // +27d 07' 42.01" (J2000) 131 transform->Xo = 32.932*RAD_DEG; 132 transform->xo = (192.859508333 + 90.0); // 12h 51m 26.282s (J2000) 93 133 94 134 // These values were used in the past, but transform to/from B1950.0 … … 144 184 Y *= RAD_DEG; 145 185 186 double cosY = cos(Y); 187 double sinY = sin(Y); 188 189 double cosX = cos(X); 190 double sinX = sin(X); 191 146 192 // recast with constants extracted: 147 sin_y = cos (Y)*sin(X)*transform->sin_phi_cos_Xo - cos(Y)*cos(X)*transform->sin_phi_sin_Xo + sin(Y)*transform->cos_phi;193 sin_y = cosY*sinX*transform->sin_phi_cos_Xo - cosY*cosX*transform->sin_phi_sin_Xo + sinY*transform->cos_phi; 148 194 cos_y = sqrt (1 - sin_y*sin_y); 149 195 150 sin_x = cos (Y)*sin(X)*transform->cos_phi_cos_Xo - cos(Y)*cos(X)*transform->cos_phi_sin_Xo - sin(Y)*transform->sin_phi;151 cos_x = cos (Y)*cos(X)*transform->cos_Xo + cos(Y)*sin(X)*transform->sin_Xo;196 sin_x = cosY*sinX*transform->cos_phi_cos_Xo - cosY*cosX*transform->cos_phi_sin_Xo - sinY*transform->sin_phi; 197 cos_x = cosY*cosX*transform->cos_Xo + cosY*sinX*transform->sin_Xo; 152 198 153 199 // atan2 returns -pi : +pi -
trunk/Ohana/src/libdvo/src/coordops.c
r37412 r37807 3 3 /* note that Coords.ctype carries the DEC (ctype2) value */ 4 4 5 static Coords mosaic; 6 static int gotMosaic = FALSE; 7 8 void RegisterMosaic (Coords *coords) { 9 mosaic = *coords; 10 gotMosaic = TRUE; 11 } 12 13 int isRegisteredMosaic () { 14 return (gotMosaic); 15 } 16 17 int GetMosaicCoords (Coords *coords) { 18 *coords = mosaic; 19 return (TRUE); 20 } 5 // default coordinates have unit scale and no rotation 6 void InitCoords (Coords *coords, char *projection) { 7 coords->crval1 = 0.0; 8 coords->crval2 = 0.0; 9 coords->crpix1 = 0.0; 10 coords->crpix2 = 0.0; 11 12 coords->cdelt1 = 1.0; 13 coords->cdelt2 = 1.0; 14 15 coords->pc1_1 = 1.0; // EW is flipped relative to sky parity (dRA/dX > 0) 16 coords->pc2_2 = 1.0; 17 coords->pc2_1 = 0.0; 18 coords->pc1_2 = 0.0; 19 20 coords->Npolyterms = 1; 21 coords->mosaic = NULL; 22 coords->offsetMap = NULL; 23 24 memset (coords->polyterms, 0, 7*2*sizeof(float)); 25 26 if (projection) { 27 strcpy (coords->ctype, projection); 28 } else { 29 strcpy (coords->ctype, "NONE"); 30 } 31 } 32 33 // default coordinates have unit scale and no rotation 34 void CopyCoords (Coords *tgt, Coords *src) { 35 tgt->crval1 = src->crval1; 36 tgt->crval2 = src->crval2; 37 tgt->crpix1 = src->crpix1; 38 tgt->crpix2 = src->crpix2; 39 tgt->cdelt1 = src->cdelt1; 40 tgt->cdelt2 = src->cdelt2; 41 tgt->pc1_1 = src->pc1_1; 42 tgt->pc2_2 = src->pc2_2; 43 tgt->pc2_1 = src->pc2_1; 44 tgt->pc1_2 = src->pc1_2; 45 tgt->Npolyterms = src->Npolyterms; 46 tgt->mosaic = src->mosaic; // pointer to another structure 47 tgt->offsetMap = src->offsetMap; // pointer to another structure 48 49 memcpy (tgt->polyterms, src->polyterms, 7*2*sizeof(float)); 50 strcpy (tgt->ctype, src->ctype); 51 } 21 52 22 53 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords) { … … 28 59 proj = GetProjection (coords[0].ctype); 29 60 mode = GetProjectionMode (proj); 61 62 // if we have an image map, it should be applied to the pixel coordinates 63 // before anything else is done. It is easier to invert the map if it is 64 // of the form (dX,dY) = f(X,Y), then if (dL,dM) = f(X,Y). 65 if (coords[0].Npolyterms == -1) { 66 myAssert (coords[0].offsetMap, "offsetMap is requested by not defined"); 67 float dX = AstromOffsetMapValue (coords->offsetMap, x, y, TRUE); 68 float dY = AstromOffsetMapValue (coords->offsetMap, x, y, FALSE); 69 if (isnan(dX)) dX = 0.0; 70 if (isnan(dY)) dY = 0.0; 71 x += dX; 72 y += dY; 73 } 30 74 31 75 /** convert pixel coordinates to cartesian system **/ … … 78 122 /* mosaic astrometry : WRP is chip astrometry; apply mosaic (DIS) term */ 79 123 if (proj == PROJ_WRP) { 80 if (!gotMosaic) return (FALSE); 81 XY_to_RD (ra, dec, L, M, &mosaic); 124 if (!coords->mosaic) { 125 myAbort ("missing mosaic element"); 126 return (FALSE); 127 } 128 XY_to_RD (ra, dec, L, M, coords->mosaic); 82 129 } 83 130 return (TRUE); … … 149 196 *dec = DEG_RAD*delta; 150 197 151 *ra = ohana_normalize_angle (*ra);198 // *ra = ohana_normalize_angle (*ra); 152 199 153 200 return (TRUE); … … 182 229 *dec = delta + coords[0].crval2; 183 230 184 *ra = ohana_normalize_angle (*ra);231 // *ra = ohana_normalize_angle (*ra); 185 232 186 233 return (TRUE); … … 208 255 if (mode == PROJ_MODE_CARTESIAN) { 209 256 if (proj == PROJ_WRP) { 210 if (!gotMosaic) return (FALSE); 211 RD_to_XY (L, M, ra, dec, &mosaic); 257 if (!coords->mosaic) { 258 myAbort ("missing mosaic element"); 259 return (FALSE); 260 } 261 RD_to_XY (L, M, ra, dec, coords->mosaic); 212 262 return (TRUE); 213 263 } … … 381 431 *y = Yo / coords[0].cdelt2 + coords[0].crpix2; 382 432 433 // if we have an image map, it should be applied to the pixel coordinates 434 // after anything else is done. It is easier to invert the map if it is 435 // of the form (dX,dY) = f(X,Y), then if (dL,dM) = f(X,Y). 436 if (coords[0].Npolyterms == -1) { 437 myAssert (coords[0].offsetMap, "offsetMap is requested by not defined"); 438 439 double xraw = *x; 440 double yraw = *y; 441 442 double dXo = 0.0; 443 double dYo = 0.0; 444 445 int i; 446 for (i = 0; i < 4; i++) { 447 double dX = AstromOffsetMapValue (coords->offsetMap, xraw, yraw, TRUE); 448 double dY = AstromOffsetMapValue (coords->offsetMap, xraw, yraw, FALSE); 449 450 if (isnan(dX)) dX = 0.0; 451 if (isnan(dY)) dY = 0.0; 452 453 dX -= dXo; 454 dY -= dYo; 455 456 xraw -= dX; 457 yraw -= dY; 458 459 dXo += dX; 460 dYo += dY; 461 } 462 463 *x = xraw; 464 *y = yraw; 465 466 // I need to iterate since the position at which I have first made the correction is 467 // not the true position. but if dX,dY is small and the gradient of dX,dY is also 468 // small, then even a single pass gets us close. 469 470 // XXX test this and use a while (hypot(dX,dY) > XXX) condition 471 } 383 472 return (TRUE); 384 473 } … … 449 538 450 539 rotate = 0.0; 451 coords[0].crval1 = coords[0].crpix1 = coords[0].cdelt1 = 0.0; 452 coords[0].crval2 = coords[0].crpix2 = coords[0].cdelt2 = 0.0; 453 coords[0].pc1_1 = coords[0].pc2_2 = 1.0; 454 coords[0].pc2_1 = coords[0].pc1_2 = 0.0; 455 coords[0].Npolyterms = 1; 456 strcpy (coords[0].ctype, "NONE"); 540 541 InitCoords (coords, NULL); 457 542 458 543 mode = COORD_TYPE_NONE; … … 619 704 } 620 705 } 621 706 622 707 if (!status) { 623 708 // fprintf (stderr, "error getting all elements for coordinate mode %s\n", coords[0].ctype); -
trunk/Ohana/src/libdvo/src/dbExtractAverages.c
r37116 r37807 50 50 51 51 /* return average.field based on the selection */ 52 dbValue dbExtractAverages (Average *average, SecFilt *secfilt, Measure *measure, dbField *field) {52 dbValue dbExtractAverages (Average *average, SecFilt *secfilt, Measure *measure, Lensobj *lensobj, StarPar *starpar, dbField *field) { 53 53 54 54 // off_t i; … … 161 161 value.Flt = average[0].stargal; 162 162 break; 163 case AVE_REF_COLOR :163 case AVE_REF_COLOR_BLUE: 164 164 value.Flt = average[0].refColorBlue; 165 break; 166 case AVE_REF_COLOR_RED: 167 value.Flt = average[0].refColorRed; 165 168 break; 166 169 … … 306 309 value.Flt = PhotUCdist (field->photcode, average, secfilt); 307 310 break; 308 // XX case MAG_OPTION_STACK_DET_ID:309 // XX value.Int = PhotStackID (field->photcode, average, secfilt);310 // XX break;311 311 case MAG_OPTION_FLAGS: { 312 312 int Nsec = GetPhotcodeNsec (field->photcode->code); … … 315 315 break; 316 316 } 317 318 // g:X11_SM_OBJ, etc, are only valid for average 319 case MAG_OPTION_X11_SM_OBJ: { value.Flt = LensValue_X11_sm_obj (field->photcode, lensobj); break; } 320 case MAG_OPTION_X12_SM_OBJ: { value.Flt = LensValue_X12_sm_obj (field->photcode, lensobj); break; } 321 case MAG_OPTION_X22_SM_OBJ: { value.Flt = LensValue_X22_sm_obj (field->photcode, lensobj); break; } 322 case MAG_OPTION_E1_SM_OBJ: { value.Flt = LensValue_E1_sm_obj (field->photcode, lensobj); break; } 323 case MAG_OPTION_E2_SM_OBJ: { value.Flt = LensValue_E2_sm_obj (field->photcode, lensobj); break; } 324 325 case MAG_OPTION_X11_SH_OBJ: { value.Flt = LensValue_X11_sh_obj (field->photcode, lensobj); break; } 326 case MAG_OPTION_X12_SH_OBJ: { value.Flt = LensValue_X12_sh_obj (field->photcode, lensobj); break; } 327 case MAG_OPTION_X22_SH_OBJ: { value.Flt = LensValue_X22_sh_obj (field->photcode, lensobj); break; } 328 case MAG_OPTION_E1_SH_OBJ: { value.Flt = LensValue_E1_sh_obj (field->photcode, lensobj); break; } 329 case MAG_OPTION_E2_SH_OBJ: { value.Flt = LensValue_E2_sh_obj (field->photcode, lensobj); break; } 330 331 case MAG_OPTION_X11_SM_PSF: { value.Flt = LensValue_X11_sm_psf (field->photcode, lensobj); break; } 332 case MAG_OPTION_X12_SM_PSF: { value.Flt = LensValue_X12_sm_psf (field->photcode, lensobj); break; } 333 case MAG_OPTION_X22_SM_PSF: { value.Flt = LensValue_X22_sm_psf (field->photcode, lensobj); break; } 334 case MAG_OPTION_E1_SM_PSF: { value.Flt = LensValue_E1_sm_psf (field->photcode, lensobj); break; } 335 case MAG_OPTION_E2_SM_PSF: { value.Flt = LensValue_E2_sm_psf (field->photcode, lensobj); break; } 336 337 case MAG_OPTION_X11_SH_PSF: { value.Flt = LensValue_X11_sh_psf (field->photcode, lensobj); break; } 338 case MAG_OPTION_X12_SH_PSF: { value.Flt = LensValue_X12_sh_psf (field->photcode, lensobj); break; } 339 case MAG_OPTION_X22_SH_PSF: { value.Flt = LensValue_X22_sh_psf (field->photcode, lensobj); break; } 340 case MAG_OPTION_E1_SH_PSF: { value.Flt = LensValue_E1_sh_psf (field->photcode, lensobj); break; } 341 case MAG_OPTION_E2_SH_PSF: { value.Flt = LensValue_E2_sh_psf (field->photcode, lensobj); break; } 342 317 343 case MAG_OPTION_NONE: 318 344 break; 319 } 320 break; 345 346 default: 347 break; 348 } 349 break; 350 351 case AVE_E_BV: { value.Flt = starpar->Ebv; break; } 352 case AVE_E_BV_ERR: { value.Flt = starpar->dEbv; break; } 353 case AVE_DISTANCE_MOD: { value.Flt = starpar->DistMag; break; } 354 case AVE_DISTANCE_MOD_ERR: { value.Flt = starpar->dDistMag; break; } 355 case AVE_M_R: { value.Flt = starpar->M_r; break; } 356 case AVE_M_R_ERR: { value.Flt = starpar->dM_r; break; } 357 case AVE_FEH: { value.Flt = starpar->FeH; break; } 358 case AVE_FEH_ERR: { value.Flt = starpar->dFeH; break; } 359 case AVE_URA_GALMODEL: { value.Flt = starpar->uRA; break; } 360 case AVE_UDEC_GALMODEL: { value.Flt = starpar->uDEC; break; } 361 case AVE_RA_GALMODEL: { value.Flt = starpar->R; break; } 362 case AVE_DEC_GALMODEL: { value.Flt = starpar->D; break; } 321 363 322 364 case AVE_TYPE: … … 324 366 case AVE_TYPEFRAC: 325 367 break; 368 369 326 370 } 327 371 return (value); -
trunk/Ohana/src/libdvo/src/dbExtractImages.c
r37035 r37807 59 59 time_t t; 60 60 dbValue value; 61 off_t Nmosaic;62 61 63 62 value.Flt = NAN; … … 68 67 case IMAGE_RA: 69 68 if (!haveCelestial) { 70 if (!FindMosaicForImage (image, Nimage, N)) return value;71 69 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 72 70 x = 0.0; … … 83 81 case IMAGE_DEC: 84 82 if (!haveCelestial) { 85 if (!FindMosaicForImage (image, Nimage, N)) return value;86 83 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 87 84 x = 0.0; … … 99 96 if (!haveGalactic) { 100 97 if (!haveCelestial) { 101 if (!FindMosaicForImage (image, Nimage, N)) return value;102 98 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 103 99 x = 0.0; … … 118 114 if (!haveGalactic) { 119 115 if (!haveCelestial) { 120 if (!FindMosaicForImage (image, Nimage, N)) return value;121 116 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 122 117 x = 0.0; … … 137 132 if (!haveEcliptic) { 138 133 if (!haveCelestial) { 139 if (!FindMosaicForImage (image, Nimage, N)) return value;140 134 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 141 135 x = 0.0; … … 156 150 if (!haveEcliptic) { 157 151 if (!haveCelestial) { 158 if (!FindMosaicForImage (image, Nimage, N)) return value;159 152 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 160 153 x = 0.0; … … 269 262 270 263 case IMAGE_FWHM_MEDIAN: 271 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 272 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 273 value.Flt = (image[Nmosaic].fwhm_x + image[Nmosaic].fwhm_y) / 50.0; 264 if (!image[N].parent) return value; 265 value.Flt = (image[N].parent->fwhm_x + image[N].parent->fwhm_y) / 50.0; 274 266 break; 275 267 case IMAGE_FWHM_MAJ_MEDIAN: 276 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 277 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 278 value.Flt = image[Nmosaic].fwhm_x / 25.0; 268 if (!image[N].parent) return value; 269 value.Flt = image[N].parent->fwhm_x / 25.0; 279 270 break; 280 271 case IMAGE_FWHM_MIN_MEDIAN: 281 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 282 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 283 value.Flt = image[Nmosaic].fwhm_y / 25.0; 272 if (!image[N].parent) return value; 273 value.Flt = image[N].parent->fwhm_y / 25.0; 284 274 break; 285 275 … … 375 365 break; 376 366 377 case IMAGE_REF_COLOR :367 case IMAGE_REF_COLOR_BLUE: 378 368 value.Flt = image[N].refColorBlue; 369 break; 370 case IMAGE_REF_COLOR_RED: 371 value.Flt = image[N].refColorRed; 379 372 break; 380 373 } -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r37246 r37807 85 85 86 86 /* return measure.field based on the selection */ 87 dbValue dbExtractMeasures (Average *average, SecFilt *secfilt, Measure *measure, dbField *field) {87 dbValue dbExtractMeasures (Average *average, SecFilt *secfilt, Measure *measure, Lensing *lensing, StarPar *starpar, dbField *field) { 88 88 89 89 int Nsec; … … 249 249 case MAG_OPTION_UC_DIST: 250 250 case MAG_OPTION_FLAGS: 251 case MAG_OPTION_X11_SM_OBJ: 252 case MAG_OPTION_X12_SM_OBJ: 253 case MAG_OPTION_X22_SM_OBJ: 254 case MAG_OPTION_E1_SM_OBJ: 255 case MAG_OPTION_E2_SM_OBJ: 256 case MAG_OPTION_X11_SH_OBJ: 257 case MAG_OPTION_X12_SH_OBJ: 258 case MAG_OPTION_X22_SH_OBJ: 259 case MAG_OPTION_E1_SH_OBJ: 260 case MAG_OPTION_E2_SH_OBJ: 261 case MAG_OPTION_X11_SM_PSF: 262 case MAG_OPTION_X12_SM_PSF: 263 case MAG_OPTION_X22_SM_PSF: 264 case MAG_OPTION_E1_SM_PSF: 265 case MAG_OPTION_E2_SM_PSF: 266 case MAG_OPTION_X11_SH_PSF: 267 case MAG_OPTION_X12_SH_PSF: 268 case MAG_OPTION_X22_SH_PSF: 269 case MAG_OPTION_E1_SH_PSF: 270 case MAG_OPTION_E2_SH_PSF: 271 case MAG_OPTION_F_AP_R5: 272 case MAG_OPTION_F_ERR_AP_R5: 273 case MAG_OPTION_F_STDEV_AP_R5: 274 case MAG_OPTION_F_FILL_AP_R5: 275 case MAG_OPTION_F_AP_R6: 276 case MAG_OPTION_F_ERR_AP_R6: 277 case MAG_OPTION_F_STDEV_AP_R6: 278 case MAG_OPTION_F_FILL_AP_R6: 279 251 280 case MAG_OPTION_NONE: 252 281 break; … … 474 503 break; 475 504 476 case MEAS_REF_COLOR :505 case MEAS_REF_COLOR_BLUE: 477 506 value.Flt = average[0].refColorBlue; 507 break; 508 case MEAS_REF_COLOR_RED: 509 value.Flt = average[0].refColorRed; 478 510 break; 479 511 … … 528 560 # endif 529 561 break; 530 case MEAS_XFIX: /* OK */ 531 value.Flt = measure[0].Xfix; 532 break; 533 case MEAS_YFIX: /* OK */ 534 value.Flt = measure[0].Yfix; 535 break; 536 case MEAS_XCCD_ERR: /* OK */ 537 value.Flt = FromShortPixels(measure[0].dXccd); 538 break; 539 case MEAS_YCCD_ERR: /* OK */ 540 value.Flt = FromShortPixels(measure[0].dYccd); 541 break; 542 case MEAS_POS_SYS_ERR: /* OK */ 543 value.Flt = FromShortPixels(measure[0].dRsys); 544 break; 562 case MEAS_XFIX: { value.Flt = measure[0].Xfix; break; } 563 case MEAS_YFIX: { value.Flt = measure[0].Yfix; break; } 564 case MEAS_XCCD_ERR: { value.Flt = FromShortPixels(measure[0].dXccd); break; } 565 case MEAS_YCCD_ERR: { value.Flt = FromShortPixels(measure[0].dYccd); break; } 566 case MEAS_POS_SYS_ERR: { value.Flt = FromShortPixels(measure[0].dRsys); } 567 568 case MEAS_XOFF_KH: { value.Flt = measure[0].XoffKH; break; } 569 case MEAS_YOFF_KH: { value.Flt = measure[0].YoffKH; break; } 570 case MEAS_XOFF_DCR: { value.Flt = measure[0].XoffDCR; break; } 571 case MEAS_YOFF_DCR: { value.Flt = measure[0].YoffDCR; break; } 572 case MEAS_ROFF_GAL: { value.Flt = measure[0].RoffGAL; break; } 573 case MEAS_DOFF_GAL: { value.Flt = measure[0].DoffGAL; break; } 545 574 546 575 case MEAS_XFIELD: /* offset relative to exposure center in ra,dec space */ … … 581 610 case MEAS_XMOSAIC: /* offset relative to exposure center in camera coords */ 582 611 if (!haveMosaicMeas) { 583 if (REMOTE_CLIENT) { 584 mosaic = MatchMosaicMetadata (measure[0].imageID); 585 } else { 586 // fprintf (stderr, "non-parallel Xmos broken\n"); 587 // abort(); 588 // mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 589 mosaic = MatchMosaicMetadata (measure[0].imageID); 590 } 612 mosaic = MatchMosaicMetadata (measure[0].imageID); 591 613 if (mosaic == NULL) break; 592 614 double Rm = measure[0].R; … … 598 620 case MEAS_YMOSAIC: /* OK */ 599 621 if (!haveMosaicMeas) { 600 if (REMOTE_CLIENT) { 601 mosaic = MatchMosaicMetadata (measure[0].imageID); 602 } else { 603 // fprintf (stderr, "non-parallel Xmos broken\n"); 604 // abort(); 605 // mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 606 mosaic = MatchMosaicMetadata (measure[0].imageID); 607 } 622 mosaic = MatchMosaicMetadata (measure[0].imageID); 608 623 if (mosaic == NULL) break; 609 624 double Rm = measure[0].R; … … 680 695 break; 681 696 682 case MEAS_MCAL_OFFSET: /* OK */ 683 value.Flt = measure[0].Mcal; 684 break; 697 case MEAS_MCAL_OFFSET: { value.Flt = measure[0].Mcal; break; } 685 698 686 699 case MEAS_FLAT: /* OK */ … … 717 730 } 718 731 break; 732 733 case MEAS_E_BV: { value.Flt = starpar->Ebv; break; } 734 case MEAS_E_BV_ERR: { value.Flt = starpar->dEbv; break; } 735 case MEAS_DISTANCE_MOD: { value.Flt = starpar->DistMag; break; } 736 case MEAS_DISTANCE_MOD_ERR: { value.Flt = starpar->dDistMag; break; } 737 case MEAS_M_R: { value.Flt = starpar->M_r; break; } 738 case MEAS_M_R_ERR: { value.Flt = starpar->dM_r; break; } 739 case MEAS_FEH: { value.Flt = starpar->FeH; break; } 740 case MEAS_FEH_ERR: { value.Flt = starpar->dFeH; break; } 741 case MEAS_URA_GALMODEL: { value.Flt = starpar->uRA; break; } 742 case MEAS_UDEC_GALMODEL: { value.Flt = starpar->uDEC; break; } 743 case MEAS_RA_GALMODEL: { value.Flt = starpar->R; break; } 744 case MEAS_DEC_GALMODEL: { value.Flt = starpar->D; break; } 719 745 720 746 // case MEAS_FLUX_PSF: /* OK */ -
trunk/Ohana/src/libdvo/src/dbFields.c
r37116 r37807 28 28 } 29 29 30 int dbFieldNeedMeasure (dbField *fields, int Nfields) { 31 int i; 32 for (i = 0; i < Nfields; i++) { 33 if (fields[i].photcode == NULL) continue; // non-measure fields do not have a photcode 34 if (fields[i].photcode[0].type == PHOT_REF) return TRUE; 35 if (fields[i].photcode[0].type == PHOT_DEP) return TRUE; 36 } 37 return FALSE; 38 } 39 40 int dbFieldNeedLensing (dbField *fields, int Nfields) { 41 int i; 42 for (i = 0; i < Nfields; i++) { 43 if (fields[i].ID == MEAS_X11_SM_OBJ) return TRUE; 44 if (fields[i].ID == MEAS_X12_SM_OBJ) return TRUE; 45 if (fields[i].ID == MEAS_X22_SM_OBJ) return TRUE; 46 if (fields[i].ID == MEAS_E1_SM_OBJ) return TRUE; 47 if (fields[i].ID == MEAS_E2_SM_OBJ) return TRUE; 48 if (fields[i].ID == MEAS_X11_SH_OBJ) return TRUE; 49 if (fields[i].ID == MEAS_X12_SH_OBJ) return TRUE; 50 if (fields[i].ID == MEAS_X22_SH_OBJ) return TRUE; 51 if (fields[i].ID == MEAS_E1_SH_OBJ) return TRUE; 52 if (fields[i].ID == MEAS_E2_SH_OBJ) return TRUE; 53 if (fields[i].ID == MEAS_X11_SM_PSF) return TRUE; 54 if (fields[i].ID == MEAS_X12_SM_PSF) return TRUE; 55 if (fields[i].ID == MEAS_X22_SM_PSF) return TRUE; 56 if (fields[i].ID == MEAS_E1_SM_PSF) return TRUE; 57 if (fields[i].ID == MEAS_E2_SM_PSF) return TRUE; 58 if (fields[i].ID == MEAS_X11_SH_PSF) return TRUE; 59 if (fields[i].ID == MEAS_X12_SH_PSF) return TRUE; 60 if (fields[i].ID == MEAS_X22_SH_PSF) return TRUE; 61 if (fields[i].ID == MEAS_E1_SH_PSF) return TRUE; 62 if (fields[i].ID == MEAS_E2_SH_PSF) return TRUE; 63 } 64 return FALSE; 65 } 66 67 int dbFieldNeedLensobj (dbField *fields, int Nfields) { 68 int i; 69 for (i = 0; i < Nfields; i++) { 70 if (fields[i].magOption == MAG_OPTION_NONE) continue; // non-measure fields do not have a photcode 71 72 if (fields[i].magOption == MAG_OPTION_X11_SM_OBJ) return TRUE; 73 if (fields[i].magOption == MAG_OPTION_X12_SM_OBJ) return TRUE; 74 if (fields[i].magOption == MAG_OPTION_X22_SM_OBJ) return TRUE; 75 if (fields[i].magOption == MAG_OPTION_E1_SM_OBJ) return TRUE; 76 if (fields[i].magOption == MAG_OPTION_E2_SM_OBJ) return TRUE; 77 if (fields[i].magOption == MAG_OPTION_X11_SH_OBJ) return TRUE; 78 if (fields[i].magOption == MAG_OPTION_X12_SH_OBJ) return TRUE; 79 if (fields[i].magOption == MAG_OPTION_X22_SH_OBJ) return TRUE; 80 if (fields[i].magOption == MAG_OPTION_E1_SH_OBJ) return TRUE; 81 if (fields[i].magOption == MAG_OPTION_E2_SH_OBJ) return TRUE; 82 if (fields[i].magOption == MAG_OPTION_X11_SM_PSF) return TRUE; 83 if (fields[i].magOption == MAG_OPTION_X12_SM_PSF) return TRUE; 84 if (fields[i].magOption == MAG_OPTION_X22_SM_PSF) return TRUE; 85 if (fields[i].magOption == MAG_OPTION_E1_SM_PSF) return TRUE; 86 if (fields[i].magOption == MAG_OPTION_E2_SM_PSF) return TRUE; 87 if (fields[i].magOption == MAG_OPTION_X11_SH_PSF) return TRUE; 88 if (fields[i].magOption == MAG_OPTION_X12_SH_PSF) return TRUE; 89 if (fields[i].magOption == MAG_OPTION_X22_SH_PSF) return TRUE; 90 if (fields[i].magOption == MAG_OPTION_E1_SH_PSF) return TRUE; 91 if (fields[i].magOption == MAG_OPTION_E2_SH_PSF) return TRUE; 92 } 93 return FALSE; 94 } 95 96 int dbFieldNeedStarpar (dbField *fields, int Nfields, int isAverage) { 97 int i; 98 for (i = 0; i < Nfields; i++) { 99 if (isAverage) { 100 if (fields[i].ID == AVE_E_BV) return TRUE; 101 if (fields[i].ID == AVE_E_BV_ERR) return TRUE; 102 if (fields[i].ID == AVE_DISTANCE_MOD) return TRUE; 103 if (fields[i].ID == AVE_DISTANCE_MOD_ERR) return TRUE; 104 if (fields[i].ID == AVE_M_R) return TRUE; 105 if (fields[i].ID == AVE_M_R_ERR) return TRUE; 106 if (fields[i].ID == AVE_FEH) return TRUE; 107 if (fields[i].ID == AVE_FEH_ERR) return TRUE; 108 if (fields[i].ID == AVE_URA_GALMODEL) return TRUE; 109 if (fields[i].ID == AVE_UDEC_GALMODEL) return TRUE; 110 if (fields[i].ID == AVE_RA_GALMODEL) return TRUE; 111 if (fields[i].ID == AVE_DEC_GALMODEL) return TRUE; 112 } else { 113 if (fields[i].ID == MEAS_E_BV) return TRUE; 114 if (fields[i].ID == MEAS_E_BV_ERR) return TRUE; 115 if (fields[i].ID == MEAS_DISTANCE_MOD) return TRUE; 116 if (fields[i].ID == MEAS_DISTANCE_MOD_ERR) return TRUE; 117 if (fields[i].ID == MEAS_M_R) return TRUE; 118 if (fields[i].ID == MEAS_M_R_ERR) return TRUE; 119 if (fields[i].ID == MEAS_FEH) return TRUE; 120 if (fields[i].ID == MEAS_FEH_ERR) return TRUE; 121 if (fields[i].ID == MEAS_URA_GALMODEL) return TRUE; 122 if (fields[i].ID == MEAS_UDEC_GALMODEL) return TRUE; 123 if (fields[i].ID == MEAS_RA_GALMODEL) return TRUE; 124 if (fields[i].ID == MEAS_DEC_GALMODEL) return TRUE; 125 } 126 } 127 return FALSE; 128 } 129 30 130 dvoMagSourceType GetMagSource (char *string) { 31 131 32 if (!strcasecmp (string, "chip")) return (MAG_SRC_CHP);33 if (!strcasecmp (string, "warp")) return (MAG_SRC_WRP);132 if (!strcasecmp (string, "chip")) return (MAG_SRC_CHP); 133 if (!strcasecmp (string, "warp")) return (MAG_SRC_WRP); 34 134 if (!strcasecmp (string, "stack")) return (MAG_SRC_STK); 35 135 … … 66 166 dvoMagOptionType GetMagOption (char *string) { 67 167 68 if (!strcasecmp (string, "mag")) return (MAG_OPTION_MAG); 69 if (!strcasecmp (string, "err")) return (MAG_OPTION_ERR); 70 if (!strcasecmp (string, "magerr")) return (MAG_OPTION_ERR); 71 if (!strcasecmp (string, "flux")) return (MAG_OPTION_FLUX); 72 if (!strcasecmp (string, "fluxerr")) return (MAG_OPTION_FLUX_ERR); 73 if (!strcasecmp (string, "stdev")) return (MAG_OPTION_STDEV); 74 if (!strcasecmp (string, "chisq")) return (MAG_OPTION_CHISQ); 75 if (!strcasecmp (string, "min")) return (MAG_OPTION_MIN); 76 if (!strcasecmp (string, "max")) return (MAG_OPTION_MAX); 77 if (!strcasecmp (string, "ncode")) return (MAG_OPTION_NCODE); 78 if (!strcasecmp (string, "nphot")) return (MAG_OPTION_NPHOT); 79 if (!strcasecmp (string, "uc_dist")) return (MAG_OPTION_UC_DIST); 80 if (!strcasecmp (string, "flags")) return (MAG_OPTION_FLAGS); 168 if (!strcasecmp (string, "mag")) return MAG_OPTION_MAG; 169 if (!strcasecmp (string, "err")) return MAG_OPTION_ERR; 170 if (!strcasecmp (string, "magerr")) return MAG_OPTION_ERR; 171 if (!strcasecmp (string, "flux")) return MAG_OPTION_FLUX; 172 if (!strcasecmp (string, "fluxerr")) return MAG_OPTION_FLUX_ERR; 173 if (!strcasecmp (string, "stdev")) return MAG_OPTION_STDEV; 174 if (!strcasecmp (string, "chisq")) return MAG_OPTION_CHISQ; 175 if (!strcasecmp (string, "min")) return MAG_OPTION_MIN; 176 if (!strcasecmp (string, "max")) return MAG_OPTION_MAX; 177 if (!strcasecmp (string, "ncode")) return MAG_OPTION_NCODE; 178 if (!strcasecmp (string, "nphot")) return MAG_OPTION_NPHOT; 179 if (!strcasecmp (string, "uc_dist")) return MAG_OPTION_UC_DIST; 180 if (!strcasecmp (string, "flags")) return MAG_OPTION_FLAGS; 181 if (!strcasecmp (string, "X11_SM_OBJ")) return MAG_OPTION_X11_SM_OBJ; 182 if (!strcasecmp (string, "X12_SM_OBJ")) return MAG_OPTION_X12_SM_OBJ; 183 if (!strcasecmp (string, "X22_SM_OBJ")) return MAG_OPTION_X22_SM_OBJ; 184 if (!strcasecmp (string, "E1_SM_OBJ")) return MAG_OPTION_E1_SM_OBJ; 185 if (!strcasecmp (string, "E2_SM_OBJ")) return MAG_OPTION_E2_SM_OBJ; 186 if (!strcasecmp (string, "X11_SH_OBJ")) return MAG_OPTION_X11_SH_OBJ; 187 if (!strcasecmp (string, "X12_SH_OBJ")) return MAG_OPTION_X12_SH_OBJ; 188 if (!strcasecmp (string, "X22_SH_OBJ")) return MAG_OPTION_X22_SH_OBJ; 189 if (!strcasecmp (string, "E1_SH_OBJ")) return MAG_OPTION_E1_SH_OBJ; 190 if (!strcasecmp (string, "E2_SH_OBJ")) return MAG_OPTION_E2_SH_OBJ; 191 if (!strcasecmp (string, "X11_SM_PSF")) return MAG_OPTION_X11_SM_PSF; 192 if (!strcasecmp (string, "X12_SM_PSF")) return MAG_OPTION_X12_SM_PSF; 193 if (!strcasecmp (string, "X22_SM_PSF")) return MAG_OPTION_X22_SM_PSF; 194 if (!strcasecmp (string, "E1_SM_PSF")) return MAG_OPTION_E1_SM_PSF; 195 if (!strcasecmp (string, "E2_SM_PSF")) return MAG_OPTION_E2_SM_PSF; 196 if (!strcasecmp (string, "X11_SH_PSF")) return MAG_OPTION_X11_SH_PSF; 197 if (!strcasecmp (string, "X12_SH_PSF")) return MAG_OPTION_X12_SH_PSF; 198 if (!strcasecmp (string, "X22_SH_PSF")) return MAG_OPTION_X22_SH_PSF; 199 if (!strcasecmp (string, "E1_SH_PSF")) return MAG_OPTION_E1_SH_PSF; 200 if (!strcasecmp (string, "E2_SH_PSF")) return MAG_OPTION_E2_SH_PSF; 201 // if (!strcasecmp (string, "F_AP_R5")) return MAG_OPTION_F_AP_R5; 202 // if (!strcasecmp (string, "F_ERR_AP_R5")) return MAG_OPTION_F_ERR_AP_R5; 203 // if (!strcasecmp (string, "F_STDEV_AP_R5")) return MAG_OPTION_F_STDEV_AP_R5; 204 // if (!strcasecmp (string, "F_FILL_AP_R5")) return MAG_OPTION_F_FILL_AP_R5; 205 // if (!strcasecmp (string, "F_AP_R6")) return MAG_OPTION_F_AP_R6; 206 // if (!strcasecmp (string, "F_ERR_AP_R6")) return MAG_OPTION_F_ERR_AP_R6; 207 // if (!strcasecmp (string, "F_STDEV_AP_R6")) return MAG_OPTION_F_STDEV_AP_R6; 208 // if (!strcasecmp (string, "F_FILL_AP_R6")) return MAG_OPTION_F_FILL_AP_R6; 81 209 82 210 return MAG_OPTION_NONE; 83 211 } 84 85 # if (0)86 int GetMagMode (char *string) {87 88 // these all imply PSF mags:89 if (!strcasecmp (string, "inst")) return (MAG_INST);90 if (!strcasecmp (string, "cat")) return (MAG_CAT);91 if (!strcasecmp (string, "sys")) return (MAG_SYS);92 if (!strcasecmp (string, "rel")) return (MAG_REL);93 if (!strcasecmp (string, "cal")) return (MAG_CAL);94 if (!strcasecmp (string, "ave")) return (MAG_AVE);95 if (!strcasecmp (string, "ref")) return (MAG_REF);96 if (!strcasecmp (string, "err")) return (MAG_ERR);97 if (!strcasecmp (string, "aveerr")) return (MAG_AVE_ERR);98 99 // these are explicit PSF mags:100 if (!strcasecmp (string, "psf_inst")) return (MAG_INST);101 if (!strcasecmp (string, "psf_cat")) return (MAG_CAT);102 if (!strcasecmp (string, "psf_sys")) return (MAG_SYS);103 if (!strcasecmp (string, "psf_rel")) return (MAG_REL);104 if (!strcasecmp (string, "psf_cal")) return (MAG_CAL);105 if (!strcasecmp (string, "psf_ave")) return (MAG_AVE);106 if (!strcasecmp (string, "psf_ref")) return (MAG_REF);107 if (!strcasecmp (string, "psf_err")) return (MAG_ERR);108 if (!strcasecmp (string, "psf_aveerr")) return (MAG_AVE_ERR);109 110 // these are aper mags:111 if (!strcasecmp (string, "ap")) return (MAG_APER);112 if (!strcasecmp (string, "aper")) return (MAG_APER);113 if (!strcasecmp (string, "aperinst")) return (MAG_APER_INST);114 if (!strcasecmp (string, "aper_inst")) return (MAG_APER_INST);115 if (!strcasecmp (string, "aper_cat")) return (MAG_APER_CAT);116 if (!strcasecmp (string, "aper_sys")) return (MAG_APER_SYS);117 if (!strcasecmp (string, "aper_rel")) return (MAG_APER_REL);118 if (!strcasecmp (string, "aper_cal")) return (MAG_APER_CAL);119 if (!strcasecmp (string, "aper_ave")) return (MAG_APER_AVE);120 if (!strcasecmp (string, "aper_ref")) return (MAG_APER_REF);121 if (!strcasecmp (string, "aper_err")) return (MAG_APER_ERR);122 123 // these are kron mags:124 if (!strcasecmp (string, "kron")) return (MAG_KRON);125 if (!strcasecmp (string, "kron_inst")) return (MAG_KRON_INST);126 if (!strcasecmp (string, "kron_cat")) return (MAG_KRON_CAT);127 if (!strcasecmp (string, "kron_sys")) return (MAG_KRON_SYS);128 if (!strcasecmp (string, "kron_rel")) return (MAG_KRON_REL);129 if (!strcasecmp (string, "kron_cal")) return (MAG_KRON_CAL);130 if (!strcasecmp (string, "kron_ave")) return (MAG_KRON_AVE);131 if (!strcasecmp (string, "kron_ref")) return (MAG_KRON_REF);132 if (!strcasecmp (string, "kron_err")) return (MAG_KRON_ERR);133 if (!strcasecmp (string, "kroninst")) return (MAG_KRON_INST);134 if (!strcasecmp (string, "kronerr")) return (MAG_KRON_ERR);135 136 // other fields:137 if (!strcasecmp (string, "photflags")) return (MAG_PHOT_FLAGS);138 if (!strcasecmp (string, "flags")) return (MAG_PHOT_FLAGS);139 if (!strcasecmp (string, "chisq")) return (MAG_CHISQ);140 if (!strcasecmp (string, "ncode")) return (MAG_NCODE);141 if (!strcasecmp (string, "nphot")) return (MAG_NPHOT);142 if (!strcasecmp (string, "stdev")) return (MAG_STDEV);143 if (!strcasecmp (string, "min")) return (MAG_MIN);144 if (!strcasecmp (string, "max")) return (MAG_MAX);145 if (!strcasecmp (string, "ucdist")) return (MAG_UC_DIST);146 if (!strcasecmp (string, "fluxpsf")) return (MAG_FLUX_PSF);147 if (!strcasecmp (string, "fluxpsferr")) return (MAG_FLUX_PSF_ERR);148 if (!strcasecmp (string, "fluxkron")) return (MAG_FLUX_KRON);149 if (!strcasecmp (string, "fluxkronerr")) return (MAG_FLUX_KRON_ERR);150 return (MAG_NONE);151 }152 # endif153 212 154 213 // field may be of the form mag:psf:inst:wrp. except for the first subword, … … 285 344 fprintf (stderr, "ERROR: unknown mag/photocode argument %s\n", word); 286 345 free (word); 346 return FALSE; 287 347 } 288 348 … … 414 474 if (!strcasecmp (fieldName, "XFIX")) ESCAPE (MEAS_XFIX, OPIHI_FLT); 415 475 if (!strcasecmp (fieldName, "YFIX")) ESCAPE (MEAS_YFIX, OPIHI_FLT); 476 if (!strcasecmp (fieldName, "XOFF_KH")) ESCAPE (MEAS_XOFF_KH, OPIHI_FLT); 477 if (!strcasecmp (fieldName, "YOFF_KH")) ESCAPE (MEAS_YOFF_KH, OPIHI_FLT); 478 if (!strcasecmp (fieldName, "XOFF_DCR")) ESCAPE (MEAS_XOFF_DCR, OPIHI_FLT); 479 if (!strcasecmp (fieldName, "YOFF_DCR")) ESCAPE (MEAS_YOFF_DCR, OPIHI_FLT); 480 if (!strcasecmp (fieldName, "ROFF_GAL")) ESCAPE (MEAS_ROFF_GAL, OPIHI_FLT); 481 if (!strcasecmp (fieldName, "DOFF_GAL")) ESCAPE (MEAS_DOFF_GAL, OPIHI_FLT); 416 482 if (!strcasecmp (fieldName, "POS_SYS_ERR")) ESCAPE (MEAS_POS_SYS_ERR, OPIHI_FLT); 417 483 if (!strcasecmp (fieldName, "XFIELD")) ESCAPE (MEAS_XFIELD, OPIHI_FLT); … … 441 507 if (!strcasecmp (fieldName, "FLAT")) ESCAPE (MEAS_FLAT, OPIHI_FLT); 442 508 if (!strcasecmp (fieldName, "CENTER_OFFSET")) ESCAPE (MEAS_CENTER_OFFSET, OPIHI_FLT); 443 // if (!strcasecmp (fieldName, "FLUX")) ESCAPE (MEAS_FLUX_PSF, OPIHI_FLT); 509 510 // individual lensing measurements are not grouped by photcode: 511 if (!strcasecmp (fieldName, "X11_SM_OBJ")) ESCAPE (MEAS_X11_SM_OBJ, OPIHI_FLT); 512 if (!strcasecmp (fieldName, "X12_SM_OBJ")) ESCAPE (MEAS_X12_SM_OBJ, OPIHI_FLT); 513 if (!strcasecmp (fieldName, "X22_SM_OBJ")) ESCAPE (MEAS_X22_SM_OBJ, OPIHI_FLT); 514 if (!strcasecmp (fieldName, "E1_SM_OBJ")) ESCAPE (MEAS_E1_SM_OBJ, OPIHI_FLT); 515 if (!strcasecmp (fieldName, "E2_SM_OBJ")) ESCAPE (MEAS_E2_SM_OBJ, OPIHI_FLT); 516 if (!strcasecmp (fieldName, "X11_SH_OBJ")) ESCAPE (MEAS_X11_SH_OBJ, OPIHI_FLT); 517 if (!strcasecmp (fieldName, "X12_SH_OBJ")) ESCAPE (MEAS_X12_SH_OBJ, OPIHI_FLT); 518 if (!strcasecmp (fieldName, "X22_SH_OBJ")) ESCAPE (MEAS_X22_SH_OBJ, OPIHI_FLT); 519 if (!strcasecmp (fieldName, "E1_SH_OBJ")) ESCAPE (MEAS_E1_SH_OBJ, OPIHI_FLT); 520 if (!strcasecmp (fieldName, "E2_SH_OBJ")) ESCAPE (MEAS_E2_SH_OBJ, OPIHI_FLT); 521 if (!strcasecmp (fieldName, "X11_SM_PSF")) ESCAPE (MEAS_X11_SM_PSF, OPIHI_FLT); 522 if (!strcasecmp (fieldName, "X12_SM_PSF")) ESCAPE (MEAS_X12_SM_PSF, OPIHI_FLT); 523 if (!strcasecmp (fieldName, "X22_SM_PSF")) ESCAPE (MEAS_X22_SM_PSF, OPIHI_FLT); 524 if (!strcasecmp (fieldName, "E1_SM_PSF")) ESCAPE (MEAS_E1_SM_PSF, OPIHI_FLT); 525 if (!strcasecmp (fieldName, "E2_SM_PSF")) ESCAPE (MEAS_E2_SM_PSF, OPIHI_FLT); 526 if (!strcasecmp (fieldName, "X11_SH_PSF")) ESCAPE (MEAS_X11_SH_PSF, OPIHI_FLT); 527 if (!strcasecmp (fieldName, "X12_SH_PSF")) ESCAPE (MEAS_X12_SH_PSF, OPIHI_FLT); 528 if (!strcasecmp (fieldName, "X22_SH_PSF")) ESCAPE (MEAS_X22_SH_PSF, OPIHI_FLT); 529 if (!strcasecmp (fieldName, "E1_SH_PSF")) ESCAPE (MEAS_E1_SH_PSF, OPIHI_FLT); 530 if (!strcasecmp (fieldName, "E2_SH_PSF")) ESCAPE (MEAS_E2_SH_PSF, OPIHI_FLT); 531 532 if (!strcasecmp (fieldName, "E_BV")) ESCAPE (MEAS_E_BV , OPIHI_FLT); 533 if (!strcasecmp (fieldName, "E_BV_ERR")) ESCAPE (MEAS_E_BV_ERR , OPIHI_FLT); 534 if (!strcasecmp (fieldName, "DISTANCE_MOD")) ESCAPE (MEAS_DISTANCE_MOD , OPIHI_FLT); 535 if (!strcasecmp (fieldName, "DISTANCE_MOD_ERR")) ESCAPE (MEAS_DISTANCE_MOD_ERR, OPIHI_FLT); 536 if (!strcasecmp (fieldName, "D_M")) ESCAPE (MEAS_DISTANCE_MOD , OPIHI_FLT); 537 if (!strcasecmp (fieldName, "D_M_ERR")) ESCAPE (MEAS_DISTANCE_MOD_ERR, OPIHI_FLT); 538 if (!strcasecmp (fieldName, "M_R")) ESCAPE (MEAS_M_R , OPIHI_FLT); 539 if (!strcasecmp (fieldName, "M_R_ERR")) ESCAPE (MEAS_M_R_ERR , OPIHI_FLT); 540 if (!strcasecmp (fieldName, "FEH")) ESCAPE (MEAS_FEH , OPIHI_FLT); 541 if (!strcasecmp (fieldName, "FEH_ERR")) ESCAPE (MEAS_FEH_ERR , OPIHI_FLT); 542 if (!strcasecmp (fieldName, "URA_GALMODEL")) ESCAPE (MEAS_URA_GALMODEL , OPIHI_FLT); 543 if (!strcasecmp (fieldName, "UDEC_GALMODEL")) ESCAPE (MEAS_UDEC_GALMODEL , OPIHI_FLT); 544 if (!strcasecmp (fieldName, "RA_GALMODEL")) ESCAPE (MEAS_RA_GALMODEL , OPIHI_FLT); 545 if (!strcasecmp (fieldName, "DEC_GALMODEL")) ESCAPE (MEAS_DEC_GALMODEL , OPIHI_FLT); 546 if (!strcasecmp (fieldName, "URA_GAL")) ESCAPE (MEAS_URA_GALMODEL , OPIHI_FLT); 547 if (!strcasecmp (fieldName, "UDEC_GAL")) ESCAPE (MEAS_UDEC_GALMODEL , OPIHI_FLT); 548 if (!strcasecmp (fieldName, "RA_GAL")) ESCAPE (MEAS_RA_GALMODEL , OPIHI_FLT); 549 if (!strcasecmp (fieldName, "DEC_GAL")) ESCAPE (MEAS_DEC_GALMODEL , OPIHI_FLT); 550 551 // if (!strcasecmp (fieldName, "FLUX")) ESCAPE (MEAS_FLUX_PSF, OPIHI_FLT); 444 552 // if (!strcasecmp (fieldName, "FLUX_ERR")) ESCAPE (MEAS_FLUX_PSF_ERR, OPIHI_FLT); 445 553 // if (!strcasecmp (fieldName, "FLUX_PSF")) ESCAPE (MEAS_FLUX_PSF, OPIHI_FLT); … … 447 555 // if (!strcasecmp (fieldName, "FLUX_KRON")) ESCAPE (MEAS_FLUX_KRON, OPIHI_FLT); 448 556 // if (!strcasecmp (fieldName, "FLUX_KRON_ERR")) ESCAPE (MEAS_FLUX_KRON_ERR, OPIHI_FLT); 449 if (!strcasecmp (fieldName, "REF_COLOR")) ESCAPE (MEAS_REF_COLOR, OPIHI_FLT); 557 if (!strcasecmp (fieldName, "REF_COLOR_BLUE")) ESCAPE (MEAS_REF_COLOR_BLUE, OPIHI_FLT); 558 if (!strcasecmp (fieldName, "REF_COLOR_RED")) ESCAPE (MEAS_REF_COLOR_RED, OPIHI_FLT); 450 559 451 560 // for words that don't parse, try a photcode … … 522 631 if (!strcasecmp (fieldName, "EXTID_HI")) ESCAPE (AVE_EXTID_HI, OPIHI_INT); 523 632 if (!strcasecmp (fieldName, "EXTID_LO")) ESCAPE (AVE_EXTID_LO, OPIHI_INT); 524 if (!strcasecmp (fieldName, "REF_COLOR")) ESCAPE (AVE_REF_COLOR, OPIHI_FLT); 633 if (!strcasecmp (fieldName, "REF_COLOR_BLUE")) ESCAPE (AVE_REF_COLOR_BLUE, OPIHI_FLT); 634 if (!strcasecmp (fieldName, "REF_COLOR_RED")) ESCAPE (AVE_REF_COLOR_RED, OPIHI_FLT); 635 636 if (!strcasecmp (fieldName, "E_BV")) ESCAPE (AVE_E_BV , OPIHI_FLT); 637 if (!strcasecmp (fieldName, "E_BV_ERR")) ESCAPE (AVE_E_BV_ERR , OPIHI_FLT); 638 if (!strcasecmp (fieldName, "DISTANCE_MOD")) ESCAPE (AVE_DISTANCE_MOD , OPIHI_FLT); 639 if (!strcasecmp (fieldName, "DISTANCE_MOD_ERR")) ESCAPE (AVE_DISTANCE_MOD_ERR, OPIHI_FLT); 640 if (!strcasecmp (fieldName, "M_R")) ESCAPE (AVE_M_R , OPIHI_FLT); 641 if (!strcasecmp (fieldName, "M_R_ERR")) ESCAPE (AVE_M_R_ERR , OPIHI_FLT); 642 if (!strcasecmp (fieldName, "FEH")) ESCAPE (AVE_FEH , OPIHI_FLT); 643 if (!strcasecmp (fieldName, "FEH_ERR")) ESCAPE (AVE_FEH_ERR , OPIHI_FLT); 644 if (!strcasecmp (fieldName, "URA_GALMODEL")) ESCAPE (AVE_URA_GALMODEL , OPIHI_FLT); 645 if (!strcasecmp (fieldName, "UDEC_GALMODEL")) ESCAPE (AVE_UDEC_GALMODEL , OPIHI_FLT); 646 if (!strcasecmp (fieldName, "RA_GALMODEL")) ESCAPE (AVE_RA_GALMODEL , OPIHI_FLT); 647 if (!strcasecmp (fieldName, "DEC_GALMODEL")) ESCAPE (AVE_DEC_GALMODEL , OPIHI_FLT); 648 525 649 526 650 // check for code:mode in photcode name … … 652 776 if (!strcasecmp (fieldName, "NLINK_PHOTOM")) ESCAPE (IMAGE_NLINK_PHOTOM, OPIHI_INT); 653 777 if (!strcasecmp (fieldName, "NLINK_ASTROM")) ESCAPE (IMAGE_NLINK_ASTROM, OPIHI_INT); 654 if (!strcasecmp (fieldName, "REF_COLOR")) ESCAPE (IMAGE_REF_COLOR, OPIHI_FLT); 778 if (!strcasecmp (fieldName, "REF_COLOR_BLUE")) ESCAPE (IMAGE_REF_COLOR_BLUE, OPIHI_FLT); 779 if (!strcasecmp (fieldName, "REF_COLOR_RED")) ESCAPE (IMAGE_REF_COLOR_RED, OPIHI_FLT); 655 780 656 781 // for words that don't parse, try a photcode -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r37356 r37807 58 58 if (!strcasecmp (catformat, "PS1_V5")) return (DVO_FORMAT_PS1_V5); 59 59 if (!strcasecmp (catformat, "PS1_REF")) return (DVO_FORMAT_PS1_REF); 60 if (!strcasecmp (catformat, "PS1_SIM")) return (DVO_FORMAT_PS1_SIM); 60 61 return (DVO_FORMAT_UNDEF); 61 62 } … … 129 130 average->Nlensing = 0; 130 131 average->Nlensobj = 0; 132 average->Nstarpar = 0; 131 133 average->Nextend = 0; 132 134 … … 135 137 average->lensingOffset = -1; 136 138 average->lensobjOffset = -1; 139 average->starparOffset = -1; 137 140 average->extendOffset = -1; 138 average->paramsOffset = -1;139 141 140 142 average->refColorBlue = NAN; … … 144 146 average->skycellID = 0; 145 147 average->projectionID = 0; 148 146 149 average->dummy = 0; 147 150 … … 437 440 438 441 // init all data, or just catalog data 442 void dvo_starpar_init (StarPar *starpar) { 443 starpar->R = NAN; 444 starpar->D = NAN; 445 starpar->galLat = NAN; 446 starpar->galLon = NAN; 447 starpar->Ebv = NAN; 448 starpar->dEbv = NAN; 449 starpar->DistMag = NAN; 450 starpar->dDistMag = NAN; 451 starpar->M_r = NAN; 452 starpar->dM_r = NAN; 453 starpar->FeH = NAN; 454 starpar->dFeH = NAN; 455 starpar->uRA = NAN; 456 starpar->uDEC = NAN; 457 starpar->averef = -1; 458 starpar->objID = -1; 459 starpar->catID = -1; 460 } 461 462 // init all data, or just catalog data 439 463 void dvo_catalog_init (Catalog *catalog, int complete) { 440 464 … … 462 486 catalog[0].lensobj = NULL; 463 487 488 catalog[0].starpar = NULL; 489 464 490 catalog[0].averageT = NULL; 465 491 catalog[0].measureT = NULL; … … 477 503 catalog[0].Nlensobj = 0; 478 504 505 catalog[0].Nstarpar = 0; 506 479 507 catalog[0].Naves_disk = 0; 480 508 catalog[0].Nmeas_disk = 0; … … 485 513 catalog[0].Nlensobj_disk = 0; 486 514 515 catalog[0].Nstarpar_disk = 0; 516 487 517 catalog[0].Naves_off = 0; 488 518 catalog[0].Nmeas_off = 0; … … 492 522 catalog[0].Nlensing_off = 0; 493 523 catalog[0].Nlensobj_off = 0; 524 525 catalog[0].Nstarpar_off = 0; 494 526 495 527 /* pointers to SPLIT data files */ … … 499 531 catalog[0].lensing_catalog = NULL; 500 532 catalog[0].lensobj_catalog = NULL; 533 catalog[0].starpar_catalog = NULL; 501 534 502 535 /* pointers for data manipulation */ … … 540 573 541 574 if (catalog[0].f == (FILE *) NULL) return (2); 542 fflush (catalog[0].f); 575 576 if (fflush (catalog[0].f)) { 577 fprintf (stderr, "failed to flush file\n"); 578 return FALSE; 579 } 580 543 581 // fprintf (stderr, "unlocking: %s\n", catalog[0].filename); 544 582 … … 552 590 553 591 // closes f but does not set back to NULL 554 fclearlockfile (catalog[0].filename, catalog[0].f, catalog[0].lockmode, &dbstate); 592 if (!fclearlockfile (catalog[0].filename, catalog[0].f, catalog[0].lockmode, &dbstate)) { 593 fprintf (stderr, "failed to unlock or close file\n"); 594 return (0); 595 } 555 596 556 597 if (catalog[0].catmode == DVO_MODE_SPLIT) { 557 if (catalog[0].measure_catalog) dvo_catalog_unlock (catalog[0].measure_catalog); 558 if (catalog[0].missing_catalog) dvo_catalog_unlock (catalog[0].missing_catalog); 559 if (catalog[0].secfilt_catalog) dvo_catalog_unlock (catalog[0].secfilt_catalog); 560 if (catalog[0].lensing_catalog) dvo_catalog_unlock (catalog[0].lensing_catalog); 561 if (catalog[0].lensobj_catalog) dvo_catalog_unlock (catalog[0].lensobj_catalog); 598 if (catalog[0].measure_catalog) { if (!dvo_catalog_unlock (catalog[0].measure_catalog)) { fprintf (stderr, "failed to unlock measures\n"); return (0); }} 599 if (catalog[0].missing_catalog) { if (!dvo_catalog_unlock (catalog[0].missing_catalog)) { fprintf (stderr, "failed to unlock missing\n"); return (0); }} 600 if (catalog[0].secfilt_catalog) { if (!dvo_catalog_unlock (catalog[0].secfilt_catalog)) { fprintf (stderr, "failed to unlock secfilt\n"); return (0); }} 601 if (catalog[0].lensing_catalog) { if (!dvo_catalog_unlock (catalog[0].lensing_catalog)) { fprintf (stderr, "failed to unlock lensing\n"); return (0); }} 602 if (catalog[0].lensobj_catalog) { if (!dvo_catalog_unlock (catalog[0].lensobj_catalog)) { fprintf (stderr, "failed to unlock lensobj\n"); return (0); }} 603 if (catalog[0].starpar_catalog) { if (!dvo_catalog_unlock (catalog[0].starpar_catalog)) { fprintf (stderr, "failed to unlock starpar\n"); return (0); }} 562 604 } 563 605 return (1); … … 597 639 } 598 640 641 // NOTE: this only check if we can write a backup; it does not actually write the backup 599 642 if (!check_file_access (catalog[0].filename, BACKUP, READWRITE, VERBOSE)) { 600 643 fprintf (stderr, "no permission to access %s\n", catalog[0].filename); … … 835 878 free (catalog[0].lensobj_catalog); 836 879 } 880 if (catalog[0].starpar_catalog) { 881 free (catalog[0].starpar_catalog[0].filename); 882 dvo_catalog_free (catalog[0].starpar_catalog); 883 free (catalog[0].starpar_catalog); 884 } 837 885 } 838 886 dvo_catalog_free_data (catalog); … … 873 921 catalog[0].Nlensobj = 0; 874 922 catalog[0].lensobj = NULL; 923 } 924 if (catalog[0].starpar) { 925 free (catalog[0].starpar); 926 catalog[0].Nstarpar = 0; 927 catalog[0].starpar = NULL; 875 928 } 876 929 if (catalog[0].nOwn_t) { free (catalog[0].nOwn_t); catalog[0].nOwn_t = NULL; } … … 985 1038 } 986 1039 } 1040 if (catalog[0].starpar_catalog != NULL) { 1041 if (catalog[0].Nstarpar_disk == 0) { 1042 // need to relock (and re-open) file for close elsewhere 1043 status = dvo_catalog_lock (catalog[0].starpar_catalog, lockmode); 1044 } else { 1045 if (!dvo_catalog_backup (catalog[0].starpar_catalog, FALSE)) { 1046 return FALSE; 1047 } 1048 } 1049 } 987 1050 } 988 1051 return TRUE; … … 1036 1099 } 1037 1100 } 1101 if ((catalog[0].starpar_catalog != NULL) && (catalog[0].Nstarpar_disk > 0)) { 1102 if (!dvo_catalog_unlink_backup (catalog[0].starpar_catalog, FALSE)) { 1103 return FALSE; 1104 } 1105 } 1038 1106 } 1039 1107 return TRUE; -
trunk/Ohana/src/libdvo/src/dvo_catalog_create.c
r37035 r37807 95 95 free (file); 96 96 97 /* define starpar catalog file */ 98 ALLOCATE (catalog[0].starpar_catalog, Catalog, 1); 99 dvo_catalog_init (catalog[0].starpar_catalog, TRUE); 100 101 /* create basic data for starpar catalog file */ 102 gfits_create_header (&catalog[0].starpar_catalog[0].header); 103 ALLOCATE (catalog[0].starpar_catalog[0].filename, char, length); 104 sprintf (catalog[0].starpar_catalog[0].filename, "%s/%s.cpz", path, root); 105 file = filebasename (catalog[0].starpar_catalog[0].filename); 106 gfits_modify (&catalog[0].header, "STARPAR", "%s", 1, file); 107 free (file); 108 97 109 free (path); 98 110 free (root); … … 117 129 } 118 130 if (dvo_catalog_lock (catalog[0].lensobj_catalog, catalog[0].lockmode) != DVO_CAT_OPEN_EMPTY) { 131 fprintf (stderr, "error with file lock\n"); 132 exit (2); 133 } 134 if (dvo_catalog_lock (catalog[0].starpar_catalog, catalog[0].lockmode) != DVO_CAT_OPEN_EMPTY) { 119 135 fprintf (stderr, "error with file lock\n"); 120 136 exit (2); … … 146 162 ALLOCATE (catalog[0].lensing, Lensing, 1); 147 163 ALLOCATE (catalog[0].lensobj, Lensobj, 1); 164 ALLOCATE (catalog[0].starpar, StarPar, 1); 148 165 149 166 /* setup secondary filters to match photcodes: -
trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c
r37035 r37807 4 4 5 5 off_t Nbytes; 6 off_t Naverage;7 off_t Nmeasure;8 off_t Nmissing;9 off_t Nlensing;10 off_t Nlensobj;11 6 off_t Nitems, Nexpect; 12 7 int Nsecfilt; … … 18 13 19 14 ftable.header = &header; 20 21 /* get the components from the header */22 if (!gfits_scan (&catalog[0].header, "NSTARS", OFF_T_FMT, 1, &Naverage)) return (FALSE);23 if (!gfits_scan (&catalog[0].header, "NMEAS", OFF_T_FMT, 1, &Nmeasure)) return (FALSE);24 if (!gfits_scan (&catalog[0].header, "NMISS", OFF_T_FMT, 1, &Nmissing)) return (FALSE);25 if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &Nsecfilt)) Nsecfilt = 0;26 if (!gfits_scan (&catalog[0].header, "NLENSING", OFF_T_FMT, 1, &Nlensing)) return (FALSE);27 if (!gfits_scan (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1, &Nlensobj)) return (FALSE);28 15 29 16 /* the OBJID is a counter that uniquely defines an average entry and never changes. if … … 38 25 catalog[0].catID = 0; 39 26 } 27 28 // NSTARS, average, Naves_disk 29 30 # define GET_TABLE_SIZES(HFIELD, CFIELD, DFIELD, REQUIRED) \ 31 off_t N##CFIELD; \ 32 if (REQUIRED) { \ 33 if (!gfits_scan (&catalog[0].header, HFIELD, OFF_T_FMT, 1, &N##CFIELD)) return (FALSE); \ 34 } else { \ 35 if (!gfits_scan (&catalog[0].header, HFIELD, OFF_T_FMT, 1, &N##CFIELD)) N##CFIELD = 0; \ 36 } \ 37 /* save the current number so we can do partial updates */ \ 38 catalog[0].DFIELD = N##CFIELD; \ 39 /* default values, but we will assign these a valid value before we exit (even if empty) */ \ 40 catalog[0].CFIELD = NULL; 40 41 41 /* save the current number so we can do partial updates*/42 catalog[0].Naves_disk = Naverage;43 catalog[0].Nmeas_disk = Nmeasure;44 catalog[0].Nmiss_disk = Nmissing;45 catalog[0].Nsecf_disk = Naverage * Nsecfilt;46 catalog[0].Nlensing_disk = Nlensing;47 catalog[0].Nlensobj_disk = Nlensobj;42 /* get the components and sizes from the header */ 43 GET_TABLE_SIZES ("NSTARS", average, Naves_disk, TRUE); 44 GET_TABLE_SIZES ("NMEAS", measure, Nmeas_disk, TRUE); 45 GET_TABLE_SIZES ("NMISS", missing, Nmiss_disk, FALSE); 46 GET_TABLE_SIZES ("NLENSING", lensing, Nlensing_disk, FALSE); 47 GET_TABLE_SIZES ("NLENSOBJ", lensobj, Nlensobj_disk, FALSE); 48 GET_TABLE_SIZES ("NSTARPAR", starpar, Nstarpar_disk, FALSE); 48 49 49 50 /** Nsecfilt is unusual: it does not list the number of data items in the table 50 51 instead, the number of items is Nsecfilt * Naverage. **/ 52 53 if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &Nsecfilt)) Nsecfilt = 0; 51 54 catalog[0].Nsecfilt = Nsecfilt; 52 53 /* default values, but we will assign these a valid value before we exit (even if empty) */ 54 catalog[0].average = NULL; 55 catalog[0].measure = NULL; 56 catalog[0].missing = NULL; 55 catalog[0].Nsecf_disk = Naverage * Nsecfilt; 57 56 catalog[0].secfilt = NULL; 58 catalog[0].lensing = NULL;59 catalog[0].lensobj = NULL;60 61 /* validate table mode ?*/62 57 63 58 /*** Average Table ***/ … … 259 254 } 260 255 256 /* read StarPar table header */ 257 if (!gfits_fread_header (catalog[0].f, &header)) { 258 if (VERBOSE) fprintf (stderr, "can't read table starpar header"); 259 return (FALSE); 260 } 261 /* read StarPar table data */ 262 if (catalog[0].catflags & LOAD_STARPAR) { 263 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 264 if (VERBOSE) fprintf (stderr, "can't read table starpar data"); 265 return (FALSE); 266 } 267 catalog[0].starpar = FtableToStarPar (&ftable, &catalog[0].Nstarpar, &catalog[0].catformat); 268 if (Nstarpar != catalog[0].Nstarpar_disk) { 269 fprintf (stderr, "Warning: mismatch between Nstarpar in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nstarpar, catalog[0].Nstarpar_disk); 270 } 271 catalog[0].Nstarpar = catalog[0].Nstarpar_disk; 272 catalog[0].Nstarpar_off = 0; 273 } else { 274 Nbytes = gfits_data_size (&header); 275 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 276 ALLOCATE (catalog[0].starpar, StarPar, 1); 277 catalog[0].Nstarpar = 0; 278 catalog[0].Nstarpar_off = catalog[0].Nstarpar_disk; 279 } 280 261 281 return (TRUE); 262 282 } … … 309 329 gfits_modify (&catalog[0].header, "NLENSING", OFF_T_FMT, 1, catalog[0].Nlensing); 310 330 gfits_modify (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1, catalog[0].Nlensobj); 331 gfits_modify (&catalog[0].header, "NSTARPAR", OFF_T_FMT, 1, catalog[0].Nstarpar); 311 332 gfits_modify_alt (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 312 333 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); … … 403 424 /* write out Lensobj table (convert to FITS table format) */ 404 425 LensobjToFtable (&ftable, catalog[0].lensobj, catalog[0].Nlensobj, catalog[0].catformat); 426 if (!gfits_fwrite_Theader (catalog[0].f, &header)) { 427 fprintf (stderr, "can't write table header"); 428 goto failure; 429 } 430 if (!gfits_fwrite_table (catalog[0].f, &ftable)) { 431 fprintf (stderr, "can't write table data"); 432 goto failure; 433 } 434 gfits_free_table (&ftable); 435 gfits_free_header (&header); 436 437 /* free temp storage */ 438 if (primary != NULL) { 439 free (primary); 440 free (secfilt); 441 } 442 return (TRUE); 443 444 /* write out StarPar table (convert to FITS table format) */ 445 StarParToFtable (&ftable, catalog[0].starpar, catalog[0].Nstarpar, catalog[0].catformat); 405 446 if (!gfits_fwrite_Theader (catalog[0].f, &header)) { 406 447 fprintf (stderr, "can't write table header"); … … 446 487 lensobj header 447 488 lensobj table 489 starpar header 490 starpar table 448 491 */ 449 492 -
trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
r37035 r37807 92 92 FORMAT_CASE (PS1_V5, PS1_V5); 93 93 FORMAT_CASE (PS1_REF, PS1_REF); 94 FORMAT_CASE (PS1_SIM, PS1_SIM); 94 95 95 96 default: … … 287 288 if (catalog[0].catformat == DVO_FORMAT_PS1_V5) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V5"); 288 289 if (catalog[0].catformat == DVO_FORMAT_PS1_REF) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_REF"); 290 if (catalog[0].catformat == DVO_FORMAT_PS1_SIM) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_SIM"); 289 291 290 292 /* rewind file pointers and truncate file */ … … 391 393 FORMAT_CASE (PS1_V5, PS1_V5); 392 394 FORMAT_CASE (PS1_REF, PS1_REF); 395 FORMAT_CASE (PS1_SIM, PS1_SIM); 393 396 394 397 default: … … 443 446 FORMAT_CASE (PS1_V5, PS1_V5); 444 447 FORMAT_CASE (PS1_REF, PS1_REF); 448 FORMAT_CASE (PS1_SIM, PS1_SIM); 445 449 446 450 default: … … 498 502 FORMAT_CASE (PS1_V5, PS1_V5); 499 503 FORMAT_CASE (PS1_REF, PS1_REF); 504 FORMAT_CASE (PS1_SIM, PS1_SIM); 500 505 501 506 default: … … 550 555 FORMAT_CASE (PS1_V5, PS1_V5); 551 556 FORMAT_CASE (PS1_REF, PS1_REF); 557 FORMAT_CASE (PS1_SIM, PS1_SIM); 552 558 553 559 default: … … 606 612 FORMAT_CASE (PS1_V5, PS1_V5); 607 613 FORMAT_CASE (PS1_REF, PS1_REF); 614 FORMAT_CASE (PS1_SIM, PS1_SIM); 608 615 609 616 default: … … 658 665 FORMAT_CASE (PS1_V5, PS1_V5); 659 666 FORMAT_CASE (PS1_REF, PS1_REF); 667 FORMAT_CASE (PS1_SIM, PS1_SIM); 660 668 661 669 default: -
trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
r37035 r37807 75 75 Matrix matrix; 76 76 77 // ohana_memcheck_func (TRUE); 78 79 80 if (0) { 81 // XXX a TEST : is the data corrupted or the file? 82 char name[1024]; 83 snprintf (name, 1024, "%s.phu.v2", catalog->filename); 84 FILE *f = fopen (name, "w"); 85 fwrite (catalog->header.buffer, sizeof(char), catalog->header.datasize, f); 86 // fprintf (stderr, "save %d bytes in %s (%zx)\n", (int) catalog->header.datasize, name, (size_t) catalog->header.buffer); 87 // fprintf (stderr, "first bytes are %c%c%c%c%c%c%c%c\n", 88 // catalog->header.buffer[0], catalog->header.buffer[1], catalog->header.buffer[2], catalog->header.buffer[3], 89 // catalog->header.buffer[4], catalog->header.buffer[5], catalog->header.buffer[6], catalog->header.buffer[7]); 90 fclose (f); 91 } 92 if (0) { 93 // XXX a TEST : is the data corrupted or the file? 94 char name[1024]; 95 snprintf (name, 1024, "%s.phu", catalog->filename); 96 FILE *f = fopen (name, "w"); 97 fwrite (catalog->header.buffer, sizeof(char), catalog->header.datasize, f); 98 // fprintf (stderr, "save %d bytes in %s (%zx)\n", (int) catalog->header.datasize, name, (size_t) catalog->header.buffer); 99 // fprintf (stderr, "first bytes are %c%c%c%c%c%c%c%c\n", 100 // catalog->header.buffer[0], catalog->header.buffer[1], catalog->header.buffer[2], catalog->header.buffer[3], 101 // catalog->header.buffer[4], catalog->header.buffer[5], catalog->header.buffer[6], catalog->header.buffer[7]); 102 fclose (f); 103 } 104 # if (0) 105 { 106 // XXX a TEST : is the data corrupted or the file? 107 char name[1024]; 108 snprintf (name, 1024, "%s.phu.v2", catalog->filename); 109 FILE *f = fopen (name, "w"); 110 fwrite (catalog->header.buffer, sizeof(char), catalog->header.datasize, f); 111 fprintf (stderr, "save %d bytes in %s (%zx)\n", (int) catalog->header.datasize, name, (size_t) catalog->header.buffer); 112 fprintf (stderr, "first bytes are %c%c%c%c%c%c%c%c\n", 113 catalog->header.buffer[0], catalog->header.buffer[1], catalog->header.buffer[2], catalog->header.buffer[3], 114 catalog->header.buffer[4], catalog->header.buffer[5], catalog->header.buffer[6], catalog->header.buffer[7]); 115 fclose (f); 116 } 117 { 118 // XXX a TEST : is the data corrupted or the file? 119 char name[1024]; 120 snprintf (name, 1024, "%s.phu.v3", catalog->filename); 121 FILE *f = fopen (name, "w"); 122 fwrite (catalog->header.buffer, sizeof(char), catalog->header.datasize, f); 123 fprintf (stderr, "save %d bytes in %s (%zx)\n", (int) catalog->header.datasize, name, (size_t) catalog->header.buffer); 124 fprintf (stderr, "first bytes are %c%c%c%c%c%c%c%c\n", 125 catalog->header.buffer[0], catalog->header.buffer[1], catalog->header.buffer[2], catalog->header.buffer[3], 126 catalog->header.buffer[4], catalog->header.buffer[5], catalog->header.buffer[6], catalog->header.buffer[7]); 127 fclose (f); 128 } 129 # endif 77 130 /* rewind file pointers and truncate (file is still open) */ 78 fseeko (catalog->f, 0LL, SEEK_SET); 131 if (fseeko (catalog->f, 0LL, SEEK_SET)) { 132 perror ("dvo_catalog_save_subset: "); 133 fprintf (stderr, "failed to seek to beginning\n"); 134 } 79 135 80 136 // write PHU header … … 134 190 if (!gfits_scan (&catalog[0].header, name, "%s", 1, string)) { 135 191 free (path); 136 // databases created prior to ~2014.07.01 did not have the LENSING or LENSOBJpaths in their headers.192 // databases created prior to ~2014.07.01 did not have the LENSING, LENSOBJ, STARPAR paths in their headers. 137 193 // in these cases, we do not try to lock or open the relevant file 138 194 if (!strcmp (name, "LENSING")) return (DVO_CAT_OPEN_EMPTY); 139 195 if (!strcmp (name, "LENSOBJ")) return (DVO_CAT_OPEN_EMPTY); 196 if (!strcmp (name, "STARPAR")) return (DVO_CAT_OPEN_EMPTY); 140 197 return (DVO_CAT_OPEN_FAIL); 141 198 } … … 182 239 off_t Nlensing; 183 240 off_t Nlensobj; 241 off_t Nstarpar; 184 242 off_t Nitems; 185 243 int status, Nsecfilt; … … 196 254 197 255 /* get the components from the header - these duplicate information in the split files (NAXIS2) */ 198 // NSTARS, NMEAS, NMISS are required; NLENSING, NLENSOBJ are not (0 if not found)256 // NSTARS, NMEAS, NMISS are required; NLENSING, NLENSOBJ, NSTARPAR are not (0 if not found) 199 257 if (!gfits_scan (&catalog[0].header, "NSTARS", OFF_T_FMT, 1, &Naverage)) return (FALSE); 200 258 if (!gfits_scan (&catalog[0].header, "NMEAS", OFF_T_FMT, 1, &Nmeasure)) return (FALSE); … … 203 261 if (!gfits_scan (&catalog[0].header, "NLENSING", OFF_T_FMT, 1, &Nlensing)) Nlensing = 0; 204 262 if (!gfits_scan (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1, &Nlensobj)) Nlensobj = 0; 263 if (!gfits_scan (&catalog[0].header, "NSTARPAR", OFF_T_FMT, 1, &Nstarpar)) Nstarpar = 0; 205 264 206 265 /* the OBJID is a counter that uniquely defines an average entry and never changes. if … … 223 282 catalog[0].Nlensing_disk = Nlensing; 224 283 catalog[0].Nlensobj_disk = Nlensobj; 284 catalog[0].Nstarpar_disk = Nstarpar; 225 285 226 286 /** Nsecfilt is unusual: it does not list the number of data items in the table … … 235 295 catalog[0].lensing = NULL; 236 296 catalog[0].lensobj = NULL; 297 catalog[0].starpar = NULL; 237 298 238 299 /*** Average Table ***/ … … 348 409 /*** Secfilt Table ***/ 349 410 status = dvo_catalog_open_subcat (catalog, &catalog[0].secfilt_catalog, ftable.header, "SECFILT", VERBOSE); 411 // fprintf (stderr, "secfilt header %s : %zx\n", catalog[0].secfilt_catalog[0].filename, (size_t) catalog[0].secfilt_catalog[0].header.buffer); 350 412 if (status == DVO_CAT_OPEN_FAIL) { 351 413 return (FALSE); … … 465 527 gfits_free_header (&header); 466 528 529 /*** StarPar Table ***/ 530 if (!(catalog[0].catflags & SKIP_STARPAR)) { 531 // unless we specify 'skip', we still need to load the 532 status = dvo_catalog_open_subcat (catalog, &catalog[0].starpar_catalog, ftable.header, "STARPAR", VERBOSE); 533 if (status == DVO_CAT_OPEN_FAIL) { 534 return (FALSE); 535 } 536 // the StarPar file need not exist, unless we expect data to exist 537 if ((status == DVO_CAT_OPEN_EMPTY) && (catalog[0].Nstarpar_disk > 0)) { 538 return (FALSE); 539 } 540 } 541 if ((status != DVO_CAT_OPEN_EMPTY) && (catalog[0].catflags & LOAD_STARPAR)) { 542 // only read the StarPar table if the file actually exists 543 /* read StarPar table data */ 544 if (!gfits_fread_ftable_data (catalog[0].starpar_catalog[0].f, &ftable, FALSE)) { 545 if (VERBOSE) fprintf (stderr, "can't read table starpar data\n"); 546 return (FALSE); 547 } 548 /* convert data format to internal : returns number of row read in Nstarpar */ 549 catalog[0].starpar = FtableToStarPar (&ftable, &Nstarpar, &catalog[0].catformat); 550 if (Nstarpar != catalog[0].Nstarpar_disk) { 551 fprintf (stderr, "Warning: mismatch between Nstarpar in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nstarpar, catalog[0].Nstarpar_disk); 552 } 553 catalog[0].Nstarpar = catalog[0].Nstarpar_disk; 554 catalog[0].Nstarpar_off = 0; 555 } else { 556 if (catalog[0].starpar_catalog) { 557 gfits_free_header (&catalog[0].starpar_catalog[0].header); 558 } else { 559 ALLOCATE (catalog[0].starpar_catalog, Catalog, 1); 560 dvo_catalog_init (catalog[0].starpar_catalog, TRUE); 561 } 562 gfits_create_header (&catalog[0].starpar_catalog[0].header); 563 ALLOCATE (catalog[0].starpar, StarPar, 1); 564 catalog[0].Nstarpar = 0; 565 catalog[0].Nstarpar_off = catalog[0].Nstarpar_disk; 566 } 567 gfits_free_header (&header); 568 467 569 return (TRUE); 468 570 } … … 473 575 474 576 off_t Nbytes; 475 off_t Naverage, Nexpect, Nitems, Nmeasure, Nmissing, Nlensing, Nlensobj ;577 off_t Naverage, Nexpect, Nitems, Nmeasure, Nmissing, Nlensing, Nlensobj, Nstarpar; 476 578 Header header; 477 579 FTable ftable; … … 497 599 } 498 600 /* read Average table data : format is irrelevant here */ 499 if (!gfits_fread_ftable_range (catalog[0].f, &ftable, start, Nrows)) {601 if (!gfits_fread_ftable_range (catalog[0].f, FALSE, &ftable, start, Nrows)) { 500 602 if (VERBOSE) fprintf (stderr, "can't read table average data"); 501 603 return (FALSE); … … 527 629 } 528 630 /* read Secfilt table data : format is irrelevant here */ 529 if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start*catalog[0].Nsecfilt, catalog[0].Naverage*catalog[0].Nsecfilt)) {631 if (!gfits_fread_ftable_range (subcat[0].f, FALSE, &ftable, start*catalog[0].Nsecfilt, catalog[0].Naverage*catalog[0].Nsecfilt)) { 530 632 if (VERBOSE) fprintf (stderr, "can't read table measure data"); 531 633 return (FALSE); … … 563 665 } 564 666 /* read Measure table data : format is irrelevant here */ 565 if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start, Nrows)) {667 if (!gfits_fread_ftable_range (subcat[0].f, FALSE, &ftable, start, Nrows)) { 566 668 if (VERBOSE) fprintf (stderr, "can't read table measure data"); 567 669 return (FALSE); … … 594 696 } 595 697 /* read Missing table data : format is irrelevant here */ 596 if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start, Nrows)) {698 if (!gfits_fread_ftable_range (subcat[0].f, FALSE, &ftable, start, Nrows)) { 597 699 if (VERBOSE) fprintf (stderr, "can't read table missing data"); 598 700 return (FALSE); … … 628 730 } 629 731 /* read Lensing table data : format is irrelevant here */ 630 if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start, Nrows)) {732 if (!gfits_fread_ftable_range (subcat[0].f, FALSE, &ftable, start, Nrows)) { 631 733 if (VERBOSE) fprintf (stderr, "can't read table lensing data"); 632 734 return (FALSE); … … 659 761 } 660 762 /* read Lensobj table data : format is irrelevant here */ 661 if (!gfits_fread_ftable_range (subcat[0].f, &ftable, start, Nrows)) {763 if (!gfits_fread_ftable_range (subcat[0].f, FALSE, &ftable, start, Nrows)) { 662 764 if (VERBOSE) fprintf (stderr, "can't read table lensobj data"); 663 765 return (FALSE); … … 675 777 } 676 778 779 // XXX check the open status of the catalog 780 if (catalog[0].catflags & LOAD_STARPAR) { 781 782 Catalog *subcat = catalog[0].starpar_catalog; 783 784 /* move pointer past header -- must be already read (load_catalog) */ 785 Nbytes = subcat[0].header.datasize + gfits_data_size (&subcat[0].header); 786 fseeko (subcat[0].f, Nbytes, SEEK_SET); 787 788 /* read StarPar table header */ 789 if (!gfits_fread_header (subcat[0].f, &header)) { 790 if (VERBOSE) fprintf (stderr, "can't read table starpar header"); 791 return (FALSE); 792 } 793 /* read StarPar table data : format is irrelevant here */ 794 if (!gfits_fread_ftable_range (subcat[0].f, FALSE, &ftable, start, Nrows)) { 795 if (VERBOSE) fprintf (stderr, "can't read table starpar data"); 796 return (FALSE); 797 } 798 799 /* convert data format to internal : returns number of row read in Nstarpar */ 800 catalog[0].starpar = FtableToStarPar (&ftable, &Nstarpar, &catalog[0].catformat); 801 if (Nstarpar != Nrows) { 802 // XXX this condition denotes the eof has been reached; not an error or a warning 803 // fprintf (stderr, "Warning: mismatch between Nstarpar in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nstarpar, Nrows); 804 } 805 gfits_free_header (&header); 806 catalog[0].Nstarpar = Nstarpar; 807 catalog[0].Nstarpar_off = start; 808 } 809 677 810 return (TRUE); 678 811 } … … 686 819 SecFilt *primary, *secfilt; 687 820 int Nsecfilt; 688 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new, Nlensing_disk_new, Nlensobj_disk_new ;821 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new, Nlensing_disk_new, Nlensobj_disk_new, Nstarpar_disk_new; 689 822 off_t first, start, Nrows; 690 823 … … 719 852 Nlensing_disk_new = MAX (catalog[0].Nlensing_disk, catalog[0].Nlensing + catalog[0].Nlensing_off); 720 853 Nlensobj_disk_new = MAX (catalog[0].Nlensobj_disk, catalog[0].Nlensobj + catalog[0].Nlensobj_off); 854 Nstarpar_disk_new = MAX (catalog[0].Nstarpar_disk, catalog[0].Nstarpar + catalog[0].Nstarpar_off); 721 855 722 856 /* make sure header is consistent with data */ … … 727 861 gfits_modify (&catalog[0].header, "NLENSING", OFF_T_FMT, 1, Nlensing_disk_new); 728 862 gfits_modify (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1, Nlensobj_disk_new); 863 gfits_modify (&catalog[0].header, "NSTARPAR", OFF_T_FMT, 1, Nstarpar_disk_new); 729 864 gfits_modify_alt (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 730 865 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); … … 845 980 } 846 981 847 /*** Lensing Table ***/848 if ((catalog[0].catflags & LOAD_LENSING) && (catalog[0].lensing != NULL)) {982 /*** Lensing Table (optional, do not save if not loaded) ***/ 983 if ((catalog[0].catflags & LOAD_LENSING) && catalog[0].lensing_catalog->f && catalog[0].lensing) { 849 984 850 985 first = 0; // first row in memory to write … … 872 1007 } 873 1008 874 /*** Lensobj Table ***/875 if ((catalog[0].catflags & LOAD_LENSOBJ) && (catalog[0].lensobj != NULL)) {1009 /*** Lensobj Table (optional, do not save if not loaded) ***/ 1010 if ((catalog[0].catflags & LOAD_LENSOBJ) && catalog[0].lensobj_catalog->f && catalog[0].lensobj) { 876 1011 877 1012 first = 0; // first row in memory to write … … 893 1028 if (!dvo_catalog_save_subcat (catalog[0].lensobj_catalog, &ftable, start, Nrows, catalog[0].Nlensobj_disk, Nlensobj_disk_new)) { 894 1029 fprintf (stderr, "trouble writing Lensobj table\n"); 1030 goto failure; 1031 } 1032 gfits_free_header (&header); 1033 gfits_free_table (&ftable); 1034 } 1035 1036 /*** StarPar Table (optional, do not save if not loaded) ***/ 1037 if ((catalog[0].catflags & LOAD_STARPAR) && catalog[0].starpar_catalog->f && catalog[0].starpar) { 1038 1039 first = 0; // first row in memory to write 1040 start = catalog[0].Nstarpar_off; // first disk row to write 1041 Nrows = catalog[0].Nstarpar - first; 1042 1043 assert (Nrows >= 0); 1044 assert (first >= 0); 1045 assert (first <= catalog[0].Nstarpar); 1046 assert (catalog[0].Nstarpar_disk >= catalog[0].Nstarpar_off); 1047 1048 // convert to external table format (note that the block above does not damage or free catalog.average) 1049 if (!StarParToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) { 1050 fprintf (stderr, "trouble converting format\n"); 1051 goto failure; 1052 } 1053 1054 // write out StarPar table 1055 if (!dvo_catalog_save_subcat (catalog[0].starpar_catalog, &ftable, start, Nrows, catalog[0].Nstarpar_disk, Nstarpar_disk_new)) { 1056 fprintf (stderr, "trouble writing StarPar table\n"); 895 1057 goto failure; 896 1058 } … … 925 1087 SecFilt *primary, *secfilt; 926 1088 int Nsecfilt; 927 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new, Nlensing_disk_new, Nlensobj_disk_new ;1089 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new, Nlensing_disk_new, Nlensobj_disk_new, Nstarpar_disk_new; 928 1090 off_t first, start, Nrows; 929 1091 … … 956 1118 if (catalog[0].Nlensobj_off > 0) { 957 1119 fprintf (stderr, "ERROR: only partial catalog (Lensobj) was loaded\n"); 1120 goto failure; 1121 } 1122 if (catalog[0].Nstarpar_off > 0) { 1123 fprintf (stderr, "ERROR: only partial catalog (StarPar) was loaded\n"); 958 1124 goto failure; 959 1125 } … … 984 1150 Nlensing_disk_new = catalog[0].Nlensing; 985 1151 Nlensobj_disk_new = catalog[0].Nlensobj; 1152 Nstarpar_disk_new = catalog[0].Nstarpar; 986 1153 987 1154 /* make sure header is consistent with data */ … … 992 1159 gfits_modify (&catalog[0].header, "NLENSING", OFF_T_FMT, 1, Nlensing_disk_new); 993 1160 gfits_modify (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1, Nlensobj_disk_new); 1161 gfits_modify (&catalog[0].header, "NSTARPAR", OFF_T_FMT, 1, Nstarpar_disk_new); 994 1162 gfits_modify_alt (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 995 1163 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); … … 1158 1326 if (!dvo_catalog_save_subcat (catalog[0].lensobj_catalog, &ftable, start, Nrows, catalog[0].Nlensobj_disk, Nlensobj_disk_new)) { 1159 1327 fprintf (stderr, "trouble writing Lensobj table\n"); 1328 goto failure; 1329 } 1330 gfits_free_header (&header); 1331 gfits_free_table (&ftable); 1332 } 1333 1334 /*** StarPar Table ***/ 1335 if ((catalog[0].catflags & LOAD_STARPAR) && (catalog[0].starpar != NULL)) { 1336 1337 first = 0; // first row in memory to write 1338 start = catalog[0].Nstarpar_off; // first disk row to write 1339 Nrows = catalog[0].Nstarpar - first; 1340 1341 assert (Nrows >= 0); 1342 assert (first >= 0); 1343 assert (first <= catalog[0].Nstarpar); 1344 assert (catalog[0].Nstarpar_disk >= catalog[0].Nstarpar_off); 1345 1346 // convert to external table format 1347 if (!StarParToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) { 1348 fprintf (stderr, "trouble converting format\n"); 1349 goto failure; 1350 } 1351 1352 // write out StarPar table 1353 if (!dvo_catalog_save_subcat (catalog[0].starpar_catalog, &ftable, start, Nrows, catalog[0].Nstarpar_disk, Nstarpar_disk_new)) { 1354 fprintf (stderr, "trouble writing StarPar table\n"); 1160 1355 goto failure; 1161 1356 } … … 1189 1384 SecFilt *primary, *secfilt; 1190 1385 int Nsecfilt; 1191 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new, Nlensing_disk_new, Nlensobj_disk_new ;1386 off_t Naves_disk_new, Nmeas_disk_new, Nmiss_disk_new, Nsecf_disk_new, Nlensing_disk_new, Nlensobj_disk_new, Nstarpar_disk_new; 1192 1387 off_t first, start, Nrows; 1193 1388 … … 1221 1416 Nlensing_disk_new = MAX (catalog[0].Nlensing_disk, catalog[0].Nlensing + catalog[0].Nlensing_off); 1222 1417 Nlensobj_disk_new = MAX (catalog[0].Nlensobj_disk, catalog[0].Nlensobj + catalog[0].Nlensobj_off); 1418 Nstarpar_disk_new = MAX (catalog[0].Nstarpar_disk, catalog[0].Nstarpar + catalog[0].Nstarpar_off); 1223 1419 1224 1420 /* make sure header is consistent with data */ … … 1229 1425 gfits_modify (&catalog[0].header, "NLENSING", OFF_T_FMT, 1, Nlensing_disk_new); 1230 1426 gfits_modify (&catalog[0].header, "NLENSOBJ", OFF_T_FMT, 1, Nlensobj_disk_new); 1427 gfits_modify (&catalog[0].header, "NSTARPAR", OFF_T_FMT, 1, Nstarpar_disk_new); 1231 1428 gfits_modify_alt (&catalog[0].header, "EXTEND", "%t", 1, TRUE); 1232 1429 gfits_modify (&catalog[0].header, "OBJID", "%d", 1, catalog[0].objID); … … 1399 1596 if (!dvo_catalog_save_subcat (catalog[0].lensobj_catalog, &ftable, start, Nrows, catalog[0].Nlensobj_disk, Nlensobj_disk_new)) { 1400 1597 fprintf (stderr, "trouble writing Lensobj table\n"); 1598 goto failure; 1599 } 1600 gfits_free_header (&header); 1601 gfits_free_table (&ftable); 1602 } 1603 1604 /*** StarPar Table ***/ 1605 if (catalog[0].starpar != NULL) { 1606 1607 first = catalog[0].Nstarpar_disk - catalog[0].Nstarpar_off; // first row in memory to write 1608 start = catalog[0].Nstarpar_disk; // first disk row to write 1609 Nrows = catalog[0].Nstarpar - first; 1610 1611 assert (Nrows >= 0); 1612 assert (first >= 0); 1613 assert (first <= catalog[0].Nstarpar); 1614 assert (catalog[0].Nstarpar_disk >= catalog[0].Nstarpar_off); 1615 1616 // convert to external table format 1617 // XXX does catalog.starpar have averef correctly set up? 1618 if (!StarParToFtable (&ftable, &catalog[0].starpar[first], Nrows, catalog[0].catformat)) { 1619 fprintf (stderr, "trouble converting format\n"); 1620 goto failure; 1621 } 1622 1623 // write out StarPar table 1624 if (!dvo_catalog_save_subcat (catalog[0].starpar_catalog, &ftable, start, Nrows, catalog[0].Nstarpar_disk, Nstarpar_disk_new)) { 1625 fprintf (stderr, "trouble writing StarPar table\n"); 1401 1626 goto failure; 1402 1627 } -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r37246 r37807 43 43 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V5", PS1_V5); 44 44 CONVERT_FORMAT ("DVO_AVERAGE_PS1_REF", PS1_REF); 45 CONVERT_FORMAT ("DVO_AVERAGE_PS1_SIM", PS1_SIM); 45 46 # undef CONVERT_FORMAT 46 47 … … 129 130 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V5", PS1_V5, PS1_V5); 130 131 CONVERT_FORMAT ("DVO_AVERAGE_PS1_REF", PS1_REF, PS1_REF); 132 CONVERT_FORMAT ("DVO_AVERAGE_PS1_SIM", PS1_SIM, PS1_SIM); 131 133 # undef CONVERT_FORMAT 132 134 … … 165 167 FORMAT_CASE (PS1_V5, PS1_V5); 166 168 FORMAT_CASE (PS1_REF, PS1_REF); 169 FORMAT_CASE (PS1_SIM, PS1_SIM); 167 170 # undef FORMAT_CASE 168 171 … … 240 243 CONVERT_FORMAT ("DVO_MEASURE_PS1_V5", PS1_V5, PS1_V5, TRUE); 241 244 CONVERT_FORMAT ("DVO_MEASURE_PS1_REF", PS1_REF, PS1_REF, FALSE); 245 CONVERT_FORMAT ("DVO_MEASURE_PS1_SIM", PS1_SIM, PS1_SIM, TRUE); 242 246 # undef CONVERT_FORMAT 243 247 … … 254 258 case DVO_FORMAT_##FORMAT: { \ 255 259 Measure_##TYPE *tmpMeasure; \ 256 myAssert (ABS_COORDS || average, "conversion tointernal needs average table"); \260 myAssert (ABS_COORDS || average, "conversion from internal needs average table"); \ 257 261 tmpMeasure = MeasureInternalTo_##TYPE (average, measure, Nmeasure); \ 258 262 gfits_table_set_Measure_##TYPE (ftable, tmpMeasure, Nmeasure); \ … … 278 282 FORMAT_CASE (PS1_V5, PS1_V5, TRUE); 279 283 FORMAT_CASE (PS1_REF, PS1_REF, FALSE); 284 FORMAT_CASE (PS1_SIM, PS1_SIM, TRUE); 280 285 # undef FORMAT_CASE 281 286 … … 350 355 CONVERT_FORMAT ("DVO_SECFILT_PS1_V5", PS1_V5, PS1_V5); 351 356 CONVERT_FORMAT ("DVO_SECFILT_PS1_REF", PS1_REF, PS1_REF); 357 CONVERT_FORMAT ("DVO_SECFILT_PS1_SIM", PS1_SIM, PS1_SIM); 352 358 # undef CONVERT_FORMAT 353 359 … … 386 392 FORMAT_CASE (PS1_V5, PS1_V5); 387 393 FORMAT_CASE (PS1_REF, PS1_REF); 394 FORMAT_CASE (PS1_SIM, PS1_SIM); 388 395 # undef FORMAT_CASE 389 396 … … 407 414 return (FALSE); 408 415 } 416 417 if (!strcmp (extname, "DVO_LENSING_PS1_V5") && (ftable[0].header[0].Naxis[0] == 128)) { 418 Lensing_PS1_V5_ALT *tmpLensing; 419 tmpLensing = gfits_table_get_Lensing_PS1_V5_ALT (ftable, Nlensing, NULL); 420 if (!tmpLensing) { 421 fprintf (stderr, "ERROR: failed to read lensings\n"); 422 exit (2); 423 } 424 lensing = Lensing_PS1_V5_ALT_ToInternal (tmpLensing, *Nlensing); 425 free (tmpLensing); 426 *format = DVO_FORMAT_PS1_V5; 427 return (lensing); } 409 428 410 429 # define CONVERT_FORMAT(NAME, FORMAT, TYPE) \ … … 585 604 default: 586 605 fprintf (stderr, "table format unknown (lensobj)\n"); 606 return (FALSE); 607 } 608 return (TRUE); 609 } 610 611 /*** StarPar / FTable conversion functions ***/ 612 613 StarPar *FtableToStarPar (FTable *ftable, off_t *Nstarpar, char *format) { 614 615 StarPar *starpar; 616 char extname[80]; 617 618 /* convert to the internal format */ 619 if (!gfits_scan (ftable[0].header, "EXTNAME", "%s", 1, extname)) { 620 fprintf (stderr, "EXTNAME missing for starpar table\n"); 621 return (FALSE); 622 } 623 624 # define CONVERT_FORMAT(NAME, FORMAT, TYPE) \ 625 if (!strcmp (extname, NAME)) { \ 626 StarPar_##TYPE *tmpStarPar; \ 627 tmpStarPar = gfits_table_get_StarPar_##TYPE (ftable, Nstarpar, NULL); \ 628 if (!tmpStarPar) { \ 629 fprintf (stderr, "ERROR: failed to read starpar\n"); \ 630 exit (2); \ 631 } \ 632 starpar = StarPar_##TYPE##_ToInternal (tmpStarPar, *Nstarpar); \ 633 free (tmpStarPar); \ 634 *format = DVO_FORMAT_##FORMAT; \ 635 return (starpar); } 636 637 if (!strcmp (extname, "DVO_STARPAR")) { 638 starpar = gfits_table_get_StarPar (ftable, Nstarpar, NULL); 639 if (!starpar) { 640 fprintf (stderr, "ERROR: failed to read starpar\n"); 641 exit (2); 642 } 643 *format = DVO_FORMAT_INTERNAL; 644 return (starpar); 645 } 646 647 CONVERT_FORMAT ("DVO_STARPAR_PS1_SIM", PS1_SIM, PS1_SIM); 648 // CONVERT_FORMAT ("DVO_STARPAR_PS1_REF", PS1_REF, PS1_REF); 649 // CONVERT_FORMAT ("DVO_STARPAR_ELIXIR", ELIXIR, Elixir); 650 // CONVERT_FORMAT ("DVO_STARPAR_LONEOS", LONEOS, Loneos); 651 // CONVERT_FORMAT ("DVO_STARPAR_PANSTARRS_DEV_0", PANSTARRS_DEV_0, Panstarrs_DEV_0); 652 // CONVERT_FORMAT ("DVO_STARPAR_PANSTARRS_DEV_1", PANSTARRS_DEV_1, Panstarrs_DEV_1); 653 // CONVERT_FORMAT ("DVO_STARPAR_PS1_DEV_1", PS1_DEV_1, PS1_DEV_1); 654 // CONVERT_FORMAT ("DVO_STARPAR_PS1_DEV_2", PS1_DEV_2, PS1_DEV_2); 655 // CONVERT_FORMAT ("DVO_STARPAR_PS1_V1", PS1_V1, PS1_V1); 656 // CONVERT_FORMAT ("DVO_STARPAR_PS1_V2", PS1_V2, PS1_V2); 657 // CONVERT_FORMAT ("DVO_STARPAR_PS1_V3", PS1_V3, PS1_V3); 658 // CONVERT_FORMAT ("DVO_STARPAR_PS1_V4", PS1_V4, PS1_V4); 659 CONVERT_FORMAT ("DVO_STARPAR_PS1_V5", PS1_V5, PS1_V5); 660 // CONVERT_FORMAT ("DVO_STELLAR_PARAMS_PS1_V5", PS1_V5, PS1_V5); 661 // XXX fix in libauto: STELLAR_PARAMS to STARPAR 662 # undef CONVERT_FORMAT 663 664 fprintf (stderr, "table format unknown: %s\n", extname); 665 666 *Nstarpar = 0; 667 return (NULL); 668 } 669 670 // StarParToFtable needs the Average since old formats stored starpar.dR,dD only 671 int StarParToFtable (FTable *ftable, StarPar *starpar, off_t Nstarpar, char format) { 672 673 # define FORMAT_CASE(FORMAT, TYPE) \ 674 case DVO_FORMAT_##FORMAT: { \ 675 StarPar_##TYPE *tmpStarPar; \ 676 tmpStarPar = StarParInternalTo_##TYPE (starpar, Nstarpar); \ 677 gfits_table_set_StarPar_##TYPE (ftable, tmpStarPar, Nstarpar); \ 678 free (tmpStarPar); \ 679 break; } 680 681 /* convert from the internal format */ 682 switch (format) { 683 case DVO_FORMAT_INTERNAL: { 684 gfits_table_set_StarPar (ftable, starpar, Nstarpar); 685 break; } 686 687 FORMAT_CASE (PS1_SIM, PS1_SIM); 688 // FORMAT_CASE (PS1_REF, PS1_REF); 689 // FORMAT_CASE (ELIXIR, Elixir); 690 // FORMAT_CASE (LONEOS, Loneos); 691 // FORMAT_CASE (PANSTARRS_DEV_0, Panstarrs_DEV_0); 692 // FORMAT_CASE (PANSTARRS_DEV_1, Panstarrs_DEV_1); 693 // FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 694 // FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 695 // FORMAT_CASE (PS1_V1, PS1_V1); 696 // FORMAT_CASE (PS1_V2, PS1_V2); 697 // FORMAT_CASE (PS1_V3, PS1_V3); 698 // FORMAT_CASE (PS1_V4, PS1_V4); 699 FORMAT_CASE (PS1_V5, PS1_V5); 700 # undef FORMAT_CASE 701 702 default: 703 fprintf (stderr, "table format unknown (starpar)\n"); 587 704 return (FALSE); 588 705 } … … 643 760 return (TRUE); } 644 761 645 if (!strcmp (extname, "DVO_IMAGE")) {646 Image *image;647 image = gfits_table_get_Image (ftable, &Nimage, NULL);648 if (!image) {649 fprintf (stderr, "ERROR: failed to read images\n");650 exit (2);651 }652 *format = DVO_FORMAT_INTERNAL;653 return (TRUE);654 }655 656 762 CONVERT_FORMAT ("DVO_IMAGE_ELIXIR", ELIXIR, Elixir); 657 763 CONVERT_FORMAT ("DVO_IMAGE_LONEOS", LONEOS, Loneos); … … 666 772 CONVERT_FORMAT ("DVO_IMAGE_PS1_V5", PS1_V5, PS1_V5); 667 773 CONVERT_FORMAT ("DVO_IMAGE_PS1_REF", PS1_REF, PS1_REF); 774 CONVERT_FORMAT ("DVO_IMAGE_PS1_SIM", PS1_SIM, PS1_SIM); 668 775 669 776 # undef CONVERT_FORMAT … … 690 797 /* convert from the internal format */ 691 798 switch (format) { 692 case DVO_FORMAT_INTERNAL: {693 gfits_convert_Image ((Image *) ftable[0].buffer, sizeof(Image), Nimage);694 break; }695 696 799 FORMAT_CASE (ELIXIR, Elixir); 697 800 FORMAT_CASE (LONEOS, Loneos); … … 706 809 FORMAT_CASE (PS1_V5, PS1_V5); 707 810 FORMAT_CASE (PS1_REF, PS1_REF); 811 FORMAT_CASE (PS1_SIM, PS1_SIM); 708 812 709 813 # undef FORMAT_CASE … … 744 848 /* convert from the internal format */ 745 849 switch (format) { 746 case DVO_FORMAT_INTERNAL: {747 for (i = 0; i < Nrow; i++) {748 gfits_convert_Image ((Image *) vtable[0].buffer[i], sizeof(Image), 1);749 }750 return (TRUE); }751 752 850 FORMAT_CASE (ELIXIR, Elixir); 753 851 FORMAT_CASE (LONEOS, Loneos); … … 762 860 FORMAT_CASE (PS1_V5, PS1_V5); 763 861 FORMAT_CASE (PS1_REF, PS1_REF); 862 FORMAT_CASE (PS1_SIM, PS1_SIM); 764 863 765 864 # undef FORMAT_CASE -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
r37246 r37807 219 219 220 220 for (i = 0; i < Nvalues; i++) { 221 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 221 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 222 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 223 out[i].coords.mosaic = NULL; 224 out[i].coords.offsetMap = NULL; 222 225 223 226 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 287 290 288 291 for (i = 0; i < Nvalues; i++) { 289 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 292 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 293 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 290 294 291 295 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r37246 r37807 214 214 215 215 for (i = 0; i < Nvalues; i++) { 216 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 216 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 217 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 218 out[i].coords.mosaic = NULL; 219 out[i].coords.offsetMap = NULL; 217 220 218 221 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 279 282 280 283 for (i = 0; i < Nvalues; i++) { 281 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 284 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 285 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 282 286 283 287 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c
r37055 r37807 18 18 19 19 for (i = 0; i < Nvalues; i++) { 20 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 20 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 21 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 22 out[i].coords.mosaic = NULL; 23 out[i].coords.offsetMap = NULL; 21 24 22 25 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 78 81 79 82 for (i = 0; i < Nvalues; i++) { 80 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 83 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 84 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 81 85 82 86 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c
r37035 r37807 145 145 146 146 for (i = 0; i < Nvalues; i++) { 147 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 147 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 148 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 149 out[i].coords.mosaic = NULL; 150 out[i].coords.offsetMap = NULL; 148 151 149 152 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 208 211 209 212 for (i = 0; i < Nvalues; i++) { 210 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 213 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 214 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 211 215 212 216 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
r37246 r37807 238 238 239 239 for (i = 0; i < Nvalues; i++) { 240 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 240 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 241 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 242 out[i].coords.mosaic = NULL; 243 out[i].coords.offsetMap = NULL; 241 244 242 245 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 302 305 303 306 for (i = 0; i < Nvalues; i++) { 304 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 307 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 308 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 305 309 306 310 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
r37246 r37807 249 249 250 250 for (i = 0; i < Nvalues; i++) { 251 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 251 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 252 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 253 out[i].coords.mosaic = NULL; 254 out[i].coords.offsetMap = NULL; 252 255 253 256 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 313 316 314 317 for (i = 0; i < Nvalues; i++) { 315 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 318 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 319 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 316 320 317 321 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c
r37246 r37807 259 259 260 260 for (i = 0; i < Nvalues; i++) { 261 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 261 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 262 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 263 out[i].coords.mosaic = NULL; 264 out[i].coords.offsetMap = NULL; 262 265 263 266 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 323 326 324 327 for (i = 0; i < Nvalues; i++) { 325 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 328 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 329 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 326 330 327 331 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
r37246 r37807 299 299 300 300 for (i = 0; i < Nvalues; i++) { 301 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 301 // this is only save because the initial 120 bytes in Coords match CoordsDisk 302 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 303 out[i].coords.mosaic = NULL; 304 out[i].coords.offsetMap = NULL; 302 305 303 306 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN … … 363 366 364 367 for (i = 0; i < Nvalues; i++) { 365 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 368 // this is only save because the initial 120 bytes in Coords match CoordsDisk 369 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 366 370 367 371 // RAW_IMAGE_NAME_LEN > DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
r37356 r37807 191 191 out[i].Nlensing = in[i].Nlensing; 192 192 out[i].Nlensobj = in[i].Nlensobj; 193 out[i].Nstarpar = in[i].Nstarpar; 193 194 out[i].Nextend = in[i].Nextend; 194 195 … … 197 198 out[i].lensingOffset = in[i].lensingOffset; 198 199 out[i].lensobjOffset = in[i].lensobjOffset; 200 out[i].starparOffset = in[i].starparOffset; 199 201 out[i].extendOffset = in[i].extendOffset; 200 out[i].paramsOffset = in[i].paramsOffset;201 202 202 203 out[i].refColorBlue = in[i].refColorBlue; … … 258 259 out[i].Nlensing = in[i].Nlensing; 259 260 out[i].Nlensobj = in[i].Nlensobj; 261 out[i].Nstarpar = in[i].Nstarpar; 260 262 out[i].Nextend = in[i].Nextend; 261 263 … … 264 266 out[i].lensingOffset = in[i].lensingOffset; 265 267 out[i].lensobjOffset = in[i].lensobjOffset; 268 out[i].starparOffset = in[i].starparOffset; 266 269 out[i].extendOffset = in[i].extendOffset; 267 out[i].paramsOffset = in[i].paramsOffset;268 270 269 271 out[i].refColorBlue = in[i].refColorBlue; … … 663 665 } 664 666 667 StarPar *StarPar_PS1_V5_ToInternal (StarPar_PS1_V5 *in, off_t Nvalues) { 668 669 off_t i; 670 StarPar *out; 671 672 ALLOCATE_ZERO (out, StarPar, Nvalues); 673 674 for (i = 0; i < Nvalues; i++) { 675 dvo_starpar_init (&out[i]); 676 677 out[i].R = in[i].R; 678 out[i].D = in[i].D; 679 out[i].galLat = in[i].galLat; 680 out[i].galLon = in[i].galLon; 681 682 out[i].Ebv = in[i].Ebv ; 683 out[i].dEbv = in[i].dEbv ; 684 out[i].DistMag = in[i].DistMag ; 685 out[i].dDistMag = in[i].dDistMag; 686 out[i].M_r = in[i].M_r ; 687 out[i].dM_r = in[i].dM_r ; 688 out[i].FeH = in[i].FeH ; 689 out[i].dFeH = in[i].dFeH ; 690 out[i].uRA = in[i].uRA ; 691 out[i].uDEC = in[i].uDEC ; 692 693 out[i].averef = in[i].averef; 694 out[i].objID = in[i].objID ; 695 out[i].catID = in[i].catID ; 696 } 697 return (out); 698 } 699 700 StarPar_PS1_V5 *StarParInternalTo_PS1_V5 (StarPar *in, off_t Nvalues) { 701 702 off_t i; 703 StarPar_PS1_V5 *out; 704 705 ALLOCATE_ZERO (out, StarPar_PS1_V5, Nvalues); 706 707 for (i = 0; i < Nvalues; i++) { 708 709 out[i].R = in[i].R; 710 out[i].D = in[i].D; 711 out[i].galLat = in[i].galLat; 712 out[i].galLon = in[i].galLon; 713 714 out[i].Ebv = in[i].Ebv ; 715 out[i].dEbv = in[i].dEbv ; 716 out[i].DistMag = in[i].DistMag ; 717 out[i].dDistMag = in[i].dDistMag; 718 out[i].M_r = in[i].M_r ; 719 out[i].dM_r = in[i].dM_r ; 720 out[i].FeH = in[i].FeH ; 721 out[i].dFeH = in[i].dFeH ; 722 out[i].uRA = in[i].uRA ; 723 out[i].uDEC = in[i].uDEC ; 724 725 out[i].averef = in[i].averef; 726 out[i].objID = in[i].objID ; 727 out[i].catID = in[i].catID ; 728 } 729 return (out); 730 } 731 665 732 # define RAW_IMAGE_NAME_LEN 117 666 733 … … 676 743 677 744 for (i = 0; i < Nvalues; i++) { 678 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 745 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 746 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 747 out[i].coords.mosaic = NULL; 748 out[i].coords.offsetMap = NULL; 679 749 680 750 // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN … … 741 811 742 812 for (i = 0; i < Nvalues; i++) { 743 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 813 // this is only save because the initial 120 bytes in Coords match CoordsDisk 814 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 744 815 745 816 // RAW_IMAGE_NAME_LEN == DVO_IMAGE_NAME_LEN … … 920 991 out[i].lensingOffset = in[i].lensingOffset; 921 992 out[i].lensobjOffset = in[i].lensobjOffset; 993 out[i].starparOffset = in[i].starparOffset; 922 994 out[i].extendOffset = in[i].extendOffset; 923 out[i].paramsOffset = in[i].paramsOffset;924 995 925 996 out[i].refColorBlue = in[i].refColorBlue; … … 1194 1265 1195 1266 1267 Lensing *Lensing_PS1_V5_ALT_ToInternal (Lensing_PS1_V5_ALT *in, off_t Nvalues) { 1268 1269 off_t i; 1270 Lensing *out; 1271 1272 ALLOCATE_ZERO (out, Lensing, Nvalues); 1273 1274 for (i = 0; i < Nvalues; i++) { 1275 dvo_lensing_init (&out[i]); 1276 1277 out[i].X11_sm_obj = in[i].X11_sm_obj; 1278 out[i].X12_sm_obj = in[i].X12_sm_obj; 1279 out[i].X22_sm_obj = in[i].X22_sm_obj; 1280 out[i].E1_sm_obj = in[i].E1_sm_obj; 1281 out[i].E2_sm_obj = in[i].E2_sm_obj; 1282 1283 out[i].X11_sh_obj = in[i].X11_sh_obj; 1284 out[i].X12_sh_obj = in[i].X12_sh_obj; 1285 out[i].X22_sh_obj = in[i].X22_sh_obj; 1286 out[i].E1_sh_obj = in[i].E1_sh_obj; 1287 out[i].E2_sh_obj = in[i].E2_sh_obj; 1288 1289 out[i].X11_sm_psf = in[i].X11_sm_psf; 1290 out[i].X12_sm_psf = in[i].X12_sm_psf; 1291 out[i].X22_sm_psf = in[i].X22_sm_psf; 1292 out[i].E1_sm_psf = in[i].E1_sm_psf; 1293 out[i].E2_sm_psf = in[i].E2_sm_psf; 1294 1295 out[i].X11_sh_psf = in[i].X11_sh_psf; 1296 out[i].X12_sh_psf = in[i].X12_sh_psf; 1297 out[i].X22_sh_psf = in[i].X22_sh_psf; 1298 out[i].E1_sh_psf = in[i].E1_sh_psf; 1299 out[i].E2_sh_psf = in[i].E2_sh_psf; 1300 1301 out[i].F_ApR5 = in[i].F_ApR5; 1302 out[i].dF_ApR5 = in[i].dF_ApR5; 1303 out[i].sF_ApR5 = in[i].sF_ApR5; 1304 out[i].fF_ApR5 = in[i].fF_ApR5; 1305 1306 out[i].F_ApR6 = in[i].F_ApR6; 1307 out[i].dF_ApR6 = in[i].dF_ApR6; 1308 out[i].sF_ApR6 = in[i].sF_ApR6; 1309 out[i].fF_ApR6 = in[i].fF_ApR6; 1310 1311 out[i].detID = in[i].detID; 1312 out[i].objID = in[i].objID; 1313 out[i].catID = in[i].catID; 1314 1315 out[i].averef = in[i].averef; 1316 } 1317 return (out); 1318 } 1319 -
trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c
r37035 r37807 210 210 211 211 for (i = 0; i < Nvalues; i++) { 212 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 212 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 213 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 214 out[i].coords.mosaic = NULL; 215 out[i].coords.offsetMap = NULL; 213 216 214 217 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 280 283 281 284 for (i = 0; i < Nvalues; i++) { 282 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 285 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 286 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 283 287 284 288 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c
r37035 r37807 188 188 189 189 for (i = 0; i < Nvalues; i++) { 190 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 190 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 191 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 192 out[i].coords.mosaic = NULL; 193 out[i].coords.offsetMap = NULL; 191 194 192 195 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 259 262 260 263 for (i = 0; i < Nvalues; i++) { 261 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 264 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 265 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 262 266 263 267 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
r37035 r37807 227 227 228 228 for (i = 0; i < Nvalues; i++) { 229 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 229 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 230 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 231 out[i].coords.mosaic = NULL; 232 out[i].coords.offsetMap = NULL; 230 233 231 234 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 297 300 298 301 for (i = 0; i < Nvalues; i++) { 299 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 302 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 303 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 300 304 301 305 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
r37035 r37807 227 227 228 228 for (i = 0; i < Nvalues; i++) { 229 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 229 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 230 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 231 out[i].coords.mosaic = NULL; 232 out[i].coords.offsetMap = NULL; 230 233 231 234 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN … … 297 300 298 301 for (i = 0; i < Nvalues; i++) { 299 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 302 // this is only safe because the initial 120 bytes in Coords match CoordsDisk 303 memcpy (&out[i].coords, &in[i].coords, sizeof(CoordsDisk)); 300 304 301 305 // RAW_IMAGE_NAME_LEN < DVO_IMAGE_NAME_LEN -
trunk/Ohana/src/libdvo/src/dvo_image.c
r37035 r37807 200 200 201 201 gfits_create_matrix (&db[0].header, &db[0].matrix); 202 gfits_table_set_Image (&db[0].ftable , NULL, 0);202 gfits_table_set_Image (&db[0].ftable); 203 203 204 204 gfits_modify (&db[0].header, "NIMAGES", "%d", 1, 0); … … 207 207 dvo_image_createID (&db[0].header); 208 208 209 if (db[0].format == DVO_FORMAT_INTERNAL) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "INTERNAL");209 // if (db[0].format == DVO_FORMAT_INTERNAL) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "INTERNAL"); 210 210 if (db[0].format == DVO_FORMAT_LONEOS) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "LONEOS"); 211 211 if (db[0].format == DVO_FORMAT_ELIXIR) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "ELIXIR"); … … 221 221 if (db[0].format == DVO_FORMAT_PS1_V5) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V5"); 222 222 if (db[0].format == DVO_FORMAT_PS1_REF) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_REF"); 223 if (db[0].format == DVO_FORMAT_PS1_SIM) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_SIM"); 223 224 224 225 return; … … 267 268 } 268 269 270 int gfits_table_set_Image (FTable *ftable) { 271 272 Header *header; 273 274 header = ftable[0].header; 275 276 gfits_table_mkheader_Image (header); 277 278 /* create table */ 279 if (!gfits_create_table (header, ftable)) return (FALSE); 280 281 return (TRUE); 282 } 283 284 int gfits_table_mkheader_Image (Header *header) { 285 286 /* create table header */ 287 if (!gfits_create_table_header (header, "BINTABLE", "DVO_IMAGE")) return (FALSE); 288 289 /* define table layout */ 290 /** TABLE DEFINITION **/ 291 gfits_define_bintable_column (header, "D", "CRVAL1", "coordinate at reference pixel", "", 1.0, 0.0); 292 gfits_define_bintable_column (header, "D", "CRVAL2", "coordinate at reference pixel", "", 1.0, 0.0); 293 gfits_define_bintable_column (header, "E", "CRPIX1", "coordinate of reference pixel", "", 1.0, 0.0); 294 gfits_define_bintable_column (header, "E", "CRPIX2", "coordinate of reference pixel", "", 1.0, 0.0); 295 gfits_define_bintable_column (header, "E", "CDELT1", "degrees per pixel", "", 1.0, 0.0); 296 gfits_define_bintable_column (header, "E", "CDELT2", "degrees per pixel", "", 1.0, 0.0); 297 gfits_define_bintable_column (header, "E", "PC1_1", "rotation matrix", "", 1.0, 0.0); 298 gfits_define_bintable_column (header, "E", "PC1_2", "rotation matrix", "", 1.0, 0.0); 299 gfits_define_bintable_column (header, "E", "PC2_1", "rotation matrix", "", 1.0, 0.0); 300 gfits_define_bintable_column (header, "E", "PC2_2", "rotation matrix", "", 1.0, 0.0); 301 gfits_define_bintable_column (header, "14E", "POLYTERMS", "higher order warping terms", "", 1.0, 0.0); 302 if (sizeof(void *) == 4) { 303 gfits_define_bintable_column (header, "J", "POINTER1", "", "", 1.0, 0.0); 304 gfits_define_bintable_column (header, "J", "POINTER2", "", "", 1.0, 0.0); 305 } 306 if (sizeof(void *) == 8) { 307 gfits_define_bintable_column (header, "K", "POINTER1", "", "", 1.0, 0.0); 308 gfits_define_bintable_column (header, "K", "POINTER2", "", "", 1.0, 0.0); 309 } 310 gfits_define_bintable_column (header, "15A", "CTYPE", "coordinate type", "", 1.0, 0.0); 311 gfits_define_bintable_column (header, "A", "NPOLYTERMS", "order of polynomial", "", 1.0, 0.0); 312 gfits_define_bintable_column (header, "J", "TZERO", "readout time (row 0)", "", 1.0, 0.0); 313 gfits_define_bintable_column (header, "J", "NSTAR", "number of stars on image", "", 1.0, 0.0); 314 gfits_define_bintable_column (header, "E", "SECZ", "airmass", "mag", 1.0, 0.0); 315 gfits_define_bintable_column (header, "I", "NX", "image width", "", 1.0, 0.0); 316 gfits_define_bintable_column (header, "I", "NY", "image height", "", 1.0, 0.0); 317 gfits_define_bintable_column (header, "E", "APMIFIT", "aperture correction", "mag", 1.0, 0.0); 318 gfits_define_bintable_column (header, "E", "DAPMIFIT", "apmifit error", "mag", 1.0, 0.0); 319 gfits_define_bintable_column (header, "E", "MCAL", "calibration mag", "mag", 1.0, 0.0); 320 gfits_define_bintable_column (header, "E", "DMCAL", "error on Mcal", "mag", 1.0, 0.0); 321 gfits_define_bintable_column (header, "I", "XM", "image chisq", "10*log(value)", 1.0, 0.0); 322 gfits_define_bintable_column (header, "I", "PHOTCODE", "identifier for CCD,", "", 1.0, 0.0); 323 gfits_define_bintable_column (header, "E", "EXPTIME", "exposure time", "seconds", 1.0, 0.0); 324 gfits_define_bintable_column (header, "E", "ST", "sidereal time of exposure", "", 1.0, 0.0); 325 gfits_define_bintable_column (header, "E", "LAT", "observatory latitude", "degrees", 1.0, 0.0); 326 gfits_define_bintable_column (header, "E", "RA_CENTER", "image center", "degrees", 1.0, 0.0); 327 gfits_define_bintable_column (header, "E", "DEC_CENTER", "image center", "degrees", 1.0, 0.0); 328 gfits_define_bintable_column (header, "E", "RADIUS", "image radius", "degrees", 1.0, 0.0); 329 gfits_define_bintable_column (header, "E", "REF_COLOR_BLUE", "median astrometry ref color", "", 1.0, 0.0); 330 gfits_define_bintable_column (header, "E", "REF_COLOR_RED", "median astrometry ref color", "", 1.0, 0.0); 331 gfits_define_bintable_column (header, "117A", "NAME", "name of original image ", "", 1.0, 0.0); 332 gfits_define_bintable_column (header, "B", "DETECTION_LIMIT", "detection limit", "10*mag", 1.0, 0.0); 333 gfits_define_bintable_column (header, "B", "SATURATION_LIMIT", "saturation limit", "10*mag", 1.0, 0.0); 334 gfits_define_bintable_column (header, "B", "CERROR", "astrometric error", "50*arcsec", 1.0, 0.0); 335 gfits_define_bintable_column (header, "B", "FWHM_X", "PSF x width", "25*arcsec", 1.0, 0.0); 336 gfits_define_bintable_column (header, "B", "FWHM_Y", "PSF y width", "25*arcsec", 1.0, 0.0); 337 gfits_define_bintable_column (header, "B", "TRATE", "scan rate", "100 usec/pixel", 1.0, 0.0); 338 gfits_define_bintable_column (header, "B", "CCDNUM", "CCD ID number", "", 1.0, 0.0); 339 gfits_define_bintable_column (header, "J", "FLAGS", "image quality flags", "", 1.0, 0.0); 340 gfits_define_bintable_column (header, "J", "IMAGE_ID", "internal image ID", "", 1.0, 0.0); 341 gfits_define_bintable_column (header, "J", "PARENT_ID", "associated ref image", "", 1.0, 0.0); 342 gfits_define_bintable_column (header, "J", "EXTERN_ID", "external image ID", "", 1.0, 0.0); 343 gfits_define_bintable_column (header, "I", "SOURCE_ID", "analysis source ID", "", 1.0, 0.0); 344 gfits_define_bintable_column (header, "I", "NLINK_ASTROM", "mean number of matched measurements for astrometry", "", 1.0, 0.0); 345 gfits_define_bintable_column (header, "I", "NLINK_PHOTOM", "mean number of matched measurements for astrometry", "", 1.0, 0.0); 346 gfits_define_bintable_column (header, "I", "UBERCAL_DIST", "distance to nearest ubercal image", "", 1.0, 0.0); 347 gfits_define_bintable_column (header, "E", "XPIX_SYS_ERR", "systematic astrometry error in X", "", 1.0, 0.0); 348 gfits_define_bintable_column (header, "E", "YPIX_SYS_ERR", "systematic astrometry error in Y", "", 1.0, 0.0); 349 gfits_define_bintable_column (header, "E", "MAG_SYS_ERR", "systematic photometry error", "", 1.0, 0.0); 350 gfits_define_bintable_column (header, "I", "N_FIT_ASTROM", "number of stars used for astrometry cal", "", 1.0, 0.0); 351 gfits_define_bintable_column (header, "I", "N_FIT_PHOTOM", "number of stars used for photometry cal", "", 1.0, 0.0); 352 gfits_define_bintable_column (header, "J", "PHOTOM_MAP_ID", "reference to 2D zero point map", "", 1.0, 0.0); 353 gfits_define_bintable_column (header, "J", "ASTROM_MAP_ID", "reference to 2D astrometry map", "", 1.0, 0.0); 354 if (sizeof(void *) == 4) { 355 gfits_define_bintable_column (header, "J", "POINTER3", "", "", 1.0, 0.0); 356 } 357 if (sizeof(void *) == 8) { 358 gfits_define_bintable_column (header, "K", "POINTER3", "", "", 1.0, 0.0); 359 } 360 361 return (TRUE); 362 } 363 364 /* return internal structure representation */ 365 Image *gfits_table_get_Image (FTable *ftable, off_t *Ndata, char *swapped) { 366 367 int Ncols; 368 Image *data; 369 370 Ncols = ftable[0].header[0].Naxis[0]; 371 if (Ncols != sizeof(Image)) { 372 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, (int) sizeof(Image)); 373 return NULL; 374 } 375 376 *Ndata = ftable[0].header[0].Naxis[1]; 377 data = (Image *) ftable[0].buffer; 378 379 if (!swapped) { 380 myAbort ("invalid to call this without suppying 'swapped'"); 381 } 382 if (*swapped == FALSE) { 383 myAbort ("invalid for table to be swapped"); 384 } 385 386 return (data); 387 } 388 -
trunk/Ohana/src/libdvo/src/dvo_image_raw.c
r37035 r37807 61 61 if (db[0].format == DVO_FORMAT_PS1_V5) ImageSize = sizeof(Image_PS1_V5); 62 62 if (db[0].format == DVO_FORMAT_PS1_REF) ImageSize = sizeof(Image_PS1_REF); 63 if (db[0].format == DVO_FORMAT_PS1_SIM) ImageSize = sizeof(Image_PS1_SIM); 63 64 64 65 /* check that filesize makes sense */ … … 92 93 if (db[0].format == DVO_FORMAT_PS1_V5) gfits_table_mkheader_Image_PS1_V5 (&db[0].theader); 93 94 if (db[0].format == DVO_FORMAT_PS1_REF) gfits_table_mkheader_Image_PS1_REF (&db[0].theader); 95 if (db[0].format == DVO_FORMAT_PS1_SIM) gfits_table_mkheader_Image_PS1_SIM (&db[0].theader); 94 96 95 97 /* read data from file */ -
trunk/Ohana/src/libdvo/src/dvo_photcode_ops.c
r37116 r37807 1788 1788 m2 = (Ns2 == -1) ? average[0].M : secfilt[Ns2].M; 1789 1789 */ 1790 1791 /*** lensing *********************************************************************************/ 1792 1793 # define LENSFIELD(NAME) \ 1794 float LensValue_##NAME (PhotCode *code, Lensobj *lensobj) { \ 1795 if (code == NULL) return NAN; \ 1796 int Ns = photcodes->hashNsec[code->code]; \ 1797 float value = (Ns == -1) ? NAN : lensobj[Ns].NAME; \ 1798 return (value); \ 1799 } 1800 1801 LENSFIELD(X11_sm_obj); 1802 LENSFIELD(X12_sm_obj); 1803 LENSFIELD(X22_sm_obj); 1804 LENSFIELD(E1_sm_obj); 1805 LENSFIELD(E2_sm_obj); 1806 1807 LENSFIELD(X11_sh_obj); 1808 LENSFIELD(X12_sh_obj); 1809 LENSFIELD(X22_sh_obj); 1810 LENSFIELD(E1_sh_obj); 1811 LENSFIELD(E2_sh_obj); 1812 1813 LENSFIELD(X11_sm_psf); 1814 LENSFIELD(X12_sm_psf); 1815 LENSFIELD(X22_sm_psf); 1816 LENSFIELD(E1_sm_psf); 1817 LENSFIELD(E2_sm_psf); 1818 1819 LENSFIELD(X11_sh_psf); 1820 LENSFIELD(X12_sh_psf); 1821 LENSFIELD(X22_sh_psf); 1822 LENSFIELD(E1_sh_psf); 1823 LENSFIELD(E2_sh_psf); -
trunk/Ohana/src/libdvo/src/dvo_tiny_values.c
r37035 r37807 20 20 measureT[0].dM = measure[0].dM; 21 21 measureT[0].airmass = measure[0].airmass; 22 measureT[0].RoffGAL = measure[0].RoffGAL; 23 measureT[0].DoffGAL = measure[0].DoffGAL; 22 24 measureT[0].Xccd = measure[0].Xccd; 23 25 measureT[0].Yccd = measure[0].Yccd; -
trunk/Ohana/src/libdvo/src/dvo_util.c
r33030 r37807 145 145 if ((image->externID == externID) && (image->sourceID == sourceID)) { 146 146 BuildChipMatch(dvoConfig->images, dvoConfig->nImages); 147 if (FindMosaicForImage(dvoConfig->images, dvoConfig->nImages, i)) { 148 return image; 149 } else { 150 fprintf(stderr, "FindMosaicForImage failed\n"); 151 return NULL; 152 } 147 return image; 153 148 } 154 149 } -
trunk/Ohana/src/libdvo/src/flatcorr_io.c
r33963 r37807 183 183 } 184 184 185 // eddie uses cell_x = (int) (X + X_PAD) / (base + X_PAD) 186 // where base = 600, X_PAD = 8, Y_PAD = 10. denominator is thus (608,610), whic is (4880/8),(4864/8) 187 // these match Eddie's NCELL_X,Y / CHIP_DX,DY, so I think we are good with this: 188 189 # define X_PAD 8 190 # define Y_PAD 10 191 185 192 float FlatCorrectionOffset (FlatCorrectionTable *flatcorr, int ID, int X, int Y) { 186 193 … … 191 198 192 199 // convert X,Y to Xbin, Ybin: 193 int Xbin = MAX(MIN( X* flatcorr->image[seq].Nx / flatcorr->image[seq].DX, flatcorr->image[seq].Nx - 1), 0);194 int Ybin = MAX(MIN( Y* flatcorr->image[seq].Ny / flatcorr->image[seq].DY, flatcorr->image[seq].Ny - 1), 0);200 int Xbin = MAX(MIN((X + X_PAD) * flatcorr->image[seq].Nx / flatcorr->image[seq].DX, flatcorr->image[seq].Nx - 1), 0); 201 int Ybin = MAX(MIN((Y + Y_PAD) * flatcorr->image[seq].Ny / flatcorr->image[seq].DY, flatcorr->image[seq].Ny - 1), 0); 195 202 196 203 // XXX warn if X,Y are out of range? not super important unless *way* out of range -
trunk/Ohana/src/libdvo/src/mosaic_astrom.c
r29938 r37807 1 1 # include <dvo.h> 2 3 // the block of code below was used to define the chip->mosaic relationship before this 4 // was assigned to the coords value 2 5 3 6 off_t getDISentry (e_time start, e_time stop, e_time *startMos, off_t *indexMos, off_t Nmosaic); 4 7 void SortDISindex (e_time *S, off_t *I, off_t N); 8 9 # if (0) 5 10 6 11 /* chip-match table: j = ChipMatch[i], images[j] is DIS for images[i] WRP */ … … 93 98 } 94 99 95 int BuildChipMatch_old (Image *images, off_t Nimages) { 100 // this is a very old version of BuildChipMatch which does not use bisection 101 int BuildChipMatch_nosort (Image *images, off_t Nimages) { 96 102 97 103 off_t i, j, NDIS; … … 140 146 } 141 147 142 int BuildChipMatch (Image *images, off_t Nimages) { 148 // this is an old version of BuildChipMatch which stores the results here in a local static variable 149 int BuildChipMatch_static (Image *images, off_t Nimages) { 143 150 144 151 off_t i, j, NDIS; … … 198 205 return (TRUE); 199 206 } 200 207 # endif 208 209 // XXX Note that this links (images[i].coords.mosaic, images[i].parent) will break 210 // if we reallocate the Image array in the middle of program 211 int BuildChipMatch (Image *images, off_t Nimages) { 212 213 off_t i, j, NDIS; 214 215 off_t Ndis = 0; 216 off_t *DISentry = NULL; 217 e_time *DIStzero = NULL; 218 219 if (DISentry != NULL) free (DISentry); 220 if (DIStzero != NULL) free (DIStzero); 221 222 // allocate containers for DIS indexing 223 Ndis = 0; 224 NDIS = 100; 225 ALLOCATE (DISentry, off_t, NDIS); 226 ALLOCATE (DIStzero, e_time, NDIS); 227 228 // find all DIS images, save tzero (& photcode?) 229 for (i = 0; i < Nimages; i++) { 230 if (strcmp(&images[i].coords.ctype[4], "-DIS")) continue; 231 DISentry[Ndis] = i; 232 DIStzero[Ndis] = images[i].tzero; 233 Ndis ++; 234 if (Ndis >= NDIS) { 235 NDIS += 100; 236 REALLOCATE (DISentry, off_t, NDIS); 237 REALLOCATE (DIStzero, e_time, NDIS); 238 } 239 } 240 241 // sort the index, start, and stop by the start times: 242 SortDISindex (DIStzero, DISentry, Ndis); 243 244 /* find all matched WRP images */ 245 for (i = 0; i < Nimages; i++) { 246 images[i].parent = NULL; // reset to NULL 247 images[i].coords.mosaic = NULL; // reset to NULL 248 if (strcmp(&images[i].coords.ctype[4], "-WRP")) continue; // only define link for WRP coords 249 250 j = getDISentry (images[i].tzero, images[i].tzero + (int) images[i].exptime, DIStzero, DISentry, Ndis); 251 if (j == -1) { 252 fprintf (stderr, "WARNING: can't find matching mosaic \n"); 253 continue; 254 } 255 if (j >= Nimages) myAbort("invalid DIS entry"); 256 images[i].parent = &images[j]; 257 images[i].coords.mosaic = &images[j].coords; 258 } 259 return (TRUE); 260 } 261 262 // use bisection to find the overlapping mosaic 201 263 off_t getDISentry (e_time start, e_time stop, e_time *startMos, off_t *indexMos, off_t Nmosaic) { 202 203 // use bisection to find the overlapping mosaic204 264 205 265 off_t Nlo, Nhi, N; -
trunk/Ohana/src/libdvo/src/skyregion_gsc.c
r34088 r37807 204 204 for (i = 0; i < Nregions; i++) { 205 205 strncpy (temp, &buffer[i*48], 48); 206 temp[4 9] = 0;206 temp[48] = 0; 207 207 hstgsc_hms_to_deg (&Rmin, &Rmax, &Dmin, &Dmax, &temp[7]); 208 208 if (Dmax < Dmin) SWAP (Dmin, Dmax); -
trunk/Ohana/src/libdvo/src/skyregion_ops.c
r35102 r37807 16 16 if (c) return (c+1); 17 17 return name; 18 } 19 20 /* find region which corresponds to the given index */ 21 SkyList *SkyRegionByIndex (SkyTable *table, int index) { 22 23 SkyList *list; 24 25 ALLOCATE (list, SkyList, 1); 26 ALLOCATE (list[0].regions, SkyRegion *, 1); 27 ALLOCATE (list[0].filename, char *, 1); 28 list[0].Nregions = 0; 29 list[0].ownElements = FALSE; // this list is only holding a view to the elements 30 strcpy (list[0].hosts, table[0].hosts); 31 32 list[0].regions[0] = &table[0].regions[index]; 33 list[0].filename[0] = table[0].filename[index]; 34 list[0].Nregions = 1; 35 return (list); 18 36 } 19 37 … … 250 268 } 251 269 252 if( Rmax > (Rmin+180.)) {253 254 double temp = Rmax;255 Rmax = Rmin;256 Rmin = temp;257 }258 259 270 list = SkyListByBounds (table, depth, Rmin, Rmax, Dmin, Dmax); 260 return (list); 261 } 262 271 272 // fprintf (stderr, "%s : %f - %f, %f - %f : %d\n", 273 // image->name, Rmin, Rmax, Dmin, Dmax, (int) list->Nregions); 274 275 return (list); 276 } 277 278 // a region like -10 10 0 20 will become 350 10 0 20 and return all regions on both sides of 0,360 263 279 SkyList *SkyListByBounds (SkyTable *table, int depth, double Rmin, double Rmax, double Dmin, double Dmax) { 264 280 -
trunk/Ohana/src/libfits/Makefile
r34088 r37807 32 32 $(HEAD)/F_scan.$(ARCH).o $(HEAD)/F_print.$(ARCH).o \ 33 33 $(HEAD)/F_copy_H.$(ARCH).o $(HEAD)/F_delete.$(ARCH).o \ 34 $(HEAD)/F_read_XH.$(ARCH).o $(HEAD)/F_init_H.$(ARCH).o \ 35 $(HEAD)/F_convert_H.$(ARCH).o $(HEAD)/version.$(ARCH).o 34 $(HEAD)/F_find_H.$(ARCH).o $(HEAD)/F_init_H.$(ARCH).o \ 35 $(HEAD)/F_convert_H.$(ARCH).o $(HEAD)/F_read_XH.$(ARCH).o \ 36 $(HEAD)/version.$(ARCH).o 36 37 37 38 MATRIX_OBJ = \ -
trunk/Ohana/src/libfits/header/F_free_H.c
r7054 r37807 4 4 /*********************** fits free header ***********************************/ 5 5 void gfits_free_header (Header *header) { 6 7 // fprintf (stderr, "free data for %zx\n", (size_t) header->buffer); 6 8 7 9 if (header[0].buffer == (char *) NULL) return; -
trunk/Ohana/src/libfits/include/gfitsio.h
r37039 r37807 17 17 # define NEWLINE 10 /* UNIX RETURN character */ 18 18 # endif /* NEWLINE */ 19 20 /* gfits_bintable_format returns 'byte' as the type associated with one-byte logical (non-char) values */ 21 typedef char byte; 19 22 20 23 /********** FITS Constants *********/ … … 116 119 int gfits_modify_alt PROTO((Header *header, char *field, char *mode, int N,...)); 117 120 int gfits_print_alt PROTO((Header *header, char *field, char *mode, int N,...)); 121 int gfits_find_Xheader PROTO((FILE *f, Header *header, char *extname)); 118 122 int gfits_read_Xheader PROTO((char *filename, Header *header, int N)); 119 123 int gfits_read_header PROTO((char *filename, Header *header)); … … 184 188 int gfits_fread_ftable PROTO((FILE *f, FTable *ftable, char *extname)); 185 189 int gfits_fread_ftable_data PROTO((FILE *f, FTable *ftable, int padIfShort)); 186 int gfits_fread_ftable_range PROTO((FILE *f, FTable *ftable, off_t start, off_t Nrows));190 int gfits_fread_ftable_range PROTO((FILE *f, int padIfShort, FTable *ftable, off_t start, off_t Nrows)); 187 191 int gfits_fread_vtable PROTO((FILE *f, VTable *vtable, char *extname, off_t Nrow, off_t *row)); 188 192 int gfits_fread_vtable_range PROTO((FILE *f, VTable *vtable, off_t start, off_t Nrows)); -
trunk/Ohana/src/libfits/table/F_read_T.c
r29938 r37807 19 19 int gfits_fread_ftable (FILE *f, FTable *table, char *extname) { 20 20 21 int j, found;22 off_t Nbytes;23 21 Header *header; 24 char tname[80];25 22 26 23 header = table[0].header; 27 fseeko (f, 0, SEEK_SET); 28 29 found = FALSE; 30 for (j = -1; !found; j++) { 31 /* load data for this header */ 32 if (!gfits_load_header (f, header)) return (FALSE); 33 34 /* check if this is the correct extension or not */ 35 bzero (tname, 80); 36 gfits_scan (header, "EXTNAME", "%s", 1, tname); 37 if (!strcmp (tname, extname)) { 38 if (gfits_fread_ftable_data (f, table, FALSE)) return (TRUE); 39 gfits_free_header (header); 40 return (FALSE); 41 } 42 43 /* skip to next header */ 44 Nbytes = gfits_data_size (header); 45 fseeko (f, Nbytes, SEEK_CUR); 46 gfits_free_header (header); 47 } 48 return (TRUE); 49 } 24 if (!gfits_find_Xheader (f, header, extname)) return FALSE; 25 26 if (gfits_fread_ftable_data (f, table, FALSE)) return (TRUE); 27 gfits_free_header (header); 28 return (FALSE); 29 } 50 30 51 31 /*********************** fits read ftable data ***********************************/ … … 84 64 85 65 /*********************** fits read ftable data ***********************************/ 86 int gfits_fread_ftable_range (FILE *f, FTable *table, off_t start, off_t Nrows) {66 int gfits_fread_ftable_range (FILE *f, int padIfShort, FTable *table, off_t start, off_t Nrows) { 87 67 88 68 off_t Nbytes, Nread, Nskip, Nx, Ny; … … 109 89 if (ferror (f)) { 110 90 perror ("fits read error"); 91 free (table[0].buffer); 92 return (FALSE); 93 } 94 fprintf (stderr, "error: fits read error in %s, read "OFF_T_FMT", need "OFF_T_FMT"\n", __func__, Nread, Nbytes); 95 if (padIfShort) { 96 memset (&table[0].buffer[Nread], 0, Nbytes - Nread); 97 fprintf (stderr, "warning: file missing data, padding with zeros: USE AT YOUR OWN RISK!\n"); 98 table[0].validsize = Nread; 99 table[0].datasize = Nbytes; 111 100 } else { 112 fprintf (stderr, "unexpected eof\n"); 113 } 114 free (table[0].buffer); 115 return (FALSE); 101 free (table[0].buffer); 102 return (FALSE); 103 } 116 104 } 117 105 -
trunk/Ohana/src/libfits/table/F_write_T.c
r28241 r37807 95 95 96 96 // cursor must be at start of the table (after table header) 97 fseeko (f, Nskip, SEEK_CUR); 97 if (fseeko (f, Nskip, SEEK_CUR)) { 98 fprintf (stderr, "can't seek table start\n"); 99 return (FALSE); 100 } 101 98 102 Nwrite = fwrite (ftable[0].buffer, sizeof (char), Nbytes, f); 99 103 if (Nwrite != Nbytes) { -
trunk/Ohana/src/libkapa/src/KapaWindow.c
r36488 r37807 98 98 graphdata[0].lweight = graphdata[0].size = 1.0; 99 99 100 graphdata[0].coords.pc1_1 = graphdata[0].coords.pc2_2 = 1.0; 101 graphdata[0].coords.pc1_2 = graphdata[0].coords.pc2_1 = 0.0; 102 strcpy (graphdata[0].coords.ctype, "DEC--LIN"); 103 graphdata[0].coords.crval1 = 0.0; 104 graphdata[0].coords.crval2 = 0.0; 105 graphdata[0].coords.crpix1 = 0.0; 106 graphdata[0].coords.crpix2 = 0.0; 107 graphdata[0].coords.cdelt1 = graphdata[0].coords.cdelt2 = 1.0; 108 graphdata[0].flipeast = TRUE; 100 InitCoords (&graphdata[0].coords, "DEC--LIN"); 101 graphdata[0].flipeast = TRUE; // default coords has EW flipped relative to sky 109 102 graphdata[0].flipnorth = FALSE; 110 103 -
trunk/Ohana/src/libohana/Makefile
r33646 r37807 35 35 $(SRC)/time.$(ARCH).o \ 36 36 $(SRC)/gaussj.$(ARCH).o \ 37 $(SRC)/spherical.$(ARCH).o \ 38 $(SRC)/vstats.$(ARCH).o \ 37 39 $(SRC)/config.$(ARCH).o \ 38 40 $(SRC)/Fread.$(ARCH).o \ … … 45 47 $(SRC)/gprint.$(ARCH).o \ 46 48 $(SRC)/version.$(ARCH).o 49 50 # $(SRC)/legendre.$(ARCH).o \ 51 # $(SRC)/gsl_utils.$(ARCH).o \ 47 52 48 53 TYPETEST = \ -
trunk/Ohana/src/libohana/include/ohana.h
r37356 r37807 242 242 // sorting is now defined as a macro call 243 243 # include <ohana_sort.h> 244 245 // vector statistics options 246 typedef enum { 247 VSTATS_NONE, 248 VSTATS_MEAN, 249 VSTATS_MEDIAN, 250 VSTATS_WT_MEAN, 251 VSTATS_INNER_MEAN, 252 VSTATS_INNER_WTMEAN, 253 VSTATS_CHI_INNER_MEAN, 254 VSTATS_CHI_INNER_WTMEAN 255 } VStatsMode; 256 257 typedef struct { 258 double median; 259 double mean; 260 double sigma; 261 double error; 262 double chisq; 263 double min; 264 double max; 265 double Upper80; 266 double Lower20; 267 double total; 268 int Nmeas; 269 VStatsMode statmode; 270 } VStatsType; 244 271 245 272 /* socket / pipe communication buffer */ … … 314 341 char *ohana_version PROTO((void)); 315 342 343 int dgaussjordan_pivot PROTO((double **A, double **B, int N, int M, double minPivot)); 316 344 int dgaussjordan PROTO((double **A, double **B, int N, int M)); 317 345 int fgaussjordan PROTO((float **A, float **B, int n, int m)); … … 388 416 int rconnect (char *command, char *hostname, char *shell, int *stdio, int *errorInfo, int doHandshake); 389 417 418 int vstats_setmode (VStatsType *stats, char *mode); 419 int vstats_getstats (double *value, double *dvalue, double *weight, int N, VStatsType *stats); 420 int vstats_getstats_f (float *value, float *dvalue, float *weight, int N, VStatsType *stats); 421 390 422 /* 391 423 # define F_SETFL 4 … … 404 436 */ 405 437 406 # endif 438 439 /** gsl-based functions for legendre and related polynomials **/ 440 441 double ohana_gsl_sf_log_1plusx (double x, double *err); 442 double ohana_gsl_sf_lnpoch(const double a, const double x, double *err); 443 double ohana_gsl_lnpoch_pos (const double a, const double x, double *err); 444 double ohana_gsl_pochrel_smallx(const double a, const double x, double *err); 445 446 double legendre_Pl (int l, double x, double *err); 447 double legendre_Plm (int l, int m, double x, double *err); 448 double legendre_Plm_sphere(int l, int m, double x, double *err); 449 450 typedef struct { 451 double *Fr; 452 double *Fi; 453 int *l; 454 int *m; 455 int lmax; 456 int Nterms; 457 } SHterms; 458 459 SHterms *SHtermsInit (int lmax); 460 void SHtermsFree (SHterms *terms); 461 void SHtermsForRD (SHterms *terms, double R, double D); 462 void SHtermsForLM (SHterms *terms, double R, double D, int l, int m); 463 464 typedef struct { 465 double *dR_B; 466 double *dR_E; 467 double *dD_B; 468 double *dD_E; 469 int *l; 470 int *m; 471 int lmax; 472 int Nterms; 473 } VSHterms; 474 475 VSHterms *VSHtermsInit (int lmax); 476 void VSHtermsFree (VSHterms *terms); 477 void VSHtermsForRD (VSHterms *terms, double R, double D); 478 void VSHtermsForLM (VSHterms *terms, double R, double D, int l, int m); 479 480 # endif -
trunk/Ohana/src/libohana/src/gaussj.c
r36084 r37807 1 1 # include <ohana.h> 2 2 # define GROWTHTEST 0 3 # define MAX_RANGE 1.0e9 3 # define VERY_VERBOSE 0 4 # define MAX_RANGE 1.0e16 4 5 5 6 // Gauss-Jordan elimination using full pivots based on Press et al's description. Substantially … … 8 9 // than their implementation. (largely based on version by William Kahan) 9 10 11 int dgaussjordan (double **A, double **B, int N, int M) { 12 13 # define myMIN_PIVOT 1.0e-7 14 int status = dgaussjordan_pivot (A, B, N, M, myMIN_PIVOT); 15 return status; 16 } 17 10 18 // MAX_RANGE is used to test for ill-conditioned input matrices. For an ill-conditioned 11 19 // matrix, one or more of the pivots trends towards zero. Rather than allow this to go to the 12 20 // numerical precision, I am raising an error if |growth| > 1e8 13 int dgaussjordan (double **A, double **B, int N, int M) {21 int dgaussjordan_pivot (double **A, double **B, int N, int M, double MIN_PIVOT) { 14 22 15 23 int *colIndex; … … 48 56 // search for the next pivot 49 57 for (row = 0; row < N; row++) { 50 if (!finite(A[row][diag])) goto escape; 58 if (!finite(A[row][diag])) { 59 fprintf (stderr, "infinity\n"); 60 goto escape; 61 } 51 62 52 63 // if we have already operated on this row (pivot[row] is true), skip it … … 65 76 # if (GROWTHTEST) 66 77 fprintf (stderr, "maxcol: %d\n", maxcol); 78 # if (VERY_VERBOSE) 67 79 fprintf (stderr, "full A matrix:\n"); 68 80 for (row = 0; row < N; row++) { 69 for (col = 0; col < N; col++) {70 fprintf (stderr, "%10.3e ", A[row][col]);71 }72 fprintf (stderr, "\n");81 for (col = 0; col < N; col++) { 82 fprintf (stderr, "%10.3e ", A[row][col]); 83 } 84 fprintf (stderr, "\n"); 73 85 } 74 86 fprintf (stderr, "\n"); 75 87 # endif 88 # endif 76 89 77 90 // if pivot[maxcol] is set, we have already done this row: this implies a singular matrix 78 if (pivot[maxcol]) goto escape; 91 if (pivot[maxcol]) { 92 fprintf (stderr, "singular\n"); 93 goto escape; 94 } 79 95 pivot[maxcol] = TRUE; 80 96 … … 86 102 rowIndex[diag] = maxrow; 87 103 colIndex[diag] = maxcol; 88 if (A[maxcol][maxcol] == 0.0) goto escape; 104 if (A[maxcol][maxcol] == 0.0) { 105 fprintf (stderr, "zero pivot\n"); 106 goto escape; 107 } 108 89 109 // XXX Kahan replaces the 0.0 pivot with epsilon*(largest element in column) + underFlow 90 110 91 111 /* rescale by pivot reciprocal */ 92 112 double tmpval = 1.0 / A[maxcol][maxcol]; 113 114 # if (0) 115 if (fabs(A[maxcol][maxcol]) < MIN_PIVOT) { 116 // we are ill-conditioned. set this row & col to 0.0, 1.0 on pivot 117 // fprintf (stderr, "WARNING: eliminating degenerate pivot %lf @ A[%d][%d]\n", A[maxcol][maxcol], maxcol, maxcol); 118 for (col = 0; col < N; col++) A[maxcol][col] = 0.0; 119 for (col = 0; col < M; col++) B[maxcol][col] = 0.0; 120 for (row = 0; row < N; row++) A[row][maxcol] = 0.0; 121 A[maxcol][maxcol] = 1.0; 122 continue; 123 } 124 # endif 125 93 126 // XXX why is this here (don't I double count this element?) A[maxcol][maxcol] = 1.0; 94 127 A[maxcol][maxcol] = 1.0; … … 102 135 # if (GROWTHTEST) 103 136 fprintf (stderr, "column: %d, maxval : %f, growth: %e, epsilon: %e\n", maxcol, tmpval, growth, epsilon); 137 # if (VERY_VERBOSE) 104 138 fprintf (stderr, "A diagonal: "); 105 139 for (col = 0; col < N; col++) fprintf (stderr, "%f ", A[col][col]); 106 140 fprintf (stderr, "\n"); 107 141 # endif 108 109 if (fabs(growth) > MAX_RANGE) goto escape; 142 # endif 143 144 if (fabs(growth) > MAX_RANGE) { 145 fprintf (stderr, "max range\n"); 146 goto escape; 147 } 110 148 111 149 /* adjust the elements above the pivot */ … … 119 157 } 120 158 121 # if (GROWTHTEST) 122 fprintf (stderr, "final A matrix:\n"); 123 for (row = 0; row < N; row++) { 124 for (col = 0; col < N; col++) { 125 fprintf (stderr, "%10.3e ", A[row][col]); 126 } 127 fprintf (stderr, "\n"); 159 # if (GROWTHTEST && VERY_VERBOSE) 160 fprintf (stderr, "final A matrix:\n"); 161 for (row = 0; row < N; row++) { 162 for (col = 0; col < N; col++) { 163 fprintf (stderr, "%10.3e ", A[row][col]); 128 164 } 129 165 fprintf (stderr, "\n"); 166 } 167 fprintf (stderr, "\n"); 130 168 # endif 131 169 -
trunk/Ohana/src/libohana/src/glockfile.c
r35754 r37807 288 288 289 289 /* set value to IDLE */ 290 fseeko (flock, 0LL, SEEK_SET); 290 if (fseeko (flock, 0LL, SEEK_SET)) { 291 *state = LCK_HARDCLOSE; 292 goto failure; 293 } 294 291 295 nbytes = fprintf (flock, "IDLE\n"); 292 296 if (nbytes != 5) { … … 303 307 304 308 /* now unlock the file */ 305 fclose (f); 309 if (fclose (f)) { 310 *state = LCK_UNKNOWN; 311 goto failure; 312 } 306 313 307 314 *state = LCK_UNLOCK; -
trunk/Ohana/src/libohana/src/ohana_allocate.c
r32632 r37807 178 178 if (!in) return; 179 179 180 // fprintf (stderr, "free %zx\n", (size_t) in); 181 180 182 ref = (Memblock *) in - 1; 183 184 // fprintf (stderr, " file: %s, line: %d, func: %s, size: %zd, addr: %zx\n", 185 // ref->file, ref->line, ref->func, ref->size, (size_t) ref); 181 186 182 187 pthread_mutex_lock(&memBlockListMutex); -
trunk/Ohana/src/markrock/src/gcatstats.c
r36481 r37807 34 34 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ 35 35 /* reference for coords is center of field */ 36 InitCoords (&catstats[0].coords, "DEC--TAN"); 36 37 catstats[0].coords.crval1 = RaCenter; 37 38 catstats[0].coords.crval2 = DecCenter; 38 catstats[0].coords.crpix1 = catstats[0].coords.crpix2 = 0.0;39 39 catstats[0].coords.cdelt1 = catstats[0].coords.cdelt2 = 1.0 / 3600.0; 40 catstats[0].coords.pc1_1 = catstats[0].coords.pc2_2 = 1.0; 41 catstats[0].coords.pc1_2 = catstats[0].coords.pc2_1 = 0.0; 42 strcpy (catstats[0].coords.ctype, "DEC--TAN"); 43 40 44 41 X1 = catstats[0].X; 45 42 Y1 = catstats[0].Y; -
trunk/Ohana/src/markstar/src/gcatstats.c
r36483 r37807 44 44 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ 45 45 /* reference for coords is center of field */ 46 InitCoords (&catstats[0].coords, "DEC--TAN"); 46 47 catstats[0].coords.crval1 = RaCenter; 47 48 catstats[0].coords.crval2 = DecCenter; 48 catstats[0].coords.crpix1 = catstats[0].coords.crpix2 = 0.0;49 49 catstats[0].coords.cdelt1 = catstats[0].coords.cdelt2 = 1.0 / 3600.0; 50 catstats[0].coords.pc1_1 = catstats[0].coords.pc2_2 = 1.0;51 catstats[0].coords.pc1_2 = catstats[0].coords.pc2_1 = 0.0;52 strcpy (catstats[0].coords.ctype, "DEC--TAN");53 50 54 51 X1 = catstats[0].X; -
trunk/Ohana/src/mosastro/src/chips.c
r7401 r37807 21 21 22 22 /* bore site center guess */ 23 strcpy (chip[i].map.ctype, "DEC--PLY"); 24 chip[i].map.crpix1 = 0.0; 25 chip[i].map.crpix2 = 0.0; 26 chip[i].map.cdelt1 = 1.0; 27 chip[i].map.cdelt2 = 1.0; 23 InitCoords (&chip[i].map, "DEC--PLY"); 28 24 29 25 /* find (L,M) coords of reference pixel (0,0) */ -
trunk/Ohana/src/mosastro/src/fakefield.c
r3401 r37807 22 22 23 23 /* bore site center guess */ 24 strcpy (field.project.ctype, "DEC--TAN"); 25 field.project.crpix1 = 0; 26 field.project.crpix2 = 0; 24 InitCoords (&field.project, "DEC--TAN"); 27 25 28 26 /* set TP plate scale */ … … 30 28 field.project.cdelt2 = 1.0/3600.0; 31 29 32 /** allow guess at field rotation?? **/33 field.project.pc1_1 = 1;34 field.project.pc2_2 = 1;35 field.project.pc1_2 = 0;36 field.project.pc2_1 = 0;37 field.project.Npolyterms = 1;38 39 30 /** distort only has power in polyterms **/ 40 strcpy (field.distort.ctype, "DEC--PLY"); 41 field.distort.crval1 = 0.0; 42 field.distort.crval2 = 0.0; 43 field.distort.crpix1 = 0.0; 44 field.distort.crpix2 = 0.0; 45 field.distort.cdelt1 = 1.0; 46 field.distort.cdelt2 = 1.0; 47 48 field.distort.pc1_1 = 1; 49 field.distort.pc2_2 = 1; 50 field.distort.pc1_2 = 0; 51 field.distort.pc2_1 = 0; 52 53 /* how do we handle renormalization? (fixed at 1000 pixels??) */ 54 field.distort.Npolyterms = 3; 55 for (i = 0; i < 7; i++) { 56 field.distort.polyterms[i][0] = 0; 57 field.distort.polyterms[i][1] = 0; 58 } 31 InitCoords (&field.distort, "DEC--PLY"); 59 32 60 33 return (1); -
trunk/Ohana/src/mosastro/src/field.c
r7401 r37807 12 12 13 13 /* bore site center guess */ 14 strcpy (field.project.ctype, "DEC--TAN");14 InitCoords (&field.project, "DEC--TAN"); 15 15 16 16 # if (PSASTRO_MODE) … … 23 23 # endif 24 24 25 field.project.crpix1 = 0;26 field.project.crpix2 = 0;27 28 25 /* measure average plate scale - would be better using parabolic min... */ 29 26 field.project.cdelt1 = 0; … … 47 44 3600*field.project.cdelt1, 3600*field.project.cdelt2); 48 45 49 /** allow guess at field rotation?? **/50 field.project.pc1_1 = 1;51 field.project.pc2_2 = 1;52 field.project.pc1_2 = 0;53 field.project.pc2_1 = 0;54 field.project.Npolyterms = 1;55 56 46 /* bore site center guess */ 57 strcpy (field.distort.ctype, "DEC--PLY"); 58 field.distort.crval1 = 0.0; 59 field.distort.crval2 = 0.0; 60 field.distort.crpix1 = 0.0; 61 field.distort.crpix2 = 0.0; 62 field.distort.cdelt1 = 1.0; 63 field.distort.cdelt2 = 1.0; 64 65 /** allow guess at field rotation?? **/ 66 field.distort.pc1_1 = 1; 67 field.distort.pc2_2 = 1; 68 field.distort.pc1_2 = 0; 69 field.distort.pc2_1 = 0; 70 71 /* allow 2nd and 3rd order? */ 72 /* how do we handle renormalization? (fixed at 1000 pixels??) */ 73 field.distort.Npolyterms = 1; 74 for (i = 0; i < 7; i++) { 75 field.distort.polyterms[i][0] = 0; 76 field.distort.polyterms[i][1] = 0; 77 } 47 InitCoords (&field.distort, "DEC--PLY"); 78 48 return (TRUE); 79 49 } … … 138 108 int load_field (char *filename) { 139 109 140 int i;141 110 Coords coords; 142 111 Header header; … … 156 125 157 126 /* bore site center guess */ 158 strcpy (field.project.ctype, "DEC--TAN");127 InitCoords (&field.project, "DEC--TAN"); 159 128 field.project.crval1 = 0.5*(field.Rmin + field.Rmax); 160 129 field.project.crval2 = 0.5*(field.Dmin + field.Dmax); 161 field.project.crpix1 = 0;162 field.project.crpix2 = 0;163 130 164 131 /* measure average plate scale - would be better using parabolic min... */ … … 174 141 175 142 /* bore site center guess */ 176 strcpy (field.distort.ctype, "DEC--PLY"); 177 field.distort.crval1 = 0.0; 178 field.distort.crval2 = 0.0; 179 field.distort.crpix1 = 0.0; 180 field.distort.crpix2 = 0.0; 181 field.distort.cdelt1 = 1.0; 182 field.distort.cdelt2 = 1.0; 183 184 /** allow guess at field rotation?? **/ 185 field.distort.pc1_1 = 1; 186 field.distort.pc2_2 = 1; 187 field.distort.pc1_2 = 0; 188 field.distort.pc2_1 = 0; 143 InitCoords (&field.distort, "DEC--PLY"); 189 144 190 /* allow 2nd and 3rd order? */191 /* how do we handle renormalization? (fixed at 1000 pixels??) */192 field.distort.Npolyterms = coords.Npolyterms;193 for (i = 0; i < 7; i++) {194 field.distort.polyterms[i][0] = coords.polyterms[i][0];195 field.distort.polyterms[i][1] = coords.polyterms[i][1];196 }197 145 return (TRUE); 198 146 } -
trunk/Ohana/src/mosastro/src/fitpoly.c
r16058 r37807 130 130 double R; 131 131 132 InitCoords (coords, "DEC--PLY"); 133 132 134 /* update the higher order terms */ 133 135 if (NORDER > 1) { … … 166 168 167 169 coords[0].Npolyterms = NORDER; 168 strcpy (coords[0].ctype, "DEC--PLY");169 170 } 170 171 -
trunk/Ohana/src/mosastro/src/mkobs.c
r7080 r37807 104 104 105 105 /* Chip-Sky terms */ 106 strcpy (coords.ctype, "DEC--WRP");106 InitCoords (&coords, "DEC--WRP"); 107 107 coords.crval1 = Ro; 108 108 coords.crval2 = Do; … … 124 124 } 125 125 126 coords.pc1_1 = 1;127 coords.pc2_2 = 1;128 coords.pc1_2 = 0;129 coords.pc2_1 = 0;130 coords.Npolyterms = 1;131 132 126 header = mkheader (2*dX, 2*dY, Nstars, &coords); 133 127 -
trunk/Ohana/src/mosastro/src/mkstandards.c
r7080 r37807 32 32 33 33 /* bore site center guess */ 34 strcpy (coords.ctype, "DEC--TAN");34 InitCoords (&coords, "DEC--TAN"); 35 35 coords.crval1 = atof(argv[1]); 36 36 coords.crval2 = atof(argv[2]); 37 37 coords.crpix1 = dX; 38 38 coords.crpix2 = dX; 39 40 39 coords.cdelt1 = 1/3600.0; 41 40 coords.cdelt2 = 1/3600.0; 42 43 coords.pc1_1 = 1;44 coords.pc2_2 = 1;45 coords.pc1_2 = 0;46 coords.pc2_1 = 0;47 coords.Npolyterms = 1;48 41 49 42 if (Random) { -
trunk/Ohana/src/mosastro/src/testcoords.c
r3404 r37807 53 53 exit (1); 54 54 } 55 RegisterMosaic (&field.project); 55 56 chip[0].map.mosaic = &field.project; 56 57 strcpy (chip[0].map.ctype, "DEC--WRP"); 57 58 for (i = 0; i < chip[0].Nmatch; i++) { -
trunk/Ohana/src/opihi/cmd.astro/Makefile
r36489 r37807 71 71 $(SRC)/star.$(ARCH).o \ 72 72 $(SRC)/transform.$(ARCH).o \ 73 $(SRC)/vshimage.$(ARCH).o \ 74 $(SRC)/shimage.$(ARCH).o \ 73 75 $(SRC)/imsub.$(ARCH).o \ 74 76 $(SRC)/imfit.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.astro/cdensify.c
r36489 r37807 97 97 // generate the PSF in a local tangent plane 98 98 Coords coords; 99 coords.crpix1 = coords.crpix2 = 0.0; 100 coords.crval1 = coords.crval2 = 0.0; 101 coords.cdelt1 = coords.cdelt2 = 1.0; 102 coords.pc1_1 = coords.pc2_2 = 1.0; 103 coords.pc1_2 = coords.pc2_1 = 0.0; 104 coords.Npolyterms = 0; 105 strcpy (coords.ctype, "DEC--TAN"); 99 InitCoords (&coords, "DEC--TAN"); 106 100 107 101 r = vr[0].elements.Flt; -
trunk/Ohana/src/opihi/cmd.astro/coords.c
r33662 r37807 71 71 if ((mosbuffer = SelectBuffer (MOSAIC, OLDBUFFER, TRUE)) == NULL) goto escape; 72 72 GetCoords (&moscoords, &mosbuffer[0].header); 73 RegisterMosaic (&moscoords);73 coords.mosaic = &moscoords; 74 74 } 75 75 -
trunk/Ohana/src/opihi/cmd.astro/csystem.c
r34342 r37807 13 13 if (argc != 5) goto syntax; 14 14 15 switch (argv[1][0]) { 16 case 'C': input = COORD_CELESTIAL; break; 17 case 'G': input = COORD_GALACTIC; break; 18 case 'E': input = COORD_ECLIPTIC; break; 19 default: goto syntax; 15 if (!strcmp(argv[1], "G2004")) { 16 input = COORD_GALACTIC_REID_2004; 17 } else { 18 switch (argv[1][0]) { 19 case 'C': input = COORD_CELESTIAL; break; 20 case 'G': input = COORD_GALACTIC; break; 21 case 'E': input = COORD_ECLIPTIC; break; 22 default: goto syntax; 23 } 20 24 } 21 25 22 switch (argv[2][0]) { 23 case 'C': output = COORD_CELESTIAL; break; 24 case 'G': output = COORD_GALACTIC; break; 25 case 'E': output = COORD_ECLIPTIC; break; 26 default: goto syntax; 26 if (!strcmp(argv[2], "G2004")) { 27 output = COORD_GALACTIC_REID_2004; 28 } else { 29 switch (argv[2][0]) { 30 case 'C': output = COORD_CELESTIAL; break; 31 case 'G': output = COORD_GALACTIC; break; 32 case 'E': output = COORD_ECLIPTIC; break; 33 default: goto syntax; 34 } 27 35 } 28 36 -
trunk/Ohana/src/opihi/cmd.astro/fitplx.c
r36489 r37807 104 104 /* project coordinates to a plane centered on the object with units of arcsec */ 105 105 Coords coords; 106 InitCoords (&coords, "DEC--SIN"); 106 107 coords.crval1 = Rmean; 107 108 coords.crval2 = Dmean; 108 coords.crpix1 = 0;109 coords.crpix2 = 0;110 109 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 111 coords.pc1_1 = coords.pc2_2 = 1.0;112 coords.pc1_2 = coords.pc2_1 = 0.0;113 coords.Npolyterms = 1;114 strcpy (coords.ctype, "DEC--SIN");115 110 116 111 double *X, *Y, *t, *pX, *pY, *dX, *dY; -
trunk/Ohana/src/opihi/cmd.astro/fitpm.c
r36489 r37807 100 100 /* project coordinates to a plane centered on the object with units of arcsec */ 101 101 Coords coords; 102 InitCoords (&coords, "DEC--SIN"); 102 103 coords.crval1 = Rmean; 103 104 coords.crval2 = Dmean; 104 coords.crpix1 = 0;105 coords.crpix2 = 0;106 105 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 107 coords.pc1_1 = coords.pc2_2 = 1.0;108 coords.pc1_2 = coords.pc2_1 = 0.0;109 coords.Npolyterms = 1;110 strcpy (coords.ctype, "DEC--SIN");111 106 112 107 double *X, *Y, *t, *dX, *dY; -
trunk/Ohana/src/opihi/cmd.astro/gauss.c
r36679 r37807 30 30 if (!GetImageData (&data, &kapa, name)) return (FALSE); 31 31 FREE (name); 32 33 int channel = 0; 34 if ((N = get_argument (argc, argv, "-ch"))) { 35 channel = GetKapaChannelFromString (argv[N]); 36 if (!channel) return FALSE; 37 KiiSetChannel (kapa, channel - 1); 38 } 32 39 33 40 Nborder = 3; -
trunk/Ohana/src/opihi/cmd.astro/getcoords.c
r34345 r37807 54 54 if (!strcmp(&coords.ctype[4], "-WRP")) { 55 55 if (MOSAIC == NULL) { 56 gprint (GP_ERR, "must supply mosaic for WRP coords \n");56 gprint (GP_ERR, "must supply mosaic for WRP coords with -mosaic [buffer]\n"); 57 57 return (FALSE); 58 58 } … … 65 65 } 66 66 GetCoords (&moscoords, &mosbuffer[0].header); 67 RegisterMosaic (&moscoords);67 coords.mosaic = &moscoords; 68 68 } 69 69 -
trunk/Ohana/src/opihi/cmd.astro/init.c
r36489 r37807 61 61 int times PROTO((int, char **)); 62 62 int transform PROTO((int, char **)); 63 int vshimage PROTO((int, char **)); 64 int shimage PROTO((int, char **)); 63 65 64 66 static Command cmds[] = { … … 121 123 {1, "star", star, "star stats at rough coords"}, 122 124 {1, "transform", transform, "geometric transformation of image"}, 125 {1, "vshimage", vshimage, "generate images for vector spherical harmonic terms"}, 126 {1, "shimage", shimage, "generate images for spherical harmonic terms"}, 123 127 }; 124 128 -
trunk/Ohana/src/opihi/cmd.astro/objload.c
r34088 r37807 19 19 if (!GetImage (NULL, &kapa, name)) return (FALSE); 20 20 FREE (name); 21 22 int channel = 0; 23 if ((N = get_argument (argc, argv, "-ch"))) { 24 channel = GetKapaChannelFromString (argv[N]); 25 if (!channel) return FALSE; 26 KiiSetChannel (kapa, channel - 1); 27 } 21 28 22 29 Objtype = 0; -
trunk/Ohana/src/opihi/cmd.astro/region.c
r36489 r37807 17 17 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 18 18 FREE (name); 19 20 int channel = 0; 21 if ((N = get_argument (argc, argv, "-ch"))) { 22 channel = GetKapaChannelFromString (argv[N]); 23 if (!channel) return FALSE; 24 KiiSetChannel (kapa, channel - 1); 25 } 19 26 20 27 NoClear = FALSE; … … 80 87 if (!ohana_str_to_radec (&Ra, &Dec, argv[1], argv[2])) return (FALSE); 81 88 Radius = atof (argv[3]); 82 strcpy (graphmode.coords.ctype, "DEC--TAN"); 89 InitCoords (&graphmode.coords, "DEC--TAN"); 90 83 91 if (argc == 5) { 84 92 if (!strcasecmp (argv[4], "TAN")) … … 99 107 strcpy (graphmode.coords.ctype, "DEC--PAR"); 100 108 } 109 110 graphmode.coords.crval1 = Ra; 111 graphmode.coords.crval2 = Dec; 101 112 102 113 graphmode.coords.pc1_1 = (graphmode.flipeast) ? -1 : 1; 114 graphmode.coords.pc2_2 = (graphmode.flipnorth) ? -1 : 1; 115 103 116 /* ask kapa for coordinate limits, to get the right aspect ratio */ 104 117 KapaGetLimits (kapa, &dx, &dy); … … 132 145 set_int_variable ("NORTH_UP", !graphmode.flipnorth); 133 146 134 graphmode.coords.pc1_1 = (graphmode.flipeast) ? -1 : 1;135 graphmode.coords.pc2_2 = (graphmode.flipnorth) ? -1 : 1;136 137 graphmode.coords.pc1_2 = graphmode.coords.pc2_1 = 0.0;138 graphmode.coords.crval1 = Ra;139 graphmode.coords.crval2 = Dec;140 graphmode.coords.crpix1 = 0.0;141 graphmode.coords.crpix2 = 0.0;142 graphmode.coords.cdelt1 = graphmode.coords.cdelt2 = 1.0;143 144 147 if (!NoClear) KapaClearSections (kapa); 145 148 KapaSetLimits (kapa, &graphmode); -
trunk/Ohana/src/opihi/cmd.data/Makefile
r37049 r37807 39 39 $(SRC)/densify.$(ARCH).o \ 40 40 $(SRC)/device.$(ARCH).o \ 41 $(SRC)/dft2d.$(ARCH).o \ 41 42 $(SRC)/dimendown.$(ARCH).o \ 42 43 $(SRC)/dimenup.$(ARCH).o \ … … 160 161 $(SRC)/vstats.$(ARCH).o \ 161 162 $(SRC)/xsection.$(ARCH).o \ 163 $(SRC)/vsh.$(ARCH).o \ 164 $(SRC)/vshfit.$(ARCH).o \ 165 $(SRC)/shterms.$(ARCH).o \ 166 $(SRC)/shfit.$(ARCH).o \ 167 $(SRC)/shdot.$(ARCH).o \ 168 $(SRC)/shapply.$(ARCH).o \ 162 169 $(SRC)/wd.$(ARCH).o \ 163 170 $(SRC)/write_vectors.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/center.c
r29540 r37807 16 16 if (!GetImage (NULL, &kapa, name)) return (FALSE); 17 17 FREE (name); 18 19 int channel = 0; 20 if ((N = get_argument (argc, argv, "-ch"))) { 21 channel = GetKapaChannelFromString (argv[N]); 22 if (!channel) return FALSE; 23 KiiSetChannel (kapa, channel - 1); 24 } 18 25 19 26 // XXX need an option to center the image based on the current plot limits -
trunk/Ohana/src/opihi/cmd.data/dimenup.c
r20936 r37807 23 23 return (FALSE); 24 24 } 25 26 gfits_free_matrix (&buf[0].matrix); 27 gfits_free_header (&buf[0].header); 28 CreateBuffer (buf, Nx, Ny, -32, 0.0, 1.0); 25 ResetBuffer (buf, Nx, Ny, -32, 0.0, 1.0); 29 26 30 27 out = (float *) buf[0].matrix.buffer; -
trunk/Ohana/src/opihi/cmd.data/erase.c
r13479 r37807 15 15 if (!GetImage (NULL, &kapa, name)) return (FALSE); 16 16 FREE (name); 17 18 int channel = 0; 19 if ((N = get_argument (argc, argv, "-ch"))) { 20 channel = GetKapaChannelFromString (argv[N]); 21 if (!channel) return FALSE; 22 KiiSetChannel (kapa, channel - 1); 23 } 17 24 18 25 if (argc < 2) { -
trunk/Ohana/src/opihi/cmd.data/fit2d.c
r31160 r37807 138 138 y = yvec[0].elements.Flt; 139 139 z = zvec[0].elements.Flt; 140 if (Weight) dz = dzvec[0].elements.Flt; 141 140 142 for (i = 0; i < xvec[0].Nelements; i++, x++, y++, z++) { 141 143 if (mask[i]) continue; -
trunk/Ohana/src/opihi/cmd.data/init.c
r37049 r37807 1 1 # include "data.h" 2 // XXX adding a comment 2 3 3 4 int accum PROTO((int, char **)); … … 31 32 int densify PROTO((int, char **)); 32 33 int device PROTO((int, char **)); 34 int dft2d PROTO((int, char **)); 33 35 int dimendown PROTO((int, char **)); 34 36 int dimenup PROTO((int, char **)); … … 147 149 int vpop PROTO((int, char **)); 148 150 int vsmooth PROTO((int, char **)); 151 int vsh PROTO((int, char **)); 152 int vshfit PROTO((int, char **)); 153 int shterms PROTO((int, char **)); 154 int shfit PROTO((int, char **)); 155 int shdot PROTO((int, char **)); 156 int shapply PROTO((int, char **)); 149 157 int wd PROTO((int, char **)); 150 158 int write_vectors PROTO((int, char **)); … … 189 197 {1, "densify", densify, "create an image histogram from a set of vectors"}, 190 198 {1, "device", device, "set / get current graphics device"}, 199 {1, "dft2d", dft2d, "2D discrete fourier transform"}, 191 200 {1, "dimendown", dimendown, "convert image to vector"}, 192 201 {1, "dimenup", dimenup, "convert vector to image"}, … … 314 323 {1, "vstats", vstats, "statistics on a vector"}, 315 324 {1, "vzload", vzload, "load vectors as overlay on image display (scaled points)"}, 325 {1, "vsh", vsh, "Vector Spherical Harmonics"}, 326 {1, "vshfit", vshfit, "Vector Spherical Harmonics fits"}, 327 {1, "shterms", shterms, "Spherical Harmonics terms"}, 328 {1, "shfit", shfit, "Spherical Harmonics fits"}, 329 {1, "shdot", shdot, "Spherical Harmonics dot product"}, 330 {1, "shapply", shapply, "Spherical Harmonics fit application"}, 316 331 {1, "wd", wd, "write an image to a file"}, 317 332 {1, "write", write_vectors, "write vectors to datafile"}, -
trunk/Ohana/src/opihi/cmd.data/load.c
r34088 r37807 23 23 if (!GetImageData (&data, &kapa, name)) return (FALSE); 24 24 FREE (name); 25 26 int channel = 0; 27 if ((N = get_argument (argc, argv, "-ch"))) { 28 channel = GetKapaChannelFromString (argv[N]); 29 if (!channel) return FALSE; 30 KiiSetChannel (kapa, channel - 1); 31 } 25 32 26 33 ISCEL = FALSE; -
trunk/Ohana/src/opihi/cmd.data/point.c
r15620 r37807 21 21 if (!GetImageData (&data, &kapa, name)) return (FALSE); 22 22 FREE (name); 23 24 int channel = 0; 25 if ((N = get_argument (argc, argv, "-ch"))) { 26 channel = GetKapaChannelFromString (argv[N]); 27 if (!channel) return FALSE; 28 KiiSetChannel (kapa, channel - 1); 29 } 23 30 24 31 celestial = FALSE; -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r37049 r37807 5 5 6 6 void read_vectors_cleanup (); 7 int read_table_sizes (Header *header); 7 8 8 9 int datafile (int argc, char **argv) { … … 331 332 332 333 off_t Nbytes; 333 int i, j, N, N extend, Ny, Binary, vecType, padIfShort;334 char type[16], ID[80] , *CCDKeyword;334 int i, j, N, Ny, Binary, vecType; 335 char type[16], ID[80]; 335 336 FTable table; 336 337 Header header; 337 338 Vector **vec; 338 int FITS_TRANSPOSE;339 339 340 340 table.buffer = NULL; 341 341 header.buffer = NULL; 342 342 343 FITS_TRANSPOSE = FALSE;343 int FITS_TRANSPOSE = FALSE; 344 344 if ((N = get_argument (argc, argv, "-transpose"))) { 345 345 remove_argument (N, &argc, argv); … … 347 347 } 348 348 349 CCDKeyword = NULL;349 char *CCDKeyword = NULL; 350 350 if ((N = get_argument (argc, argv, "-keyword"))) { 351 351 remove_argument (N, &argc, argv); … … 354 354 } 355 355 356 padIfShort = FALSE;356 int padIfShort = FALSE; 357 357 if ((N = get_argument (argc, argv, "-pad-if-short"))) { 358 358 remove_argument (N, &argc, argv); … … 360 360 } 361 361 362 Nextend = -1; 362 int getSizes = FALSE; 363 if ((N = get_argument (argc, argv, "-sizes"))) { 364 remove_argument (N, &argc, argv); 365 getSizes = TRUE; 366 } 367 368 int Nextend = -1; 363 369 if ((N = get_argument (argc, argv, "-extnum"))) { 364 370 remove_argument (N, &argc, argv); 365 371 Nextend = atoi (extname); 372 } 373 374 int start = 0; 375 int Nrows = -1; // -1 : read entire table 376 if ((N = get_argument (argc, argv, "-range"))) { 377 remove_argument (N, &argc, argv); 378 start = atoi (argv[N]); 379 remove_argument (N, &argc, argv); 380 Nrows = atoi (argv[N]); 381 remove_argument (N, &argc, argv); 382 } 383 384 // if CharAsVectors, char fields will be saved as vectors NAME:0 -- NAME:n for n characters 385 // else char fields will be saved as $NAME:0 - $NAME:m for m rows 386 // if (Ny > 10000), force CharAsVectors 387 int CharAsVectors = FALSE; 388 if ((N = get_argument (argc, argv, "-char-vectors"))) { 389 remove_argument (N, &argc, argv); 390 CharAsVectors = TRUE; 366 391 } 367 392 … … 397 422 } 398 423 if (!gfits_load_header (f, &header)) ESCAPE ("error reading header for extension %d\n", Nextend); 399 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension %d\n", Nextend); 400 424 425 if (getSizes) { 426 read_table_sizes (&header); 427 if (CCDKeyword != NULL) free (CCDKeyword); 428 gfits_free_header (&header); 429 return TRUE; 430 } 431 432 if (Nrows == -1) { 433 Nrows = header.Naxis[1] - start; 434 } 435 if (start < 0) ESCAPE ("invalid range: start < 0\n"); 436 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]); 437 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n"); 438 if (start + Nrows > header.Naxis[1]) ESCAPE ("invalid range: start + Nrows > Ny (%d)\n", header.Naxis[1]); 439 440 // Ny = 100, start = 0, Nrows = -1 -> Nrows => 100 441 // Ny = 100, start = 10, Nrows = 90 442 443 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend); 401 444 } else { 402 445 if (CCDKeyword == NULL) { … … 428 471 continue; 429 472 } 430 if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension\n"); 473 474 if (Nrows == -1) { 475 Nrows = header.Naxis[1] - start; 476 } 477 if (start < 0) ESCAPE ("invalid range: start < 0\n"); 478 if (start >= header.Naxis[1]) ESCAPE ("invalid range: start >= Ny (%d)\n", header.Naxis[1]); 479 if (Nrows < 0) ESCAPE ("invalid range: Nrows < 0\n"); 480 if (start + Nrows > header.Naxis[1]) ESCAPE ("invalid range: start + Nrows > Ny (%d)\n", header.Naxis[1]); 481 482 if (!gfits_fread_ftable_range (f, padIfShort, &table, start, Nrows)) ESCAPE ("error reading table for extension %d\n", Nextend); 483 484 // if (!gfits_fread_ftable_data (f, &table, padIfShort)) ESCAPE ("error reading table for extension\n"); 485 431 486 break; 432 487 } … … 465 520 if (!FITS_TRANSPOSE) { 466 521 // read string column into a list rather than a vector 467 if (!strcmp (type, "char") ) {522 if (!strcmp (type, "char") && !CharAsVectors && (Ny < 3000)) { 468 523 char *fieldName = argv[i]; 469 524 char *Ptr = data; … … 537 592 if (vec) free (vec); 538 593 } 594 595 // read -fits foo -sizes -- Nx, Ny, Nfields -> $table:Nx, $table:Ny, $table:$Nfields 596 // read -fits foo -fields 597 598 int read_table_sizes (Header *header) { 599 600 int Nfields; 601 602 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 603 604 set_int_variable ("table:Nx", header->Naxis[0]); 605 set_int_variable ("table:Nx", header->Naxis[0]); 606 set_int_variable ("table:Nfields", Nfields); 607 608 return TRUE; 609 } 610 -
trunk/Ohana/src/opihi/cmd.data/relocate.c
r27435 r37807 17 17 FREE (name); 18 18 19 int channel = 0; 20 if ((N = get_argument (argc, argv, "-ch"))) { 21 channel = GetKapaChannelFromString (argv[N]); 22 if (!channel) return FALSE; 23 KiiSetChannel (kapa, channel - 1); 24 } 25 19 26 if (argc != 3) { 20 27 gprint (GP_ERR, "USAGE: relocate x y [-n]\n"); -
trunk/Ohana/src/opihi/cmd.data/resize.c
r29938 r37807 17 17 if (!GetImage (NULL, &kapa, name)) return (FALSE); 18 18 FREE (name); 19 20 int channel = 0; 21 if ((N = get_argument (argc, argv, "-ch"))) { 22 channel = GetKapaChannelFromString (argv[N]); 23 if (!channel) return FALSE; 24 KiiSetChannel (kapa, channel - 1); 25 } 19 26 20 27 if ((N = get_argument (argc, argv, "-by-image"))) { -
trunk/Ohana/src/opihi/cmd.data/save.c
r13479 r37807 16 16 FREE (name); 17 17 18 int channel = 0; 19 if ((N = get_argument (argc, argv, "-ch"))) { 20 channel = GetKapaChannelFromString (argv[N]); 21 if (!channel) return FALSE; 22 KiiSetChannel (kapa, channel - 1); 23 } 24 18 25 celestial = FALSE; 19 26 if ((N = get_argument (argc, argv, "-c"))) { -
trunk/Ohana/src/opihi/cmd.data/tv.c
r35757 r37807 18 18 if (!GetImage (&data, &kapa, name)) return (FALSE); 19 19 FREE (name); 20 21 int channel = 0; 22 if ((N = get_argument (argc, argv, "-ch"))) { 23 remove_argument (N, &argc, argv); 24 channel = GetKapaChannelFromString (argv[N]); 25 remove_argument (N, &argc, argv); 26 if (!channel) return FALSE; 27 KiiSetChannel (kapa, channel - 1); 28 } 20 29 21 30 /* shell exits on pipe close, FIX */ -
trunk/Ohana/src/opihi/cmd.data/tvchannel.c
r16038 r37807 22 22 } 23 23 24 Nchannel = atoi (argv[1]); 24 Nchannel = GetKapaChannelFromString (argv[1]); 25 if (!Nchannel) return FALSE; 26 27 KiiSetChannel (kapa, Nchannel - 1); 28 return (TRUE); 29 } 30 31 int GetKapaChannelFromString (char *string) { 32 33 int Nchannel = atoi (string); 25 34 if (Nchannel == 0) { 26 35 // try the string values R/Red, G/Green, B/Blue 27 if (!strcasecmp ( argv[1], "R") || !strcasecmp (argv[1], "RED")) {36 if (!strcasecmp (string, "R") || !strcasecmp (string, "RED")) { 28 37 Nchannel = 1; 29 38 } 30 if (!strcasecmp ( argv[1], "G") || !strcasecmp (argv[1], "GREEN")) {39 if (!strcasecmp (string, "G") || !strcasecmp (string, "GREEN")) { 31 40 Nchannel = 2; 32 41 } 33 if (!strcasecmp ( argv[1], "B") || !strcasecmp (argv[1], "BLUE")) {42 if (!strcasecmp (string, "B") || !strcasecmp (string, "BLUE")) { 34 43 Nchannel = 3; 35 44 } 36 45 } 37 if ((Nchannel < 1) || (Nchannel > 3)) { 38 gprint (GP_ERR, "invalid channel : use 1 - 3 or (R)ed, (G)reen, (B)lue\n"); 39 return (FALSE); 46 if ((Nchannel < 1) || (Nchannel > 10)) { 47 gprint (GP_ERR, "invalid channel : use 1 - 10 or (R)ed, (G)reen, (B)lue\n"); 48 gprint (GP_ERR, " (R)ed, (G)reen, (B)lue == (1,2,3)\n"); 49 return (0); 40 50 } 41 42 KiiSetChannel (kapa, Nchannel - 1); 43 return (TRUE); 51 return Nchannel; 44 52 } -
trunk/Ohana/src/opihi/cmd.data/tvcontour.c
r13479 r37807 71 71 if (!GetImage (NULL, &kapa, name)) return (FALSE); 72 72 FREE (name); 73 74 int channel = 0; 75 if ((N = get_argument (argc, argv, "-ch"))) { 76 channel = GetKapaChannelFromString (argv[N]); 77 if (!channel) return FALSE; 78 KiiSetChannel (kapa, channel - 1); 79 } 73 80 74 81 if ((argc != 4) && (argc != 5)) { -
trunk/Ohana/src/opihi/cmd.data/tvgrid.c
r13479 r37807 24 24 if (!GetImage (NULL, &kapa, name)) return (FALSE); 25 25 FREE (name); 26 27 int channel = 0; 28 if ((N = get_argument (argc, argv, "-ch"))) { 29 channel = GetKapaChannelFromString (argv[N]); 30 if (!channel) return FALSE; 31 KiiSetChannel (kapa, channel - 1); 32 } 26 33 27 34 if (argc != 3) { -
trunk/Ohana/src/opihi/cmd.data/vload.c
r20936 r37807 18 18 if (!GetImage (NULL, &kapa, name)) return (FALSE); 19 19 FREE (name); 20 21 int channel = 0; 22 if ((N = get_argument (argc, argv, "-ch"))) { 23 channel = GetKapaChannelFromString (argv[N]); 24 if (!channel) return FALSE; 25 KiiSetChannel (kapa, channel - 1); 26 } 20 27 21 28 type = KII_OVERLAY_BOX; -
trunk/Ohana/src/opihi/cmd.data/vzload.c
r20936 r37807 18 18 if (!GetImage (NULL, &kapa, name)) return (FALSE); 19 19 FREE (name); 20 21 int channel = 0; 22 if ((N = get_argument (argc, argv, "-ch"))) { 23 channel = GetKapaChannelFromString (argv[N]); 24 if (!channel) return FALSE; 25 KiiSetChannel (kapa, channel - 1); 26 } 20 27 21 28 MAX_OUTPUT_SIZE = 10.0; -
trunk/Ohana/src/opihi/dvo/Makefile
r37049 r37807 46 46 $(SRC)/badimages.$(ARCH).o \ 47 47 $(SRC)/catdir.$(ARCH).o \ 48 $(SRC)/catname.$(ARCH).o \ 48 49 $(SRC)/cmatch.$(ARCH).o \ 49 50 $(SRC)/cmpload.$(ARCH).o \ -
trunk/Ohana/src/opihi/dvo/avextract.c
r37049 r37807 5 5 off_t i, j, n, m; 6 6 int N, Npts, NPTS, last, next, state, Nfields, Nreturn, Ncstack, Nstack; 7 int Nsecfilt, VERBOSE , needMeasures;7 int Nsecfilt, VERBOSE; 8 8 char **cstack, name[1024]; 9 9 void *Signal; … … 137 137 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 138 138 if (PARALLEL && !HOST_ID) { 139 int status = HostTableParallelOps (skylist, argc, argv, RESULT_FILE, TRUE, 0, VERBOSE);139 int status = HostTableParallelOps (skylist, argc, argv, RESULT_FILE, TRUE, 0, VERBOSE); 140 140 141 141 dbFreeFields (fields, Nfields); … … 163 163 } 164 164 165 // check the requested fields : are all average/secfilt entries, or do we need measures? 166 needMeasures = FALSE; 167 for (i = 0; !needMeasures && (i < Nfields); i++) { 168 if (fields[i].photcode == NULL) continue; // non-measure fields do not have a photcode 169 if (fields[i].photcode[0].type == PHOT_REF) needMeasures = TRUE; 170 if (fields[i].photcode[0].type == PHOT_DEP) needMeasures = TRUE; 171 } 165 // check the requested fields 166 int needMeasure = dbFieldNeedMeasure (fields, Nfields); 167 int needLensobj = dbFieldNeedLensobj (fields, Nfields); 168 int needStarpar = dbFieldNeedStarpar (fields, Nfields, TRUE); 172 169 173 170 // grab data from all selected sky regions … … 189 186 catalog.filename = (HOST_ID || PARALLEL_LOCAL) ? hostfile : skylist[0].filename[i]; 190 187 catalog.catflags = LOAD_AVES | LOAD_SECF; 191 catalog.catflags |= needMeasures ? LOAD_MEAS : SKIP_MEAS; 188 catalog.catflags |= needMeasure ? LOAD_MEAS : SKIP_MEAS; 189 catalog.catflags |= needLensobj ? LOAD_LENSOBJ : SKIP_LENSOBJ; 190 catalog.catflags |= needStarpar ? LOAD_STARPAR : SKIP_STARPAR; 192 191 catalog.Nsecfilt = 0; 193 192 … … 205 204 // XXX for measure values, this could be optimized for one loop over measures... 206 205 207 m = catalog.average[j].measureOffset;208 209 206 dbExtractAveragesInitAve (); // reset counters for saved fields (costs very little) 210 207 208 Average *average = &catalog.average[j]; 209 210 m = average->measureOffset; 211 Measure *measure = needMeasure ? &catalog.measure[m] : NULL; 212 213 m = average->lensobjOffset; 214 Lensobj *lensobj = needLensobj ? &catalog.lensobj[m] : NULL; 215 216 m = average->starparOffset; 217 StarPar *starpar = needStarpar ? &catalog.starpar[m] : NULL; 218 219 m = j*Nsecfilt; 220 SecFilt *secfilt = &catalog.secfilt[m]; 221 211 222 for (n = 0; n < Nfields; n++) { 212 values[n] = dbExtractAverages ( &catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &fields[n]);223 values[n] = dbExtractAverages (average, secfilt, measure, lensobj, starpar, &fields[n]); 213 224 } 214 225 -
trunk/Ohana/src/opihi/dvo/avmatch.c
r37049 r37807 149 149 } 150 150 151 // check the requested fields : are all average/secfilt entries, or do we need measures? 152 int needMeasures = FALSE; 153 for (i = 0; !needMeasures && (i < Nfields); i++) { 154 if (fields[i].photcode == NULL) continue; // assert this? 155 if (fields[i].photcode[0].type == PHOT_REF) needMeasures = TRUE; 156 if (fields[i].photcode[0].type == PHOT_DEP) needMeasures = TRUE; 157 } 151 // check the requested fields 152 int needMeasure = dbFieldNeedMeasure (fields, Nfields); 153 int needLensobj = dbFieldNeedLensobj (fields, Nfields); 154 int needStarpar = dbFieldNeedStarpar (fields, Nfields, TRUE); 158 155 159 156 /* create output storage vectors */ … … 194 191 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 195 192 catalog.catflags = LOAD_AVES | LOAD_SECF; 196 catalog.catflags |= needMeasures ? LOAD_MEAS : SKIP_MEAS; 193 catalog.catflags |= needMeasure ? LOAD_MEAS : SKIP_MEAS; 194 catalog.catflags |= needLensobj ? LOAD_LENSOBJ : SKIP_LENSOBJ; 195 catalog.catflags |= needStarpar ? LOAD_STARPAR : SKIP_STARPAR; 197 196 catalog.Nsecfilt = 0; 198 197 … … 219 218 if (Ncat == -2) continue; // no matches to this point 220 219 221 m = catalog.average[Ncat].measureOffset; 220 m = Ncat; 221 Average *average = &catalog.average[m]; 222 223 m = average->measureOffset; 224 Measure *measure = needMeasure ? &catalog.measure[m] : NULL; 225 226 m = average->lensobjOffset; 227 Lensobj *lensobj = needLensobj ? &catalog.lensobj[m] : NULL; 228 229 m = average->starparOffset; 230 StarPar *starpar = needStarpar ? &catalog.starpar[m] : NULL; 231 232 m = Ncat*Nsecfilt; 233 SecFilt *secfilt = &catalog.secfilt[m]; 222 234 223 235 // reset counters for saved fields, extract fields 224 236 dbExtractAveragesInitAve (); 225 237 for (n = 0; n < Nfields; n++) { 226 values[n] = dbExtractAverages ( &catalog.average[Ncat], &catalog.secfilt[Ncat*Nsecfilt], &catalog.measure[m], &fields[n]);238 values[n] = dbExtractAverages (average, secfilt, measure, lensobj, starpar, &fields[n]); 227 239 } 228 240 -
trunk/Ohana/src/opihi/dvo/cmpload.c
r34088 r37807 24 24 if (!GetImage (NULL, &kapa, name)) return (FALSE); 25 25 FREE (name); 26 27 int channel = 0; 28 if ((N = get_argument (argc, argv, "-ch"))) { 29 channel = GetKapaChannelFromString (argv[N]); 30 if (!channel) return FALSE; 31 KiiSetChannel (kapa, channel - 1); 32 } 26 33 27 34 Objtype = 0; -
trunk/Ohana/src/opihi/dvo/dvo_host_utils.c
r35416 r37807 137 137 138 138 // determine the sky region 139 // XXX EAM 20141230 : this needs to respect the -region selection 139 140 double Rmin, Rmax, Dmin, Dmax; 140 141 get_skyregion (&Rmin, &Rmax, &Dmin, &Dmax); -
trunk/Ohana/src/opihi/dvo/find_matches.c
r36489 r37807 38 38 * far from the projection pole. We use the center of the region (catalog) for crval1,2. 39 39 */ 40 InitCoords (&tcoords, "DEC--ARC"); 40 41 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 41 42 if (region[0].Dmax < 90) { … … 44 45 tcoords.crval2 = 90.0; 45 46 } 46 tcoords.crpix1 = 0;47 tcoords.crpix2 = 0;48 47 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 49 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;50 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;51 tcoords.Npolyterms = 1;52 strcpy (tcoords.ctype, "DEC--ARC");53 48 54 49 // this region includes a boundary layer of size RADIUS -
trunk/Ohana/src/opihi/dvo/gimages.c
r36489 r37807 85 85 if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE); 86 86 image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, trange, TimeSelect); 87 BuildChipMatch (image, Nimage);87 // BuildChipMatch (image, Nimage); 88 88 89 89 int DistortImage = wordhash ("-DIS"); … … 102 102 } 103 103 } 104 if (!FindMosaicForImage (image, Nimage, i)) continue;105 104 106 105 typehash = wordhash (&image[i].coords.ctype[4]); … … 129 128 if (fabs(Ro - Ra) > 120.0) continue; 130 129 130 InitCoords (&local, "DEC--TAN"); 131 131 local.crval1 = Ro; 132 132 local.crval2 = Do; 133 local.crpix1 = local.crpix2 = 0.0;134 133 local.cdelt1 = local.cdelt2 = 1.0/3600.0; 135 local.pc1_1 = local.pc2_2 = 1.0;136 local.pc2_1 = local.pc1_2 = 0.0;137 local.Npolyterms = 1;138 strcpy (local.ctype, "DEC--TAN");139 134 140 135 if (typehash == DistortImage) { -
trunk/Ohana/src/opihi/dvo/images.c
r34584 r37807 131 131 /* it is not an error for the database not to have any images */ 132 132 if ((image = LoadImagesDVO (&Nimage)) == NULL) return (TRUE); 133 BuildChipMatch (image, Nimage);133 // BuildChipMatch (image, Nimage); 134 134 135 135 if (SOLO_MOSAIC && photcode) { … … 152 152 SetVector (&Yvec, OPIHI_FLT, NPTS); 153 153 154 Image *mosaic = NULL; 155 154 156 ALLOCATE (plist, int, NPTS); 155 157 n = N = 0; … … 157 159 if (ByName && strncmp (image[i].name, name, strlen(name))) continue; 158 160 if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) 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 161 162 mosaic = image[i].parent; 163 Nmosaic = (SOLO_MOSAIC && mosaic) ? mosaic - image : -1; 164 161 165 if (photcode) { 162 166 if ( photcodeEquiv && (photcode[0].code != GetPhotcodeEquivCodebyCode(image[i].photcode))) continue; … … 170 174 typehash = wordhash (&image[i].coords.ctype[4]); 171 175 172 if (photcode && SOLO_MOSAIC ) {176 if (photcode && SOLO_MOSAIC && (Nmosaic >= 0)) { 173 177 // mosaic (DIS) images are not currently given a photcode : plot these via the WRP entries 174 178 /* DIS images represent a field, not a chip */ 175 179 if (typehash != ChipImage) continue; 176 180 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 x[0] = -0.5*mosaic->NX; y[0] = -0.5*mosaic->NY; 182 x[1] = +0.5*mosaic->NX; y[1] = -0.5*mosaic->NY; 183 x[2] = +0.5*mosaic->NX; y[2] = +0.5*mosaic->NY; 184 x[3] = -0.5*mosaic->NX; y[3] = +0.5*mosaic->NY; 181 185 for (j = 0; j < Npts; j++) { 182 status = XY_to_RD (&r[j], &d[j], x[j], y[j], & image[Nmosaic].coords);186 status = XY_to_RD (&r[j], &d[j], x[j], y[j], &mosaic->coords); 183 187 if (!status) break; 184 188 r[j] = ohana_normalize_angle (r[j]); … … 198 202 199 203 /* DIS images represent a field, not a chip */ 200 if ((typehash == DistortImage) && !WITH_MOSAIC) continue; 201 if ((typehash != DistortImage) && SOLO_MOSAIC) continue; 204 if ((typehash == DistortImage) && !WITH_MOSAIC) continue; // do not plot the mosaic images 205 if ((typehash != DistortImage) && SOLO_MOSAIC) continue; // plot only the mosaic images 206 202 207 if (typehash == DistortImage) { 203 208 x[0] = -0.5*image[i].NX; y[0] = -0.5*image[i].NY; -
trunk/Ohana/src/opihi/dvo/imbox.c
r34584 r37807 43 43 SetVector (&Yvec, OPIHI_FLT, NPTS); 44 44 45 mosaic.ctype[0] = 0; 46 45 47 while (gfits_fread_header (f, &header)) { 46 48 if (!GetCoords (&coords, &header)) goto skip; 47 49 if (!SOLO_PHU && !strcmp (&coords.ctype[4], "-DIS")) { 48 50 mosaic = coords; 49 RegisterMosaic (&mosaic);50 51 goto skip; 52 } 53 if (!strcmp (&coords.ctype[4], "-WRP")) { 54 if (!mosaic.ctype[0]) { 55 fprintf (stderr, "PHU mosaic not found\n"); 56 return FALSE; 57 } 58 coords.mosaic = &mosaic; 51 59 } 52 60 -
trunk/Ohana/src/opihi/dvo/imdata.c
r37049 r37807 87 87 if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE); 88 88 image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, trange, TimeSelect); 89 BuildChipMatch (image, Nimage);89 // BuildChipMatch (image, Nimage); 90 90 GetTimeFormat (&TimeReference, &TimeFormat); 91 91 … … 103 103 I = subset[i]; 104 104 105 if (!FindMosaicForImage (image, Nimage, I)) continue;106 105 skyset = SkyListByImage (sky, -1, &image[I]); 107 106 -
trunk/Ohana/src/opihi/dvo/imdense.c
r34584 r37807 22 22 23 23 if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE); 24 BuildChipMatch (image, Nimage);24 // BuildChipMatch (image, Nimage); 25 25 26 26 Rmin = graphmode.coords.crval1 - 182.0; … … 42 42 /* project this image to screen display coords */ 43 43 status = FALSE; 44 if (!FindMosaicForImage (image, Nimage, i)) continue;45 44 XY_to_RD (&r, &d, x, y, &image[i].coords); 46 45 r = ohana_normalize_angle (r); -
trunk/Ohana/src/opihi/dvo/imextract.c
r37049 r37807 90 90 91 91 if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape; 92 BuildChipMatch (image, Nimage);92 // BuildChipMatch (image, Nimage); 93 93 dbExtractImagesInit (); 94 94 -
trunk/Ohana/src/opihi/dvo/imlist.c
r34088 r37807 38 38 } 39 39 40 // int RegionSelect = FALSE;41 // if ((N = get_argument (argc, argv, "-region"))) {42 // remove_argument (N, &argc, argv);43 // RegionSelect = TRUE;44 // }45 46 40 PhotcodeValue = NULL; 47 41 PhotcodeSelect = FALSE; … … 76 70 } 77 71 72 int MAX_LIST = -1; 73 if ((N = get_argument (argc, argv, "-max-list"))) { 74 remove_argument (N, &argc, argv); 75 MAX_LIST = atoi (argv[N]); 76 remove_argument (N, &argc, argv); 77 } 78 78 79 if (argc != 1) { 79 gprint (GP_ERR, "USAGE: image [-time start range] [-region] [-name string] \n");80 gprint (GP_ERR, "USAGE: image [-time start range] [-region] [-name string] [-photcode code] [-Nphotcode N] [-max-list N]\n"); 80 81 return (FALSE); 81 82 } … … 83 84 if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE); 84 85 image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, trange, TimeSelect); 85 BuildChipMatch (image, Nimage);86 MAX_LIST = MAX_LIST < 0 ? Nsubset : MIN(MAX_LIST, Nsubset); 86 87 87 88 GetTimeFormat (&TimeReference, &TimeFormat); 88 89 89 for (j = 0; j < Nsubset; j++) {90 for (j = 0; j < MAX_LIST; j++) { 90 91 i = subset[j]; 91 92 if (NameSelect && (strstr (image[i].name, name) == (char *) NULL)) continue; … … 97 98 } 98 99 } 99 if (!FindMosaicForImage (image, Nimage, i)) continue;100 100 t = TimeValue (image[i].tzero, TimeReference, TimeFormat); 101 101 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) { -
trunk/Ohana/src/opihi/dvo/imstats.c
r34584 r37807 31 31 32 32 if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE); 33 BuildChipMatch (image, Nimage);33 // BuildChipMatch (image, Nimage); 34 34 35 35 /* assign vector values */ … … 44 44 else 45 45 Yvec.elements.Flt[i] = image[i].dMcal; 46 if (!FindMosaicForImage (image, Nimage, i)) continue;47 46 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 48 47 gprint (GP_ERR, "%d %8.4f %8.4f %10d %6d %5.3f %6.3f %6.3f\n", -
trunk/Ohana/src/opihi/dvo/init.c
r37049 r37807 7 7 int calmextract PROTO((int, char **)); 8 8 int catlog PROTO((int, char **)); 9 int catname PROTO((int, char **)); 9 10 int catdir_define PROTO((int, char **)); 10 11 int ccd PROTO((int, char **)); … … 68 69 // {1, "calextract", calextract, "extract photometry calibration"}, 69 70 // {1, "calmextract", calmextract, "extract photometry calibration"}, 71 {1, "catname", catname, "list catalog files by name"}, 70 72 {1, "catdir", catdir_define,"re-define CATDIR"}, 71 73 // {1, "ccd", ccd, "plot color-color diagram"}, -
trunk/Ohana/src/opihi/dvo/mextract.c
r35416 r37807 211 211 } 212 212 213 // int needLensing = dbFieldNeedLensing (fields, Nfields); 214 int needStarpar = dbFieldNeedStarpar (fields, Nfields, FALSE); 215 213 216 // grab data from all selected sky regions 214 217 Signal = signal (SIGINT, handle_interrupt); … … 227 230 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 228 231 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_SECF; 232 // catalog.catflags |= needLensing ? LOAD_LENSING : SKIP_LENSING; 233 catalog.catflags |= needStarpar ? LOAD_STARPAR : SKIP_STARPAR; 229 234 catalog.Nsecfilt = Nsecfilt; 230 235 … … 259 264 // extract the relevant values for this measurement 260 265 dbExtractMeasuresInitMeas (); // reset counters for saved fields (costs very little 266 267 Average *average = &catalog.average[j]; 268 269 int Nstarpar = average->starparOffset; 270 StarPar *starpar = needStarpar ? &catalog.starpar[Nstarpar] : NULL; 271 272 // int Nlensing = average->lensobjOffset; 273 // Lensobj *lensobj = needLensobj ? &catalog.lensobj[m] : NULL; 274 275 int Nsec = j*Nsecfilt; 276 SecFilt *secfilt = &catalog.secfilt[Nsec]; 277 261 278 for (n = 0; n < Nfields; n++) { 262 values[n] = dbExtractMeasures ( &catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &fields[n]);279 values[n] = dbExtractMeasures (average, secfilt, &catalog.measure[m], NULL, starpar, &fields[n]); 263 280 } 264 281 // fprintf (stderr, "object: ave: %f, cat: %f, averef %d\n", fields[n].name, values[2], values[3], catalog.measure[m].averef); -
trunk/Ohana/src/opihi/dvo/mmatch.c
r35416 r37807 233 233 ALLOCATE (index, off_t, Nelem); 234 234 235 // int needLensing = dbFieldNeedLensing (fields, Nfields); 236 int needStarpar = dbFieldNeedStarpar (fields, Nfields, FALSE); 237 235 238 // grab data from all selected sky regions 236 239 Signal = signal (SIGINT, handle_interrupt); … … 246 249 catalog.filename = HOST_ID ? hostfile : skylist[0].filename[i]; 247 250 catalog.catflags = LOAD_AVES | LOAD_SECF | LOAD_MEAS; 251 catalog.catflags |= needStarpar ? LOAD_STARPAR : SKIP_STARPAR; 248 252 catalog.Nsecfilt = Nsecfilt; 249 253 … … 282 286 // extract the relevant values for this measurement 283 287 dbExtractMeasuresInitMeas (); // reset counters for saved fields (costs very little 288 289 Average *average = &catalog.average[Ncat]; 290 291 int Nstarpar = average->starparOffset; 292 StarPar *starpar = needStarpar ? &catalog.starpar[Nstarpar] : NULL; 293 294 // int Nlensing = average->lensobjOffset; 295 // Lensobj *lensobj = needLensobj ? &catalog.lensobj[m] : NULL; 296 297 int Nsec = Ncat*Nsecfilt; 298 SecFilt *secfilt = &catalog.secfilt[Nsec]; 299 284 300 for (n = 0; n < Nfields; n++) { 285 values[n] = dbExtractMeasures ( &catalog.average[Ncat], &catalog.secfilt[Ncat*Nsecfilt], &catalog.measure[m], &fields[n]);301 values[n] = dbExtractMeasures (average, secfilt, &catalog.measure[m], NULL, starpar, &fields[n]); 286 302 } 287 303 -
trunk/Ohana/src/opihi/dvo/mmextract.c
r35263 r37807 174 174 } 175 175 176 // int needLensing = dbFieldNeedLensing (fields, Nfields); 177 int needStarpar = dbFieldNeedStarpar (fields, Nfields, FALSE); 178 176 179 // grab data from all selected sky regions 177 180 Signal = signal (SIGINT, handle_interrupt); … … 213 216 // extract the relevant values for this measurement 214 217 dbExtractMeasuresInitMeas (); // reset counters for saved fields 218 219 Average *average = &catalog.average[j]; 220 221 int Nstarpar = average->starparOffset; 222 StarPar *starpar = needStarpar ? &catalog.starpar[Nstarpar] : NULL; 223 224 // int Nlensing = average->lensobjOffset; 225 // Lensobj *lensobj = needLensobj ? &catalog.lensobj[m] : NULL; 226 227 int Nsec = j*Nsecfilt; 228 SecFilt *secfilt = &catalog.secfilt[Nsec]; 229 215 230 for (n = 0; n < Nfields; n++) { 216 231 // values needs to be a pointer to a type with FLT and INT (with a union, we would save a bit of memory...) 217 values[n] = dbExtractMeasures ( &catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &fields[n]);232 values[n] = dbExtractMeasures (average, secfilt, &catalog.measure[m], NULL, starpar, &fields[n]); 218 233 } 219 234 // fprintf (stderr, "object: ave: %f, cat: %f, averef %d\n", fields[n].name, values[2], values[3], catalog.measure[m].averef); -
trunk/Ohana/src/opihi/dvo/objectcoverage.c
r34088 r37807 147 147 strcpy (buf[0].file, "(empty)"); 148 148 149 InitCoords (&coords, projection); 149 150 coords.crval1 = RaCenter; 150 151 coords.crval2 = DecCenter; 151 152 coords.crpix1 = 0.5*Nx; 152 153 coords.crpix2 = 0.5*Ny; 153 strcpy (coords.ctype, projection); 154 coords.pc1_1 = -1.0; 154 coords.pc1_1 = -1.0; // sky parity 155 155 coords.pc2_2 = +1.0; 156 coords.pc1_2 = 0.0;157 coords.pc2_1 = 0.0;158 156 coords.cdelt1 = coords.cdelt2 = pixscale; 159 coords.Npolyterms = 0;160 157 161 158 PutCoords (&coords, &buf[0].header); … … 166 163 for (xs = 0; xs < Nx; xs++) { 167 164 status = XY_to_RD (&r, &d, (double)(xs), (double)(ys), &coords); 168 status &= (r >= 0); 169 status &= (r <= 360); 165 r = ohana_normalize_angle (r); 170 166 if (status) { 171 167 V[ys*Nx + xs] = ShowDensity ? 0 : 2; -
trunk/Ohana/src/opihi/dvo/showtile.c
r36489 r37807 28 28 29 29 /* reference for coords is this image */ 30 coords.crpix1 = coords.crpix2 = 0.0; 31 coords.crval1 = coords.crval2 = 0.0; 32 coords.cdelt1 = coords.cdelt2 = 1.0; 33 coords.pc1_1 = coords.pc2_2 = 1.0; 34 coords.pc1_2 = coords.pc2_1 = 0.0; 35 coords.Npolyterms = 0; 36 strcpy (coords.ctype, "DEC--TAN"); 30 InitCoords (&coords, "DEC--TAN"); 37 31 38 32 /* fill in top-left region */ -
trunk/Ohana/src/opihi/dvo/simage.c
r36489 r37807 42 42 } 43 43 /* get astrometry information */ 44 strcpy (coords.ctype, "NONE"); 45 gfits_scan (&header, "CTYPE2", "%s", 1, coords.ctype); 46 if (strcmp (coords.ctype, "DEC--PLY")) { 47 gprint (GP_ERR, "ERROR: wrong astrometric info in header\n"); 44 if (!GetCoords (&coords, &header)) { 45 gprint (GP_ERR, "ERROR: can't get coord info from header\n"); 48 46 return (FALSE); 49 47 } 50 gfits_scan (&header, "CDELT1", "%f", 1, &coords.cdelt1);51 gfits_scan (&header, "CDELT2", "%f", 1, &coords.cdelt2);52 gfits_scan (&header, "CRVAL1", "%lf", 1, &coords.crval1);53 gfits_scan (&header, "CRVAL2", "%lf", 1, &coords.crval2);54 gfits_scan (&header, "CRPIX1", "%f", 1, &coords.crpix1);55 gfits_scan (&header, "CRPIX2", "%f", 1, &coords.crpix2);56 gfits_scan (&header, "PC001001", "%f", 1, &coords.pc1_1);57 gfits_scan (&header, "PC001002", "%f", 1, &coords.pc1_2);58 gfits_scan (&header, "PC002001", "%f", 1, &coords.pc2_1);59 gfits_scan (&header, "PC002002", "%f", 1, &coords.pc2_2);60 /* RA Terms */61 gfits_scan (&header, "PCA1X2Y0", "%f", 1, &coords.polyterms[0][0]);62 gfits_scan (&header, "PCA1X1Y1", "%f", 1, &coords.polyterms[1][0]);63 gfits_scan (&header, "PCA1X0Y2", "%f", 1, &coords.polyterms[2][0]);64 gfits_scan (&header, "PCA1X3Y0", "%f", 1, &coords.polyterms[3][0]);65 gfits_scan (&header, "PCA1X2Y1", "%f", 1, &coords.polyterms[4][0]);66 gfits_scan (&header, "PCA1X1Y2", "%f", 1, &coords.polyterms[5][0]);67 gfits_scan (&header, "PCA1X0Y3", "%f", 1, &coords.polyterms[6][0]);68 /* Dec Terms */69 gfits_scan (&header, "PCA2X2Y0", "%f", 1, &coords.polyterms[0][1]);70 gfits_scan (&header, "PCA2X1Y1", "%f", 1, &coords.polyterms[1][1]);71 gfits_scan (&header, "PCA2X0Y2", "%f", 1, &coords.polyterms[2][1]);72 gfits_scan (&header, "PCA2X3Y0", "%f", 1, &coords.polyterms[3][1]);73 gfits_scan (&header, "PCA2X2Y1", "%f", 1, &coords.polyterms[4][1]);74 gfits_scan (&header, "PCA2X1Y2", "%f", 1, &coords.polyterms[5][1]);75 gfits_scan (&header, "PCA2X0Y3", "%f", 1, &coords.polyterms[6][1]);76 coords.Npolyterms = 2; /* how many do we use? */77 48 78 49 /* find number of stars */ -
trunk/Ohana/src/opihi/dvo/skycoverage.c
r33963 r37807 204 204 strcpy (buf[0].file, "(empty)"); 205 205 206 InitCoords (&coords, projection); 206 207 coords.crval1 = RaCenter; 207 208 coords.crval2 = DecCenter; 208 209 coords.crpix1 = 0.5*Nx; 209 210 coords.crpix2 = 0.5*Ny; 210 strcpy (coords.ctype, projection); 211 coords.pc1_1 = -1.0; 211 coords.pc1_1 = -1.0; // sky parity 212 212 coords.pc2_2 = +1.0; 213 coords.pc1_2 = 0.0;214 coords.pc2_1 = 0.0;215 213 coords.cdelt1 = coords.cdelt2 = pixscale; 216 coords.Npolyterms = 0;217 214 218 215 PutCoords (&coords, &buf[0].header); … … 222 219 return (FALSE); 223 220 } 224 BuildChipMatch (image, Nimage);221 // BuildChipMatch (image, Nimage); 225 222 226 223 V = (float *)buf[0].matrix.buffer; … … 230 227 for (xs = 0; xs < Nx; xs++) { 231 228 status = XY_to_RD (&r, &d, (double)(xs), (double)(ys), &coords); 232 status &= (r >= 0);233 status &= (r <= 360); 229 r = ohana_normalize_angle (r); 230 234 231 // are we in a part of the projection covering the sky or not? 235 232 if (status) { … … 284 281 } 285 282 } 286 287 if (!FindMosaicForImage (image, Nimage, i)) continue;288 283 289 284 typehash = wordhash (&image[i].coords.ctype[4]); -
trunk/Ohana/src/opihi/dvo/subpix.c
r37049 r37807 115 115 /* load all images, extract those touching Ra, Dec */ 116 116 if ((image = LoadImagesDVO (&Nimage)) == NULL) return (FALSE); 117 BuildChipMatch (image, Nimage);117 // BuildChipMatch (image, Nimage); 118 118 119 119 for (i = 0; i < Nimage; i++) { 120 if (!FindMosaicForImage (image, Nimage, i)) continue;121 120 status = RD_to_XY (&X, &Y, Ra, Dec, &image[i].coords); 122 121 if (!status || (X < 0) || (X > image[i].NX) || (Y < 0) || (Y > image[i].NY)) continue; … … 134 133 for (i = 0; i < Nsub; i++) { 135 134 I = index[i]; 136 if (!FindMosaicForImage (image, Nimage, I)) continue;137 135 Timage = image[I].tzero; 138 136 for (j = 0; j < Nmeasure; j++) { -
trunk/Ohana/src/opihi/include/astro.h
r31635 r37807 12 12 void FreeAstro (void); 13 13 14 typedef struct {15 int isIdentity; // identity transformation16 double phi; // saved in radians17 double Xo; // saved in radians18 double xo; // saved in degrees19 double sin_phi_cos_Xo; // pre-computed values20 double sin_phi_sin_Xo; // pre-computed values21 double cos_phi_cos_Xo; // pre-computed values22 double cos_phi_sin_Xo; // pre-computed values23 double cos_phi; // pre-computed values24 double sin_phi; // pre-computed values25 double cos_Xo; // pre-computed values26 double sin_Xo; // pre-computed values27 } CoordTransform;28 29 #ifndef MOVED_TO_LIBDVO30 typedef enum {COORD_NONE, COORD_CELESTIAL, COORD_GALACTIC, COORD_ECLIPTIC} CoordTransformSystem;31 #endif32 33 CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output);34 int ApplyTransform (double *x, double *y, double X, double Y, CoordTransform *transform);35 36 14 # endif -
trunk/Ohana/src/opihi/include/data.h
r36679 r37807 224 224 void ListMedImages (); 225 225 226 // in tvchannel.c 227 int GetKapaChannelFromString (char *string); 228 226 229 # endif -
trunk/Ohana/src/opihi/include/dvomath.h
r37049 r37807 187 187 int ListBuffersToList PROTO((char *name)); 188 188 int CreateBuffer PROTO((Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale)); 189 int ResetBuffer PROTO((Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale)); 189 190 Buffer *SelectBuffer PROTO((char *name, int mode, int verbose)); 190 191 void dump_buffers PROTO((int n)); /* deprecated? */ -
trunk/Ohana/src/opihi/lib.shell/BufferOps.c
r33662 r37807 88 88 } 89 89 90 int ResetBuffer (Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale) { 91 92 gfits_free_matrix (&buf[0].matrix); 93 gfits_free_header (&buf[0].header); 94 CreateBuffer (buf, Nx, Ny, bitpix, bzero, bscale); 95 return TRUE; 96 } 97 90 98 int CreateBuffer (Buffer *buf, int Nx, int Ny, int bitpix, float bzero, float bscale) { 91 99 -
trunk/Ohana/src/opihi/pantasks/controller_status.c
r23530 r37807 3 3 int controller_status (int argc, char **argv) { 4 4 5 int status;6 char command[1024] ;5 int i, status; 6 char command[1024], tmpline[1024]; 7 7 IOBuffer buffer; 8 8 9 if (argc != 1) { 10 gprint (GP_ERR, "USAGE: controller status\n"); 9 if ((argc > 1) && (!strcasecmp(argv[1], "help"))) { 10 gprint (GP_ERR, "USAGE: controller status [options]\n"); 11 gprint (GP_ERR, " OPTIONS:\n"); 12 gprint (GP_ERR, " -cmd command\n"); 13 gprint (GP_ERR, " -host hostname\n"); 14 gprint (GP_ERR, " -state state\n"); 15 gprint (GP_ERR, " -age seconds\n"); 16 gprint (GP_ERR, " +jobs [-nohost]\n"); 17 gprint (GP_ERR, " +host [-nojobs]\n"); 11 18 return (FALSE); 12 19 } … … 19 26 } 20 27 28 snprintf (command, 1024, "status"); 29 for (i = 1; i < argc; i++) { 30 snprintf (tmpline, 1024, "%s %s", command, argv[i]); 31 strcpy (command, tmpline); 32 } 21 33 22 sprintf (command, "status");23 34 InitIOBuffer (&buffer, 0x100); 24 35 -
trunk/Ohana/src/opihi/pcontrol/Makefile
r34088 r37807 11 11 12 12 # programs may add their own internal requirements here 13 LIBS1 = -l kapa -lFITS -lohana13 LIBS1 = -ldvo -lkapa -lFITS -lohana 14 14 LIBS2 = -lbasiccmd -lshell -ldata 15 15 FULL_CFLAGS = $(BASE_CFLAGS) -
trunk/Ohana/src/opihi/pcontrol/status.c
r36623 r37807 85 85 86 86 usage: 87 gprint (GP_ ERR, "USAGE: status [-cmd command] [-host hostname] [-state state] [-age seconds] [+jobs,-nohost] [+host,-nojobs]\n");87 gprint (GP_LOG, "USAGE: status [-cmd command] [-host hostname] [-state state] [-age seconds] [+jobs,-nohost] [+host,-nojobs]\n"); 88 88 return FALSE; 89 89 } -
trunk/Ohana/src/photdbc/include/photdbc.h
r37045 r37807 31 31 int PARALLEL_MANUAL; 32 32 int PARALLEL_SERIAL; 33 char *PARALLEL_OUTHOSTS; 33 34 34 35 int HOST_ID; 35 36 char *HOSTDIR; 37 char *HOSTDIR_OUTPUT; 36 38 37 39 // need to get RADIUS from Config … … 40 42 41 43 /* global variables */ 44 int SKIP_IMAGES; 45 int ONLY_IMAGES; 42 46 int SHOW_PARAMS; 43 47 int VERBOSE; -
trunk/Ohana/src/photdbc/src/CopyToHostLocation.c
r33655 r37807 54 54 } 55 55 56 char extname[4][16] = {"cpm", "cpt", "cps", "cpn"}; 57 for (j = 0; success && (j < 4); j++) { 56 # define NEXTNAME 7 57 char extname[NEXTNAME][16] = {"cpm", "cpt", "cps", "cpn", "cpx", "cpy", "cpz"}; 58 for (j = 0; success && (j < NEXTNAME); j++) { 58 59 59 60 // set the in and out table names -
trunk/Ohana/src/photdbc/src/args.c
r36833 r37807 15 15 remove_argument (N, &argc, argv); 16 16 SHOW_PARAMS = TRUE; 17 } 18 19 SKIP_IMAGES = FALSE; 20 if ((N = get_argument (argc, argv, "-skip-images"))) { 21 SKIP_IMAGES = TRUE; 22 remove_argument (N, &argc, argv); 23 } 24 25 ONLY_IMAGES = FALSE; 26 if ((N = get_argument (argc, argv, "-only-images"))) { 27 if (SKIP_IMAGES) { 28 fprintf (stderr, "-skip-images and -only-images cannot be used together\n"); 29 } 30 ONLY_IMAGES = TRUE; 31 remove_argument (N, &argc, argv); 17 32 } 18 33 … … 131 146 } 132 147 148 // XXX for the moment, make this selection manual. it needs to be automatic 149 // based on the state of the SkyTable 150 HOSTDIR_OUTPUT = NULL; 151 PARALLEL_OUTHOSTS = NULL; 152 if ((N = get_argument (argc, argv, "-parallel-output"))) { 153 remove_argument (N, &argc, argv); 154 PARALLEL_OUTHOSTS = strcreate (argv[N]); 155 remove_argument (N, &argc, argv); 156 } 157 133 158 if (argc != 2) usage(); 134 159 … … 171 196 if (!HOSTDIR) usage(); 172 197 198 HOSTDIR_OUTPUT = NULL; 199 if ((N = get_argument (argc, argv, "-hostdir-output"))) { 200 remove_argument (N, &argc, argv); 201 HOSTDIR_OUTPUT = strcreate (argv[N]); 202 remove_argument (N, &argc, argv); 203 } 204 173 205 VERBOSE = FALSE; 174 206 if ((N = get_argument (argc, argv, "-v"))) { … … 289 321 fprintf (stderr, " photdbc (output)\n\n"); 290 322 323 fprintf (stderr, " parallel options:\n"); 324 fprintf (stderr, " -parallel:\n"); 325 fprintf (stderr, " -parallel-output HostTable : HostTable should be relative path in OUTPUT directory\n"); 326 fprintf (stderr, " -parallel-manual\n"); 327 fprintf (stderr, " -parallel-serial\n\n"); 328 291 329 fprintf (stderr, " allowed filters / restrictions include:\n\n"); 292 330 … … 303 341 fprintf (stderr, " option options:\n"); 304 342 fprintf (stderr, " -v : verbose mode\n"); 305 fprintf (stderr, " -params : list the current parameters\n\n"); 343 fprintf (stderr, " -params : list the current parameters\n"); 344 fprintf (stderr, " -skip-images\n"); 345 fprintf (stderr, " -only-images\n"); 346 fprintf (stderr, " -set-format (catformat)\n"); 347 fprintf (stderr, " -set-mode (catmode)\n"); 306 348 307 349 fprintf (stderr, "ptolemy.rc config values used by this program:\n"); -
trunk/Ohana/src/photdbc/src/copy_images.c
r36833 r37807 52 52 } 53 53 54 BuildChipMatch (image, Nimage); 55 // MARKTIME("build chip match: %f sec\n", dtime); 56 57 char mapfile[DVO_MAX_PATH]; 58 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 59 AstromOffsetTable *table_src = AstromOffsetMapLoad (mapfile, VERBOSE); 60 61 // assign images.coords.offsetMap -> table->map[i] 62 if (table_src) { 63 AstromOffsetTableMatchChips (image, Nimage, table_src); 64 } 65 54 66 subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset, FALSE); 67 68 if (table_src) { 69 AstromOffsetTable *table_tgt = AstromOffsetTableInit (); 70 71 off_t i; 72 for (i = 0; i < Nsubset; i++) { 73 if (!subset[i].coords.offsetMap) continue; 74 if (subset[i].coords.Npolyterms != -1) continue; // assert on this? 75 AstromOffsetTableAddMapFromImage (table_tgt, &subset[i]); 76 } 77 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", outdir); 78 AstromOffsetMapSave (table_tgt, mapfile); 79 free (table_tgt->imageIDtoTableSeq); 80 free (table_tgt->map); 81 free (table_tgt); 82 } 55 83 56 84 dvo_image_addrows (&out, subset, Nsubset); … … 73 101 SavePhotcodesFITS (filename); 74 102 103 // free the astrom offset tables 104 AstromOffsetTableFree (table_src); 105 75 106 return (TRUE); 76 107 } -
trunk/Ohana/src/photdbc/src/find_images.c
r36481 r37807 19 19 20 20 /* we make positional comparisons in the projection of catalog */ 21 InitCoords (&tcoords, "DEC--TAN"); 21 22 tcoords.crval1 = 0.5*(region[0].RA[0] + region[0].RA[1]); 22 23 tcoords.crval2 = 0.5*(region[0].DEC[0] + region[0].DEC[1]); 23 tcoords.crpix1 = tcoords.crpix2 = 0.0;24 24 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 25 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;26 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;27 strcpy (tcoords.ctype, "DEC--TAN");28 25 29 26 timage = gfits_table_get_Image (&db[0].ftable, &Ntimage, &db[0].swapped); -
trunk/Ohana/src/photdbc/src/join_stars.c
r37045 r37807 50 50 51 51 /* coordinate system for projection */ 52 InitCoords (&tcoords, "DEC--TAN"); 52 53 tcoords.crval1 = Rmid; 53 54 tcoords.crval2 = Dmid; 54 tcoords.crpix1 = tcoords.crpix2 = 0.0;55 55 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 56 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;57 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;58 tcoords.Npolyterms = 0;59 strcpy (tcoords.ctype, "DEC--TAN");60 56 61 57 /* project & sort coordinates in local linear frame */ -
trunk/Ohana/src/photdbc/src/photdbc.c
r36833 r37807 15 15 16 16 // load and copy the image table 17 copy_images (argv[1], skylist); 17 if (!SKIP_IMAGES) { 18 copy_images (argv[1], skylist); 19 } 18 20 19 21 // hostID is 0 for master program 20 photdbc_catalogs (argv[1], skylist, 0); 22 if (!ONLY_IMAGES) { 23 photdbc_catalogs (argv[1], skylist, 0); 24 } 21 25 22 26 char *skyfile = SkyTableFilename (argv[1]); -
trunk/Ohana/src/photdbc/src/photdbc_catalogs.c
r36833 r37807 42 42 snprintf (outfile, DVO_MAX_PATH, "%s/%s.cpt", outroot, skylist[0].regions[i]->name); 43 43 outcatalog.filename = outfile; 44 45 if (HOSTDIR_OUTPUT) { 46 // parallel-ouput puts the output in a per-host directory (keeps the source sky partition) 47 snprintf (outfile, DVO_MAX_PATH, "%s/%s.cpt", HOSTDIR_OUTPUT, skylist[0].regions[i]->name); 48 } 49 44 50 if (outcatalog.filename == NULL) Shutdown ("error with input catalog name"); 45 51 … … 95 101 } 96 102 103 HostTable *table_output = NULL; 104 if (PARALLEL_OUTHOSTS) { 105 table_output = HostTableLoad (outroot, PARALLEL_OUTHOSTS); 106 if (!table_output) { 107 fprintf (stderr, "%s not found in %s, please create\n", PARALLEL_OUTHOSTS, outroot); 108 } 109 } 110 97 111 int i; 98 112 for (i = 0; i < table->Nhosts; i++) { … … 123 137 if (CATFORMAT) { snprintf (tmpline, DVO_MAX_PATH, "%s -set-format %s", command, CATFORMAT); strcpy (command, tmpline); } 124 138 if (CATMODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -set-mode %s", command, CATMODE); strcpy (command, tmpline); } 139 140 if (PARALLEL_OUTHOSTS) { 141 tmppath = abspath (table_output->hosts[i].pathname, DVO_MAX_PATH); 142 free (table_output->hosts[i].pathname); 143 table_output->hosts[i].pathname = tmppath; 144 snprintf (tmpline, DVO_MAX_PATH, "%s -hostdir-output %s", command, table_output->hosts[i].pathname); strcpy (command, tmpline); 145 } 125 146 126 147 fprintf (stderr, "command: %s\n", command); -
trunk/Ohana/src/photdbc/src/select_images.c
r36833 r37807 34 34 35 35 // the comparison is made in the catalog local projection. below we set crval1,2 36 tcoords.crpix1 = tcoords.crpix2 = 0.0;36 InitCoords (&tcoords, "DEC--TAN"); 37 37 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 38 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;39 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;40 strcpy (tcoords.ctype, "DEC--TAN");41 38 42 39 ALLOCATE (skycoords, SkyRegionCoords, skylist[0].Nregions); … … 92 89 93 90 if (VERBOSE) fprintf (stderr, "finding images\n"); 94 BuildChipMatch (timage, Ntimage);95 MARKTIME("build chip match: %f sec\n", dtime);96 91 97 92 nimage = 0; … … 115 110 keep_image: 116 111 117 // this adds 1.3 sec for 3M images118 if (!FindMosaicForImage (timage, Ntimage, i)) {119 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);120 continue;121 }122 123 112 /* define image corners - note the DIS images (mosaic phu) are special */ 124 113 if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) { -
trunk/Ohana/src/relastro/Makefile
r37261 r37807 60 60 $(SRC)/CoordOps.$(ARCH).o \ 61 61 $(SRC)/extra.$(ARCH).o \ 62 $(SRC)/FixProblemImages.$(ARCH).o \63 62 $(SRC)/StarMaps.$(ARCH).o \ 64 63 $(SRC)/high_speed_catalogs.$(ARCH).o \ … … 75 74 $(SRC)/relastro_parallel_regions.$(ARCH).o \ 76 75 $(SRC)/MeanPosIO.$(ARCH).o \ 76 $(SRC)/MeasPosIO.$(ARCH).o \ 77 77 $(SRC)/share_mean_pos.$(ARCH).o \ 78 $(SRC)/share_meas_pos.$(ARCH).o \ 78 79 $(SRC)/share_images_pos.$(ARCH).o \ 80 $(SRC)/share_icrf_obj.$(ARCH).o \ 81 $(SRC)/ICRF.$(ARCH).o \ 82 $(SRC)/ICRFobjIO.$(ARCH).o \ 83 $(SRC)/FrameCorrection.$(ARCH).o \ 84 $(SRC)/FrameCorrectionIO.$(ARCH).o \ 85 $(SRC)/FrameCorrectionUtils.$(ARCH).o \ 79 86 $(SRC)/ImagePosIO.$(ARCH).o \ 80 87 $(SRC)/ImageTable.$(ARCH).o \ … … 82 89 $(SRC)/indexCatalogs.$(ARCH).o \ 83 90 $(SRC)/syncfile.$(ARCH).o \ 91 $(SRC)/client_logger.$(ARCH).o \ 84 92 $(SRC)/relastroVisual.$(ARCH).o 85 93 … … 117 125 $(SRC)/relastro_objects.$(ARCH).o \ 118 126 $(SRC)/save_catalogs.$(ARCH).o \ 119 $(SRC)/CoordOps.$(ARCH).o \120 127 $(SRC)/extra.$(ARCH).o \ 121 128 $(SRC)/high_speed_catalogs.$(ARCH).o \ … … 128 135 $(SRC)/plot_scatter.$(ARCH).o \ 129 136 $(SRC)/plotstuff.$(ARCH).o \ 137 $(SRC)/ICRF.$(ARCH).o \ 130 138 $(SRC)/relastroVisual.$(ARCH).o \ 131 139 $(SRC)/syncfile.$(ARCH).o \ 132 140 $(SRC)/BrightCatalog.$(ARCH).o 133 134 #$(SRC)/FitChip.$(ARCH).o \135 #$(SRC)/FitMosaic.$(ARCH).o \136 #$(SRC)/UpdateChips.$(ARCH).o \137 #$(SRC)/UpdateMosaic.$(ARCH).o \138 #$(SRC)/UpdateSimple.$(ARCH).o \139 #$(SRC)/write_coords.$(ARCH).o \140 #$(SRC)/FixProblemImages.$(ARCH).o \141 #$(SRC)/StarMaps.$(ARCH).o \142 141 143 142 $(RELASTRO_CLIENT): $(INC)/relastro.h -
trunk/Ohana/src/relastro/doc/pv2.txt
r37038 r37807 1 2 2014.10.28 3 4 Going over the sequence of steps in relastro. I'm concerned that the 5 iteration is not modifying the measure.R,D values, preventing any 6 actual iterative improvements. 7 8 * UpdateObjects : takes measure.R,D to calculate average.R,D and 9 motion terms 10 11 * ImageOps : 12 * getImageRaw : takes measure.X,Y, applies image.coords to get (L,M), 13 (P,Q), etc, calculates 14 * getImageRef : takes average.R,D, applies image.coords to get 15 (P,Q), (L,M), etc 16 * FitChip : fit raw.X,Y to ref.L,M, plus residual map (dX,dY) 17 18 *** modified raw.L,M values are then dropped and not used to update measure.R.D 1 19 2 20 2014.07.03 -
trunk/Ohana/src/relastro/include/relastro.h
r37261 r37807 34 34 35 35 typedef struct { 36 floatR;37 floatD;36 double R; 37 double D; 38 38 unsigned int objID; 39 39 unsigned int catID; 40 40 } MeanPos; 41 42 typedef struct { 43 double R; 44 double D; 45 unsigned int objID; 46 unsigned int catID; 47 unsigned int imageID; 48 } MeasPos; 41 49 42 50 typedef struct { … … 47 55 int nFitAstrom; 48 56 int flags; 57 float refColorBlue; 58 float refColorRed; 49 59 } ImagePos; 50 60 … … 142 152 } FitStats; 143 153 154 typedef struct { 155 double scale; 156 double **Roff; 157 double **Doff; 158 double *dR; 159 int *Nra; 160 int Ndec; 161 } FrameCorrectionType; 162 163 typedef struct { 164 // AstromOffsetMap *map; 165 Coords *coords; // carries a pointer to the AstromOffsetMap 166 FrameCorrectionType *frame; 167 } FrameCorrectionSet; 168 169 170 typedef struct { 171 double *Rave; 172 double *Dave; 173 double *dRoff; 174 double *dDoff; 175 int Nicrfobj; 176 } ICRFobj; 177 144 178 /* global variables set in parameter file */ 145 179 # define DVO_MAX_PATH 1024 … … 172 206 double MIN_ERROR; 173 207 208 int IMFIT_TOO_FEW; // need more than this number of stars to fit an image 174 209 int IMFIT_CLIP_NITER; // number of clipping iterations to perform in FitChip 175 210 double IMFIT_CLIP_NSIGMA; // number of sigma to clip in FitChip … … 188 223 189 224 int USE_FIXED_PIXCOORDS; 225 int USE_GALAXY_MODEL; 226 int USE_ICRF_CORRECT; 227 228 int USE_ICRF_LOCAL; 229 int USE_ICRF_SHFIT; 230 int USE_ICRF_POLE; 190 231 191 232 int RESET; 233 int RESET_IMAGES; 192 234 int RESET_BAD_IMAGES; 193 235 int NLOOP; … … 204 246 int PLOTDELAY; 205 247 int CHIPORDER; 248 int CHIPMAP; 206 249 207 250 int MaxDensityUse; … … 242 285 int CLIP_THRESH; 243 286 int USE_BASIC_CHECK; 287 int APPLY_OFFSETS; // in parallel-regions mode, do not launch UpdateObjectOffsets unless -apply-offsets is called 244 288 245 289 int ExcludeBogus; … … 397 441 void FitSimple (StarData *raw, StarData *ref, int Nmatch, Coords *coords); 398 442 void initObjectData (Catalog *catalog, int Ncatalog); 399 int UpdateObjects (Catalog *catalog, int Ncatalog );443 int UpdateObjects (Catalog *catalog, int Ncatalog, int Nloop); 400 444 int UpdateSimple (Catalog *catalog, int Ncatalog); 401 445 int UpdateChips (Catalog *catalog, int Ncatalog); … … 417 461 StarData *getImageRef (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode); 418 462 StarData *getImageRaw (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode); 463 int setImageRaw (Catalog *catalog, int Ncatalog, off_t im, StarData *raw, off_t Nraw, CoordMode mode); 419 464 off_t getImageByID (off_t ID); 465 int updateImageRaw (Catalog *catalog, int Ncatalog, off_t im); 420 466 421 467 Mosaic *getmosaics (off_t *N); … … 447 493 int relastroGetVisual(void); 448 494 449 int FixProblemImages (SkyList *skylist);450 495 int *getCatlist (int *N, off_t im); 451 496 452 void initCoords (void); 453 void getOffsets (double *dPos, off_t *nPos, off_t N); 454 void saveOffsets (double dPos, off_t nPos, off_t N); 455 void setBadCoords (off_t N); 456 int badCoords (off_t N); 457 Coords *getCoords (off_t N); 458 int saveCoords (Coords *coords, off_t N); 459 void resetImageRaw (Catalog *catalog, int Ncatalog, off_t im); 497 void SaveCoords (Coords *tgt, Coords *src); 498 void RestoreCoords (Coords *tgt, Coords *src, Image *image); 460 499 461 500 int high_speed_catalogs (SkyTable *sky, SkyList *skylist, int hostID, char *hostpath); … … 468 507 int checkStarMap(int N); 469 508 int createStarMap (Catalog *catalog, int Ncatalog); 509 int printStarMap(int N, char *filename); 470 510 471 511 int GetScatterRawRef(float *dLsig, float *dMsig, float *dRsig, int *nKeep, StarData *raw, StarData *ref, int Nstars, float SigmaLimit); … … 519 559 MeanPos *MeanPosLoad(char *filename, off_t *nmeanpos); 520 560 561 int share_meas_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 562 int slurp_meas_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 563 int set_meas_pos (MeasPos *measpos, Average *average, MeasureTiny *measure); 564 MeasPos *merge_meas_pos (MeasPos *target, int *ntarget, MeasPos *source, int Nsource); 565 566 int MeasPosSave(char *filename, MeasPos *measpos, off_t Nmeaspos); 567 MeasPos *MeasPosLoad(char *filename, off_t *nmeaspos); 568 521 569 int indexCatalogs (Catalog *catalog, int Ncatalog); 522 570 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq); … … 528 576 529 577 int share_image_pos (RegionHostTable *regionHosts, int nloop); 530 int slurp_image_pos ( RegionHostTable *regionHosts, int nloop);578 int slurp_image_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 531 579 ImagePos *merge_image_pos (ImagePos *target, int *ntarget, ImagePos *source, int Nsource); 532 580 int set_image_pos (ImagePos *image_pos, Image *image); … … 547 595 int isGPC1stack (int photcode); 548 596 int isGPC1warp (int photcode); 597 598 int save_astrom_table (); 599 AstromOffsetTable *get_astrom_table (); 600 void put_astrom_table (AstromOffsetTable *myTable); 601 602 int fit_map (AstromOffsetMap *map, StarData *raw, StarData *ref, int Npts); 603 604 // ICRF QSOs : these must be marked in the database (flag on average, flag on measure) 605 606 void ICRFinit (); 607 int ICRFsave (int cat, int ave, int meas); 608 int ICRFdata (int n, int *cat, int *ave, int *meas); 609 int ICRFmax (); 610 int select_catalog_ICRF (Catalog *catalog, int Ncatalog); 611 612 void ICRFobjFree (ICRFobj *icrfobj); 613 ICRFobj *get_ICRF_data (Catalog *catalog, int Ncatalog); 614 ICRFobj *merge_icrf_obj (ICRFobj *target, ICRFobj *source); 615 ICRFobj *slurp_icrf_obj (RegionHostTable *regionHosts, int nloop); 616 int share_icrf_obj (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 617 618 int ICRFobjSave(char *filename, ICRFobj *icrfobj); 619 ICRFobj *ICRFobjLoad(char *filename); 620 621 int SHfitWithMask (double *R, double *D, double *value, int *mask, int Npts, SHterms *fit); 622 623 FrameCorrectionType *FrameCorrectionInit (double scale); 624 void FrameCorrectionFree (FrameCorrectionType *frame); 625 626 int FrameCorrectionParallelMaster (RegionHostTable *regionHosts); 627 int FrameCorrectionParallelSlave (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 628 int FrameCorrectionSerial (Catalog *catalog, int Ncatalog); 629 630 FrameCorrectionSet *FrameCorrectionMeasure (ICRFobj *icrfobj); 631 632 int FrameCorrectionFromSH (FrameCorrectionType *frame, SHterms *dR, SHterms *dD); 633 634 Coords *FrameCorrectionImageToMap (Header *header, Matrix *matrix, Coords *coords, int raDirection); 635 int FrameCorrectionMapToImage (Header *header, Matrix *matrix, Coords *coords, int raDirection); 636 int FrameCorrectionSHtoImage (Header *header, Matrix *matrix, FrameCorrectionType *frame, int raDirection); 637 FrameCorrectionType *FrameCorrectionImageToSH (Header *header, Matrix *matrix, FrameCorrectionType *frame, int raDirection); 638 int FrameCorrectionFromSH (FrameCorrectionType *frame, SHterms *dR, SHterms *dD); 639 void FrameCorrectionFree (FrameCorrectionType *frame); 640 FrameCorrectionType *FrameCorrectionInit (double scale); 641 void FrameCorrectionSetFree (FrameCorrectionSet *set); 642 FrameCorrectionSet *FrameCorrectionSetInit (); 643 644 int FrameCorrectionSetSave(char *filename, FrameCorrectionSet *set); 645 FrameCorrectionSet *FrameCorrectionSetLoad(char *filename); 646 647 int FrameCorrectionFitSH (ICRFobj *icrfobj, SHterms *dRc, SHterms *dDc); 648 int FrameCorrectionFitLocal (ICRFobj *icrfobj, Coords *coords); 649 int FrameCorrectionApply (Catalog *catalog, int Ncatalog, FrameCorrectionType *frame, Coords *coords); 650 651 int dump_stardata_pts (StarData *raw, int Npts, char *filename); 652 void printNcatTotal (); 653 654 int HarvestRegionHosts (RegionHostTable *regionHosts); 655 656 void lockUpdateChips (); 657 void unlockUpdateChips (); 658 659 int client_logger_init (char *dirname); 660 int client_logger_message (char *format,...); -
trunk/Ohana/src/relastro/src/BrightCatalog.c
r37038 r37807 43 43 if (!gfits_fread_header (f, &header)) { 44 44 if (VERBOSE) fprintf (stderr, "can't read image subset header\n"); 45 fclose (f);46 45 goto escape; 47 46 } 48 47 if (!gfits_fread_matrix (f, &matrix, &header)) { 49 48 if (VERBOSE) fprintf (stderr, "can't read image subset matrix\n"); 50 gfits_free_header (&header);51 fclose (f);52 49 goto escape; 53 50 } … … 70 67 GET_COLUMN(R, "RA", double); 71 68 GET_COLUMN(D, "DEC", double); 69 GET_COLUMN(RoffGAL, "ROFF_GAL", float); 70 GET_COLUMN(DoffGAL, "DOFF_GAL", float); 72 71 GET_COLUMN(M, "MAG_SYS", float); 73 72 GET_COLUMN(Mcal, "MAG_CAL", float); … … 94 93 measure[i].R = R[i]; 95 94 measure[i].D = D[i]; 95 measure[i].RoffGAL = RoffGAL[i]; 96 measure[i].DoffGAL = DoffGAL[i]; 96 97 measure[i].M = M[i]; 97 98 measure[i].Mcal = Mcal[i]; … … 115 116 free (R ); 116 117 free (D ); 118 free (RoffGAL ); 119 free (DoffGAL ); 117 120 free (M ); 118 121 free (Mcal ); … … 310 313 if (catalog) free (catalog); 311 314 312 fclose (f);315 if (f) fclose (f); 313 316 return NULL; 314 317 } … … 343 346 gfits_create_table_header (&theader, "BINTABLE", "MEASURE_TINY"); 344 347 345 gfits_define_bintable_column (&theader, "E", "RA_OFF", "ra offset", "arcsec", 1.0, 0.0); 346 gfits_define_bintable_column (&theader, "E", "DEC_OFF", "dec offset", "arcsec", 1.0, 0.0); 348 gfits_define_bintable_column (&theader, "D", "RA", "ra", "degrees", 1.0, 0.0); 349 gfits_define_bintable_column (&theader, "D", "DEC", "dec", "degrees", 1.0, 0.0); 350 gfits_define_bintable_column (&theader, "E", "ROFF_GAL", "ra offset", "arcsec", 1.0, 0.0); 351 gfits_define_bintable_column (&theader, "E", "DOFF_GAL", "dec offset", "arcsec", 1.0, 0.0); 347 352 gfits_define_bintable_column (&theader, "E", "MAG_SYS", "magnitude (sys)", NULL, 1.0, 0.0); 348 353 gfits_define_bintable_column (&theader, "E", "MAG_CAL", "magnitude (cal)", NULL, 1.0, 0.0); … … 368 373 double *R ; ALLOCATE (R , double, catalog->Nmeasure); 369 374 double *D ; ALLOCATE (D , double, catalog->Nmeasure); 375 float *RoffGAL ; ALLOCATE (RoffGAL , float, catalog->Nmeasure); 376 float *DoffGAL ; ALLOCATE (DoffGAL , float, catalog->Nmeasure); 370 377 float *M ; ALLOCATE (M , float, catalog->Nmeasure); 371 378 float *Mcal ; ALLOCATE (Mcal , float, catalog->Nmeasure); … … 390 397 R[i] = measure[i].R ; 391 398 D[i] = measure[i].D ; 399 RoffGAL[i] = measure[i].RoffGAL ; 400 DoffGAL[i] = measure[i].DoffGAL ; 392 401 M[i] = measure[i].M ; 393 402 Mcal[i] = measure[i].Mcal ; … … 411 420 gfits_set_bintable_column (&theader, &ftable, "RA", R, catalog->Nmeasure); 412 421 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); 422 gfits_set_bintable_column (&theader, &ftable, "ROFF_GAL", RoffGAL, catalog->Nmeasure); 423 gfits_set_bintable_column (&theader, &ftable, "DOFF_GAL", DoffGAL, catalog->Nmeasure); 413 424 gfits_set_bintable_column (&theader, &ftable, "MAG_SYS", M, catalog->Nmeasure); 414 425 gfits_set_bintable_column (&theader, &ftable, "MAG_CAL", Mcal, catalog->Nmeasure); … … 430 441 free (R ); 431 442 free (D ); 443 free (RoffGAL ); 444 free (DoffGAL ); 432 445 free (M ); 433 446 free (Mcal ); -
trunk/Ohana/src/relastro/src/ConfigInit.c
r36630 r37807 25 25 if (!ScanConfig (config, "RELASTRO_IMFIT_CLIP_NSIGMA", "%lf", 0, &IMFIT_CLIP_NSIGMA)) IMFIT_CLIP_NSIGMA = 3.0; 26 26 if (!ScanConfig (config, "RELASTRO_IMFIT_SYS_SIGMA_LIM", "%lf", 0, &IMFIT_SYS_SIGMA_LIM)) IMFIT_SYS_SIGMA_LIM = 0.01; 27 if (!ScanConfig (config, "RELASTRO_IMFIT_TOO_FEW", "%d", 0, &IMFIT_TOO_FEW)) IMFIT_TOO_FEW = 5; 27 28 28 29 if (!ScanConfig (config, "PM_DT_MIN", "%lf", 0, &PM_DT_MIN)) PM_DT_MIN = 0.25; … … 36 37 37 38 if (!ScanConfig (config, "USE_FIXED_PIXCOORDS", "%d", 0, &USE_FIXED_PIXCOORDS)) USE_FIXED_PIXCOORDS = FALSE; 39 if (!ScanConfig (config, "USE_GALAXY_MODEL", "%d", 0, &USE_GALAXY_MODEL)) USE_GALAXY_MODEL = FALSE; 40 if (!ScanConfig (config, "USE_ICRF_CORRECT", "%d", 0, &USE_ICRF_CORRECT)) USE_ICRF_CORRECT = FALSE; 41 if (!ScanConfig (config, "USE_ICRF_LOCAL", "%d", 0, &USE_ICRF_LOCAL)) USE_ICRF_LOCAL = FALSE; 42 if (!ScanConfig (config, "USE_ICRF_SHFIT", "%d", 0, &USE_ICRF_SHFIT)) USE_ICRF_SHFIT = FALSE; 43 if (!ScanConfig (config, "USE_ICRF_POLE", "%d", 0, &USE_ICRF_POLE)) USE_ICRF_POLE = FALSE; 38 44 39 45 // force CATDIR to be absolute (so parallel mode will work) -
trunk/Ohana/src/relastro/src/FitChip.c
r37038 r37807 14 14 15 15 for (Niter = 0; Niter < IMFIT_CLIP_NITER; Niter ++) { 16 16 17 17 // measure the scatter for the unmarked (good) measurements with dM < limit 18 18 // SIGMA_LIM here is redundant with ImageOps.c:915 … … 49 49 // use that count to set order_use below 50 50 51 // 20140925 : the same logic below is used to constrain the dimensions of the image map 52 51 53 // figures to assess the fitting process: 52 54 // x vs dx, x vs dy, y vs dx, y vs dy : 53 55 // residual vector field 54 56 // dx vs mag, dy vs mag 57 if (relastroGetVisual()) { 58 fprintf (stderr, "fitting chip %s, %d matched stars\n", image->name, Nmatch); 59 } 55 60 relastroVisualPlotChipFit(raw, ref, dRmax, Nmatch); 61 62 // for polynomial fits, I used (5,30,60) = (5,6,7) stars per term 56 63 57 64 // set the maximum order for the polynomial (based on number of stars kept above) 58 65 int order_use = 0; 59 if (Nkeep > 5) order_use = 1; // 4 stars per polynomial term (per dimension) 60 if (Nkeep > 30) order_use = 2; // 5 stars per polynomial term (per dimension) 61 if (Nkeep > 60) order_use = 3; // 6 stars per polynomial term (per dimension) 66 if (Nkeep > 5) order_use = 1; // 5 stars per cell 67 if (Nkeep > 24) order_use = 2; // 6 stars per cell 68 if (Nkeep > 63) order_use = 3; // 7 stars per cell 69 if (Nkeep > 128) order_use = 4; // 8 stars per cell 70 if (Nkeep > 225) order_use = 5; // 9 stars per cell 71 if (Nkeep > 360) order_use = 6; // 10 stars per cell 62 72 if (order_use < 1) { 63 73 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nkeep); … … 65 75 return FALSE; 66 76 } 67 image[0].coords.Npolyterms = order_use; 77 if (CHIPMAP) { 78 order_use = MIN(MIN(order_use, CHIPMAP), 6); // can only go up to 6th order map (can be user limited) 79 } else { 80 order_use = MIN(order_use, 3); // can only go up to 3rd order for polynomials 81 } 82 83 if (VERBOSE2) fprintf (stderr, "using %d for %s\n", order_use, image[0].name); 84 85 // when fitting the map, first fit a linear model (below? change Npolyterms to -1) 86 image[0].coords.Npolyterms = CHIPMAP ? 1 : order_use; 68 87 69 88 if (fit) fit_free (fit); … … 91 110 } 92 111 112 // apply fit to get the fitted X,Y coordinates. we need these to fit the residual map below 93 113 for (i = 0; i < Nmatch; i++) { 114 // we have not yet fitted the map, so Npolyterms needs to be 1 here: 115 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[0].coords); 116 } 117 118 if (CHIPMAP) { 119 if (image[0].coords.offsetMap == NULL) { 120 // allocate a new table and assign to this image 121 // need to lock threads here because 'table' is a static with 122 // modifiable elements 123 lockUpdateChips (); 124 AstromOffsetTable *table = get_astrom_table (); 125 AstromOffsetTableNewMap(table, order_use, order_use, image); 126 unlockUpdateChips (); 127 } 128 // XXX Need to check / update the order of the map here. if we already have a map, it might have been 129 // allocated with too small arrays 130 AstromOffsetMapSetOrder (image[0].coords.offsetMap, order_use, order_use, image); 131 image[0].coords.offsetMap->keep = TRUE; // if we are trying or re-trying this map, we should keep it unless it fails 132 fit_map (image[0].coords.offsetMap, raw, ref, Nmatch); 133 image[0].coords.Npolyterms = -1; 134 } 135 136 if (!strcmp(image[0].name, "o5745g0403o.356777.cm.982487.smf[XY17.hdr]")) { 137 fprintf (stderr, "test image\n"); 138 } 139 140 for (i = 0; i < Nmatch; i++) { 141 // if we have fitted the map above, Npolyterms needs to be -1 here: 94 142 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[0].coords); 95 143 } 96 97 144 } 98 145 … … 223 270 L,M -> X,Y (polynomial transformation : WRP) 224 271 225 Some details about this function:226 227 - the initial value of the clipping radius is set based on the distribution of the dR228 values for the bright sources.229 230 - NITER clipping passes are performed231 232 - the per-star astrometric errors are included in the fit. The photcode table controls233 whether only the reported positional errors are used, or if the magnitudes errors are234 scaled to determine the error, and if there is a systematic floor for all sources.235 236 - input detections are pre-filtered on the basis of the photFlags, etc, in bcatalog237 238 - outlying detections are clipped in the iterative passes, but the clipped detections are239 not recorded272 Some details about this function: 273 274 - the initial value of the clipping radius is set based on the distribution of the dR 275 values for the bright sources. 276 277 - NITER clipping passes are performed 278 279 - the per-star astrometric errors are included in the fit. The photcode table controls 280 whether only the reported positional errors are used, or if the magnitudes errors are 281 scaled to determine the error, and if there is a systematic floor for all sources. 282 283 - input detections are pre-filtered on the basis of the photFlags, etc, in bcatalog 284 285 - outlying detections are clipped in the iterative passes, but the clipped detections are 286 not recorded 240 287 241 288 */ … … 243 290 /* example using fit_apply() : 244 291 245 f = fopen ("test3.dat", "w"); 246 247 // apply new coords to raw (X,Y -> L,M) 248 for (i = 0; i < Nmatch; i++) { 249 fprintf (f, "%f %f %f %f ", raw[i].X, raw[i].Y, raw[i].L, raw[i].M); 250 fit_apply (newfit, &L1, &M1, raw[i].X - coords[0].crpix1, raw[i].Y - coords[0].crpix2); 251 fprintf (f, "%f %f\n", L1, M1); 292 f = fopen ("test3.dat", "w"); 293 294 // apply new coords to raw (X,Y -> L,M) 295 for (i = 0; i < Nmatch; i++) { 296 fprintf (f, "%f %f %f %f ", raw[i].X, raw[i].Y, raw[i].L, raw[i].M); 297 fit_apply (newfit, &L1, &M1, raw[i].X - coords[0].crpix1, raw[i].Y - coords[0].crpix2); 298 fprintf (f, "%f %f\n", L1, M1); 299 } 300 fclose (f); 301 */ 302 303 int fit_map (AstromOffsetMap *map, StarData *raw, StarData *ref, int Npts) { 304 305 // we are actually fitting the residual after the linear fit has been taken off 306 307 // fit the linear terms as above 308 // calculate dX (raw.X - ref.X) and dY 309 310 int i, N; 311 312 float *x, *y, *dX, *dY; 313 ALLOCATE (x, float, Npts); 314 ALLOCATE (y, float, Npts); 315 ALLOCATE (dX, float, Npts); 316 ALLOCATE (dY, float, Npts); 317 318 N = 0; 319 for (i = 0; i < Npts; i++) { 320 if (raw[i].mask) continue; 321 x[N] = raw[i].X; 322 y[N] = raw[i].Y; 323 dX[N] = ref[i].X - raw[i].X; 324 dY[N] = ref[i].Y - raw[i].Y; 325 N++; 326 } 327 328 // in coordsops.c:XY_to_LM, the map is defined to carry dX,dY so that: 329 // (L,M) = f(X',Y') : (X',Y') = (X,Y) + (dX,dY) 330 331 AstromOffsetMapFit (map, x, y, dX, N, TRUE); 332 AstromOffsetMapFit (map, x, y, dY, N, FALSE); 333 334 AstromOffsetMapRepair (map, TRUE); 335 AstromOffsetMapRepair (map, FALSE); 336 337 free (x); 338 free (y); 339 free (dX); 340 free (dY); 341 342 return TRUE; 343 } 344 345 int dump_stardata_pts (StarData *raw, int Npts, char *filename) { 346 347 FILE *f = fopen (filename, "w"); 348 if (!f) { 349 fprintf (stderr, "failed to open file %s\n", filename); 350 return FALSE; 351 } 352 353 int i; 354 for (i = 0; i < Npts; i++) { 355 fprintf (f, "%4d %10.6f %10.6f %10.6f %10.6f %9.2f %9.2f %9.2f %9.2f %9.4f %3d\n", 356 i, raw[i].R, raw[i].D, raw[i].P, raw[i].Q, raw[i].L, raw[i].M, raw[i].X, raw[i].Y, raw[i].dPos, raw[i].mask); 252 357 } 253 358 fclose (f); 254 */ 255 359 360 return TRUE; 361 } -
trunk/Ohana/src/relastro/src/ImageOps.c
r37038 r37807 28 28 static off_t *imageIDs; // list of all image IDs 29 29 static off_t *imageIdx; // list of index for image IDs 30 # else 30 31 // as an alternative, we generate imageSeq, which directly maps imageID -> seq 32 static off_t *imageSeq; // list of index for image IDs 33 34 // MAX_ID requires 512M to store the image index 35 # define MAX_ID 0x8000000 36 static off_t minImageID = MAX_ID; 37 static off_t maxImageID = 0; 38 39 # else /* not using IMAGE_ID */ 31 40 static unsigned int *start; 32 41 static unsigned int *stop; … … 84 93 imageIdx[i] = i; 85 94 imageIDs[i] = image[i].imageID; 95 minImageID = MIN(minImageID, image[i].imageID); 96 maxImageID = MAX(maxImageID, image[i].imageID); 97 myAssert (image[i].imageID < MAX_ID, "image IDs too large for index memory"); 86 98 } 87 99 llsortpair (imageIDs, imageIdx, Nimage); 100 101 ALLOCATE (imageSeq, off_t, maxImageID + 1); 102 for (i = 0; i < maxImageID + 1; i++) { 103 imageSeq[i] = -1; // not yet assigned 104 } 105 106 for (i = 0; i < Nimage; i++) { 107 off_t N = image[i].imageID; 108 myAssert (imageSeq[N] == -1, "previously assigned"); 109 imageSeq[N] = i; 110 } 111 88 112 # else 89 113 ALLOCATE (start, unsigned, Nimage); … … 98 122 99 123 off_t getImageByID (off_t ID) { 124 # if USE_IMAGE_ID 125 126 if (imageSeq) { 127 if (ID < minImageID) return (-1); 128 if (ID > maxImageID) return (-1); 129 off_t N = imageSeq[ID]; 130 return N; 131 } 100 132 101 133 // we have a pair of vectors (imageIDs, imageIdx) sorted by imageIDs 102 134 // use bisection to find the specified image ID 103 135 104 # if USE_IMAGE_ID105 136 off_t Nlo, Nhi, N; 106 137 … … 207 238 if (VERBOSE2 || (MATCHCAT && (N_onImage[i] < 20))) { 208 239 name = GetPhotcodeNamebyCode (image[i].photcode); 209 fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s)", i, image[i].imageID, image[i].name, N_onImage[i], image[i].nstar, 240 int showExample = (Nfew < 30); 241 if (showExample) fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s) ", i, image[i].imageID, image[i].name, N_onImage[i], image[i].nstar, 210 242 ohana_sec_to_date(image[i].tzero), name); 211 243 if (N_onImage[i] < 20) { 212 fprintf (stderr, "*");244 if (showExample) fprintf (stderr, "*"); 213 245 Nfew ++; 214 246 } 215 247 if (N_onImage[i] < 15) { 216 fprintf (stderr, "*** warning ***");248 if (showExample) fprintf (stderr, "*** warning ***"); 217 249 Nbad ++; 218 250 } 219 fprintf (stderr, "\n");220 } 221 } 222 fprintf (stderr, OFF_T_FMT" total images, %d with < 20 measurements, %d with < 15\n", Nimage, Nfew, Nbad);251 if (showExample) fprintf (stderr, "\n"); 252 } 253 } 254 if (MATCHCAT) fprintf (stderr, OFF_T_FMT" total images, %d with < 20 measurements, %d with < 15\n", Nimage, Nfew, Nbad); 223 255 } 224 256 … … 245 277 } 246 278 279 if (!ID) return; // detection not associated with an image 280 247 281 idx = getImageByID (ID); 248 282 if (idx == -1) { … … 250 284 return; 251 285 } 286 measure->myDet = TRUE; // I 'own' this detection (I am calibrating its image) 252 287 253 288 // index for (catalog, measure) -> image … … 334 369 # endif 335 370 336 /*337 Coords *getCoords (off_t meas, int cat) {338 339 off_t i;340 341 i = MeasureToImage[cat][meas];342 if (i == -1) return (NULL);343 return (&image[i].coords);344 }345 */346 347 371 float getColorBlue (off_t meas, int cat) { 348 372 … … 433 457 Coords *moscoords, *imcoords; 434 458 435 // check if this image is bad and should be skipped436 if (badCoords(im)) return;437 438 459 // WRP images need to have an associated mosaic 439 460 moscoords = NULL; … … 491 512 492 513 int TESTPT = FALSE; 493 494 TESTPT |= CAT_ID_SRC && OBJ_ID_SRC && (measure->imageID == CAT_ID_SRC) && (measure->detID == OBJ_ID_SRC); 495 TESTPT |= CAT_ID_DST && OBJ_ID_DST && (measure->imageID == CAT_ID_DST) && (measure->detID == OBJ_ID_DST); 514 TESTPT |= CAT_ID_SRC && OBJ_ID_SRC && (measure->catID == CAT_ID_SRC) && (measure->objID == OBJ_ID_SRC); 515 TESTPT |= CAT_ID_DST && OBJ_ID_DST && (measure->catID == CAT_ID_DST) && (measure->objID == OBJ_ID_DST); 496 516 if (TESTPT) { 497 517 fprintf (stderr, "got test det\n"); … … 597 617 int Noff = NoffRAave + NoffDECave + NoffRAori + NoffDECori; 598 618 if (VERBOSE2 && (Noff > 0)) fprintf (stderr, "Noff ave RA %d, Noff ave DEC %d, Noff ori RA %d, Noff ori DEC %d\n", NoffRAave, NoffDECave, NoffRAori, NoffDECori); 599 saveOffsets (dPos, nPos, im);600 619 601 620 return; … … 604 623 void printNcatTotal () { 605 624 fprintf (stderr, "NcatTotal: %d\n", NcatTotal); 606 }607 608 // return StarData values for detections in the specified image, converting coordinates from the609 // chip positions: X,Y -> L,M -> P,Q -> R,D610 void resetImageRaw (Catalog *catalog, int Ncatalog, off_t im) {611 612 off_t i, m, c, n;613 double X, Y, L, M, P, Q, R, D;614 615 Mosaic *mosaic;616 Coords *moscoords, *imcoords, *oldcoords;617 618 fprintf (stderr, "fix resetImageRaw wrt MeasureTiny\n");619 abort();620 621 // check if this image is bad and should be skipped622 if (!badCoords(im)) {623 fprintf (stderr, "ERROR: inconsistent result?");624 abort();625 }626 627 // replace the current coords with the old coords:628 oldcoords = getCoords (im);629 memcpy (&image[im].coords, oldcoords, sizeof(Coords));630 631 // WRP images need to have an associated mosaic632 moscoords = NULL;633 if (!strcmp(&image[im].coords.ctype[4], "-WRP")) {634 mosaic = getMosaicForImage (im);635 if (mosaic == NULL) return; // if we cannot find the associated image, skip it636 moscoords = &mosaic[0].coords;637 }638 imcoords = &image[im].coords;639 640 for (i = 0; i < N_onImage[im]; i++) {641 m = ImageToMeasure[im][i];642 c = ImageToCatalog[im][i];643 644 // XXX unclear if this should use Measure or MeasureTiny; it is only called by FixProblemImages, which has not been updated645 Measure *measure = &catalog[c].measure[m];646 647 X = measure[0].Xccd;648 Y = measure[0].Yccd;649 if (USE_FIXED_PIXCOORDS) {650 if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) {651 float dX = measure[0].Xfix - measure[0].Xccd;652 float dY = measure[0].Yfix - measure[0].Yccd;653 if (hypot(dX,dY) < 2.0) {654 X = measure[0].Xfix;655 Y = measure[0].Yfix;656 }657 }658 }659 n = measure[0].averef;660 661 if (moscoords == NULL) {662 // this is a Simple image (not a mosaic)663 // note that for a Simple image, L,M = P,Q664 XY_to_LM (&L, &M, X, Y, imcoords);665 LM_to_RD (&R, &D, L, M, imcoords);666 } else {667 XY_to_LM (&L, &M, X, Y, imcoords);668 XY_to_LM (&P, &Q, L, M, moscoords);669 LM_to_RD (&R, &D, P, Q, moscoords);670 }671 measure[0].R = R;672 measure[0].D = D;673 674 float dRoff = dvoOffsetR(measure, &catalog[c].average[n]);675 676 if (dRoff > +180.0*3600.0) {677 // average on high end of boundary, move star up678 measure[0].R += 360.0;679 dRoff -= 360.0*3600.0;680 }681 if (dRoff < -180.0*3600.0) {682 measure[0].R -= 360.0;683 dRoff += 360.0*3600.0;684 }685 }686 687 return;688 625 } 689 626 … … 736 673 737 674 n = measure[0].averef; 675 676 int TESTPT = FALSE; 677 TESTPT |= CAT_ID_SRC && OBJ_ID_SRC && (catalog[c].average[n].catID == CAT_ID_SRC) && (catalog[c].average[n].objID == OBJ_ID_SRC); 678 TESTPT |= CAT_ID_DST && OBJ_ID_DST && (catalog[c].average[n].catID == CAT_ID_DST) && (catalog[c].average[n].objID == OBJ_ID_DST); 679 if (TESTPT) { 680 fprintf (stderr, "got test det\n"); 681 } 738 682 739 683 // an object with only one detection provides no information about the image calibration … … 808 752 ref[i].D = catalog[c].average[n].D; 809 753 754 // if we are correcting for the Galaxy Motion Model, we assume the mean R,D is at the J2000 epoch position 755 if (USE_GALAXY_MODEL) { 756 myAssert (!isnan(measure[0].RoffGAL), "oops"); 757 myAssert (!isnan(measure[0].DoffGAL), "oops"); 758 ref[i].R += measure[0].RoffGAL / 3600.0; 759 ref[i].D += measure[0].DoffGAL / 3600.0; 760 } 761 810 762 ref[i].Mag = measure[0].M; 811 763 ref[i].dMag = measure[0].dM; … … 842 794 *Nstars = N_onImage[im]; 843 795 return (ref); 796 } 797 798 // return StarData values for detections in the specified image, converting coordinates from the 799 // chip positions: X,Y -> L,M -> P,Q -> R,D. This function is used by the image fitting steps, for 800 // which the detections have already been filtered when they were loaded (bcatalog) 801 int setImageRaw (Catalog *catalog, int Ncatalog, off_t im, StarData *raw, off_t Nraw, CoordMode mode) { 802 803 off_t i, m, c; 804 805 Coords *moscoords; 806 807 moscoords = NULL; 808 if (mode == MODE_MOSAIC) { 809 moscoords = image[im].coords.mosaic; 810 myAssert (moscoords, "coords.mosaic not defined for image %s (%d)", image[im].name, (int) im); 811 } 812 813 myAssert (Nraw == N_onImage[im], "impossible!"); 814 815 for (i = 0; i < N_onImage[im]; i++) { 816 m = ImageToMeasure[im][i]; 817 c = ImageToCatalog[im][i]; 818 819 // XXX should I use the raw coords or just measure.X,Y -> R,D? 820 821 switch (mode) { 822 case MODE_SIMPLE: 823 /* note that for a Simple image, L,M = P,Q */ 824 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 825 raw[i].P = raw[i].L; 826 raw[i].Q = raw[i].M; 827 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 828 break; 829 case MODE_MOSAIC: 830 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 831 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 832 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 833 break; 834 default: 835 fprintf (stderr, "error: invalid mode in getImageRaw"); 836 abort (); 837 } 838 839 MeasureTiny *measure = &catalog[c].measureT[m]; 840 measure->R = raw[i].R; 841 measure->D = raw[i].D; 842 if (catalog[c].measure) { 843 catalog[c].measure[m].R = raw[i].R; 844 catalog[c].measure[m].D = raw[i].D; 845 } 846 } 847 return TRUE; 848 } 849 850 // return StarData values for detections in the specified image, converting coordinates from the 851 // chip positions: X,Y -> L,M -> P,Q -> R,D. This function is used by the image fitting steps, for 852 // which the detections have already been filtered when they were loaded (bcatalog) 853 int updateImageRaw (Catalog *catalog, int Ncatalog, off_t im) { 854 855 off_t i, m, c; 856 857 for (i = 0; i < N_onImage[im]; i++) { 858 m = ImageToMeasure[im][i]; 859 c = ImageToCatalog[im][i]; 860 861 MeasureTiny *measure = &catalog[c].measureT[m]; 862 863 /* apply the current image transformation or use the current value of R+dR, D+dD? */ 864 double X = measure[0].Xccd; 865 double Y = measure[0].Yccd; 866 if (USE_FIXED_PIXCOORDS) { 867 if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) { 868 float dX = measure[0].Xfix - measure[0].Xccd; 869 float dY = measure[0].Yfix - measure[0].Yccd; 870 if (hypot(dX,dY) < 2.0) { 871 X = measure[0].Xfix; 872 Y = measure[0].Yfix; 873 } 874 } 875 } 876 877 double R, D; 878 XY_to_RD (&R, &D, X, Y, &image[im].coords); 879 measure->R = R; 880 measure->D = D; 881 if (catalog[c].measure) { 882 catalog[c].measure[m].R = R; 883 catalog[c].measure[m].D = D; 884 } 885 } 886 return TRUE; 844 887 } 845 888 -
trunk/Ohana/src/relastro/src/ImagePosIO.c
r36630 r37807 70 70 GET_COLUMN (polyterms, "POLYTERMS", float); // verify that we got 14 columns? 71 71 GET_COLUMN (ctype, "CTYPE", char); // verify that we got 15 columns? 72 GET_COLUMN (Npolyterms, "NPOLYTERMS", char);72 GET_COLUMN (Npolyterms, "NPOLYTERMS", byte); 73 73 GET_COLUMN (dXpixSys, "XPIX_SYS_ERR", float); 74 74 GET_COLUMN (dYpixSys, "YPIX_SYS_ERR", float); 75 GET_COLUMN (refColorBlue, "REF_COLOR_BLUE", float); 76 GET_COLUMN (refColorRed, "REF_COLOR_RED", float); 75 77 GET_COLUMN (imageID, "ID", int); 76 78 GET_COLUMN (nFitAstrom, "NFIT", int); … … 85 87 ALLOCATE (image_pos, ImagePos, Nrow); 86 88 for (i = 0; i < Nrow; i++) { 87 image_pos[i].coords.crval1 = crval1 [i]; 88 image_pos[i].coords.crval2 = crval2 [i]; 89 image_pos[i].coords.crpix1 = crpix1 [i]; 90 image_pos[i].coords.crpix2 = crpix2 [i]; 91 image_pos[i].coords.cdelt1 = cdelt1 [i]; 92 image_pos[i].coords.cdelt2 = cdelt2 [i]; 93 image_pos[i].coords.pc1_1 = pc1_1 [i]; 94 image_pos[i].coords.pc1_2 = pc1_2 [i]; 95 image_pos[i].coords.pc2_1 = pc2_1 [i]; 96 image_pos[i].coords.pc2_2 = pc2_2 [i]; 97 image_pos[i].coords.Npolyterms = Npolyterms[i]; 98 image_pos[i].dXpixSys = dXpixSys [i]; 99 image_pos[i].dYpixSys = dYpixSys [i]; 100 image_pos[i].imageID = imageID [i]; 101 image_pos[i].nFitAstrom = nFitAstrom[i]; 102 image_pos[i].flags = flags [i]; 89 InitCoords(&image_pos[i].coords, NULL); 90 image_pos[i].coords.crval1 = crval1 [i]; 91 image_pos[i].coords.crval2 = crval2 [i]; 92 image_pos[i].coords.crpix1 = crpix1 [i]; 93 image_pos[i].coords.crpix2 = crpix2 [i]; 94 image_pos[i].coords.cdelt1 = cdelt1 [i]; 95 image_pos[i].coords.cdelt2 = cdelt2 [i]; 96 image_pos[i].coords.pc1_1 = pc1_1 [i]; 97 image_pos[i].coords.pc1_2 = pc1_2 [i]; 98 image_pos[i].coords.pc2_1 = pc2_1 [i]; 99 image_pos[i].coords.pc2_2 = pc2_2 [i]; 100 image_pos[i].coords.Npolyterms = Npolyterms [i]; 101 image_pos[i].dXpixSys = dXpixSys [i]; 102 image_pos[i].dYpixSys = dYpixSys [i]; 103 image_pos[i].refColorBlue = refColorBlue[i]; 104 image_pos[i].refColorRed = refColorRed [i]; 105 image_pos[i].imageID = imageID [i]; 106 image_pos[i].nFitAstrom = nFitAstrom [i]; 107 image_pos[i].flags = flags [i]; 103 108 104 109 // polyterms and ctype are a bit different … … 108 113 fprintf (stderr, "loaded data for %lld images\n", (long long) Nrow); 109 114 110 free (crval1 ); 111 free (crval2 ); 112 free (crpix1 ); 113 free (crpix2 ); 114 free (cdelt1 ); 115 free (cdelt2 ); 116 free (pc1_1 ); 117 free (pc1_2 ); 118 free (pc2_1 ); 119 free (pc2_2 ); 120 free (polyterms ); 121 free (ctype ); 122 free (Npolyterms); 123 free (dXpixSys ); 124 free (dYpixSys ); 125 free (imageID ); 126 free (nFitAstrom); 127 free (flags ); 115 free (crval1 ); 116 free (crval2 ); 117 free (crpix1 ); 118 free (crpix2 ); 119 free (cdelt1 ); 120 free (cdelt2 ); 121 free (pc1_1 ); 122 free (pc1_2 ); 123 free (pc2_1 ); 124 free (pc2_2 ); 125 free (polyterms ); 126 free (ctype ); 127 free (Npolyterms ); 128 free (dXpixSys ); 129 free (dYpixSys ); 130 free (refColorBlue); 131 free (refColorRed ); 132 free (imageID ); 133 free (nFitAstrom ); 134 free (flags ); 128 135 129 136 *nimage_pos = Nrow; … … 153 160 gfits_create_table_header (&theader, "BINTABLE", "IMAGE_POS"); 154 161 155 gfits_define_bintable_column (&theader, "D", "CRVAL1", "word", "unit", 1.0, 0.0); 156 gfits_define_bintable_column (&theader, "D", "CRVAL2", "word", "unit", 1.0, 0.0); 157 gfits_define_bintable_column (&theader, "E", "CRPIX1", "word", "unit", 1.0, 0.0); 158 gfits_define_bintable_column (&theader, "E", "CRPIX2", "word", "unit", 1.0, 0.0); 159 gfits_define_bintable_column (&theader, "E", "CDELT1", "word", "unit", 1.0, 0.0); 160 gfits_define_bintable_column (&theader, "E", "CDELT2", "word", "unit", 1.0, 0.0); 161 gfits_define_bintable_column (&theader, "E", "PC1_1", "word", "unit", 1.0, 0.0); 162 gfits_define_bintable_column (&theader, "E", "PC1_2", "word", "unit", 1.0, 0.0); 163 gfits_define_bintable_column (&theader, "E", "PC2_1", "word", "unit", 1.0, 0.0); 164 gfits_define_bintable_column (&theader, "E", "PC2_2", "word", "unit", 1.0, 0.0); 165 gfits_define_bintable_column (&theader, "14E", "POLYTERMS", "word", "unit", 1.0, 0.0); 166 gfits_define_bintable_column (&theader, "15A", "CTYPE", "word", "unit", 1.0, 0.0); 167 gfits_define_bintable_column (&theader, "L", "NPOLYTERMS", "word", "unit", 1.0, 0.0); 168 gfits_define_bintable_column (&theader, "E", "XPIX_SYS_ERR", "word", "unit", 1.0, 0.0); 169 gfits_define_bintable_column (&theader, "E", "YPIX_SYS_ERR", "word", "unit", 1.0, 0.0); 170 gfits_define_bintable_column (&theader, "J", "ID", "image ID", "unitless", 1.0, 0.0); 171 gfits_define_bintable_column (&theader, "J", "NFIT", "number of fitted stars", "unitless", 1.0, 0.0); 172 gfits_define_bintable_column (&theader, "J", "FLAGS", "analysis flags", "unitless", 1.0, 0.0); 162 gfits_define_bintable_column (&theader, "D", "CRVAL1", "word", "unit", 1.0, 0.0); 163 gfits_define_bintable_column (&theader, "D", "CRVAL2", "word", "unit", 1.0, 0.0); 164 gfits_define_bintable_column (&theader, "E", "CRPIX1", "word", "unit", 1.0, 0.0); 165 gfits_define_bintable_column (&theader, "E", "CRPIX2", "word", "unit", 1.0, 0.0); 166 gfits_define_bintable_column (&theader, "E", "CDELT1", "word", "unit", 1.0, 0.0); 167 gfits_define_bintable_column (&theader, "E", "CDELT2", "word", "unit", 1.0, 0.0); 168 gfits_define_bintable_column (&theader, "E", "PC1_1", "word", "unit", 1.0, 0.0); 169 gfits_define_bintable_column (&theader, "E", "PC1_2", "word", "unit", 1.0, 0.0); 170 gfits_define_bintable_column (&theader, "E", "PC2_1", "word", "unit", 1.0, 0.0); 171 gfits_define_bintable_column (&theader, "E", "PC2_2", "word", "unit", 1.0, 0.0); 172 gfits_define_bintable_column (&theader, "14E", "POLYTERMS", "word", "unit", 1.0, 0.0); 173 gfits_define_bintable_column (&theader, "15A", "CTYPE", "word", "unit", 1.0, 0.0); 174 gfits_define_bintable_column (&theader, "L", "NPOLYTERMS", "word", "unit", 1.0, 0.0); 175 gfits_define_bintable_column (&theader, "E", "XPIX_SYS_ERR", "word", "unit", 1.0, 0.0); 176 gfits_define_bintable_column (&theader, "E", "YPIX_SYS_ERR", "word", "unit", 1.0, 0.0); 177 gfits_define_bintable_column (&theader, "E", "REF_COLOR_BLUE", "word", "unit", 1.0, 0.0); 178 gfits_define_bintable_column (&theader, "E", "REF_COLOR_RED", "word", "unit", 1.0, 0.0); 179 gfits_define_bintable_column (&theader, "J", "ID", "image ID", "unitless", 1.0, 0.0); 180 gfits_define_bintable_column (&theader, "J", "NFIT", "number of fitted stars", "unitless", 1.0, 0.0); 181 gfits_define_bintable_column (&theader, "J", "FLAGS", "analysis flags", "unitless", 1.0, 0.0); 173 182 174 183 // generate the output array that carries the data 175 184 gfits_create_table (&theader, &ftable); 176 185 177 double *crval1 ; 178 double *crval2 ; 179 float *crpix1 ; 180 float *crpix2 ; 181 float *cdelt1 ; 182 float *cdelt2 ; 183 float *pc1_1 ; 184 float *pc1_2 ; 185 float *pc2_1 ; 186 float *pc2_2 ; 187 float *polyterms ; 188 char *ctype ; 189 char *Npolyterms; 190 float *dXpixSys ; 191 float *dYpixSys ; 192 int *imageID ; 193 int *nFitAstrom; 194 int *flags ; 186 double *crval1 ; 187 double *crval2 ; 188 float *crpix1 ; 189 float *crpix2 ; 190 float *cdelt1 ; 191 float *cdelt2 ; 192 float *pc1_1 ; 193 float *pc1_2 ; 194 float *pc2_1 ; 195 float *pc2_2 ; 196 float *polyterms ; 197 char *ctype ; 198 char *Npolyterms ; 199 float *dXpixSys ; 200 float *dYpixSys ; 201 float *refColorBlue; 202 float *refColorRed ; 203 int *imageID ; 204 int *nFitAstrom ; 205 int *flags ; 195 206 196 207 // create intermediate storage arrays … … 210 221 ALLOCATE (dXpixSys , float , Nimage_pos); 211 222 ALLOCATE (dYpixSys , float , Nimage_pos); 223 ALLOCATE (refColorBlue, float , Nimage_pos); 224 ALLOCATE (refColorRed , float , Nimage_pos); 212 225 ALLOCATE (imageID , int , Nimage_pos); 213 226 ALLOCATE (nFitAstrom, int , Nimage_pos); … … 216 229 // assign the storage arrays 217 230 for (i = 0; i < Nimage_pos; i++) { 218 crval1 [i] = image_pos[i].coords.crval1 ; 219 crval2 [i] = image_pos[i].coords.crval2 ; 220 crpix1 [i] = image_pos[i].coords.crpix1 ; 221 crpix2 [i] = image_pos[i].coords.crpix2 ; 222 cdelt1 [i] = image_pos[i].coords.cdelt1 ; 223 cdelt2 [i] = image_pos[i].coords.cdelt2 ; 224 pc1_1 [i] = image_pos[i].coords.pc1_1 ; 225 pc1_2 [i] = image_pos[i].coords.pc1_2 ; 226 pc2_1 [i] = image_pos[i].coords.pc2_1 ; 227 pc2_2 [i] = image_pos[i].coords.pc2_2 ; 228 Npolyterms[i] = image_pos[i].coords.Npolyterms; 229 dXpixSys [i] = image_pos[i].dXpixSys ; 230 dYpixSys [i] = image_pos[i].dYpixSys ; 231 imageID [i] = image_pos[i].imageID ; 232 nFitAstrom[i] = image_pos[i].nFitAstrom ; 233 flags [i] = image_pos[i].flags ; 231 crval1 [i] = image_pos[i].coords.crval1 ; 232 crval2 [i] = image_pos[i].coords.crval2 ; 233 crpix1 [i] = image_pos[i].coords.crpix1 ; 234 crpix2 [i] = image_pos[i].coords.crpix2 ; 235 cdelt1 [i] = image_pos[i].coords.cdelt1 ; 236 cdelt2 [i] = image_pos[i].coords.cdelt2 ; 237 pc1_1 [i] = image_pos[i].coords.pc1_1 ; 238 pc1_2 [i] = image_pos[i].coords.pc1_2 ; 239 pc2_1 [i] = image_pos[i].coords.pc2_1 ; 240 pc2_2 [i] = image_pos[i].coords.pc2_2 ; 241 Npolyterms [i] = image_pos[i].coords.Npolyterms; 242 dXpixSys [i] = image_pos[i].dXpixSys ; 243 dYpixSys [i] = image_pos[i].dYpixSys ; 244 refColorBlue[i] = image_pos[i].refColorBlue ; 245 refColorRed [i] = image_pos[i].refColorRed ; 246 imageID [i] = image_pos[i].imageID ; 247 nFitAstrom [i] = image_pos[i].nFitAstrom ; 248 flags [i] = image_pos[i].flags ; 234 249 235 250 // polyterms and ctype are a bit different … … 239 254 240 255 // add the columns to the output array 241 gfits_set_bintable_column (&theader, &ftable, "CRVAL1", crval1 , Nimage_pos); 242 gfits_set_bintable_column (&theader, &ftable, "CRVAL2", crval2 , Nimage_pos); 243 gfits_set_bintable_column (&theader, &ftable, "CRPIX1", crpix1 , Nimage_pos); 244 gfits_set_bintable_column (&theader, &ftable, "CRPIX2", crpix2 , Nimage_pos); 245 gfits_set_bintable_column (&theader, &ftable, "CDELT1", cdelt1 , Nimage_pos); 246 gfits_set_bintable_column (&theader, &ftable, "CDELT2", cdelt2 , Nimage_pos); 247 gfits_set_bintable_column (&theader, &ftable, "PC1_1", pc1_1 , Nimage_pos); 248 gfits_set_bintable_column (&theader, &ftable, "PC1_2", pc1_2 , Nimage_pos); 249 gfits_set_bintable_column (&theader, &ftable, "PC2_1", pc2_1 , Nimage_pos); 250 gfits_set_bintable_column (&theader, &ftable, "PC2_2", pc2_2 , Nimage_pos); 251 gfits_set_bintable_column (&theader, &ftable, "POLYTERMS", polyterms , Nimage_pos); 252 gfits_set_bintable_column (&theader, &ftable, "CTYPE", ctype , Nimage_pos); 253 gfits_set_bintable_column (&theader, &ftable, "NPOLYTERMS", Npolyterms, Nimage_pos); 254 gfits_set_bintable_column (&theader, &ftable, "XPIX_SYS_ERR",dXpixSys , Nimage_pos); 255 gfits_set_bintable_column (&theader, &ftable, "YPIX_SYS_ERR",dYpixSys , Nimage_pos); 256 gfits_set_bintable_column (&theader, &ftable, "ID", imageID , Nimage_pos); 257 gfits_set_bintable_column (&theader, &ftable, "NFIT", nFitAstrom, Nimage_pos); 258 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags , Nimage_pos); 259 260 free (crval1 ); 261 free (crval2 ); 262 free (crpix1 ); 263 free (crpix2 ); 264 free (cdelt1 ); 265 free (cdelt2 ); 266 free (pc1_1 ); 267 free (pc1_2 ); 268 free (pc2_1 ); 269 free (pc2_2 ); 270 free (polyterms ); 271 free (ctype ); 272 free (Npolyterms); 273 free (dXpixSys ); 274 free (dYpixSys ); 275 free (imageID ); 276 free (nFitAstrom); 277 free (flags ); 256 gfits_set_bintable_column (&theader, &ftable, "CRVAL1", crval1 , Nimage_pos); 257 gfits_set_bintable_column (&theader, &ftable, "CRVAL2", crval2 , Nimage_pos); 258 gfits_set_bintable_column (&theader, &ftable, "CRPIX1", crpix1 , Nimage_pos); 259 gfits_set_bintable_column (&theader, &ftable, "CRPIX2", crpix2 , Nimage_pos); 260 gfits_set_bintable_column (&theader, &ftable, "CDELT1", cdelt1 , Nimage_pos); 261 gfits_set_bintable_column (&theader, &ftable, "CDELT2", cdelt2 , Nimage_pos); 262 gfits_set_bintable_column (&theader, &ftable, "PC1_1", pc1_1 , Nimage_pos); 263 gfits_set_bintable_column (&theader, &ftable, "PC1_2", pc1_2 , Nimage_pos); 264 gfits_set_bintable_column (&theader, &ftable, "PC2_1", pc2_1 , Nimage_pos); 265 gfits_set_bintable_column (&theader, &ftable, "PC2_2", pc2_2 , Nimage_pos); 266 gfits_set_bintable_column (&theader, &ftable, "POLYTERMS", polyterms , Nimage_pos); 267 gfits_set_bintable_column (&theader, &ftable, "CTYPE", ctype , Nimage_pos); 268 gfits_set_bintable_column (&theader, &ftable, "NPOLYTERMS", Npolyterms, Nimage_pos); 269 gfits_set_bintable_column (&theader, &ftable, "XPIX_SYS_ERR", dXpixSys , Nimage_pos); 270 gfits_set_bintable_column (&theader, &ftable, "YPIX_SYS_ERR", dYpixSys , Nimage_pos); 271 gfits_set_bintable_column (&theader, &ftable, "REF_COLOR_BLUE", refColorBlue, Nimage_pos); 272 gfits_set_bintable_column (&theader, &ftable, "REF_COLOR_RED", refColorRed , Nimage_pos); 273 gfits_set_bintable_column (&theader, &ftable, "ID", imageID , Nimage_pos); 274 gfits_set_bintable_column (&theader, &ftable, "NFIT", nFitAstrom, Nimage_pos); 275 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags , Nimage_pos); 276 277 free (crval1 ); 278 free (crval2 ); 279 free (crpix1 ); 280 free (crpix2 ); 281 free (cdelt1 ); 282 free (cdelt2 ); 283 free (pc1_1 ); 284 free (pc1_2 ); 285 free (pc2_1 ); 286 free (pc2_2 ); 287 free (polyterms ); 288 free (ctype ); 289 free (Npolyterms ); 290 free (dXpixSys ); 291 free (dYpixSys ); 292 free (refColorBlue); 293 free (refColorRed ); 294 free (imageID ); 295 free (nFitAstrom ); 296 free (flags ); 278 297 279 298 FILE *f = fopen (filename, "w"); -
trunk/Ohana/src/relastro/src/StarMaps.c
r36630 r37807 176 176 } 177 177 178 int printStarMap(int N, char *filename) { 179 180 off_t i, Nimages; 181 Image *images = getimages(&Nimages, NULL); 182 double L, M; 183 184 FILE *f = fopen (filename, "w"); 185 186 for (i = 0; i < starmap[N].Npoints; i++) { 187 // set the transformed coordinates 188 XY_to_LM (&L, &M, starmap[N].points[i].X, starmap[N].points[i].Y, &images[N].coords); 189 190 fprintf (f, "%d %7.2f %f : %7.2f %7.2f : %7.2f %7.2f : %7.2f %7.2f\n", (int) i, starmap[N].points[i].X, starmap[N].points[i].Y, starmap[N].points[i].L, starmap[N].points[i].M, L, M, starmap[N].points[i].L - L, starmap[N].points[i].M - M); 191 } 192 fclose (f); 193 return (TRUE); 194 } 195 -
trunk/Ohana/src/relastro/src/UpdateChips.c
r33652 r37807 36 36 off_t i, Nraw, Nref, nFitAstr; 37 37 StarData *raw, *ref; 38 Coords *oldCoords;39 38 float dXpixSys, dYpixSys; 40 39 double *Ro, *Do; … … 74 73 Nskip ++; 75 74 mode[i] = 0; 75 continue; 76 } 77 if (Nraw <= IMFIT_TOO_FEW) { 78 Nskip ++; 79 mode[i] = 0; 80 free (raw); 76 81 continue; 77 82 } … … 90 95 91 96 // save these in case of failure 92 saveCoords (&image[i].coords, i); 97 Coords oldCoords; 98 SaveCoords (&oldCoords, &image[i].coords); 99 93 100 dXpixSys = image[i].dXpixSys; 94 101 dYpixSys = image[i].dYpixSys; … … 100 107 if (VERBOSE) fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT" of %d\n", image[i].name, i, Nraw, image[i].nstar); 101 108 102 // restore status quo ante 103 oldCoords = getCoords (i); 104 memcpy (&image[i].coords, oldCoords, sizeof(Coords)); 105 image[i].dXpixSys = dXpixSys; 106 image[i].dYpixSys = dYpixSys; 107 image[i].nFitAstrom = nFitAstr; 108 109 saveCenter (image, &Ro[i], &Do[i], i); 110 mode[i] = 1; 111 NoldFit ++; 112 free (raw); 113 free (ref); 114 continue; 109 if (1) { 110 // restore status quo ante (replace truMap with tmpMap) 111 RestoreCoords (&image[i].coords, &oldCoords, &image[i]); 112 image[i].dXpixSys = dXpixSys; 113 image[i].dYpixSys = dYpixSys; 114 image[i].nFitAstrom = nFitAstr; 115 116 saveCenter (image, &Ro[i], &Do[i], i); 117 mode[i] = 1; 118 NoldFit ++; 119 free (raw); 120 free (ref); 121 continue; 122 } 115 123 } 116 124 117 125 if (!checkStarMap (i)) { 118 126 if (VERBOSE) fprintf (stderr, "fit diverges too much for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name, i, Nraw); 119 // restore status quo ante 120 oldCoords = getCoords (i); 121 memcpy (&image[i].coords, oldCoords, sizeof(Coords)); 122 image[i].dXpixSys = dXpixSys; 123 image[i].dYpixSys = dYpixSys; 124 image[i].nFitAstrom = nFitAstr; 125 126 saveCenter (image, &Ro[i], &Do[i], i); 127 mode[i] = 2; 128 image[i].flags |= ID_IMAGE_ASTROM_POOR; 129 NoldFit ++; 130 free (raw); 131 free (ref); 132 continue; 127 128 if (1) { 129 // restore status quo ante (replace truMap with tmpMap) 130 RestoreCoords (&image[i].coords, &oldCoords, &image[i]); 131 image[i].dXpixSys = dXpixSys; 132 image[i].dYpixSys = dYpixSys; 133 image[i].nFitAstrom = nFitAstr; 134 135 saveCenter (image, &Ro[i], &Do[i], i); 136 mode[i] = 2; 137 image[i].flags |= ID_IMAGE_ASTROM_POOR; 138 NoldFit ++; 139 free (raw); 140 free (ref); 141 continue; 142 } 133 143 } 144 145 // Apply the modified coords back to the measure.R,D. Note that raw.R,D, ref.L,M, etc 146 // are all automatically updated in this block because they are re-generated from 147 // image.coords on each pass. 148 setImageRaw (catalog, Ncatalog, i, raw, Nraw, MODE_MOSAIC); 149 if (USE_GALAXY_MODEL) { 150 image[i].flags |= ID_IMAGE_ASTROM_GMM; 151 } 134 152 135 153 saveCenter (image, &Ro[i], &Do[i], i); … … 235 253 off_t Nraw, Nref, nFitAstr; 236 254 StarData *raw, *ref; 237 Coords *oldCoords;238 255 float dXpixSys, dYpixSys; 239 256 … … 260 277 threadinfo->Nskip ++; 261 278 threadinfo->mode[i] = 0; 279 continue; 280 } 281 if (Nraw <= IMFIT_TOO_FEW) { 282 threadinfo->Nskip ++; 283 threadinfo->mode[i] = 0; 284 free (raw); 262 285 continue; 263 286 } … … 276 299 277 300 // save these in case of failure 278 saveCoords (&image[i].coords, i); 301 Coords oldCoords; 302 SaveCoords (&oldCoords, &image[i].coords); 279 303 dXpixSys = image[i].dXpixSys; 280 304 dYpixSys = image[i].dYpixSys; … … 286 310 if (VERBOSE) fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT" of %d\n", image[i].name, i, Nraw, image[i].nstar); 287 311 288 // restore status quo ante 289 oldCoords = getCoords (i); 290 memcpy (&image[i].coords, oldCoords, sizeof(Coords)); 312 // restore status quo ante (replace truMap with tmpMap) 313 RestoreCoords (&image[i].coords, &oldCoords, &image[i]); 291 314 image[i].dXpixSys = dXpixSys; 292 315 image[i].dYpixSys = dYpixSys; … … 303 326 if (!checkStarMap (i)) { 304 327 if (VERBOSE) fprintf (stderr, "fit diverges too much for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name, i, Nraw); 305 // restore status quo ante 306 oldCoords = getCoords (i);307 memcpy (&image[i].coords, oldCoords, sizeof(Coords));328 329 // restore status quo ante (replace truMap with tmpMap) 330 RestoreCoords (&image[i].coords, &oldCoords, &image[i]); 308 331 image[i].dXpixSys = dXpixSys; 309 332 image[i].dYpixSys = dYpixSys; … … 319 342 } 320 343 344 // apply the modified R,D back to the measures 345 setImageRaw (threadinfo->catalog, threadinfo->Ncatalog, i, raw, Nraw, MODE_MOSAIC); 346 321 347 saveCenter (image, &threadinfo->Ro[i], &threadinfo->Do[i], i); 322 348 threadinfo->mode[i] = 3; … … 333 359 static pthread_mutex_t UpdateChips_mutex = PTHREAD_MUTEX_INITIALIZER; 334 360 361 void lockUpdateChips () { 362 pthread_mutex_lock (&UpdateChips_mutex); 363 } 364 void unlockUpdateChips () { 365 pthread_mutex_unlock (&UpdateChips_mutex); 366 } 367 335 368 // we have an array of chips (image, Nimage). we need to hand out images one at a time to 336 369 // the worker threads as they need 337 370 off_t getNextImageForThread () { 338 371 339 pthread_mutex_lock (&UpdateChips_mutex);372 lockUpdateChips (); 340 373 if (nextImage >= Nimage) { 341 pthread_mutex_unlock (&UpdateChips_mutex);374 unlockUpdateChips (); 342 375 return (-1); 343 376 } … … 345 378 nextImage ++; 346 379 347 pthread_mutex_unlock (&UpdateChips_mutex);380 unlockUpdateChips (); 348 381 return (thisImage); 349 382 } … … 494 527 } 495 528 496 // XXX if (!FindMosaicForImage (image, Nimage, i)) { } 529 // save the coords and offset map in src at tgt 530 void SaveCoords (Coords *tgt, Coords *src) { 531 myAssert (tgt, "oops"); 532 myAssert (src, "oops"); 533 CopyCoords (tgt, src); // src retains a pointer to the AstromOffsetMap table, to be saved 534 tgt->offsetMap = AstromOffsetMapCopy(src->offsetMap); // oldCoords now saves the old values in a new structure 535 } 536 537 // restore the coords and offset map at tgt from src 538 void RestoreCoords (Coords *tgt, Coords *src, Image *image) { 539 540 AstromOffsetMap *truMap = tgt->offsetMap; 541 AstromOffsetMap *tmpMap = src->offsetMap; 542 543 // copy the coords structure data first, then fix the offsetMap pointers 544 // this modifies tgt.coords, but we need to keep the original pointer 545 CopyCoords (tgt, src); 546 tgt->offsetMap = truMap; 547 548 // we want to keep the old solution, which is (maybe) a pointer to a stand-alone 549 // map. the image has a bad solution, but it is a pointer to the map in the I/O 550 // table. those values will be saved on exit. 551 552 if (!tmpMap && !truMap) return; 553 554 if (tmpMap && truMap) { 555 AstromOffsetMapSetOrder (truMap, tmpMap->Nx, tmpMap->Ny, image); 556 AstromOffsetMapCopyData (truMap, tmpMap); 557 return; 558 } 559 560 if (tmpMap && !truMap) { 561 // is this even possible? 562 lockUpdateChips (); 563 AstromOffsetTable *table = get_astrom_table (); 564 AstromOffsetTableNewMap(table, tmpMap->Nx, tmpMap->Ny, image); // registers the map with the image 565 unlockUpdateChips (); 566 AstromOffsetMapCopyData (image->coords.offsetMap, tmpMap); 567 return; 568 } 569 if (!tmpMap && truMap) { 570 truMap->keep = FALSE; 571 return; 572 } 573 myAbort ("oops"); 574 } -
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r35763 r37807 1 1 # include "relastro.h" 2 void dump_measures (Average *average, Measure *measure); // in ImageOps.c 2 3 3 void printNcatTotal (); 4 // this function is called by UpdateObjectOffsets or relastro_images.c for reset 5 int UpdateMeasures (Catalog *catalog, int Ncatalog) { 6 7 off_t i, j, Nimage; 8 Image *image; 9 double DPOS_MAX_ASEC; 10 11 int badImage = 12 ID_IMAGE_ASTROM_NOCAL | 13 ID_IMAGE_ASTROM_POOR | 14 ID_IMAGE_ASTROM_FAIL | 15 ID_IMAGE_ASTROM_SKIP | 16 ID_IMAGE_ASTROM_FEW; 17 18 if (RESET_BAD_IMAGES) badImage = 0; 19 20 image = getimages (&Nimage, NULL); 21 22 // track measurements which are far from their original position (poor at pole) 23 int NoffRAave = 0; int NoffRAori = 0; 24 int NoffDECave = 0; int NoffDECori = 0; 25 26 for (i = 0; i < Ncatalog; i++) { 27 myAssert (!catalog[i].Nmeasure || catalog[i].measureT, "programming error"); 28 for (j = 0; j < catalog[i].Nmeasure; j++) { 29 MeasureTiny *measureT = &catalog[i].measureT[j]; 30 Measure *measureB = catalog[i].measure ? &catalog[i].measure[j] : NULL; 31 32 off_t im = getImageByID (measureT->imageID); 33 if (im < 0) continue; // detections without imageIDs are not associated with a known image (eg, refs) 34 35 // check that we have the right image: 36 myAssert (measureT->photcode == image[im].photcode, "image photcode mismatch"); 37 myAssert (measureT->t >= image[im].tzero, "image time mismatch (1)"); 38 myAssert (measureT->t <= image[im].tzero + image[im].NX*image[im].trate/5000.0, "image time mismatch (2)"); 39 // I'm allowing the trate*NX to be a factor of 2x too small 40 41 // skip measurements on images that have failed solutions (divergent or otherwise) 42 // XXX apply this or not?? 43 if (FALSE && (image[im].flags & badImage)) continue; 44 45 Coords *moscoords = image[im].coords.mosaic; 46 Coords *imcoords = &image[im].coords; 47 48 if (moscoords) { 49 DPOS_MAX_ASEC = 3600.0*DPOS_MAX*hypot(moscoords->cdelt1, moscoords->cdelt2); 50 } else { 51 DPOS_MAX_ASEC = 3600.0*DPOS_MAX*hypot(imcoords->cdelt1, imcoords->cdelt2); 52 } 53 54 double X = measureT->Xccd; 55 double Y = measureT->Yccd; 56 if (USE_FIXED_PIXCOORDS) { 57 if (isfinite(measureT->Xfix) && isfinite(measureT->Yfix)) { 58 float dX = measureT->Xfix - measureT->Xccd; 59 float dY = measureT->Yfix - measureT->Yccd; 60 if (hypot(dX,dY) < 2.0) { 61 X = measureT->Xfix; 62 Y = measureT->Yfix; 63 } 64 } 65 } 66 67 double R, D; 68 XY_to_RD (&R, &D, X, Y, imcoords); 69 70 int n = measureT[0].averef; 71 Average *average = &catalog[i].average[n]; 72 73 double dR = 3600.0*(average[0].R - R); 74 double dD = 3600.0*(average[0].D - D); 75 76 // make sure detection is on the same side of the 0,360 boundary as the average 77 // this will give some funny results withing ~1 arcsec of the pol 78 if (dR > +180.0*3600.0) { 79 // average on high end of boundary, move star up 80 R += 360.0; 81 dR = 3600.0*(average[0].R - R); 82 } 83 if (dR < -180.0*3600.0) { 84 // average on low end of boundary, move star down 85 R -= 360.0; 86 dR = 3600.0*(average[0].R - R); 87 } 88 89 float csdec = cos(average[0].D * RAD_DEG); 90 91 // complain if the new location is far from the average location 92 // NOTE: This should never happen, or our StarMap tests are not working 93 if (fabs(dR*csdec) > 3.0*ADDSTAR_RADIUS) { 94 NoffRAave ++; 95 if (VERBOSE2 && catalog[i].measure) { 96 fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, dR*csdec, dD); 97 dump_measures (&average[0], catalog[i].measure); 98 } 99 } 100 if (fabs(dD) > 3.0*ADDSTAR_RADIUS) { 101 NoffDECave ++; 102 if (VERBOSE2 && catalog[i].measure) { 103 fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", average[0].R, average[0].D, dR, dD); 104 dump_measures (&average[0], catalog[i].measure); 105 } 106 } 107 108 // complain if the new location is far from the old location 109 if (fabs(csdec*(measureT[0].R - R)) > DPOS_MAX_ASEC) { 110 NoffRAori ++; 111 if (VERBOSE2 && catalog[i].measure) { 112 fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measureT[0].R, dR, csdec*(measureT[0].R - R), dD); 113 dump_measures (&average[0], catalog[i].measure); 114 } 115 } 116 if (fabs(measureT[0].D - D) > DPOS_MAX_ASEC) { 117 NoffDECori ++; 118 if (VERBOSE2 && catalog[i].measure) { 119 fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, measureT[0].D, dD); 120 dump_measures (&average[0], catalog[i].measure); 121 } 122 } 123 measureT->R = R; 124 measureT->D = D; 125 if (measureB) { 126 measureB->R = R; 127 measureB->D = D; 128 } 129 } 130 } 131 // printNcatTotal (); 132 133 int Noff = NoffRAave + NoffDECave + NoffRAori + NoffDECori; 134 if (VERBOSE && (Noff > 0)) fprintf (stderr, "Noff ave RA %d, Noff ave DEC %d, Noff ori RA %d, Noff ori DEC %d\n", NoffRAave, NoffDECave, NoffRAori, NoffDECori); 135 136 return (TRUE); 137 } 4 138 5 139 // this function operates on Measure, not MeasureTiny 6 int UpdateMeasures (Catalog *catalog, int Ncatalog) {140 int UpdateMeasuresOld (Catalog *catalog, int Ncatalog) { 7 141 8 142 off_t i, Nimage; … … 32 166 } 33 167 34 printNcatTotal ();168 // printNcatTotal (); 35 169 36 170 return (TRUE); -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r37038 r37807 59 59 60 60 // uses MeasureTiny values, but will also update Measure values when populated 61 UpdateObjects (&catalog, 1); 61 // if Galaxy Motion Model correction is active, do not apply at this last stage 62 UpdateObjects (&catalog, 1, FALSE); 62 63 63 64 free_tiny_values(&catalog); … … 74 75 save_catalogs (&catalog, 1); 75 76 } 76 77 printNcatTotal(); 77 78 return (TRUE); 78 79 } 80 81 int UpdateObjectOffsets_parallel_group (HostTableGroup *group, SkyList *sky); 82 int UpdateObjectOffsets_parallel_table (HostTable *table, SkyList *sky); 79 83 80 84 // CATDIR is supplied globally … … 90 94 exit (1); 91 95 } 96 97 # if (0) 98 99 UpdateObjectOffsets_parallel_table (table, sky); 100 101 # else 102 103 int Ngroups; 104 HostTableGroup *groups = HostTableGroups (table, &Ngroups); 105 // split the table into Ngroups, each with a unique set of machines (this avoids overloading the remote host machines) 106 107 int i; 108 for (i = 0; i < Ngroups; i++) { 109 // update only a group of unique machines at a time 110 UpdateObjectOffsets_parallel_group (&groups[i], sky); 111 } 112 # endif 113 114 return TRUE; 115 } 116 117 // CATDIR is supplied globally 118 # define DEBUG 1 119 int UpdateObjectOffsets_parallel_group (HostTableGroup *group, SkyList *sky) { 120 121 // launch the relastro_client jobs to the parallel hosts 122 123 int i, j; 124 for (i = 0; i < group->Nhosts; i++) { 125 126 if (sky->Nregions < group->Nhosts) { 127 // do any of the regions want this host? 128 int wantThisHost = FALSE; 129 for (j = 0; j < sky->Nregions; j++) { 130 if (HostTableTestHost (sky->regions[j], group->hosts[i][0].hostID)) { 131 wantThisHost = TRUE; 132 break; 133 } 134 } 135 if (!wantThisHost) { 136 // fprintf (stderr, "skip host %s\n", group->hosts[i][0].hostname); 137 continue; 138 } 139 } 140 141 // ensure that the paths are absolute path names 142 char *tmppath = abspath (group->hosts[i][0].pathname, DVO_MAX_PATH); 143 free (group->hosts[i][0].pathname); 144 group->hosts[i][0].pathname = tmppath; 145 146 // options / arguments that can affect relastro_client -load: 147 // VERBOSE, VERBOSE2 148 // RESET (-reset) 149 // TimeSelect -time 150 // (note that psfQF is applied rigidly at 0.85, as is the galaxy test) 151 // ImagSelect, ImagMin, ImagMax 152 // MaxDensityUse, MaxDensityValue 153 154 char command[1024]; 155 snprintf (command, 1024, "relastro_client -update-offsets -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f", 156 group->hosts[i][0].hostID, CATDIR, group->hosts[i][0].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR); 157 158 if (FIT_MODE == FIT_PM_ONLY) strextend (command, "-pm"); 159 if (FIT_MODE == FIT_PAR_ONLY) strextend (command, "-par"); 160 if (FIT_MODE == FIT_PM_AND_PAR) strextend (command, "-pmpar"); 161 162 if (VERBOSE) strextend (command, "-v"); 163 if (VERBOSE2) strextend (command, "-vv"); 164 if (RESET) strextend (command, "-reset"); 165 if (UPDATE) strextend (command, "-update"); 166 167 if (RESET_BAD_IMAGES) strextend (command, "-reset-bad-images"); 168 169 if (ImagSelect) strextend (command, "-instmag %f %f", ImagMin, ImagMax); 170 if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue); 171 172 if (USE_BASIC_CHECK) strextend (command, "-basic-image-search"); 173 if (FlagOutlier) strextend (command, "-clip %d", CLIP_THRESH); 174 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 175 176 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 177 178 if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 179 if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST); 180 if (PhotFlagSelect) strextend (command, "+photflags"); 181 if (PhotFlagBad) strextend (command, "+photflagbad %d", PhotFlagBad); 182 if (PhotFlagPoor) strextend (command, "+photflagpoor %d", PhotFlagPoor); 183 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 184 185 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 186 strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 187 } 188 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 189 strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 190 } 191 192 if (MinBadQF > 0.0) strextend (command, "-min-bad-psfqf %f", MinBadQF); 193 if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset %f", MaxMeanOffset); 194 195 if (TimeSelect) { 196 char *tstart = ohana_sec_to_date (TSTART); 197 char *tstop = ohana_sec_to_date (TSTOP); 198 strextend (command, "-time %s %s", tstart, tstop); 199 free (tstart); 200 free (tstop); 201 } 202 fprintf (stderr, "command: %s\n", command); 203 204 if (PARALLEL_MANUAL) continue; 205 206 if (PARALLEL_SERIAL) { 207 int status = system (command); 208 if (status) { 209 fprintf (stderr, "ERROR running relastro_client\n"); 210 exit (2); 211 } 212 } else { 213 // launch the job on the remote machine (no handshake) 214 int errorInfo = 0; 215 int pid = rconnect ("ssh", group->hosts[i][0].hostname, command, group->hosts[i][0].stdio, &errorInfo, FALSE); 216 if (!pid) { 217 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", group->hosts[i][0].hostname, errorInfo); 218 exit (1); 219 } 220 group->hosts[i][0].pid = pid; // save for future reference 221 } 222 } 223 224 if (PARALLEL_MANUAL) { 225 fprintf (stderr, "run the relastro_client commands above. when these are done, hit return\n"); 226 getchar(); 227 } 228 if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) { 229 HostTableGroupWaitJobsGetIO (group, __FILE__, __LINE__, VERBOSE); 230 } 231 232 return TRUE; 233 } 234 235 // CATDIR is supplied globally 236 # define DEBUG 1 237 int UpdateObjectOffsets_parallel_table (HostTable *table, SkyList *sky) { 238 239 // launch the relastro_client jobs to the parallel hosts 92 240 93 241 int i, j; -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r37261 r37807 2 2 # define PAR_TOOFEW 5 3 3 4 int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int i, off_t m );4 int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int i, off_t m, int applyGalaxyOffset); 5 5 int UpdateObjects_Stack (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats); 6 6 … … 69 69 70 70 /* project coordinates to a plane centered on the object with units of arcsec */ 71 coords.crval1 = 0; 72 coords.crval2 = 0; 73 coords.crpix1 = 0; 74 coords.crpix2 = 0; 71 InitCoords (&coords, "DEC--SIN"); 75 72 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 76 coords.pc1_1 = coords.pc2_2 = 1.0;77 coords.pc1_2 = coords.pc2_1 = 0.0;78 coords.Npolyterms = 1;79 strcpy (coords.ctype, "DEC--SIN");80 73 81 74 // use J2000 as a reference time … … 106 99 // This function operates on both Measure and MeasureTiny. In the big stages, this should 107 100 // be called with just MeasureTiny set and Measure == NULL 108 int UpdateObjects (Catalog *catalog, int Ncatalog ) {101 int UpdateObjects (Catalog *catalog, int Ncatalog, int Nloop) { 109 102 110 103 initObjectData (catalog, Ncatalog); … … 137 130 138 131 UpdateObjects_Stack(average, secfilt, measure, measureBig, Nsecfilt, &fitStatsStack); 139 UpdateObjects_Chips(average, secfilt, measure, measureBig, Nsecfilt, &fitStatsChips, i, m );140 } 141 if (VERBOSE ) fprintf (stderr, "catalog %d : chips "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n", i, fitStatsChips.Nave, fitStatsChips.Npm, fitStatsChips.Npar, fitStatsChips.Nskip, fitStatsChips.Noffset);142 if (VERBOSE ) fprintf (stderr, "catalog %d : stack "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n", i, fitStatsStack.Nave, fitStatsStack.Npm, fitStatsStack.Npar, fitStatsStack.Nskip, fitStatsStack.Noffset);132 UpdateObjects_Chips(average, secfilt, measure, measureBig, Nsecfilt, &fitStatsChips, i, m, Nloop); 133 } 134 if (VERBOSE2) fprintf (stderr, "catalog %d : chips "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n", i, fitStatsChips.Nave, fitStatsChips.Npm, fitStatsChips.Npar, fitStatsChips.Nskip, fitStatsChips.Noffset); 135 if (VERBOSE2) fprintf (stderr, "catalog %d : stack "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n", i, fitStatsStack.Nave, fitStatsStack.Npm, fitStatsStack.Npar, fitStatsStack.Nskip, fitStatsStack.Noffset); 143 136 sumFitStats (&fitStatsChips, &sumStatsChips); 144 137 sumFitStats (&fitStatsStack, &sumStatsStack); … … 146 139 freeObjectData (); 147 140 148 if (VERBOSE ) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n", (sumStatsChips.Nave + sumStatsChips.Npm + sumStatsChips.Npar), sumStatsChips.Nave, sumStatsChips.Npm, sumStatsChips.Npar, sumStatsChips.Nskip, sumStatsChips.Noffset);149 if (VERBOSE ) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n", (sumStatsStack.Nave + sumStatsStack.Npm + sumStatsStack.Npar), sumStatsStack.Nave, sumStatsStack.Npm, sumStatsStack.Npar, sumStatsStack.Nskip, sumStatsStack.Noffset);141 if (VERBOSE && (Ncatalog > 1)) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n", (sumStatsChips.Nave + sumStatsChips.Npm + sumStatsChips.Npar), sumStatsChips.Nave, sumStatsChips.Npm, sumStatsChips.Npar, sumStatsChips.Nskip, sumStatsChips.Noffset); 142 if (VERBOSE && (Ncatalog > 1)) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n", (sumStatsStack.Nave + sumStatsStack.Npm + sumStatsStack.Npar), sumStatsStack.Nave, sumStatsStack.Npm, sumStatsStack.Npar, sumStatsStack.Nskip, sumStatsStack.Noffset); 150 143 return (TRUE); 151 144 } … … 153 146 // This function operates on both Measure and MeasureTiny. In the big stages, this should 154 147 // be called with just MeasureTiny set and Measure == NULL 155 int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int i, off_t m ) {148 int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int i, off_t m, int applyGalaxyOffset) { 156 149 157 150 int setRefColor = areImagesMatched(); … … 215 208 double Ri = getMeanR (&measure[k], average, secfilt); 216 209 double Di = getMeanD (&measure[k], average, secfilt); 210 211 // if we are correcting for the Galaxy Motion Model, only should apply it here 212 // (a) when we are working to correct the images (mean R,D assumed to be at J2000) and 213 // (b) if we think the measure R,D is already at the image epoch position 214 if (USE_GALAXY_MODEL && applyGalaxyOffset) { 215 Ri -= measure[k].RoffGAL / 3600.0; 216 Di -= measure[k].DoffGAL / 3600.0; 217 } 218 219 // XXX add in dR,dD GAL here 217 220 218 221 // mark (as POOR) any measurements which are deviant from the mean by > ExcludeBogusRadius … … 329 332 // to judge the quality of the PM and PAR fits, we need to fit all three models and compare Chisq 330 333 334 // project all of the R,D coordinates to a plane centered on this coordinate. set 335 // the times to be relative to Tmean (this is required for parallax as well) 336 for (k = 0; k < N; k++) { 337 RD_to_XY (&X[k], &Y[k], R[k], D[k], &coords); 338 T[k] -= Tmean; 339 if (XVERB) { 340 fprintf (stderr, OFF_T_FMT" %f %f %f %f %f +/- %f %f\n", k, T[k], R[k], D[k], X[k], Y[k], dX[k], dY[k]); 341 } 342 } 343 331 344 // *** first fit for the proper motion (skip fit if Trange or Npts is too small) *** 332 345 if ((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) { … … 340 353 } 341 354 342 // project all of the R,D coordinates to a plane centered on this coordinate. set343 // the times to be relative to Tmean (this is required for parallax as well)344 for (k = 0; k < N; k++) {345 RD_to_XY (&X[k], &Y[k], R[k], D[k], &coords);346 T[k] -= Tmean;347 if (XVERB) {348 fprintf (stderr, OFF_T_FMT" %f %f %f %f %f +/- %f %f\n", k, T[k], R[k], D[k], X[k], Y[k], dX[k], dY[k]);349 }350 }351 352 355 FitPM (&fitPM, X, dX, Y, dY, T, N, XVERB); 353 356 … … 357 360 XY_to_RD (&fitPM.Ro, &fitPM.Do, fitPM.Ro, fitPM.Do, &coords); 358 361 if (XVERB) fprintf (stderr, "project: %f %f : %f %f : %f\n", fitPM.Ro, fitPM.Do, fitPM.uR, fitPM.uD, fitPM.p); 362 if (fabs(fitPM.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n"); 363 // XXX : does this make sense at 0,360 boundary? 359 364 360 365 fitPM.p = fitPM.dp = 0.0; … … 409 414 fitStats->Npar ++; 410 415 416 if (fabs(fitPM.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n"); 417 411 418 // XXX a hard-wired hack... 412 419 if ((fabs(fitPAR.uR) > 2.0) || (fabs(fitPAR.uD) > 2.0)) { … … 419 426 // ALWAYS fit the average model 420 427 StatType statsR, statsD; 421 liststats_pos (R, dR, N, &statsR, XVERB); // WARNING: this function modifies R (do not use after here) 422 liststats_pos (D, dD, N, &statsD, XVERB); // WARNING: this function modifies D (do not use after here) 423 424 fitAve.Ro = statsR.mean; 425 fitAve.dRo = 3600.0*statsR.sigma; 426 427 fitAve.Do = statsD.mean; 428 fitAve.dDo = 3600.0*statsD.sigma; 428 liststats_pos (X, dX, N, &statsR, XVERB); // WARNING: this function modifies R (do not use after here) 429 liststats_pos (Y, dY, N, &statsD, XVERB); // WARNING: this function modifies D (do not use after here) 430 431 // project Ro, Do back to RA,DEC 432 XY_to_RD (&fitAve.Ro, &fitAve.Do, statsR.mean, statsD.mean, &coords); 433 if (XVERB) fprintf (stderr, "average: %f %f\n", fitAve.Ro, fitAve.Do); 434 435 fitAve.dRo = statsR.sigma; 436 fitAve.dDo = statsD.sigma; 429 437 430 438 fitAve.chisq = (N > 1) ? 0.5 * (statsR.chisq + statsD.chisq) : NAN; … … 466 474 break; 467 475 } 468 if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f) plx=(%f +/- %f)\n", 469 average[0].R, 470 average[0].D, 471 fit.Ro, fit.Do, 472 3600*(average[0].R - fit.Ro), 473 3600*(average[0].D - fit.Do), 474 fit.uR, fit.uD, fit.p, fit.dp); 476 if (XVERB) { 477 fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f) plx=(%f +/- %f)\n", 478 average[0].R, 479 average[0].D, 480 fit.Ro, fit.Do, 481 3600*(average[0].R - fit.Ro), 482 3600*(average[0].D - fit.Do), 483 fit.uR, fit.uD, fit.p, fit.dp); 484 fprintf (stderr, "-----\n"); 485 } 475 486 476 487 // make sure that the fit succeeded … … 494 505 coords.crval1 = average[0].R; 495 506 coords.crval2 = average[0].D; 507 if (isnan(coords.crval1)) { 508 return (FALSE); 509 } 510 if (isnan(coords.crval2)) { 511 return (FALSE); 512 } 496 513 497 514 double dXoff, dYoff; … … 505 522 return FALSE; // XXX ?? 506 523 } 507 508 average[0].R = fit.Ro; // RA in degrees509 average[0].D = fit.Do; // DEC in degrees510 average[0].dR = fit.dRo; // RA scatter in arcsec511 average[0].dD = fit.dDo; // DEC scatter in arcsec512 513 average[0].uR = fit.uR; // RA proper motion in arcsec/year514 average[0].uD = fit.uD; // DEC proper motion in arcsec/year515 average[0].duR = fit.duR; // RA proper motion error in arcsec/year516 average[0].duD = fit.duD; // DEC proper motion error in arcsec/year517 518 average[0].P = fit.p; // parallax in arcsec519 average[0].dP = fit.dp; // parallax error in arcsec520 521 average[0].ChiSqAve = fitAve.chisq;522 average[0].ChiSqPM = fitPM.chisq;523 average[0].ChiSqPar = fitPAR.chisq;524 525 average[0].Tmean = (Tmean * 86400 * 365.25) + T2000;526 average[0].Trange = (Trange * 86400 * 365.25);527 average[0].Npos = fit.Nfit;528 529 // unset the NO_ASTROM bit (not(NO_ASTROM) == HAVE_ASTROM)530 average[0].flags &= ~ID_STAR_NO_ASTROM;531 524 532 525 if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f) chisq=(%f, %f, %f)\n", … … 540 533 fitAve.chisq, fitPM.chisq, fitPAR.chisq); 541 534 535 average[0].R = fit.Ro; // RA in degrees 536 average[0].D = fit.Do; // DEC in degrees 537 average[0].dR = fit.dRo; // RA scatter in arcsec 538 average[0].dD = fit.dDo; // DEC scatter in arcsec 539 540 average[0].uR = fit.uR; // RA proper motion in arcsec/year 541 average[0].uD = fit.uD; // DEC proper motion in arcsec/year 542 average[0].duR = fit.duR; // RA proper motion error in arcsec/year 543 average[0].duD = fit.duD; // DEC proper motion error in arcsec/year 544 545 average[0].P = fit.p; // parallax in arcsec 546 average[0].dP = fit.dp; // parallax error in arcsec 547 548 average[0].ChiSqAve = fitAve.chisq; 549 average[0].ChiSqPM = fitPM.chisq; 550 average[0].ChiSqPar = fitPAR.chisq; 551 552 average[0].Tmean = (Tmean * 86400 * 365.25) + T2000; 553 average[0].Trange = (Trange * 86400 * 365.25); 554 average[0].Npos = fit.Nfit; 555 556 // unset the NO_ASTROM bit (not(NO_ASTROM) == HAVE_ASTROM) 557 average[0].flags &= ~ID_STAR_NO_ASTROM; 558 542 559 return (TRUE); 543 560 } -
trunk/Ohana/src/relastro/src/args.c
r37038 r37807 265 265 remove_argument (N, &argc, argv); 266 266 MaxDensityUse = TRUE; 267 } 268 269 APPLY_OFFSETS = FALSE; 270 if ((N = get_argument (argc, argv, "-apply-offsets"))) { 271 remove_argument (N, &argc, argv); 272 APPLY_OFFSETS = TRUE; 267 273 } 268 274 … … 372 378 } 373 379 380 CHIPMAP = 0; 381 if ((N = get_argument (argc, argv, "-chipmap"))) { 382 remove_argument (N, &argc, argv); 383 CHIPMAP = atoi(argv[N]); 384 remove_argument (N, &argc, argv); 385 386 } 387 374 388 SAVEPLOT = FALSE; 375 389 PLOTSTUFF = FALSE; … … 399 413 RESET = TRUE; 400 414 } 401 402 415 RESET_BAD_IMAGES = FALSE; 403 416 if ((N = get_argument (argc, argv, "-reset-bad-images"))) { 404 417 remove_argument (N, &argc, argv); 405 418 RESET_BAD_IMAGES = TRUE; 419 } 420 RESET_IMAGES = FALSE; 421 if ((N = get_argument (argc, argv, "-reset-images"))) { 422 remove_argument (N, &argc, argv); 423 RESET_IMAGES = TRUE; 406 424 } 407 425 … … 868 886 fprintf (stderr, " -high-speed (code[,code,code]) (code[,code,code]) (radius) (output catdir)\n"); 869 887 fprintf (stderr, " -hpm (radius) (output catdir)\n"); 888 fprintf (stderr, " -chipmap (MaxOrder)\n"); 870 889 fprintf (stderr, " -merge-source (objID) (catID) into (objID) (catID)\n\n"); 871 890 … … 880 899 fprintf (stderr, " -statmode (mode)\n"); 881 900 fprintf (stderr, " -reset\n"); 901 fprintf (stderr, " -reset-images\n"); 882 902 fprintf (stderr, " -nloop (N) : number of image-fit iterations\n"); 883 903 fprintf (stderr, " -update : apply new fit to database\n"); -
trunk/Ohana/src/relastro/src/assign_images.c
r36630 r37807 23 23 BuildChipMatch (image, Nimage); 24 24 MARKTIME("build chip match for %d images: %f sec\n", (int) Nimage, dtime); 25 26 char mapfile[DVO_MAX_PATH]; 27 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 28 AstromOffsetTable *table = AstromOffsetMapLoad (mapfile, VERBOSE); 29 30 // assign images.coords.offsetMap -> table->map[i] 31 if (table) { 32 AstromOffsetTableMatchChips (image, Nimage, table); 33 } else { 34 table = AstromOffsetTableInit (); 35 } 36 put_astrom_table (table); 25 37 26 38 initMosaics (image, Nimage); … … 89 101 if (!strcmp(&image[j].coords.ctype[4], "-DIS")) continue; 90 102 91 // match the image to its corresponding ASTROMETRIC mosaic (not the same as the Mosaic above)92 if (!FindMosaicForImage (image, Nimage, j)) {93 if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);94 continue;95 }96 97 103 // Exclude images with crazy astrometry 98 104 // XXX NOTE : this is gpc1-specific … … 150 156 151 157 // this is a bit memory expensive : I am making a complete copy of the image table here 152 off_t Nsubset = regionHosts->hosts[i].Nimage; 153 regionHosts->hosts[i].image[Nsubset] = image[j]; 154 regionHosts->hosts[i].imseq[Nsubset] = j; 155 156 regionHosts->hosts[i].Nimage ++; 157 if (regionHosts->hosts[i].Nimage == regionHosts->hosts[i].NIMAGE) { 158 regionHosts->hosts[i].NIMAGE += D_NIMAGE; 159 REALLOCATE (regionHosts->hosts[i].image, Image, regionHosts->hosts[i].NIMAGE); 160 REALLOCATE (regionHosts->hosts[i].imseq, off_t, regionHosts->hosts[i].NIMAGE); 158 off_t Nsubset = host->Nimage; 159 host->image[Nsubset] = image[j]; 160 host->imseq[Nsubset] = j; 161 162 host->Nimage ++; 163 if (host->Nimage == host->NIMAGE) { 164 host->NIMAGE += D_NIMAGE; 165 REALLOCATE (host->image, Image, host->NIMAGE); 166 REALLOCATE (host->imseq, off_t, host->NIMAGE); 167 } 168 169 // save the astrometry maps, where they exist 170 if (image[j].coords.offsetMap) { 171 if (!host->astromTable) { 172 host->astromTable = AstromOffsetTableInit(); 173 } 174 AstromOffsetTableAddMapFromImage(host->astromTable, &image[j]); 161 175 } 162 176 } … … 199 213 } 200 214 201 int calculate_host_image_bounds (RegionHostTable *regionHosts) {202 203 int i, n;204 off_t j;205 206 for (i = 0; i < regionHosts->Nhosts; i++) {207 208 RegionHostInfo *host = ®ionHosts->hosts[i];209 210 // XXX clear the chip match?211 212 BuildChipMatch (host->image, host->Nimage);213 214 double Rmin = 360.0;215 double Rmax = 0.0;216 double Dmin = +90.0;217 double Dmax = -90.0;218 219 for (j = 0; j < host->Nimage; j++) {220 221 Image *image = &host->image[j];222 223 if (!FindMosaicForImage (host->image, host->Nimage, j)) {224 fprintf (stderr, "missing astrometry? programming error?\n");225 abort ();226 }227 228 // define image corners229 for (n = 0; n < 4; n++) {230 double Xc, Yc, Rc, Dc;231 Xc = Xf[n]*image->NX;232 Yc = Yf[n]*image->NY;233 XY_to_RD (&Rc, &Dc, Xc, Yc, &image->coords);234 Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);235 236 Rmin = MIN (Rmin, Rc);237 Dmin = MIN (Dmin, Rc);238 239 Rmax = MAX (Rmax, Rc);240 Dmax = MAX (Dmax, Rc);241 }242 243 }244 245 host->RminCat = Rmin;246 host->DminCat = Dmin;247 host->RmaxCat = Rmax;248 host->DmaxCat = Dmax;249 250 // regionHosts needs to have the full outer boundary251 // (so reload_catalogs covers the correct region)252 regionHosts->Rmin = MIN(Rmin, regionHosts->Rmin);253 regionHosts->Rmax = MAX(Rmax, regionHosts->Rmax);254 regionHosts->Dmin = MIN(Dmin, regionHosts->Dmin);255 regionHosts->Dmax = MAX(Dmax, regionHosts->Dmax);256 }257 return TRUE;258 }259 260 261 215 // XXX add a search tree to speed this up? 262 216 int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc) { -
trunk/Ohana/src/relastro/src/bcatalog.c
r36833 r37807 27 27 28 28 /* for outlier rejection, project coordinates to a plane centered on the object with units of arcsec */ 29 coords.crval1 = 0; 30 coords.crval2 = 0; 31 coords.crpix1 = 0; 32 coords.crpix2 = 0; 29 InitCoords (&coords, "DEC--SIN"); 33 30 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 34 coords.pc1_1 = coords.pc2_2 = 1.0;35 coords.pc1_2 = coords.pc2_1 = 0.0;36 coords.Npolyterms = 1;37 strcpy (coords.ctype, "DEC--SIN");38 31 39 32 // XXX in the future, use catalog[0].Nsecfilt only? allow catalogs to have variable Nsecfilt? … … 72 65 if (catalog[0].average[i].Nmeasure <= SRC_MEAS_TOOFEW) { 73 66 continue; 74 // XXX can't (easily) count this for a given chip75 67 } 76 68 … … 84 76 if (RESET) { 85 77 subcatalog[0].average[Naverage].flags &= ~averageBits; 78 } 79 80 // if we want to do static correction to ICRF, keep the ICRF QSOs (regardless of other data quality) 81 if (USE_ICRF_CORRECT && (subcatalog[0].average[Naverage].flags & ID_ICRF_QSO)) { 82 Nm = 0; 83 for (j = 0; j < catalog[0].average[i].Nmeasure; j++) { 84 85 offset = catalog[0].average[i].measureOffset + j; 86 87 CopyMeasureToTiny (&subcatalog[0].measureT[Nmeasure], &catalog[0].measure[offset]); 88 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_SKIP_ASTROM; 89 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_NOCAL; 90 subcatalog[0].measureT[Nmeasure].averef = Naverage; 91 if (RESET) { 92 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_POOR_ASTROM; 93 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_AREA; 94 } 95 96 Nmeasure ++; 97 Nm ++; 98 if (Nmeasure == NMEASURE) { 99 NMEASURE += 1000; 100 REALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 101 } 102 } 103 subcatalog[0].average[Naverage].Nmeasure = Nm; 104 Naverage ++; 105 if (Naverage == NAVERAGE) { 106 NAVERAGE += 50; 107 REALLOCATE (subcatalog[0].average, Average, NAVERAGE); 108 REALLOCATE (subcatalog[0].secfilt, SecFilt, NAVERAGE*Nsecfilt); 109 } 110 continue; 111 } 112 113 // if we want to correct to the galay model, we need to use objects with distances determined by Green & Schlafly 114 if (USE_GALAXY_MODEL && !catalog[0].average[i].Nstarpar) { 115 // we may want to add some starpar quality filters... 116 continue; 86 117 } 87 118 … … 116 147 // exclude bogus 117 148 if (ExcludeBogus) { 118 double Ri = getMeanR_Big (&catalog[0].measure[offset], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]); 119 double Di = getMeanD_Big (&catalog[0].measure[offset], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]); 120 coords.crval1 = catalog[0].average[i].R; 121 coords.crval2 = catalog[0].average[i].D; 122 double Xi, Yi; 123 RD_to_XY (&Xi, &Yi, Ri, Di, &coords); 124 double radius = hypot(Xi, Yi); 125 if (radius > ExcludeBogusRadius) { 126 NskipBogus ++; 127 if (VERBOSE2) { 128 FILE *foutput = fbogus ? fbogus : stderr; 129 char *date = ohana_sec_to_date(catalog[0].measure[offset].t); 130 fprintf (foutput, "exclude bogus: %10.6f %10.6f : %10.6f %10.6f : %6.2f %6.2f : %6.2f : %5d %s\n", catalog[0].average[i].R, catalog[0].average[i].D, Ri, Di, Xi, Yi, radius, catalog[0].measure[offset].photcode, date); 131 free (date); 132 } 133 continue; 149 double Ri = getMeanR_Big (&catalog[0].measure[offset], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]); 150 double Di = getMeanD_Big (&catalog[0].measure[offset], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]); 151 coords.crval1 = catalog[0].average[i].R; 152 coords.crval2 = catalog[0].average[i].D; 153 double Xi, Yi; 154 RD_to_XY (&Xi, &Yi, Ri, Di, &coords); 155 double radius = hypot(Xi, Yi); 156 if (radius > ExcludeBogusRadius) { 157 NskipBogus ++; 158 if (VERBOSE2) { 159 FILE *foutput = fbogus ? fbogus : stderr; 160 char *date = ohana_sec_to_date(catalog[0].measure[offset].t); 161 fprintf (foutput, "exclude bogus: %10.6f %10.6f : %10.6f %10.6f : %6.2f %6.2f : %6.2f : %5d %s\n", catalog[0].average[i].R, catalog[0].average[i].D, Ri, Di, Xi, Yi, radius, catalog[0].measure[offset].photcode, date); 162 free (date); 134 163 } 164 continue; 165 } 135 166 } 136 167 … … 157 188 subcatalog[0].measureT[Nmeasure].averef = Naverage; 158 189 if (RESET) { 159 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_POOR_ASTROM;160 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_AREA;190 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_POOR_ASTROM; 191 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_AREA; 161 192 } 162 193 … … 164 195 Nm ++; 165 196 if (Nmeasure == NMEASURE) { 166 NMEASURE += 1000; 167 REALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 168 } 197 NMEASURE += 1000; 198 REALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 199 } 200 } 201 // we have filtered this object. do not keep it if we now have too few meas 202 if (Nm <= SRC_MEAS_TOOFEW) { 203 Nmeasure -= Nm; 204 continue; 169 205 } 170 206 subcatalog[0].average[Naverage].Nmeasure = Nm; … … 186 222 assert (Nsecfilt == catalog[0].Nsecfilt); 187 223 188 // limit the total number of stars in the catalog224 // limit the total number of stars in the catalog 189 225 if (MaxDensityUse) { 190 226 LimitDensityCatalog_ByNmeasureGrid (subcatalog, catalog); … … 217 253 218 254 # define SWAPFUNC(A,B){ int tmpI; off_t tmpT; \ 219 tmpI = X[A]; X[A] = X[B]; X[B] = tmpI;\220 tmpT = Y[A]; Y[A] = Y[B]; Y[B] = tmpT;\221 }255 tmpI = X[A]; X[A] = X[B]; X[B] = tmpI; \ 256 tmpT = Y[A]; Y[A] = Y[B]; Y[B] = tmpT; \ 257 } 222 258 # define COMPARE(A,B)(X[A] > X[B]) 223 259 … … 231 267 /* generate a grid in a locally-projected coordinate system, try to select average entries 232 268 from each grid cell in decending Nmeasure order. 233 */269 */ 234 270 int LimitDensityCatalog_ByNmeasureGrid (Catalog *subcatalog, Catalog *oldcatalog) { 235 271 … … 269 305 /* project coordinates to a plane centered on the object with units of arcsec */ 270 306 Coords coords; 307 InitCoords (&coords, "DEC--SIN"); 271 308 coords.crval1 = Rc; 272 309 coords.crval2 = Dc; 273 coords.crpix1 = 0;274 coords.crpix2 = 0;275 310 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 276 coords.pc1_1 = coords.pc2_2 = 1.0;277 coords.pc1_2 = coords.pc2_1 = 0.0;278 coords.Npolyterms = 1;279 strcpy (coords.ctype, "DEC--SIN");280 311 281 312 // convert all average R,D values to X,Y: -
trunk/Ohana/src/relastro/src/fitpoly.c
r33652 r37807 78 78 } 79 79 80 int array_print (double **matrix, int Nx, int Ny) { 81 82 int i, j; 83 for (i = 0; i < Nx; i++) { 84 for (j = 0; j < Ny; j++) { 85 fprintf (stderr, "%10.3e ", matrix[i][j]); 86 } 87 fprintf (stderr, "\n"); 88 } 89 return TRUE; 90 } 91 92 int fit_print (CoordFit *fit) { 93 94 fprintf (stderr, "Npts: %d, Norder: %d, Nterms: %d, Nsums: %d, Nelems: %d\n", 95 fit[0].Npts, fit[0].Norder, fit[0].Nterms, fit[0].Nsums, fit[0].Nelems); 96 97 fprintf (stderr, "sums: \n"); 98 array_print (fit[0].sum, fit[0].Nsums, fit[0].Nsums); 99 100 fprintf (stderr, "xsums: \n"); 101 array_print (fit[0].xsum, fit[0].Nterms, fit[0].Nterms); 102 103 fprintf (stderr, "ysums: \n"); 104 array_print (fit[0].ysum, fit[0].Nterms, fit[0].Nterms); 105 106 fprintf (stderr, "xfits: \n"); 107 array_print (fit[0].xfit, fit[0].Nterms, fit[0].Nterms); 108 109 fprintf (stderr, "yfits: \n"); 110 array_print (fit[0].yfit, fit[0].Nterms, fit[0].Nterms); 111 112 return TRUE; 113 } 114 80 115 // XXX use implicit masks as below or explicit masks (with function to set?) 81 116 // XXX eg, add a global mask to this file and … … 134 169 for (j = 0; j < fit[0].Nelems; j++) { 135 170 matrix[i][j] = 0.0; 171 matrix[j][i] = 0.0; 136 172 } 137 173 vector[i][0] = 0.0; … … 148 184 } 149 185 150 if (!dgaussjordan (matrix, vector, fit[0].Nelems, 2)) {186 if (!dgaussjordan_pivot (matrix, vector, fit[0].Nelems, 2, 1e-16)) { 151 187 array_free (matrix, fit[0].Nelems); 152 188 array_free (vector, fit[0].Nelems); … … 277 313 /* this should only apply to the polynomial, not the projection terms */ 278 314 /* compare with psastro supporting code */ 315 // this code will work for linear (Npolyterm == 0 or 1) and linear + map fits 279 316 int fit_apply_coords (CoordFit *fit, Coords *coords, int keepRef) { 280 317 … … 352 389 /* keep the order and type from initial values */ 353 390 391 if (isnan(coords[0].crval1)) { 392 return FALSE; 393 } 394 if (isnan(coords[0].crval2)) { 395 return FALSE; 396 } 397 if (isnan(coords[0].crpix1)) { 398 return FALSE; 399 } 400 if (isnan(coords[0].crpix2)) { 401 return FALSE; 402 } 403 354 404 return (TRUE); 355 405 } -
trunk/Ohana/src/relastro/src/high_speed_objects.c
r37038 r37807 149 149 150 150 // define a local projection 151 InitCoords (&tcoords, "DEC--ARC"); 151 152 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 152 153 if (region[0].Dmax < 90) { … … 155 156 tcoords.crval2 = 90.0; 156 157 } 157 tcoords.crpix1 = 0;158 tcoords.crpix2 = 0;159 158 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 160 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;161 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;162 tcoords.Npolyterms = 1;163 strcpy (tcoords.ctype, "DEC--ARC");164 159 165 160 /* build spatial index (RA sort) referencing input array sequence */ … … 271 266 272 267 populate_tiny_values (&catalogOut, DVO_TV_MEASURE); 273 UpdateObjects (&catalogOut, 1 );268 UpdateObjects (&catalogOut, 1, 0); 274 269 free_tiny_values(&catalogOut); 275 270 -
trunk/Ohana/src/relastro/src/high_speed_utils.c
r33652 r37807 141 141 off_t n; 142 142 for (n = 0; n < NfieldsA; n++) { 143 valuesA[n] = dbExtractAverages (&catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt], &catalog[0].measure[m], &fieldsA[n]);143 valuesA[n] = dbExtractAverages (&catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt], &catalog[0].measure[m], NULL, NULL, &fieldsA[n]); 144 144 } 145 145 return dbBooleanCond(stackA, NstackA, valuesA); … … 155 155 off_t n; 156 156 for (n = 0; n < NfieldsB; n++) { 157 valuesB[n] = dbExtractAverages (&catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt], &catalog[0].measure[m], &fieldsB[n]);157 valuesB[n] = dbExtractAverages (&catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt], &catalog[0].measure[m], NULL, NULL, &fieldsB[n]); 158 158 } 159 159 return dbBooleanCond(stackB, NstackB, valuesB); -
trunk/Ohana/src/relastro/src/hpm_objects.c
r37038 r37807 126 126 127 127 // define a local projection 128 InitCoords (&tcoords, "DEC--ARC"); 128 129 tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax); 129 130 if (region[0].Dmax < 90) { … … 132 133 tcoords.crval2 = 90.0; 133 134 } 134 tcoords.crpix1 = 0;135 tcoords.crpix2 = 0;136 135 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 137 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;138 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;139 tcoords.Npolyterms = 1;140 136 strcpy (tcoords.ctype, "DEC--ARC"); 141 137 … … 256 252 // distinguishing a bad fit from a fit with 1 or 2 bad points 257 253 FIT_MODE = FIT_PM_ONLY; 258 UpdateObjects (&testcat, 1 );254 UpdateObjects (&testcat, 1, 0); 259 255 260 256 free_tiny_values(&testcat); … … 286 282 287 283 populate_tiny_values (&catalogOut, DVO_TV_MEASURE); 288 UpdateObjects (&catalogOut, 1 );284 UpdateObjects (&catalogOut, 1, 0); 289 285 free_tiny_values(&catalogOut); 290 286 -
trunk/Ohana/src/relastro/src/initialize.c
r37038 r37807 9 9 10 10 if (DCR_BLUE_COLOR_POS) fprintf (stderr, "DCR_BLUE_COLOR_POS: %s - %s\n", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 11 if (DCR_ BLUE_COLOR_POS) fprintf (stderr, "DCR_BLUE_COLOR_POS: %s - %s\n", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG);11 if (DCR_RED_COLOR_POS) fprintf (stderr, "DCR_RED_COLOR_POS: %s - %s\n", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 12 12 13 13 if (PHOTCODE_KEEP_LIST) fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); … … 63 63 initstats (STATMODE); 64 64 65 if (USE_ICRF_CORRECT) { 66 if (!USE_ICRF_LOCAL && !USE_ICRF_SHFIT) { 67 fprintf (stderr, "no ICRF correction method chosen\n"); 68 exit (2); 69 } 70 } 71 if (USE_ICRF_CORRECT) ICRFinit(); 72 65 73 /* XXX drop irrelevant entries */ 66 74 if (SHOW_PARAMS) { -
trunk/Ohana/src/relastro/src/launch_region_hosts.c
r37038 r37807 6 6 int i; 7 7 8 // clear the I/O files 9 for (i = 0; i < regionHosts->Nhosts; i++) { 10 char *syncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanmags.sync"); 11 if (truncate (syncfile, 0)) fprintf (stderr, "trouble clearing syncfile %s\n", syncfile); 12 free (syncfile); 8 // do not remote the sync and fits files if we do a manual run -- user must clear if needed 9 if (!PARALLEL_REGIONS_MANUAL) { 10 // clear the I/O files 11 for (i = 0; i < regionHosts->Nhosts; i++) { 12 char *meansync = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanpos.sync"); 13 if (truncate (meansync, 0)) fprintf (stderr, "trouble clearing meansync %s\n", meansync); 14 free (meansync); 13 15 14 char *fitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanmags.fits");15 if (truncate (fitsfile, 0)) fprintf (stderr, "trouble clearing fitsfile %s\n", fitsfile);16 free (fitsfile);16 char *meanfits = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanpos.fits"); 17 if (truncate (meanfits, 0)) fprintf (stderr, "trouble clearing meanfits %s\n", meanfits); 18 free (meanfits); 17 19 18 char *imsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagemags.sync");19 if (truncate (imsyncfile, 0)) fprintf (stderr, "trouble clearing imsyncfile %s\n", imsyncfile);20 free (imsyncfile);20 char *meassync = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "measpos.sync"); 21 if (truncate (meassync, 0)) fprintf (stderr, "trouble clearing meassync %s\n", meassync); 22 free (meassync); 21 23 22 char *imfitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagemags.fits");23 if (truncate (imfitsfile, 0)) fprintf (stderr, "trouble clearing imfitsfile %s\n", imfitsfile);24 free (imfitsfile);24 char *measfits = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "measpos.fits"); 25 if (truncate (measfits, 0)) fprintf (stderr, "trouble clearing measfits %s\n", measfits); 26 free (measfits); 25 27 26 char *loopsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "loop.sync"); 27 if (truncate (loopsyncfile, 0)) fprintf (stderr, "trouble clearing loopsyncfile %s\n", loopsyncfile); 28 free (loopsyncfile); 28 char *icrfsync = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "icrfobj.sync"); 29 if (truncate (icrfsync, 0)) fprintf (stderr, "trouble clearing icrfsync %s\n", icrfsync); 30 free (icrfsync); 31 32 char *icrffits = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "icrfobj.fits"); 33 if (truncate (icrffits, 0)) fprintf (stderr, "trouble clearing icrffits %s\n", icrffits); 34 free (icrffits); 35 36 char *imsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagepos.sync"); 37 if (truncate (imsyncfile, 0)) fprintf (stderr, "trouble clearing imsyncfile %s\n", imsyncfile); 38 free (imsyncfile); 39 40 char *imfitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagepos.fits"); 41 if (truncate (imfitsfile, 0)) fprintf (stderr, "trouble clearing imfitsfile %s\n", imfitsfile); 42 free (imfitsfile); 43 44 char *loopsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "loop.sync"); 45 if (truncate (loopsyncfile, 0)) fprintf (stderr, "trouble clearing loopsyncfile %s\n", loopsyncfile); 46 free (loopsyncfile); 47 } 48 49 char *framesync = make_filename (CATDIR, "master", 0, "frame.corr.sync"); 50 if (truncate (framesync, 0)) fprintf (stderr, "trouble clearing framesync %s\n", framesync); 51 free (framesync); 52 53 char *framefits = make_filename (CATDIR, "master", 0, "frame.corr.fits"); 54 if (truncate (framefits, 0)) fprintf (stderr, "trouble clearing framefits %s\n", framefits); 55 free (framefits); 29 56 } 30 57 … … 37 64 char filename[1024]; 38 65 snprintf (filename, 1024, "%s/Image.%d.fits", CATDIR, host->hostID); 66 if (unlink (filename)) fprintf (stderr, "trouble clearing image %s\n", filename); 39 67 40 68 // write the image subset for this host 41 69 ImageTableSave (filename, host->image, host->Nimage); 70 71 if (host->astromTable) { 72 char mapname[1024]; 73 snprintf (mapname, 1024, "%s/AstroMap.%d.fits", CATDIR, host->hostID); 74 75 // write the image subset for this host 76 AstromOffsetMapSave (host->astromTable, mapname); 77 } 42 78 43 79 char command[1024]; … … 92 128 if (PhotFlagPoor) strextend (command, "+photflagpoor %d", PhotFlagPoor); 93 129 130 if (CHIPMAP) strextend (command, "-chipmap %d", CHIPMAP); 131 if (RESET_IMAGES) strextend (command, "-reset-images"); 132 94 133 if (MinBadQF > 0.0) strextend (command, "-min-bad-psfqf %f", MinBadQF); 95 134 if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset %f", MaxMeanOffset); … … 99 138 strextend (command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX); 100 139 strextend (command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS); 140 141 strextend (command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 142 143 strextend (command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 144 strextend (command, "-D USE_ICRF_LOCAL %d", USE_ICRF_LOCAL); 145 strextend (command, "-D USE_ICRF_SHFIT %d", USE_ICRF_SHFIT); 146 strextend (command, "-D USE_ICRF_POLE %d", USE_ICRF_POLE); 101 147 102 148 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); … … 133 179 } 134 180 181 if (USE_ICRF_CORRECT) return TRUE; 182 183 int status = HarvestRegionHosts (regionHosts); 184 return status; 185 } 186 187 int HarvestRegionHosts (RegionHostTable *regionHosts) { 188 189 int status = TRUE; 190 135 191 if (PARALLEL_REGIONS_MANUAL) { 136 192 fprintf (stderr, "run the relastro_client commands above. when these are done, hit return\n"); 137 193 getchar(); 138 194 } else { 139 RegionHostTableWaitJobsGetIO (regionHosts, __FILE__, __LINE__, VERBOSE);195 status = RegionHostTableWaitJobsGetIO (regionHosts, __FILE__, __LINE__, VERBOSE); 140 196 } 141 142 int status = TRUE;143 for (i = 0; i < regionHosts->Nhosts; i++) {144 status = status && (regionHosts->hosts[i].status == 0);145 }146 147 197 return status; 148 198 } -
trunk/Ohana/src/relastro/src/liststats.c
r34576 r37807 252 252 X2 += M / dM; 253 253 dS += M; 254 if (XVERB) fprintf (stderr, "chisq contrib : %f : %f : %f : %f : %f\n", Mo, 3600.0*(value[i] - Mo), 3600.0*dvalue[i], (value[i] - Mo) / dvalue[i], X2);254 if (XVERB) fprintf (stderr, "chisq contrib : %f : %f : %f : %f : %f\n", Mo, (value[i] - Mo), dvalue[i], (value[i] - Mo) / dvalue[i], X2); 255 255 } 256 256 X2 = X2 / (Nm - 1); -
trunk/Ohana/src/relastro/src/load_catalogs.c
r37038 r37807 6 6 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath, char *syncfile) { 7 7 8 int i, j , Nstar;8 int i, j; 9 9 // int k, m; 10 10 Catalog *catalog, *pcatalog, tcatalog; … … 88 88 89 89 bcatalog_show_skips(); 90 91 Nstar = 0; 90 fprintf (stderr, "included %d ICRF QSOs\n", ICRFmax()); 91 92 int Nstar = 0; 93 int Nmeas = 0; 92 94 for (i = 0; i < Ncat; i++) { 93 95 Nstar += catalog[i].Naverage; 96 Nmeas += catalog[i].Nmeasure; 94 97 if ((sizeof(IDX_T) == 8) && (catalog[i].Nmeasure > 0xffffffff)) { 95 98 fprintf (stderr, "ERROR: using small-sized IDX_T on data with more than 2G detections per table will cause errors\n"); … … 101 104 fprintf (stderr, "warning: insufficient stars %d\n", Nstar); 102 105 } 106 fprintf (stderr, "using %d stars, %d measurements to calibrate\n", Nstar, Nmeas); 103 107 104 108 // if we are running with parallel_images but not a parallel database, we need to … … 170 174 if (FlagOutlier) strextend (command, "-clip %d", CLIP_THRESH); 171 175 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 176 177 if (USE_ICRF_CORRECT) strextend (command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 178 if (USE_GALAXY_MODEL) strextend (command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 172 179 173 180 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { -
trunk/Ohana/src/relastro/src/load_images.c
r36630 r37807 1 1 # include "relastro.h" 2 3 static AstromOffsetTable *table = NULL; 4 5 /* AstromOffsetMap is the map of Astrometry Offsets for non-polynomial astrometric 6 * corrections for each chip. 7 */ 2 8 3 9 int load_images (FITS_DB *db, SkyList *skylist, int UseFullOverlap) { … … 17 23 MARKTIME(" convert image table: %f sec\n", dtime); 18 24 25 // assign image->parent and image->coords.mosaic 26 BuildChipMatch (image, Nimage); 27 MARKTIME("build chip match: %f sec\n", dtime); 28 29 char mapfile[DVO_MAX_PATH]; 30 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 31 table = AstromOffsetMapLoad (mapfile, VERBOSE); 32 33 // assign images.coords.offsetMap -> table->map[i] 34 if (table) { 35 AstromOffsetTableMatchChips (image, Nimage, table); 36 } else { 37 table = AstromOffsetTableInit (); 38 } 39 19 40 // select the images which overlap the selected sky regions 20 41 subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset, UseFullOverlap); 21 42 MARKTIME(" select images: %f sec\n", dtime); 43 44 if (Nsubset == Nimage) { 45 free (subset); 46 subset = image; 47 } 22 48 23 49 initImages (subset, LineNumber, Nsubset); … … 51 77 return TRUE; 52 78 } 79 80 int save_astrom_table () { 81 82 char mapfile[DVO_MAX_PATH]; 83 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 84 AstromOffsetMapSave (table, mapfile); 85 86 return TRUE; 87 } 88 89 AstromOffsetTable *get_astrom_table () { 90 return table; 91 } 92 93 void put_astrom_table (AstromOffsetTable *myTable) { 94 table = myTable; 95 } 96 -
trunk/Ohana/src/relastro/src/markObjects.c
r37038 r37807 14 14 int m = catalog[i].average[j].measureOffset; 15 15 for (n = 0; n < catalog[i].average[j].Nmeasure; n++) { 16 if (!catalog[i].measureT[m+n].myDet) continue; 17 nOwn ++; 16 // this is a detection I own (it is on one of my images) 17 if (catalog[i].measureT[m+n].myDet) { 18 nOwn ++; 19 continue; 20 } 21 // 2MASS detections are counted as 'owned' (I completely control this object is nOwn_t == Nmeasure; no sharing needed) 22 if ((catalog[i].measureT[m+n].photcode == 2011) || 23 (catalog[i].measureT[m+n].photcode == 2012) || 24 (catalog[i].measureT[m+n].photcode == 2013)) { 25 nOwn ++; 26 continue; 27 } 18 28 } 19 29 catalog[i].nOwn_t[j] = nOwn; -
trunk/Ohana/src/relastro/src/relastroVisual.c
r37038 r37807 24 24 /** Spawn a kapa window */ 25 25 static int initWindow(int *kapid) { 26 if (NTHREADS) { 27 fprintf (stderr, "-visual and -threads are incompatible, quitting\n"); 28 exit (2); 29 } 26 30 if (*kapid == -1) { 27 31 *kapid = KapaOpenNamedSocket("kapa", "relastro_plots"); … … 348 352 349 353 int i; 350 for (i = 0; i < numObj; i++) {354 for (i = 0; i < numObj; i++) { 351 355 if (raw[i].mask) continue; // XXX 352 356 -
trunk/Ohana/src/relastro/src/relastro_client.c
r36833 r37807 79 79 load_images (&db, skylist, FALSE); 80 80 81 // I can free the database after I have loaded the images... 82 81 83 // // load the image subset table from the specified location 82 84 // off_t Nimage; -
trunk/Ohana/src/relastro/src/relastro_images.c
r36833 r37807 23 23 MARKTIME("load images: %f sec\n", dtime); 24 24 25 initCoords();26 27 25 /* load catalog data from region files : subselect high-quality measurements */ 28 // XXX pass in the image table29 // XXX who carries the image grid?30 26 31 27 // photcodesKeep is used here to allow measurements from the images being calibrated … … 33 29 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, NULL); 34 30 MARKTIME("load catalog data: %f sec\n", dtime); 31 32 // find ICRF QSOs for reference downstream (only if USE_ICRF_CORRECT) 33 select_catalog_ICRF (catalog, Ncatalog); 35 34 36 35 if (photcodesReset) { … … 65 64 case TARGET_SIMPLE: 66 65 for (i = 0; i < NLOOP; i++) { 67 UpdateObjects (catalog, Ncatalog );66 UpdateObjects (catalog, Ncatalog, i); 68 67 UpdateSimple (catalog, Ncatalog); 69 68 } … … 71 70 72 71 case TARGET_CHIPS: 72 if (RESET_IMAGES) UpdateMeasures (catalog, Ncatalog); 73 73 for (i = 0; i < NLOOP; i++) { 74 UpdateObjects (catalog, Ncatalog); 75 UpdateChips (catalog, Ncatalog); 74 UpdateObjects (catalog, Ncatalog, (i > 0)); // calculate <R>,<D>; if (i > 0), apply Galaxy Motion Model (if desired) 75 if ((i > 1) || !USE_GALAXY_MODEL) { 76 // if GALAXY_MODEL is selected, we want to delay the frame correction until we have 77 // applied the galaxy model a couple of times. 78 FrameCorrectionSerial (catalog, Ncatalog); 79 } 80 UpdateChips (catalog, Ncatalog); // measure.X,Y -> R,D, fit image.coords 76 81 MARKTIME("update chips: %f sec\n", dtime); 77 82 } … … 82 87 case TARGET_MOSAICS: 83 88 for (i = 0; i < NLOOP; i++) { 84 UpdateObjects (catalog, Ncatalog );89 UpdateObjects (catalog, Ncatalog, i); 85 90 UpdateMosaic (catalog, Ncatalog); 86 91 } … … 102 107 if (PARALLEL) { 103 108 // save the updated image parameters 109 // need to also save the image map table... 110 save_astrom_table (); 104 111 dvo_image_update (&db, VERBOSE); 105 112 dvo_image_unlock (&db); … … 109 116 UpdateObjectOffsets (skylist, 0, NULL); 110 117 111 // iterate over catalogs to make detection coordinates consistant112 // FixProblemImages (skylist);113 114 118 if (!PARALLEL) { 115 119 // save the updated image parameters 120 save_astrom_table (); 116 121 dvo_image_update (&db, VERBOSE); 117 122 dvo_image_unlock (&db); -
trunk/Ohana/src/relastro/src/relastro_objects.c
r36833 r37807 77 77 populate_tiny_values(&catalog, DVO_TV_MEASURE); 78 78 79 UpdateObjects (&catalog, 1 );79 UpdateObjects (&catalog, 1, 0); 80 80 81 81 free_tiny_values(&catalog); -
trunk/Ohana/src/relastro/src/relastro_parallel_images.c
r36833 r37807 17 17 INITTIME; 18 18 19 client_logger_init (CATDIR); 20 19 21 // load the RegionTable (UserRegion should not be used at this level) 20 22 RegionHostTable *regionHosts = RegionHostTableLoad (CATDIR, REGION_FILE); 21 23 int myHost = regionHosts->index[REGION_HOST_ID]; 22 24 RegionHostFindNeighbors (regionHosts, myHost); 25 client_logger_message ("started parallel images on %s\n", regionHosts->hosts[myHost].hostname); 23 26 24 27 // load the subset images belonging to this host … … 29 32 exit (2); 30 33 } 34 35 // assign image->parent and image->coords.mosaic 36 BuildChipMatch (image, Nimage); 37 38 char mapfile[DVO_MAX_PATH]; 39 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.%d.fits", CATDIR, REGION_HOST_ID); 40 AstromOffsetTable *table = AstromOffsetMapLoad (mapfile, VERBOSE); 41 42 // assign images.coords.offsetMap -> table->map[i] 43 if (table) { 44 AstromOffsetTableMatchChips (image, Nimage, table); 45 } else { 46 table = AstromOffsetTableInit (); 47 } 48 put_astrom_table (table); 49 client_logger_message ("loaded images on %s\n", regionHosts->hosts[myHost].hostname); 31 50 32 51 // once we have read this table, we should remove it for repeat runs … … 42 61 SkyList *skylist = SkyListByBounds (sky, -1, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 43 62 44 initCoords();45 46 63 /* load catalog data from region files (hostID is 0 since we are not a client */ 47 64 char *syncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loadcat.sync"); 48 65 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, syncfile); 49 MARKTIME("-- load catalog data : %f sec\n", dtime);66 MARKTIME("-- load catalog data, host %d: %f sec\n", REGION_HOST_ID, dtime); 50 67 free (syncfile); 51 68 69 client_logger_message ("loaded catalog data %s\n", regionHosts->hosts[myHost].hostname); 70 71 // find ICRF QSOs for reference downstream (only if USE_ICRF_CORRECT) 72 select_catalog_ICRF (catalog, Ncatalog); 73 52 74 if (photcodesReset) { 53 75 photcodesKeep = photcodesReset; … … 60 82 /* match measurements with images, mosaics */ 61 83 initImageBins (catalog, Ncatalog, TRUE); 62 MARKTIME("-- make image bins : %f sec\n", dtime);84 MARKTIME("-- make image bins, host %d: %f sec\n", REGION_HOST_ID, dtime); 63 85 64 86 findImages (catalog, Ncatalog, TRUE); 65 MARKTIME("-- set up image indexes : %f sec\n", dtime);87 MARKTIME("-- set up image indexes, host %d: %f sec\n", REGION_HOST_ID, dtime); 66 88 67 89 // set test points based on the starmap 68 90 createStarMap (catalog, Ncatalog); 91 92 client_logger_message ("set up image indexes on %s\n", regionHosts->hosts[myHost].hostname); 69 93 70 94 markObjects (catalog, Ncatalog); … … 72 96 SAVEPLOT = FALSE; 73 97 98 client_logger_message ("starting the loops: %s\n", regionHosts->hosts[myHost].hostname); 99 74 100 /* major modes */ 75 101 switch (FIT_TARGET) { 76 102 case TARGET_SIMPLE: 77 103 for (i = 0; i < NLOOP; i++) { 78 UpdateObjects (catalog, Ncatalog );104 UpdateObjects (catalog, Ncatalog, i); 79 105 share_mean_pos (catalog, Ncatalog, regionHosts, i); 80 106 slurp_mean_pos (catalog, Ncatalog, regionHosts, i); 81 107 UpdateSimple (catalog, Ncatalog); 82 108 share_image_pos (regionHosts, i); 83 slurp_image_pos ( regionHosts, i);109 slurp_image_pos (catalog, Ncatalog, regionHosts, i); 84 110 } 85 111 break; 86 112 87 113 case TARGET_CHIPS: 114 if (RESET_IMAGES) { 115 UpdateMeasures (catalog, Ncatalog); 116 MARKTIME("reset measures, host %d: %f sec\n", REGION_HOST_ID, dtime); 117 client_logger_message ("reset measures: %s\n", regionHosts->hosts[myHost].hostname); 118 } 88 119 for (i = 0; i < NLOOP; i++) { 89 UpdateObjects (catalog, Ncatalog); 120 UpdateObjects (catalog, Ncatalog, (i > 0)); 121 MARKTIME("update objects loop %d, host %d: %f sec\n", i, REGION_HOST_ID, dtime); 122 client_logger_message ("update objects loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 123 if ((i > 1) || !USE_GALAXY_MODEL) { 124 // if GALAXY_MODEL is selected, we want to delay the frame correction until we have 125 // applied the galaxy model a couple of times. 126 FrameCorrectionParallelSlave (catalog, Ncatalog, regionHosts, i); 127 MARKTIME("frame correction loop %d, host %d: %f sec\n", i, REGION_HOST_ID, dtime); 128 client_logger_message ("frame correction loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 129 } 90 130 share_mean_pos (catalog, Ncatalog, regionHosts, i); 91 131 slurp_mean_pos (catalog, Ncatalog, regionHosts, i); 132 client_logger_message ("slurp mags loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 133 92 134 UpdateChips (catalog, Ncatalog); 135 MARKTIME("update chips loop %d, host %d: %f sec\n", i, REGION_HOST_ID, dtime); 136 client_logger_message ("update chips loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 137 93 138 share_image_pos (regionHosts, i); 94 slurp_image_pos (regionHosts, i); 95 MARKTIME("update chips: %f sec\n", dtime); 139 slurp_image_pos (catalog, Ncatalog, regionHosts, i); 140 client_logger_message ("slurp image pos loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 141 142 share_meas_pos (catalog, Ncatalog, regionHosts, i); 143 slurp_meas_pos (catalog, Ncatalog, regionHosts, i); 144 MARKTIME("done exchange loop %d, host %d: %f sec\n", i, REGION_HOST_ID, dtime); 145 client_logger_message ("slurp meas loop %d: %s\n", i, regionHosts->hosts[myHost].hostname); 96 146 } 97 147 // create summary plots of the process … … 101 151 case TARGET_MOSAICS: 102 152 for (i = 0; i < NLOOP; i++) { 103 UpdateObjects (catalog, Ncatalog );153 UpdateObjects (catalog, Ncatalog, i); 104 154 share_mean_pos (catalog, Ncatalog, regionHosts, i); 105 155 slurp_mean_pos (catalog, Ncatalog, regionHosts, i); 106 156 UpdateMosaic (catalog, Ncatalog); 107 157 share_image_pos (regionHosts, i); 108 slurp_image_pos ( regionHosts, i);158 slurp_image_pos (catalog, Ncatalog, regionHosts, i); 109 159 } 110 160 break; … … 128 178 129 179 share_image_pos (regionHosts, -1); 180 client_logger_message ("share image pos loop %d: %s\n", -1, regionHosts->hosts[myHost].hostname); 130 181 131 182 exit (0); -
trunk/Ohana/src/relastro/src/relastro_parallel_regions.c
r36630 r37807 44 44 if (!launch_region_hosts (regionHosts)) Shutdown ("error launching region hosts"); 45 45 46 // If we are doing FrameCorrection, we have to loop here waiting for ICRF objects from the region 47 // hosts. we then measure the frame correction and send back the result 48 if (!FrameCorrectionParallelMaster (regionHosts)) Shutdown ("error running parallel frame correction"); 49 46 50 // retrieve updated image parameters from the remote hosts (also set Image.mcal) 47 if (!slurp_image_pos ( regionHosts, -1)) Shutdown ("error loading image updates");51 if (!slurp_image_pos (NULL, 0, regionHosts, -1)) Shutdown ("error loading image updates"); 48 52 49 53 if (!UPDATE) { … … 59 63 60 64 if (PARALLEL) { 61 // save the updated image parameters 65 // save the updated image parameters. if we are NOT PARALLEL, we have to wait 66 // until after UpdateObjectOffsets, or the image parameters are swapped and/or freed 67 save_astrom_table (); 62 68 dvo_image_save (&db, VERBOSE); 63 69 dvo_image_unlock (&db); … … 65 71 66 72 // iterate over catalogs to make detection coordinates consistant 67 UpdateObjectOffsets (skylist, 0, NULL); 73 if (APPLY_OFFSETS) { 74 UpdateObjectOffsets (skylist, 0, NULL); 75 } 68 76 69 77 if (!PARALLEL) { 70 78 // save the changes to the image parameters 79 save_astrom_table (); 71 80 dvo_image_save (&db, VERBOSE); 72 81 dvo_image_unlock (&db); -
trunk/Ohana/src/relastro/src/select_images.c
r36630 r37807 23 23 int InRange, found; 24 24 double Ri[5], Di[5], Xi[5], Yi[5], dx, dy; 25 Coords tcoords;26 25 SkyRegionCoords *skycoords; 27 26 … … 46 45 47 46 // the comparison is made in the catalog local projection. below we set crval1,2 48 tcoords.crpix1 = tcoords.crpix2 = 0.0; 47 Coords tcoords; 48 InitCoords (&tcoords, "DEC--TAN"); 49 49 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 50 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;51 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;52 strcpy (tcoords.ctype, "DEC--TAN");53 50 54 51 ALLOCATE (skycoords, SkyRegionCoords, skylist[0].Nregions); … … 104 101 105 102 if (VERBOSE) fprintf (stderr, "finding images\n"); 106 BuildChipMatch (timage, Ntimage);107 MARKTIME("build chip match: %f sec\n", dtime);108 103 109 104 nimage = 0; … … 148 143 } 149 144 150 // this adds 1.3 sec for 3M images151 if (!FindMosaicForImage (timage, Ntimage, i)) {152 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);153 continue;154 }155 156 145 /* define image corners - note the DIS images (mosaic phu) are special */ 157 146 if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) { -
trunk/Ohana/src/relastro/src/share_images_pos.c
r36630 r37807 34 34 free (iposfile); 35 35 36 // save the per-chip residual table 37 AstromOffsetTable *table = get_astrom_table (); 38 if (table) { 39 char mapname[1024]; 40 snprintf (mapname, 1024, "%s/AstroMapUpdate.%d.fits", CATDIR, REGION_HOST_ID); 41 42 // write the image subset for this host 43 AstromOffsetMapSave (table, mapname); 44 } 45 36 46 char *syncfile = make_filename (CATDIR, hostname, REGION_HOST_ID, "imagepos.sync"); 37 47 update_sync_file (syncfile, nloop); … … 41 51 } 42 52 43 int slurp_image_pos ( RegionHostTable *regionHosts, int nloop) {53 int slurp_image_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop) { 44 54 45 off_t Nimage, i ;55 off_t Nimage, i, j; 46 56 Image *images = getimages (&Nimage, NULL); 47 57 … … 74 84 continue; 75 85 } 86 Coords *moscoords = images[seq].coords.mosaic; 76 87 images[seq].coords = image_pos[i].coords ; 77 images[seq].dXpixSys = image_pos[i].dXpixSys ; 78 images[seq].dYpixSys = image_pos[i].dYpixSys ; 79 images[seq].imageID = image_pos[i].imageID ; 80 images[seq].nFitAstrom = image_pos[i].nFitAstrom; 81 images[seq].flags = image_pos[i].flags ; 88 images[seq].coords.mosaic = moscoords; 89 90 images[seq].dXpixSys = image_pos[i].dXpixSys ; 91 images[seq].dYpixSys = image_pos[i].dYpixSys ; 92 images[seq].refColorBlue = image_pos[i].refColorBlue; 93 images[seq].refColorRed = image_pos[i].refColorRed; 94 images[seq].imageID = image_pos[i].imageID ; 95 images[seq].nFitAstrom = image_pos[i].nFitAstrom; 96 images[seq].flags = image_pos[i].flags ; 97 } 98 99 // load the astrometry offset maps, if they exist, and apply 100 for (i = 0; i < regionHosts->Nhosts; i++) { 101 if (regionHosts->hosts[i].hostID == REGION_HOST_ID) continue; 102 if (REGION_HOST_ID && !regionHosts->hosts[i].isNeighbor) continue; 103 104 char mapname[1024]; 105 snprintf (mapname, 1024, "%s/AstroMapUpdate.%d.fits", CATDIR, regionHosts->hosts[i].hostID); 106 107 AstromOffsetTable *table = AstromOffsetMapLoad (mapname, VERBOSE); 108 109 // apply table entries here to existing images 110 for (j = 0; j < table->Nmap; j++) { 111 off_t seq = getImageByID (table->map[j][0].imageID); 112 // I do not necessarily own all images listed in the table. skip if not found 113 if (seq < 0) continue; 114 115 AstromOffsetMap *oldMap = images[seq].coords.offsetMap; 116 AstromOffsetMap *newMap = table->map[j]; 117 118 if (oldMap) { 119 AstromOffsetMapSetOrder (oldMap, newMap->Nx, newMap->Ny, &images[seq]); 120 AstromOffsetMapCopyData (oldMap, newMap); 121 } else { 122 lockUpdateChips (); 123 AstromOffsetTable *FullTable = get_astrom_table (); 124 AstromOffsetTableNewMap(FullTable, newMap->Nx, newMap->Ny, &images[seq]); // registers the map with the image 125 unlockUpdateChips (); 126 AstromOffsetMapCopyData (images[seq].coords.offsetMap, newMap); // oldMap is now not valid 127 } 128 } 129 AstromOffsetTableFree(table); 130 } 131 132 // apply the modified image parameters to my detections 133 for (i = 0; FALSE && (Ncatalog > 0) && (i < Nimage_pos); i++) { 134 off_t seq = getImageByID (image_pos[i].imageID); 135 if (seq < 0) continue; 136 updateImageRaw (catalog, Ncatalog, seq); 82 137 } 83 138 free (image_pos); … … 93 148 image_pos->dXpixSys = image->dXpixSys; 94 149 image_pos->dYpixSys = image->dYpixSys; 150 image_pos->refColorBlue = image->refColorBlue; 151 image_pos->refColorRed = image->refColorRed; 95 152 image_pos->imageID = image->imageID; 96 153 image_pos->nFitAstrom = image->nFitAstrom; -
trunk/Ohana/src/relastro/src/testparallax.c
r36482 r37807 49 49 50 50 /* project coordinates to a plane centered on the object with units of arcsec */ 51 coords.crval1 = 0; 52 coords.crval2 = 0; 53 coords.crpix1 = 0; 54 coords.crpix2 = 0; 51 InitCoords (&coords, "DEC--SIN"); 55 52 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 56 coords.pc1_1 = coords.pc2_2 = 1.0;57 coords.pc1_2 = coords.pc2_1 = 0.0;58 coords.Npolyterms = 1;59 strcpy (coords.ctype, "DEC--SIN");60 53 61 54 // use one point as a local reference -
trunk/Ohana/src/relphot/include/relphot.h
r37116 r37807 452 452 int setMrel_catalog_alt (Catalog *catalog, int Nc, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt); 453 453 int setMrelAverageExposure (off_t meas, int cat, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, AverageTiny *averageT, SecFilt *secfilt, Measure *measure, MeasureTiny *measureT, off_t *found); 454 int setMrelAverageStack (off_t meas, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure); 454 int setMrelAverageStack (off_t measureOffset, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, off_t Nmeasure); 455 int setMrelAverageForcedWarp (off_t measureOffset, int cat, int pass, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, off_t *found, off_t Nmeasure); 456 455 457 int setGlobalObjStats (Average *average, Measure *measure); 456 458 -
trunk/Ohana/src/relphot/src/BoundaryTreeOps.c
r36491 r37807 51 51 if (!tess) return FALSE; 52 52 53 status = TessellationPrimaryCellIDs(tess, Ntess, tessID, projID, skycellID, ra, dec); 53 double R = ohana_normalize_angle(ra); 54 status = TessellationPrimaryCellIDs(tess, Ntess, tessID, projID, skycellID, R, dec); 54 55 return status; 55 56 } -
trunk/Ohana/src/relphot/src/ImageOps.c
r37116 r37807 35 35 static off_t *imageIdx; // list of index for image IDs 36 36 37 // QQ // as an alternative, we generate imageSeq, which directly maps imageID -> seq 38 // QQ static off_t *imageSeq; // list of index for image IDs 39 // QQ 40 // QQ // MAX_ID requires 512M to store the image index 41 // QQ # define MAX_ID 0x8000000 42 // QQ static off_t minImageID = MAX_ID; 43 // QQ static off_t maxImageID = 0; 44 37 45 // elsewhere, we have loaded a set of catalogs with measures (catalog[cat].measure[meas]) 38 46 // each image has N_onImage[ImageIndex] measurements … … 95 103 96 104 TessellationIDsByImageName (&tessID[i], &projectID[i], &skycellID[i], image[i].name); 105 106 // QQ minImageID = MIN(minImageID, image[i].imageID); 107 // QQ maxImageID = MAX(maxImageID, image[i].imageID); 108 // QQ myAssert (image[i].imageID < MAX_ID, "image IDs too large for index memory"); 97 109 } 98 110 … … 100 112 // XXX does this break the imageID <-> projectID, etc match? 101 113 llsortpair (imageIDs, imageIdx, Nimage); 114 115 // QQ ALLOCATE (imageSeq, off_t, maxImageID + 1); 116 // QQ for (i = 0; i < maxImageID + 1; i++) { 117 // QQ imageSeq[i] = -1; // not yet assigned 118 // QQ } 119 // QQ 120 // QQ for (i = 0; i < Nimage; i++) { 121 // QQ off_t N = image[i].imageID; 122 // QQ myAssert (imageSeq[N] == -1, "previously assigned"); 123 // QQ imageSeq[N] = i; 124 // QQ } 102 125 } 103 126 … … 167 190 168 191 off_t getImageByID (off_t ID) { 192 193 // QQ if (imageSeq) { 194 // QQ myAssert (ID >= minImageID, "oops"); 195 // QQ myAssert (ID <= maxImageID, "oops"); 196 // QQ off_t N = imageSeq[ID]; 197 // QQ return N; 198 // QQ } 169 199 170 200 // we have a pair of vectors (imageIDs, imageIdx) sorted by imageIDs -
trunk/Ohana/src/relphot/src/ImageTable.c
r36630 r37807 32 32 } 33 33 34 // XXX do not make the chip match -- we have not loaded the PHU entries (and do not need them here) 35 // BuildChipMatch (image, Nimage); 36 34 37 *nimage = Nimage; 35 38 return image; -
trunk/Ohana/src/relphot/src/MosaicOps.c
r37037 r37807 520 520 m = MosaicToImage[i][j]; 521 521 522 if (!FindMosaicForImage (image, Nimage, m)) {523 if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);524 continue;525 }526 527 522 NX = image[m].NX; 528 523 NY = image[m].NY; 529 XY_to_RD (&R, &D, 0.5*NX, 0.5*NY, &image[m].coords);524 if (!XY_to_RD (&R, &D, 0.5*NX, 0.5*NY, &image[m].coords)) continue; 530 525 R = ohana_normalize_angle_to_midpoint (R, 180.0); 531 526 … … 587 582 } 588 583 589 strcpy (mosaic[i].coords.ctype, "DEC--TAN");584 InitCoords (&mosaic[i].coords, "DEC--TAN"); 590 585 mosaic[i].coords.crval1 = Rmid; 591 586 mosaic[i].coords.crval2 = Dmid; 592 mosaic[i].coords.crpix1 = 0.0;593 mosaic[i].coords.crpix2 = 0.0;594 587 mosaic[i].coords.cdelt1 = 1.0 / 3600.0; 595 588 mosaic[i].coords.cdelt2 = 1.0 / 3600.0; 596 mosaic[i].coords.pc1_1 = 1.0;597 mosaic[i].coords.pc2_2 = 1.0;598 mosaic[i].coords.pc1_2 = 0.0;599 mosaic[i].coords.pc2_1 = 0.0;600 589 601 590 mosaic[i].Mcal = 0.0; … … 631 620 NY = image[m].NY; 632 621 dS += hypot (image[m].coords.cdelt1*image[m].coords.pc1_1, image[m].coords.cdelt1*image[m].coords.pc2_1); 633 XY_to_RD (&R, &D, 0.0, 0.0, &image[m].coords); 622 623 OhanaProjection proj = GetProjection (image[m].coords.ctype); 624 if ((proj == PROJ_WRP) && !image[m].coords.mosaic) { 625 XY_to_LM (&R, &D, 0.0, 0.0, &image[m].coords); 626 } else { 627 XY_to_RD (&R, &D, 0.0, 0.0, &image[m].coords); 628 } 634 629 Rmin = MIN (Rmin, R); 635 630 Rmax = MAX (Rmax, R); 636 631 Dmin = MIN (Dmin, D); 637 632 Dmax = MAX (Dmax, D); 638 XY_to_RD (&R, &D, (double) NX, 0.0, &image[m].coords); 633 634 if ((proj == PROJ_WRP) && !image[m].coords.mosaic) { 635 XY_to_LM (&R, &D, (double) NX, 0.0, &image[m].coords); 636 } else { 637 XY_to_RD (&R, &D, (double) NX, 0.0, &image[m].coords); 638 } 639 639 Rmin = MIN (Rmin, R); 640 640 Rmax = MAX (Rmax, R); 641 641 Dmin = MIN (Dmin, D); 642 642 Dmax = MAX (Dmax, D); 643 XY_to_RD (&R, &D, (double) NX, (double) NY, &image[m].coords); 643 644 if ((proj == PROJ_WRP) && !image[m].coords.mosaic) { 645 XY_to_LM (&R, &D, (double) NX, (double) NY, &image[m].coords); 646 } else { 647 XY_to_RD (&R, &D, (double) NX, (double) NY, &image[m].coords); 648 } 644 649 Rmin = MIN (Rmin, R); 645 650 Rmax = MAX (Rmax, R); 646 651 Dmin = MIN (Dmin, D); 647 652 Dmax = MAX (Dmax, D); 648 XY_to_RD (&R, &D, 0.0, (double) NY, &image[m].coords); 653 654 if ((proj == PROJ_WRP) && !image[m].coords.mosaic) { 655 XY_to_LM (&R, &D, 0.0, (double) NY, &image[m].coords); 656 } else { 657 XY_to_RD (&R, &D, 0.0, (double) NY, &image[m].coords); 658 } 649 659 Rmin = MIN (Rmin, R); 650 660 Rmax = MAX (Rmax, R); … … 652 662 Dmax = MAX (Dmax, D); 653 663 664 // XXX : this probably does not handle mosaics at RA = 0,360 well 665 654 666 /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */ 655 667 … … 668 680 } 669 681 dS /= MosaicN_Image[i]; 670 strcpy (mosaic[i].coords.ctype, "DEC--TAN"); 682 683 InitCoords (&mosaic[i].coords, "DEC--TAN"); 671 684 mosaic[i].coords.crval1 = Rmin; 672 685 mosaic[i].coords.crval2 = Dmin; 673 mosaic[i].coords.crpix1 = 0.0;674 mosaic[i].coords.crpix2 = 0.0;675 686 mosaic[i].coords.cdelt1 = dS; 676 687 mosaic[i].coords.cdelt2 = dS; 677 mosaic[i].coords.pc1_1 = 1.0; 678 mosaic[i].coords.pc2_2 = 1.0; 679 mosaic[i].coords.pc1_2 = 0.0; 680 mosaic[i].coords.pc2_1 = 0.0; 688 681 689 RD_to_XY (&dX, &dY, Rmax, Dmax, &mosaic[i].coords); 682 690 -
trunk/Ohana/src/relphot/src/assign_images.c
r37037 r37807 80 80 if (!strcmp(&image[j].coords.ctype[4], "-DIS")) continue; 81 81 82 // match the image to its corresponding ASTROMETRIC mosaic (not the same as the Mosaic above)83 if (!FindMosaicForImage (image, Nimage, j)) {84 if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);85 continue;86 }87 88 82 // Exclude images with crazy astrometry 89 83 // XXX NOTE : this is gpc1-specific … … 123 117 124 118 if (MOSAIC_ZEROPT) { 125 // use the coords of the associated mosaic to select 119 // use the coords of the associated mosaic to select (only for chips; stacks use their own center) 126 120 Mosaic *mosaic = getMosaicForImage (j); 127 Rc = mosaic->coords.crval1; 128 Dc = mosaic->coords.crval2; 129 // NOTE : have defined mosaic Rc,Dc to choose the side of 0,360 on which most of the 130 // chips are located. but, for host assignment, we rationalize to 0.0 - 360.0 131 Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0); 121 if (mosaic) { 122 Rc = mosaic->coords.crval1; 123 Dc = mosaic->coords.crval2; 124 // NOTE : have defined mosaic Rc,Dc to choose the side of 0,360 on which most of the 125 // chips are located. but, for host assignment, we rationalize to 0.0 - 360.0 126 Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0); 127 } 132 128 } 133 129 … … 206 202 } 207 203 208 int calculate_host_image_bounds (RegionHostTable *regionHosts, double Rmid) {209 210 int i, n;211 off_t j;212 213 for (i = 0; i < regionHosts->Nhosts; i++) {214 215 RegionHostInfo *host = ®ionHosts->hosts[i];216 217 // XXX clear the chip match?218 219 BuildChipMatch (host->image, host->Nimage);220 221 double Rmin = 720.0;222 double Rmax = -360.0;223 double Dmin = +90.0;224 double Dmax = -90.0;225 226 for (j = 0; j < host->Nimage; j++) {227 228 Image *image = &host->image[j];229 230 if (!FindMosaicForImage (host->image, host->Nimage, j)) {231 fprintf (stderr, "missing astrometry? programming error?\n");232 abort ();233 }234 235 // define image corners236 for (n = 0; n < 4; n++) {237 double Xc, Yc, Rc, Dc;238 Xc = Xf[n]*image->NX;239 Yc = Yf[n]*image->NY;240 XY_to_RD (&Rc, &Dc, Xc, Yc, &image->coords);241 Rc = ohana_normalize_angle_to_midpoint (Rc, Rmid);242 243 Rmin = MIN (Rmin, Rc);244 Dmin = MIN (Dmin, Rc);245 246 Rmax = MAX (Rmax, Rc);247 Dmax = MAX (Dmax, Rc);248 }249 250 }251 252 // RminCat, RmaxCat may extended beyond 0.0 - 360.0253 host->RminCat = Rmin;254 host->DminCat = Dmin;255 host->RmaxCat = Rmax;256 host->DmaxCat = Dmax;257 258 // regionHosts needs to have the full outer boundary259 // (so reload_catalogs covers the correct region)260 regionHosts->Rmin = MIN(Rmin, regionHosts->Rmin);261 regionHosts->Rmax = MAX(Rmax, regionHosts->Rmax);262 regionHosts->Dmin = MIN(Dmin, regionHosts->Dmin);263 regionHosts->Dmax = MAX(Dmax, regionHosts->Dmax);264 }265 return TRUE;266 }267 268 269 204 // Rc is in range 0.0 - 360.0, hosts Rmin,Rmax in range 0.0 - 360.0 270 205 int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc) { -
trunk/Ohana/src/relphot/src/load_images.c
r35759 r37807 27 27 } 28 28 MARKTIME("read image table: %f sec\n", dtime); 29 30 BuildChipMatch (image, Nimage); 31 MARKTIME("build chip match for %d images: %f sec\n", (int) Nimage, dtime); 32 33 char mapfile[DVO_MAX_PATH]; 34 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 35 AstromOffsetTable *table = AstromOffsetMapLoad (mapfile, VERBOSE); 36 37 // assign images.coords.offsetMap -> table->map[i] 38 if (table) { 39 AstromOffsetTableMatchChips (image, Nimage, table); 40 } 29 41 30 42 // allocate and init an array to identify the images included in the subset -
trunk/Ohana/src/relphot/src/reload_catalogs.c
r36630 r37807 128 128 } 129 129 130 int reload_catalog_parallel_group (HostTableGroup *group, SkyList *sky, char *imageFile); 131 130 132 // XXX Image to Image Subset 131 133 int reload_catalogs_parallel (SkyList *sky) { … … 165 167 free (BOUNDARY_TREE); 166 168 BOUNDARY_TREE = tmppath; 167 168 } 169 } 170 171 int Ngroups; 172 HostTableGroup *groups = HostTableGroups (table, &Ngroups); 173 // split the table into Ngroups, each with a unique set of machines (this avoids overloading the remote host machines) 174 175 int i; 176 for (i = 0; i < Ngroups; i++) { 177 // update only a group of unique machines at a time 178 reload_catalog_parallel_group (&groups[i], sky, imageFile); 179 } 180 return TRUE; 181 } 182 183 int reload_catalog_parallel_group (HostTableGroup *group, SkyList *sky, char *imageFile) { 169 184 170 185 int i, j; 171 for (i = 0; i < table->Nhosts; i++) {172 173 if (sky->Nregions < table->Nhosts) {186 for (i = 0; i < group->Nhosts; i++) { 187 188 if (sky->Nregions < group->Nhosts) { 174 189 // do any of the regions want this host? 175 190 int wantThisHost = FALSE; 176 191 for (j = 0; j < sky->Nregions; j++) { 177 if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) {192 if (HostTableTestHost (sky->regions[j], group->hosts[i][0].hostID)) { 178 193 wantThisHost = TRUE; 179 194 break; … … 181 196 } 182 197 if (!wantThisHost) { 183 // fprintf (stderr, "skip host %s\n", table->hosts[i].hostname);198 // fprintf (stderr, "skip host %s\n", group->hosts[i][0].hostname); 184 199 continue; 185 200 } … … 187 202 188 203 // ensure that the paths are absolute path names 189 char *tmppath = abspath ( table->hosts[i].pathname, DVO_MAX_PATH);190 free ( table->hosts[i].pathname);191 table->hosts[i].pathname = tmppath;204 char *tmppath = abspath (group->hosts[i][0].pathname, DVO_MAX_PATH); 205 free (group->hosts[i][0].pathname); 206 group->hosts[i][0].pathname = tmppath; 192 207 193 208 char command[1024]; 194 209 snprintf (command, 1024, "relphot_client %s -update-catalogs %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -D CAMERA %s -D STAR_TOOFEW %d -minerror %f", 195 PhotcodeList, imageFile, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, CAMERA, STAR_TOOFEW, MIN_ERROR);210 PhotcodeList, imageFile, group->hosts[i][0].hostID, CATDIR, group->hosts[i][0].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, CAMERA, STAR_TOOFEW, MIN_ERROR); 196 211 197 212 // options & configs which affect relphot_client -update-catalogs … … 238 253 // launch the job on the remote machine (no handshake) 239 254 int errorInfo = 0; 240 int pid = rconnect ("ssh", table->hosts[i].hostname, command, table->hosts[i].stdio, &errorInfo, FALSE);255 int pid = rconnect ("ssh", group->hosts[i][0].hostname, command, group->hosts[i][0].stdio, &errorInfo, FALSE); 241 256 if (!pid) { 242 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", table->hosts[i].hostname, errorInfo);257 if (DEBUG) fprintf (stderr, "failure to start %s (error %d)\n", group->hosts[i][0].hostname, errorInfo); 243 258 exit (1); 244 259 } 245 table->hosts[i].pid = pid; // save for future reference260 group->hosts[i][0].pid = pid; // save for future reference 246 261 } 247 262 } … … 252 267 } 253 268 if (!PARALLEL_MANUAL && !PARALLEL_SERIAL) { 254 int status = HostTable WaitJobsGetIO (table, __FILE__, __LINE__, VERBOSE);269 int status = HostTableGroupWaitJobsGetIO (group, __FILE__, __LINE__, VERBOSE); 255 270 if (!status) { 256 271 fprintf (stderr, "at least one remote client job failed to load data, exiting\n"); -
trunk/Ohana/src/relphot/src/relphot.c
r36630 r37807 9 9 switch (mode) { 10 10 case UPDATE_IMAGES: 11 // IF CALLED WITH NLOOP == 0, DOES NOT LOAD bcatalog, just loads image table and generates ImageSubset.dat 11 12 relphot_images (); 12 13 exit (0); … … 14 15 case UPDATE_AVERAGES: 15 16 // take the current set of detections and set the mean magnitudes 17 // DOES NOT LOAD THE IMAGE TABLE 16 18 relphot_objects (0, NULL); 17 19 exit (0); … … 43 45 exit (1); 44 46 } 47 48 /*** 49 50 I would like to merge the functionality of relphot_images (Nloop == 0), relphot_objects, and apply_offsets 51 52 ***/ -
trunk/Ohana/src/relphot/src/relphot_objects.c
r35104 r37807 36 36 if (!HostTableTestHost(skylist[0].regions[i], hostID)) continue; 37 37 38 // set up the basic catalog info39 38 // set up the basic catalog info 40 39 char hostfile[1024]; -
trunk/Ohana/src/relphot/src/relphot_parallel_regions.c
r37037 r37807 43 43 MARKTIME("-- load image data: %f sec\n", dtime); 44 44 45 // save Images.dat using the copied structure 46 if (UPDATE_CATFORMAT) { 47 // ensure the db format is updated 48 db.format = dvo_catalog_catformat (UPDATE_CATFORMAT); 49 } 50 45 51 /* assign the images to the different region hosts */ 46 52 if (!assign_images (&db, regionHosts)) Shutdown ("error assigning images to region hosts"); … … 49 55 /* launch processing on the parallel region hosts */ 50 56 if (!launch_region_hosts (regionHosts)) Shutdown ("error launching region hosts"); 57 MARKTIME ("finished relphot -parallel-regions: %f sec total\n", dtime); 51 58 52 59 // retrieve updated image parameters from the remote hosts (also set Image.mcal) -
trunk/Ohana/src/relphot/src/select_images.c
r36491 r37807 36 36 37 37 // the comparison is made in the catalog local projection. below we set crval1,2 38 tcoords.crpix1 = tcoords.crpix2 = 0.0;38 InitCoords (&tcoords, "DEC--TAN"); 39 39 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 40 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;41 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;42 strcpy (tcoords.ctype, "DEC--TAN");43 40 44 41 double RminSkyRegion = region[0].Rmin; … … 93 90 94 91 if (VERBOSE) fprintf (stderr, "finding images\n"); 95 BuildChipMatch (timage, Ntimage);96 MARKTIME("build chip match for %d images: %f sec\n", (int) Ntimage, dtime);97 92 98 93 D_NIMAGE = 6000; … … 107 102 108 103 if (!(i % 300000)) fprintf (stderr, "."); 104 105 // XXX I am just going for force this for the moment: 106 goto found_it; 109 107 110 108 /* exclude images by photcode */ … … 123 121 } 124 122 125 // this adds 1.3 sec for 3M images126 if (!FindMosaicForImage (timage, Ntimage, i)) {127 if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);128 continue;129 }130 131 123 /* define image corners - note the DIS images (mosaic phu) are special */ 132 124 if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) { … … 405 397 406 398 // the comparison is made in the catalog local projection. below we set crval1,2 407 tcoords.crpix1 = tcoords.crpix2 = 0.0;399 InitCoords (&tcoords, "DEC--TAN"); 408 400 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 409 tcoords.pc1_1 = tcoords.pc2_2 = 1.0;410 tcoords.pc1_2 = tcoords.pc2_1 = 0.0;411 412 tcoords.Npolyterms = 0;413 memset (tcoords.polyterms, 0, 14*sizeof(float));414 strcpy (tcoords.ctype, "DEC--TAN");415 401 416 402 /* compare with each region file */ -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r37740 r37807 36 36 } 37 37 38 int setMrelAverageForcedWarp (off_t measureOffset, int cat, int pass, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, off_t *found);39 40 38 int setMrel_catalog_alt (Catalog *catalog, int Nc, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt) { 41 39 … … 60 58 Average *average = catalog[Nc].average ? &catalog[Nc].average[j] : NULL; 61 59 Measure *measure = catalog[Nc].measure ? &catalog[Nc].measure[m] : NULL; 62 setMrelAverageExposure (m, Nc, pass, flatcorr, results, average, &catalog[Nc].averageT[j], &catalog[Nc].secfilt[j*Nsecfilt], measure, &catalog[Nc].measureT[m], &catalog[Nc].found_t[Nsecfilt*j]); 60 SecFilt *secfilt = catalog[Nc].secfilt ? &catalog[Nc].secfilt[j*Nsecfilt] : NULL; 61 setMrelAverageExposure (m, Nc, pass, flatcorr, results, average, &catalog[Nc].averageT[j], secfilt, measure, &catalog[Nc].measureT[m], &catalog[Nc].found_t[Nsecfilt*j]); 63 62 64 63 // only apply Stack operation on setMrelFinal in first pass 65 64 if (isSetMrelFinal && (pass == 0)) { 66 setMrelAverageStack (m, Nc, flatcorr, results, &catalog[Nc].average[j], &catalog[Nc].secfilt[j*Nsecfilt], &catalog[Nc].measure[m]);65 setMrelAverageStack (m, Nc, flatcorr, results, average, secfilt, &catalog[Nc].measure[m], catalog[Nc].Nmeasure); 67 66 setGlobalObjStats (&catalog[Nc].average[j], &catalog[Nc].measure[m]); 68 67 } … … 70 69 // only measure force-warp mean values if issetMrelFinal (make it optional?) 71 70 if (isSetMrelFinal) { 72 setMrelAverageForcedWarp (m, Nc, pass, results, &catalog[Nc].average[j], &catalog[Nc].secfilt[j*Nsecfilt], &catalog[Nc].measure[m], &catalog[Nc].foundWarp_t[Nsecfilt*j]);73 setGlobalObjStats ( &catalog[Nc].average[j], &catalog[Nc].measure[m]);71 setMrelAverageForcedWarp (m, Nc, pass, results, average, secfilt, measure, &catalog[Nc].foundWarp_t[Nsecfilt*j], catalog[Nc].Nmeasure); 72 setGlobalObjStats (average, measure); 74 73 } 75 74 } … … 456 455 // 2) select the BEST detections per filter (regardless of PRIMARY) 457 456 // 3) apply the zero point and AB->Jy transformations 458 int setMrelAverageStack (off_t measureOffset, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure ) {457 int setMrelAverageStack (off_t measureOffset, int cat, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, off_t Nmeasure) { 459 458 460 459 off_t k; … … 496 495 int Nstack = 0; // number for this photcode 497 496 int NstackDet = 0; // number for this photcode 497 498 secfilt[Nsec].stackBestOff = -1; 499 secfilt[Nsec].stackPrmryOff = -1; 498 500 499 501 off_t meas = measureOffset; … … 526 528 measure[k].dbFlags |= ID_MEAS_STACK_PRIMARY; 527 529 secfilt[Nsec].stackPrmryOff = meas; 530 myAssert (secfilt[Nsec].stackPrmryOff <= Nmeasure, "stackPrmryOff out of range"); 528 531 } 529 532 … … 637 640 638 641 secfilt[Nsec].stackBestOff = k + measureOffset; 642 myAssert (secfilt[Nsec].stackBestOff <= Nmeasure, "stackBestOff out of range"); 639 643 640 644 secfilt[Nsec].Nstack = Nstack; … … 669 673 // somewhat simplified relative to chip-photometry: 670 674 // * no grid, no mosaic, no 2MASS, no SYNTH, no Ubercal, no flatcorr 671 int setMrelAverageForcedWarp (off_t measureOffset, int cat, int pass, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, off_t *found ) {675 int setMrelAverageForcedWarp (off_t measureOffset, int cat, int pass, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, off_t *found, off_t Nmeasure) { 672 676 673 677 off_t k; … … 713 717 // if we cannot make that association, skip this set of warps 714 718 int stkTessID, stkProjID, stkSkycellID; 719 720 myAssert (secfilt[Nsec].stackBestOff <= Nmeasure, "stackBestOff out of range"); 715 721 if (!FindImageSkycellID (secfilt[Nsec].stackBestOff, cat, &stkTessID, &stkProjID, &stkSkycellID)) continue; 716 722 -
trunk/Ohana/src/uniphot/Makefile
r35764 r37807 1 default: uniphot setphot setphot_client setfwhm setposangle setposangle_client setastrom setastrom_client fiximids fiximids_client fixstkids fixstkids_client ckids ckids_client1 default: uniphot setphot setphot_client setfwhm setposangle setposangle_client setastrom setastrom_client setgalmodel setgalmodel_client fiximids fiximids_client fixstkids fixstkids_client ckids ckids_client 2 2 help: 3 3 @echo "make options: uniphot setphot setfwhm default help install default (uniphot setphot setfwhm)" … … 25 25 setastrom: $(BIN)/setastrom.$(ARCH) 26 26 setastrom_client: $(BIN)/setastrom_client.$(ARCH) 27 setgalmodel: $(BIN)/setgalmodel.$(ARCH) 28 setgalmodel_client: $(BIN)/setgalmodel_client.$(ARCH) 27 29 fiximids: $(BIN)/fiximids.$(ARCH) 28 30 fiximids_client: $(BIN)/fiximids_client.$(ARCH) … … 32 34 ckids_client: $(BIN)/ckids_client.$(ARCH) 33 35 34 install: $(DESTBIN)/uniphot $(DESTBIN)/setfwhm $(DESTBIN)/setphot $(DESTBIN)/setphot_client $(DESTBIN)/setposangle $(DESTBIN)/setposangle_client $(DESTBIN)/setastrom $(DESTBIN)/setastrom_client $(DESTBIN)/ fiximids $(DESTBIN)/fiximids_client $(DESTBIN)/fixstkids $(DESTBIN)/fixstkids_client $(DESTBIN)/ckids $(DESTBIN)/ckids_client36 install: $(DESTBIN)/uniphot $(DESTBIN)/setfwhm $(DESTBIN)/setphot $(DESTBIN)/setphot_client $(DESTBIN)/setposangle $(DESTBIN)/setposangle_client $(DESTBIN)/setastrom $(DESTBIN)/setastrom_client $(DESTBIN)/setgalmodel $(DESTBIN)/setgalmodel_client $(DESTBIN)/fiximids $(DESTBIN)/fiximids_client $(DESTBIN)/fixstkids $(DESTBIN)/fixstkids_client $(DESTBIN)/ckids $(DESTBIN)/ckids_client 35 37 36 38 UNIPHOT = \ … … 110 112 $(SRC)/setastrom.$(ARCH).o \ 111 113 $(SRC)/initialize_setastrom.$(ARCH).o \ 114 $(SRC)/dcr_correction.$(ARCH).o \ 115 $(SRC)/kh_correction.$(ARCH).o \ 112 116 $(SRC)/astrom_correction.$(ARCH).o \ 113 117 $(SRC)/update_dvo_setastrom.$(ARCH).o \ … … 123 127 $(SRC)/update_dvo_setastrom.$(ARCH).o \ 124 128 $(SRC)/update_catalog_setastrom.$(ARCH).o \ 129 $(SRC)/dcr_correction.$(ARCH).o \ 130 $(SRC)/kh_correction.$(ARCH).o \ 125 131 $(SRC)/astrom_correction.$(ARCH).o \ 126 132 $(SRC)/initialize_setastrom.$(ARCH).o … … 128 134 $(SETASTROM_CLIENT): $(INC)/setastrom.h 129 135 $(BIN)/setastrom_client.$(ARCH): $(SETASTROM_CLIENT) 136 137 SETGALMODEL = \ 138 $(SRC)/setgalmodel.$(ARCH).o \ 139 $(SRC)/initialize_setgalmodel.$(ARCH).o \ 140 $(SRC)/galmodel_correction.$(ARCH).o \ 141 $(SRC)/update_dvo_setgalmodel.$(ARCH).o \ 142 $(SRC)/update_catalog_setgalmodel.$(ARCH).o \ 143 $(SRC)/SetSignals.$(ARCH).o \ 144 $(SRC)/Shutdown.$(ARCH).o 145 146 $(SETGALMODEL): $(INC)/setgalmodel.h 147 $(BIN)/setgalmodel.$(ARCH): $(SETGALMODEL) 148 149 SETGALMODEL_CLIENT = \ 150 $(SRC)/setgalmodel_client.$(ARCH).o \ 151 $(SRC)/update_dvo_setgalmodel.$(ARCH).o \ 152 $(SRC)/update_catalog_setgalmodel.$(ARCH).o \ 153 $(SRC)/galmodel_correction.$(ARCH).o \ 154 $(SRC)/initialize_setgalmodel.$(ARCH).o 155 156 $(SETGALMODEL_CLIENT): $(INC)/setgalmodel.h 157 $(BIN)/setgalmodel_client.$(ARCH): $(SETGALMODEL_CLIENT) 130 158 131 159 SETFWHM = \ -
trunk/Ohana/src/uniphot/include/setastrom.h
r35103 r37807 25 25 char *SINGLE_CPT; 26 26 27 char *KH_FILE; 28 char *DCR_FILE; 29 30 int KH_RESET; 31 int DCR_RESET; 32 27 33 SkyRegion UserPatch; 28 34 … … 46 52 // int SetSignals PROTO((void)); 47 53 48 int update_dvo_setastrom PROTO(( char *corrfile));49 int update_dvo_setastrom_parallel PROTO((SkyTable *sky , char *corrfile));54 int update_dvo_setastrom PROTO(()); 55 int update_dvo_setastrom_parallel PROTO((SkyTable *sky)); 50 56 51 57 int update_catalog_setastrom PROTO((Catalog *catalog)); 52 58 53 59 // spline correction functions 54 int load_astrom_correction (char *filename);55 int get_astrom_correction (int sub, int chip, double *dX, double *dY, float Minst);56 60 double spline_apply_dbl (double *x, double *y, double *y2, int N, double X); 61 62 int load_kh_correction (char *filename); 63 int get_kh_correction (int sub, int chip, double *dX, double *dY, float Minst); 64 65 int load_dcr_correction (char *filename); 66 int get_dcr_correction (int filter, double *dX, double *dY, float Color); -
trunk/Ohana/src/uniphot/src/astrom_correction.c
r35103 r37807 2 2 3 3 // astrometry correction functions: 4 // load the correction set from a file 5 6 // the correction is saved as a set of splines, one per file extension 7 // extensions have names of the form XYnn.Dx.Td 8 9 // where nn = 00 - 77, the chip number 10 // x is X or Y, the correction direction (dir) 11 // d is 0 or 1, pre or post camera correction (sub) 12 13 // these are stored in an N-D array of (Spline *) splineset[sub][dir][chip] 14 15 # define N_SUB 2 16 # define N_DIR 2 17 # define N_CHIP 78 18 // note that we are allocating pointers for XY00 - XY77, but only the octal elements are set (and not the 00,07,70,77 ones) 19 20 Spline ****splineset; 21 22 int load_astrom_correction (char *filename) { 23 24 int Ncol; 25 off_t Nrow; 26 27 char type[16]; 28 char extname[80]; 29 30 Header header; 31 Header theader; 32 FTable ftable; 33 34 /* open file for input */ 35 FILE *f = fopen (filename, "r"); 36 if (f == (FILE *) NULL) { 37 gprint (GP_ERR, "can't open file for read : %s\n", filename); 38 return FALSE; 39 } 40 41 // read the PHU header 42 if (!gfits_load_header (f, &header)) return (FALSE); 43 44 int Nbytes = gfits_data_size (&header); 45 fseeko (f, Nbytes, SEEK_CUR); 46 // XXX gfits_free_header (&header); 47 48 ftable.header = &theader; 49 50 int sub, dir, chip; 51 52 // we have a N-D array of splines: 53 // splineset[sub][dir][chip] 54 55 ALLOCATE (splineset, Spline ***, N_SUB); 56 for (sub = 0; sub < N_SUB; sub++) { 57 ALLOCATE (splineset[sub], Spline **, N_DIR); 58 for (dir = 0; dir < N_DIR; dir++) { 59 ALLOCATE (splineset[sub][dir], Spline *, N_CHIP); 60 for (chip = 0; chip < N_CHIP; chip ++) { 61 splineset[sub][dir][chip] = NULL; 62 } 63 } 64 } 65 66 while (TRUE) { 67 // load data for this header : if not found, assume we hit the end of the file 68 if (!gfits_load_header (f, &theader)) break; 69 70 if (!gfits_fread_ftable_data (f, &ftable, FALSE)) return (FALSE); 71 72 if (!gfits_scan (&theader, "EXTNAME", "%s", 1, extname)) return (FALSE); 73 74 // figure out the chip ID, diretion, and sequence from the EXTNAME 75 76 // EXTNAME is of the form XY%d%d.D%s.T%s where 77 char chipname[3]; 78 chipname[0] = extname[2]; 79 chipname[1] = extname[3]; 80 chipname[2] = 0; 81 int chip = atoi(chipname); 82 myAssert (chip > 0, "error in extname %s not(chip > 0)\n", extname); 83 myAssert (chip < 77, "error in extname %s not(chip < 77)\n", extname); 84 myAssert (chip != 7, "error in extname %s not(chip != 7)\n", extname); 85 myAssert (chip != 70, "error in extname %s not(chip != 70)\n", extname); 86 87 int dir = -1; 88 if (extname[6] == 'X') { 89 dir = 0; 90 } 91 if (extname[6] == 'Y') { 92 dir = 1; 93 } 94 myAssert (dir != -1, "error in extname %s (dir)\n", extname); 95 96 int sub = -1; 97 if (extname[9] == '0') { 98 sub = 0; 99 } 100 if (extname[9] == '1') { 101 sub = 1; 102 } 103 myAssert (sub != -1, "error in extname %s (sub)\n", extname); 104 105 // need to create and assign to flat-field correction 106 double *xk = gfits_get_bintable_column_data (&theader, &ftable, "X_KNOT", type, &Nrow, &Ncol); 107 myAssert (!strcmp(type, "double"), "error reading X_KNOT"); 108 109 // need to create and assign to flat-field correction 110 double *yk = gfits_get_bintable_column_data (&theader, &ftable, "Y_KNOT", type, &Nrow, &Ncol); 111 myAssert (!strcmp(type, "double"), "error reading X_KNOT"); 112 113 // need to create and assign to flat-field correction 114 double *y2 = gfits_get_bintable_column_data (&theader, &ftable, "DY2_DX", type, &Nrow, &Ncol); 115 myAssert (!strcmp(type, "double"), "error reading X_KNOT"); 116 117 ALLOCATE (splineset[sub][dir][chip], Spline, 1); 118 splineset[sub][dir][chip]->xk = xk; 119 splineset[sub][dir][chip]->yk = yk; 120 splineset[sub][dir][chip]->y2 = y2; 121 splineset[sub][dir][chip]->Nknots = Nrow; 122 } 123 return (TRUE); 124 } 125 126 int get_astrom_correction (int sub, int chip, double *dX, double *dY, float Minst) { 127 128 Spline *spline = NULL; 129 130 *dX = 0.0; 131 *dY = 0.0; 132 133 // XXX need to include some limits on Minst? 134 135 spline = splineset[sub][0][chip]; 136 if (spline) { 137 *dX = spline_apply_dbl (spline->xk, spline->yk, spline->y2, spline->Nknots, Minst); 138 } 139 140 spline = splineset[sub][1][chip]; 141 if (spline) { 142 *dY = spline_apply_dbl (spline->xk, spline->yk, spline->y2, spline->Nknots, Minst); 143 } 144 return (TRUE); 145 } 4 // KH correction 5 // DCR correction 146 6 147 7 /* evaluate spline for x, y, y2 at X */ -
trunk/Ohana/src/uniphot/src/find_image_sgroups.c
r36481 r37807 18 18 } 19 19 20 coords.crpix1 = coords.crpix2 = 0.0; 21 coords.cdelt1 = coords.cdelt2 = 1.0; /* scale is degrees, radius in degrees */ 22 coords.pc1_1 = coords.pc2_2 = 1.0; 23 coords.pc1_2 = coords.pc2_1 = 0.0; 24 strcpy (coords.ctype, "DEC--TAN"); 20 InitCoords (&coords, "DEC--TAN"); 25 21 26 22 Ngroup = 0; … … 41 37 // NOCAL above is used to mark images which do not match the photcode (including the DIS) 42 38 // if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue; 43 44 // this adds 1.3 sec for 3M images45 if (!FindMosaicForImage (image, Nimage, i)) {46 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);47 continue;48 }49 39 50 40 /* define image center - note the DIS images (mosaic phu) are special */ … … 83 73 // if (!strcmp(&image[j].coords.ctype[4], "-DIS")) continue; 84 74 85 // this adds 1.3 sec for 3M images86 if (!FindMosaicForImage (image, Nimage, j)) {87 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", j);88 continue;89 }90 91 75 /* project image center to local coords, check radius */ 92 76 if (!strcmp(&image[j].coords.ctype[4], "-DIS")) { -
trunk/Ohana/src/uniphot/src/initialize_setastrom.c
r35103 r37807 2 2 3 3 void usage_setastrom () { 4 fprintf (stderr, "USAGE: setastrom (corrections)[options]\n");4 fprintf (stderr, "USAGE: setastrom [options]\n"); 5 5 fprintf (stderr, " options:\n"); 6 fprintf (stderr, " -DCR (file) : supply DCR correction splines\n"); 7 fprintf (stderr, " -KH (file) : supply Koppenhoefer correction splines\n"); 6 8 fprintf (stderr, " -v : verbose mode\n"); 7 9 fprintf (stderr, " -region Rmin Rmax Dmin Dmax\n"); … … 49 51 int N; 50 52 53 KH_FILE = NULL; 54 if ((N = get_argument (argc, argv, "-KH"))) { 55 remove_argument (N, &argc, argv); 56 char *tmpfile = strcreate (argv[N]); 57 KH_FILE = abspath (tmpfile, DVO_MAX_PATH); 58 remove_argument (N, &argc, argv); 59 } 60 KH_RESET = FALSE; 61 if ((N = get_argument (argc, argv, "-KH-reset"))) { 62 remove_argument (N, &argc, argv); 63 KH_RESET = TRUE; 64 } 65 66 DCR_FILE = NULL; 67 if ((N = get_argument (argc, argv, "-DCR"))) { 68 remove_argument (N, &argc, argv); 69 char *tmpfile = strcreate (argv[N]); 70 DCR_FILE = abspath (tmpfile, DVO_MAX_PATH); 71 remove_argument (N, &argc, argv); 72 } 73 DCR_RESET = FALSE; 74 if ((N = get_argument (argc, argv, "-DCR-reset"))) { 75 remove_argument (N, &argc, argv); 76 DCR_RESET = TRUE; 77 } 78 51 79 SINGLE_CPT = NULL; 52 80 if ((N = get_argument (argc, argv, "-cpt"))) { … … 118 146 } 119 147 120 if (argc != 2) usage_setastrom(); 148 if (!KH_FILE && !DCR_FILE) { 149 fprintf (stderr, "at least one of -KH and -DCR must be supplied\n"); 150 exit (1); 151 } 152 153 if (argc != 1) usage_setastrom(); 121 154 122 155 return (TRUE); … … 124 157 125 158 void usage_setastrom_client () { 126 fprintf (stderr, "USAGE: setastrom_client (correction)-hostID (hostID) -catdir (catdir) -hostdir (hostdir) [options]\n");159 fprintf (stderr, "USAGE: setastrom_client -hostID (hostID) -catdir (catdir) -hostdir (hostdir) [options]\n"); 127 160 fprintf (stderr, " options:\n"); 161 fprintf (stderr, " -DCR (file) : supply DCR correction splines\n"); 162 fprintf (stderr, " -KH (file) : supply Koppenhoefer correction splines\n"); 128 163 fprintf (stderr, " -region Rmin Rmax Dmin Dmax\n"); 129 164 fprintf (stderr, " -update-catformat (format) : change database schema on output\n"); … … 163 198 164 199 int N; 200 201 KH_FILE = NULL; 202 if ((N = get_argument (argc, argv, "-KH"))) { 203 remove_argument (N, &argc, argv); 204 KH_FILE = strcreate (argv[N]); 205 remove_argument (N, &argc, argv); 206 } 207 KH_RESET = FALSE; 208 if ((N = get_argument (argc, argv, "-KH-reset"))) { 209 remove_argument (N, &argc, argv); 210 KH_RESET = TRUE; 211 } 212 213 DCR_FILE = NULL; 214 if ((N = get_argument (argc, argv, "-DCR"))) { 215 remove_argument (N, &argc, argv); 216 DCR_FILE = strcreate (argv[N]); 217 remove_argument (N, &argc, argv); 218 } 219 DCR_RESET = FALSE; 220 if ((N = get_argument (argc, argv, "-DCR-reset"))) { 221 remove_argument (N, &argc, argv); 222 DCR_RESET = TRUE; 223 } 165 224 166 225 /* specify portion of the sky : allow default of all sky? */ … … 223 282 if (!CATDIR) usage_setastrom_client(); 224 283 225 if (argc != 2) usage_setastrom_client(); 284 if (!KH_FILE && !DCR_FILE) { 285 fprintf (stderr, "at least one of -KH and -DCR must be supplied\n"); 286 exit (1); 287 } 288 289 if (argc != 1) usage_setastrom_client(); 226 290 return (TRUE); 227 291 } -
trunk/Ohana/src/uniphot/src/load_zpt_table.c
r33654 r37807 173 173 mjdstart = tstart_uc[i]; 174 174 mjdstop = tstop_uc[i]; 175 } else {175 } else { 176 176 char name[9]; 177 snprintf (name, 9, "TS0_%04d", i); 177 // snprintf (name, 9, "TS0_%04d", i); 178 snprintf (name, 9, "S0_MJD%d", i); 178 179 if (!gfits_scan (&header, name, "%lf", 1, &mjdstart)) { 179 180 fprintf (stderr, "cannot find %s in header of %s\n", name, filename); … … 182 183 } 183 184 184 snprintf (name, 9, "TS1_%04d", i); 185 // snprintf (name, 9, "TS1_%04d", i); 186 snprintf (name, 9, "S1_MJD%d", i); 185 187 if (!gfits_scan (&header, name, "%lf", 1, &mjdstop)) { 186 188 fprintf (stderr, "cannot find %s in header of %s\n", name, filename); … … 189 191 } 190 192 } 191 flatcorrTable->tstart[i] = ohana_mjd_to_sec(mjdstart);192 flatcorrTable->tstop[i] = ohana_mjd_to_sec(mjdstop);193 flatcorrTable->tstart[i] = (mjdstart > 0) ? ohana_mjd_to_sec(mjdstart) : ohana_mjd_to_sec(50000.0); // 1995/10/10 (ancient history) 194 flatcorrTable->tstop[i] = (mjdstop > 0) ? ohana_mjd_to_sec(mjdstop) : ohana_mjd_to_sec(60000.0); // 2023/02/25 (infinite future) 193 195 } 194 196 … … 247 249 } else { 248 250 if (!gfits_scan (&header, "FILTER", "%s", 1, filter)) { 249 fprintf (stderr, "cannot find FILTER in header of %s\n", filename); 250 fclose (f); 251 return NULL; 251 fprintf (stderr, "cannot find FILTER in header of %s, using %s\n", filename, filters_uc[nfilter]); 252 strcpy (filter, filters_uc[nfilter]); 253 // fclose (f); 254 // return NULL; 252 255 } 253 256 } … … 278 281 REALLOCATE (offset64, double, matrix.Naxis[0]); 279 282 matrix.buffer = (char *) offset64; 283 } 284 if (matrix.Naxes == 1) { 285 int Ntotal = NSEASON*NCHIP_X*NCHIP_Y*NCELL_X*NCELL_Y; 286 if (matrix.Naxis[0] != Ntotal) { 287 int Nextra = Ntotal - matrix.Naxis[0]; 288 assert (Nextra >= 0); 289 fprintf (stderr, "warning: images are not fully populated, extending by %d\n", Nextra); 290 291 REALLOCATE (offset64, double, Ntotal); 292 int npix; 293 for (npix = matrix.Naxis[0]; npix < Ntotal; npix ++) offset64[npix] = 0.0; 294 295 matrix.Naxis[0] = Ntotal; 296 matrix.buffer = (char *) offset64; 297 } 280 298 } 281 299 -
trunk/Ohana/src/uniphot/src/match_zpts_to_images.c
r35764 r37807 97 97 } 98 98 99 // if secz is crazy, do not trust ubercal; skip and move along 100 if (image[Ni].secz < 0.1) { 101 i++; 102 continue; 103 } 104 99 105 // we have a match: set zpt and record the match 100 106 // is the zero point supplied nominally corrected or not? -
trunk/Ohana/src/uniphot/src/update_catalog_setastrom.c
r37043 r37807 1 1 # include "setastrom.h" 2 3 // this code does both DCR and KH corrections, if both are specified. 2 4 3 5 // XXX this function is dependent in two ways on the specific numerical values of the photcodes … … 7 9 int update_catalog_setastrom (Catalog *catalog) { 8 10 9 off_t i , found;11 off_t i; 10 12 11 13 time_t timeRef = ohana_date_to_sec("2011/05/11,00:00:00"); 12 14 13 found = 0; 15 int Nsecfilt = GetPhotcodeNsecfilt (); 16 PhotCode *code_g = GetPhotcodebyName ("g"); 17 PhotCode *code_i = GetPhotcodebyName ("i"); 18 PhotCode *code_z = GetPhotcodebyName ("z"); 19 PhotCode *code_y = GetPhotcodebyName ("y"); 20 21 int Nsec_g = GetPhotcodeNsec(code_g->code); 22 int Nsec_i = GetPhotcodeNsec(code_i->code); 23 int Nsec_z = GetPhotcodeNsec(code_z->code); 24 int Nsec_y = GetPhotcodeNsec(code_y->code); 25 26 off_t found = 0; 14 27 15 28 for (i = 0; i < catalog[0].Nmeasure; i++) { … … 17 30 Measure *measure = &catalog[0].measure[i]; 18 31 19 // XXX only do GPC1 data for now32 // only do GPC1 data for now (true for both DCR and KH) 20 33 if (measure[0].photcode < 10000) continue; 21 34 if (measure[0].photcode > 10600) continue; 22 35 23 // XXX hardwire the list of chips to correct 36 int averef = measure->averef; 37 Average *average = &catalog[0].average[averef]; 38 SecFilt *secfilt = &catalog[0].secfilt[averef*Nsecfilt]; 39 40 int chipID = measure[0].photcode % 100; 41 42 // XXX hardwire the list of chips to KH correct 24 43 // some notes: 25 // XY24 surp isingly does not need correction44 // XY24 surprisingly does not need correction 26 45 // XY27 has poor astrometry with a weird correction for all mags 27 // XY36 surp isingly does not need correction46 // XY36 surprisingly does not need correction 28 47 // XY67 has poor astrometry with a weird correction for all mags 29 48 30 int chipID = measure[0].photcode % 100;49 int doKH = FALSE; 31 50 switch (chipID) { 32 51 case 4: … … 57 76 case 72: 58 77 case 73: 78 doKH = TRUE; 59 79 break; 60 80 default: 61 measure[0].Xfix = measure[0].Xccd; 62 measure[0].Yfix = measure[0].Yccd; 63 continue; 64 } 65 66 double Xccd = measure[0].Xccd; 67 double Yccd = measure[0].Yccd; 81 break; 82 } 83 68 84 double pltScale = fabs(measure[0].pltscale); 69 70 // this is not needed, is it? 71 // double posAngle = FromShortDegrees(measure[0].posangle); 72 73 // I need to know which chip we have. use photcode assuming range 74 int chip = measure[0].photcode % 100; 75 76 // correction may be Minst or Minst + 5.0*log(fwhm 77 float fwhm_maj = FromShortPixels(measure[0].FWx); 78 float Minst = PhotInst (measure, MAG_CLASS_PSF); 79 float MinstSB = Minst + 5.0*log10(fwhm_maj); 80 81 // I should validate that the spline I'm using is SB corrected not Minst... 82 83 // XXX this is very ad hoc. the splines are measured based on an extraction from dvo 84 // the dvo values of fwhm_maj are sigmas (NOT FWHM!) in pixels. 85 double posAngle = FromShortDegrees(measure[0].posangle); 86 87 /**** KH section ****/ 88 89 double dX_KH = 0.0; 90 double dY_KH = 0.0; 91 if (KH_FILE && doKH && (measure[0].t < timeRef)) { 92 93 // correction may be Minst or Minst + 5.0*log(fwhm 94 float fwhm_maj = FromShortPixels(measure[0].FWx); 95 float Minst = PhotInst (measure, MAG_CLASS_PSF); 96 // float MinstSB = Minst + 5.0*log10(fwhm_maj); 97 98 // NOTE: the spline correction was measured on the nightly-science database using measurements 99 // from the period in which fwhm_maj & fwhm_min were a factor of sqrt(2) too small. I am making 100 // this correction here (but ideally I would re-measure the KH trend from PV2 data and re-generate 101 // the splines 102 float MinstSB = Minst + 5.0*log10(M_SQRT2*fwhm_maj); 103 104 // I should validate that the spline I'm using is SB corrected not Minst.. 105 // NOTE: it is SB, not raw Minst 106 107 // XXX this is very ad hoc. the splines are measured based on an extraction from dvo 108 // the dvo values of fwhm_maj are sigmas (NOT FWHM!) in pixels. 85 109 86 // saturate fwhm_maj in the range 1.0 < fwhm_maj < 5.0 87 // (images with really odd psf probably have poor astrometry anyway...) 88 fwhm_maj = MIN(fwhm_maj,5.0); 89 fwhm_maj = MAX(fwhm_maj,1.0); 90 91 double dX; 92 double dY; 93 94 // correction is in arcseconds 95 if (measure[0].t < timeRef) { 96 get_astrom_correction (0, chip, &dX, &dY, MinstSB); 97 } else { 98 // XXX do not correct new data 99 // get_astrom_correction (1, chip, &dX, &dY, MinstSB); 100 dX = 0.0; 101 dY = 0.0; 102 } 110 // saturate fwhm_maj in the range 1.0 < fwhm_maj < 5.0 111 // (images with really odd psf probably have poor astrometry anyway...) 112 fwhm_maj = MIN(fwhm_maj,5.0); 113 fwhm_maj = MAX(fwhm_maj,1.0); 114 115 // correction is in arcseconds 116 get_kh_correction (0, chipID, &dX_KH, &dY_KH, MinstSB); 117 } 118 119 /**** DCR section ****/ 120 121 double dX_DCR = 0.0; 122 double dY_DCR = 0.0; 123 if (DCR_FILE) { 124 125 // check if the color*airmass term is not-nan (Skip otherwise) 126 127 // XXX hard-wire gpc1 photcodes for now: 128 // I should use photcode ops: PhotCode *code = PhotCodeByCode(measure->photcode) 129 // int equiv = code->equiv 130 // Nsec = GetNsec(equiv) 131 132 float dColor = 0.0; 133 int filtCode = (int)(measure->photcode / 100); // eg, 101 = r 134 switch (filtCode) { 135 case 100: 136 case 101: 137 case 102: { 138 float gmag = secfilt[Nsec_g].M; 139 float imag = secfilt[Nsec_i].M; 140 dColor = average->refColorBlue - (gmag - imag); 141 break; 142 } 143 case 103: 144 case 104: { 145 float zmag = secfilt[Nsec_z].M; 146 float ymag = secfilt[Nsec_y].M; 147 dColor = average->refColorRed - (zmag - ymag); 148 break; 149 } 150 } 151 int filtSeq = filtCode % 100; 152 if (!isfinite(dColor)) goto skip_DCR; 153 154 // I need to get the parallactic angle, but I only have alt & az, s:o 155 156 // airmass = 1.0 / cos(90 - alt) 157 // cos(90 - alt) = cos(zd) = sin(alt) = 1.0 / airmass 158 // airmass = 1.0 / sin(alt) 159 160 // airmass = 1.0 / cos(zd) 161 // cos(zd) = 1.0 / airmass == sn_alt 162 // sin(zd) = sqrt(1.0 - cos(zd)^2) == cs_alt 163 // tan(zd) = sin(zd) / cos(zd) = cs_alt / sn_alt 164 165 double sn_alt = 1.0 / measure->airmass; 166 double cs_alt = sqrt(1.0 - SQ(sn_alt)); 167 double tan_zd = cs_alt / sn_alt; 168 169 double cs_az = cos(RAD_DEG*measure->az); 170 double sn_az = sin(RAD_DEG*measure->az); 171 172 # define LATITUDE (20.7070999146*RAD_DEG) 173 double sn_lat = sin(LATITUDE); 174 double cs_lat = cos(LATITUDE); 175 176 // double sind = sn_alt * sn_lat + cs_alt * cs_az * cs_lat; 177 // *dec = DEG_RAD * asin (sind); 178 179 // WARNING: these are NOT sin(ha),cos(ha) but are scaled 180 // double ha = DEG_RAD * atan2 (sinh, cosh); 181 double sinh = -cs_alt * sn_az; 182 double cosh = sn_alt * cs_lat - cs_alt * cs_az * sn_lat; 183 double r_ha = hypot(sinh, cosh); 184 double sn_ha = sinh / r_ha; 185 double cs_ha = cosh / r_ha; 186 187 sinh = -cs_az * sn_alt * sn_ha * sn_lat + sn_az * sn_alt * cs_ha - sn_ha * cs_alt * cs_lat; 188 cosh = -sn_az * sn_ha * sn_lat - cs_az * cs_ha; 189 double r_rot = hypot(sinh, cosh); 190 191 double sn_rot = -sinh / r_rot; 192 double cs_rot = +cosh / r_rot; 193 194 double dPx = 0.0; 195 double dPy = 0.0; 196 197 float colorOffset = dColor * tan_zd; 198 get_dcr_correction (filtSeq, &dPx, &dPy, colorOffset); 199 200 // if we had x-terms, we would have: 201 // double dPx = dRx *cs_rot + dD_s*sn_rot; 202 // double dPy = dD_s*cs_rot - dRx *sn_rot; 203 // double dR = dPx*cs_rot - dPy*sn_rot; 204 // double dD = dPx*sn_rot + dPy*cs_rot; 205 206 // since dPx = 0.0, instead we have: dPx, dPy as measured in dvo.dcr.sh 207 double dR = -dPy*sn_rot; 208 double dD = +dPy*cs_rot; 209 210 // dR = (measure->R - average->R) * 3600 * dcos(dec) [ie, in the projected plane] 211 // dD = (measure->D - average->D) * 3600 212 // average->D = measure->D - dD/3600 213 214 // now we need to rotate dR,dD into the chip frame and correction Xccd,Yccd 215 216 // are the plate-scale and posangle correctly set in the db? 217 218 // XXX the koppenhoefer code implies pos if angle from y -> D, (ie negative of the 219 // below). if so, apply sin(pos) -> -sin(pos) 220 221 // if parity = sky: 222 // double dR = dX*cos(pos) + dY*sin(pos); 223 // double dD = -dX*sin(pos) + dY*cos(pos); 224 225 // XXX signs set here to reflect pos = -pos 226 float posAngRad = posAngle * RAD_DEG; 227 dX_DCR = dR*cos(posAngRad) + dD*sin(posAngRad); 228 dY_DCR = -dR*sin(posAngRad) + dD*cos(posAngRad); 229 } 230 231 skip_DCR: 103 232 104 233 // do not modify the original Xccd,Yccd values 105 measure[0].Xfix = Xccd + dX / pltScale; 106 measure[0].Yfix = Yccd + dY / pltScale; 107 234 if (KH_FILE) { 235 measure[0].XoffKH = dX_KH / pltScale; 236 measure[0].YoffKH = dY_KH / pltScale; 237 } 238 if (KH_RESET) { 239 measure[0].XoffKH = 0.0; 240 measure[0].YoffKH = 0.0; 241 } 242 if (DCR_FILE) { 243 measure[0].XoffDCR = -dX_DCR / pltScale; 244 measure[0].YoffDCR = -dY_DCR / pltScale; 245 } 246 if (DCR_RESET) { 247 measure[0].XoffDCR = -dX_DCR / pltScale; 248 measure[0].YoffDCR = -dY_DCR / pltScale; 249 } 250 251 measure[0].Xfix = measure[0].Xccd; 252 measure[0].Yfix = measure[0].Yccd; 253 if (isfinite(measure[0].XoffKH) && isfinite(measure[0].YoffKH)) { 254 measure[0].Xfix += measure[0].XoffKH; 255 measure[0].Yfix += measure[0].YoffKH; 256 } 257 if (isfinite(measure[0].XoffDCR) && isfinite(measure[0].YoffDCR)) { 258 measure[0].Xfix += measure[0].XoffDCR; 259 measure[0].Yfix += measure[0].YoffDCR; 260 } 108 261 found ++; 109 262 } -
trunk/Ohana/src/uniphot/src/update_dvo_setastrom.c
r35103 r37807 1 1 # include "setastrom.h" 2 2 3 int update_dvo_setastrom ( char *corrfile) {3 int update_dvo_setastrom () { 4 4 5 5 SkyTable *sky = NULL; … … 13 13 14 14 if (PARALLEL && !HOST_ID) { 15 int status = update_dvo_setastrom_parallel (sky , corrfile);15 int status = update_dvo_setastrom_parallel (sky); 16 16 return status; 17 17 } 18 18 19 load_astrom_correction (corrfile); 19 if (KH_FILE) load_kh_correction (KH_FILE); 20 if (DCR_FILE) load_dcr_correction (DCR_FILE); 20 21 21 22 // determine the populated SkyRegions overlapping the requested area (default depth) … … 78 79 # define DEBUG 1 79 80 80 int update_dvo_setastrom_parallel (SkyTable *sky , char *corrfile) {81 int update_dvo_setastrom_parallel (SkyTable *sky) { 81 82 82 83 // now launch the setastrom_client jobs to the parallel hosts 83 84 char *abscorrfile = abspath (corrfile, DVO_MAX_PATH);85 84 86 85 // load the list of hosts … … 96 95 97 96 char command[1024]; 98 snprintf (command, 1024, "setastrom_client %s-hostID %d -catdir %s -hostdir %s -region %f %f %f %f",99 abscorrfile,table->hosts[i].hostID, CATDIR, table->hosts[i].pathname,97 snprintf (command, 1024, "setastrom_client -hostID %d -catdir %s -hostdir %s -region %f %f %f %f", 98 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, 100 99 UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 101 102 fprintf (stderr, "command: %s\n", command);103 100 104 101 char tmpline[1024]; 105 102 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 106 103 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); } 104 if (KH_FILE) { snprintf (tmpline, 1024, "%s -KH %s", command, KH_FILE); strcpy (command, tmpline); } 105 if (DCR_FILE) { snprintf (tmpline, 1024, "%s -DCR %s", command, DCR_FILE); strcpy (command, tmpline); } 107 106 if (UPDATE_CATFORMAT) { snprintf (tmpline, 1024, "%s -update-catformat %s", command, UPDATE_CATFORMAT); strcpy (command, tmpline); } 107 108 if (KH_RESET) { snprintf (tmpline, 1024, "%s -KH-reset", command); strcpy (command, tmpline); } 109 if (DCR_RESET) { snprintf (tmpline, 1024, "%s -DCR-reset", command); strcpy (command, tmpline); } 110 111 fprintf (stderr, "command: %s\n", command); 108 112 109 113 if (PARALLEL_MANUAL) continue; … … 126 130 } 127 131 } 128 free (abscorrfile);129 132 130 133 // wait for the remote jobs to be completed -
trunk/Ohana/src/uniphot/src/update_dvo_uniphot.c
r36481 r37807 57 57 glob (line, 0, NULL, &pglob); 58 58 59 coords.crpix1 = coords.crpix2 = 0.0; 60 coords.cdelt1 = coords.cdelt2 = 1.0; /* scale is degrees, radius in degrees */ 61 coords.pc1_1 = coords.pc2_2 = 1.0; 62 coords.pc1_2 = coords.pc2_1 = 0.0; 63 strcpy (coords.ctype, "DEC--TAN"); 59 InitCoords (&coords, "DEC--TAN"); 64 60 65 61 for (i = 0; i < pglob.gl_pathc; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.
