Changeset 39926 for trunk/Ohana
- Timestamp:
- Jan 6, 2017, 11:30:10 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 deleted
- 104 edited
- 14 copied
-
. (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
Ohana/Makefile.in (modified) (1 diff)
-
Ohana/src/addstar/Makefile (modified) (5 diffs)
-
Ohana/src/addstar/include/gaia.h (copied) (copied from branches/czw_branch/20160809/Ohana/src/addstar/include/gaia.h )
-
Ohana/src/addstar/src/args_loadgaia.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/addstar/src/args_loadgaia.c )
-
Ohana/src/addstar/src/find_matches_gaia.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/addstar/src/find_matches_gaia.c )
-
Ohana/src/addstar/src/loadgaia.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia.c )
-
Ohana/src/addstar/src/loadgaia_catalog.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia_catalog.c )
-
Ohana/src/addstar/src/loadgaia_make_subset.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia_make_subset.c )
-
Ohana/src/addstar/src/loadgaia_readstars.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia_readstars.c )
-
Ohana/src/addstar/src/loadgaia_table.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia_table.c )
-
Ohana/src/addstar/src/psps_ids.c (modified) (2 diffs)
-
Ohana/src/delstar/include/delstar.h (modified) (3 diffs)
-
Ohana/src/delstar/src/args.c (modified) (7 diffs)
-
Ohana/src/delstar/src/delete_duplicate_measures.c (modified) (2 diffs)
-
Ohana/src/delstar/src/delete_measures_by_match.c (modified) (7 diffs)
-
Ohana/src/dvomerge/include/dvomerge.h (modified) (2 diffs)
-
Ohana/src/dvomerge/src/LoadCatalog.c (modified) (2 diffs)
-
Ohana/src/dvomerge/src/args.c (modified) (2 diffs)
-
Ohana/src/dvomerge/src/build_links.c (modified) (54 diffs)
-
Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c (modified) (1 diff)
-
Ohana/src/dvomerge/src/merge_catalogs_old.c (modified) (22 diffs)
-
Ohana/src/fakeastro/Makefile (modified) (1 diff)
-
Ohana/src/fakeastro/include/fakeastro.h (modified) (4 diffs)
-
Ohana/src/fakeastro/src/ConfigInit.c (modified) (3 diffs)
-
Ohana/src/fakeastro/src/args.c (modified) (4 diffs)
-
Ohana/src/fakeastro/src/fakeastro.c (modified) (1 diff)
-
Ohana/src/fakeastro/src/fakeastro_gaia.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/fakeastro/src/fakeastro_gaia.c )
-
Ohana/src/fakeastro/src/initialize.c (modified) (2 diffs)
-
Ohana/src/fakeastro/src/make_fake_stars_catalog.c (modified) (1 diff)
-
Ohana/src/fakeastro/src/make_fakestars.c (modified) (5 diffs)
-
Ohana/src/fakeastro/src/make_gaia_measures.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/fakeastro/src/make_gaia_measures.c )
-
Ohana/src/kapa2/include/prototypes.h (modified) (3 diffs)
-
Ohana/src/kapa2/src/DrawFrame.c (modified) (2 diffs)
-
Ohana/src/kapa2/src/DrawObjects.c (modified) (18 diffs)
-
Ohana/src/kapa2/src/LoadObject.c (modified) (1 diff)
-
Ohana/src/kapa2/src/PSFrame.c (modified) (2 diffs)
-
Ohana/src/kapa2/src/PSObjects.c (modified) (4 diffs)
-
Ohana/src/kapa2/src/bDrawFrame.c (modified) (2 diffs)
-
Ohana/src/kapa2/src/bDrawObjects.c (modified) (2 diffs)
-
Ohana/src/libdvo/include/dvo.h (modified) (2 diffs)
-
Ohana/src/libdvo/src/ImageMetadataSelection.c (modified) (2 diffs)
-
Ohana/src/libdvo/src/coordops.c (modified) (12 diffs)
-
Ohana/src/libdvo/src/dbExtractMeasures.c (modified) (2 diffs)
-
Ohana/src/libdvo/src/galaxy_model.c (modified) (1 diff)
-
Ohana/src/libdvo/test/coords.sh (copied) (copied from branches/czw_branch/20160809/Ohana/src/libdvo/test/coords.sh )
-
Ohana/src/libfits/header/F_H_field.c (modified) (1 diff)
-
Ohana/src/libkapa/Makefile (modified) (1 diff)
-
Ohana/src/libkapa/include/kapa.h (modified) (3 diffs)
-
Ohana/src/libkapa/src/KapaOpen.c (modified) (1 diff)
-
Ohana/src/libkapa/src/KapaStyles.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/libkapa/src/KapaStyles.c )
-
Ohana/src/libkapa/src/KapaWindow.c (modified) (1 diff)
-
Ohana/src/libkapa/src/bDrawFuncs.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/csystem.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/fitplx_irls.c (modified) (2 diffs)
-
Ohana/src/opihi/cmd.astro/spex1dgas.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/spex2dgas.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/spexseq.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/Makefile (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/init.c (modified) (2 diffs)
-
Ohana/src/opihi/cmd.data/match2d.c (modified) (10 diffs)
-
Ohana/src/opihi/cmd.data/rndseed.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/opihi/cmd.data/rndseed.c )
-
Ohana/src/opihi/cmd.data/stats-new.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/test/fit1d_irls.sh (copied) (copied from branches/czw_branch/20160809/Ohana/src/opihi/cmd.data/test/fit1d_irls.sh )
-
Ohana/src/opihi/dvo/imbox.c (modified) (3 diffs)
-
Ohana/src/opihi/dvo/imdense.c (modified) (2 diffs)
-
Ohana/src/opihi/dvo/skycat.c (modified) (1 diff)
-
Ohana/src/opihi/lib.data/style_args.c (modified) (3 diffs)
-
Ohana/src/opihi/lib.shell/startup.c (modified) (1 diff)
-
Ohana/src/photdbc/src/make_subcatalog.c (modified) (5 diffs)
-
Ohana/src/photdbc/src/photdbc_catalogs.c (modified) (2 diffs)
-
Ohana/src/relastro/include/relastro.h (modified) (11 diffs)
-
Ohana/src/relastro/src (modified) (1 prop)
-
Ohana/src/relastro/src/BootstrapOps.c (modified) (1 diff)
-
Ohana/src/relastro/src/BrightCatalog.c (modified) (2 diffs)
-
Ohana/src/relastro/src/ConfigInit.c (modified) (1 diff)
-
Ohana/src/relastro/src/FitAstromOps.c (modified) (1 diff)
-
Ohana/src/relastro/src/FitChip.c (modified) (2 diffs)
-
Ohana/src/relastro/src/FitPM.c (modified) (8 diffs)
-
Ohana/src/relastro/src/FitPM_IRLS.c (deleted)
-
Ohana/src/relastro/src/FitPMandPar.c (modified) (8 diffs)
-
Ohana/src/relastro/src/FitPMandPar_IRLS.c (deleted)
-
Ohana/src/relastro/src/FitPosPMfixed.c (modified) (8 diffs)
-
Ohana/src/relastro/src/FitPosPMfixed_IRLS.c (deleted)
-
Ohana/src/relastro/src/GetAstromError.c (modified) (6 diffs)
-
Ohana/src/relastro/src/ImageOps.c (modified) (5 diffs)
-
Ohana/src/relastro/src/StarMaps.c (modified) (2 diffs)
-
Ohana/src/relastro/src/UpdateChips.c (modified) (4 diffs)
-
Ohana/src/relastro/src/UpdateMeasures.c (modified) (1 diff)
-
Ohana/src/relastro/src/UpdateObjectOffsets.c (modified) (8 diffs)
-
Ohana/src/relastro/src/UpdateObjects.c (modified) (16 diffs)
-
Ohana/src/relastro/src/UpdateStacks.c (modified) (2 diffs)
-
Ohana/src/relastro/src/args.c (modified) (33 diffs)
-
Ohana/src/relastro/src/assign_images.c (modified) (2 diffs)
-
Ohana/src/relastro/src/bcatalog.c (modified) (4 diffs)
-
Ohana/src/relastro/src/extra.c (modified) (1 diff)
-
Ohana/src/relastro/src/initialize.c (modified) (1 diff)
-
Ohana/src/relastro/src/launch_region_hosts.c (modified) (4 diffs)
-
Ohana/src/relastro/src/load_catalogs.c (modified) (5 diffs)
-
Ohana/src/relastro/src/load_images.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastro_images.c (modified) (6 diffs)
-
Ohana/src/relastro/src/relastro_objects.c (modified) (3 diffs)
-
Ohana/src/relastro/src/relastro_parallel_images.c (modified) (2 diffs)
-
Ohana/src/relastro/src/select_images.c (modified) (2 diffs)
-
Ohana/src/relastro/src/syncfile.c (modified) (1 diff)
-
Ohana/src/relphot/include/relphot.h (modified) (2 diffs)
-
Ohana/src/relphot/src/args.c (modified) (2 diffs)
-
Ohana/src/relphot/src/extra.c (modified) (2 diffs)
-
Ohana/src/relphot/src/reload_catalogs.c (modified) (1 diff)
-
Ohana/src/relphot/src/relphot_objects.c (modified) (1 diff)
-
Ohana/src/relphot/src/setMrelCatalog.c (modified) (4 diffs)
-
Ohana/src/uniphot/include/setgalmodel.h (modified) (2 diffs)
-
Ohana/src/uniphot/include/setphot.h (modified) (1 diff)
-
Ohana/src/uniphot/src/initialize_setgalmodel.c (modified) (4 diffs)
-
Ohana/src/uniphot/src/initialize_setphot.c (modified) (1 diff)
-
Ohana/src/uniphot/src/initialize_setphot_client.c (modified) (1 diff)
-
Ohana/src/uniphot/src/update_catalog_setgalmodel.c (modified) (2 diffs)
-
Ohana/src/uniphot/src/update_catalog_setphot.c (modified) (3 diffs)
-
Ohana/src/uniphot/src/update_dvo_setgalmodel.c (modified) (1 diff)
-
Ohana/src/uniphot/src/update_dvo_setphot.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to
/branches/czw_branch/20160809 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana
-
trunk/Ohana/Makefile.in
r38473 r39926 138 138 139 139 rebuild: 140 @date 140 141 $(MAKE) clean 141 142 $(MAKE) install 143 @date 142 144 143 145 # standard rules: targets are foo, foo.clean, foo.install, foo.dist -
trunk/Ohana/src/addstar/Makefile
r39496 r39926 25 25 load2mass : $(BIN)/load2mass.$(ARCH) 26 26 loadgalphot : $(BIN)/loadgalphot.$(ARCH) 27 loadgaia : $(BIN)/loadgaia.$(ARCH) 27 28 loadstarpar : $(BIN)/loadstarpar.$(ARCH) 28 29 loadstarpar_client : $(BIN)/loadstarpar_client.$(ARCH) … … 42 43 # programs in 'SERVER' use the client-server concept and are out of date 43 44 44 INSTALL = addstar addstar_client sedstar loadgalphot load starpar loadstarpar_client setobjflags setobjflags_client loadICRF loadICRF_client skycells mkcmf dumpskycells findskycell load2mass loadwise loadtycho loadbsc loadsupercos45 INSTALL = addstar addstar_client sedstar loadgalphot loadgaia loadstarpar loadstarpar_client setobjflags setobjflags_client loadICRF loadICRF_client skycells mkcmf dumpskycells findskycell load2mass loadwise loadtycho loadbsc loadsupercos 45 46 SERVER = addstarc addstard addstart 46 47 … … 267 268 $(SRC)/psps_ids.$(ARCH).o 268 269 269 # $(SRC)/SkyRegionUtils.$(ARCH).o 270 # $(SRC)/loadstarpar_io.$(ARCH).o 271 # $(SRC)/loadgalphot_remote_hosts.$(ARCH).o 272 # $(SRC)/loadgalphot_save_remote.$(ARCH).o 270 LOAD-GAIA = \ 271 $(SRC)/loadgaia.$(ARCH).o \ 272 $(SRC)/ConfigInit.$(ARCH).o \ 273 $(SRC)/SetSignals.$(ARCH).o \ 274 $(SRC)/Shutdown.$(ARCH).o \ 275 $(SRC)/args_loadgaia.$(ARCH).o \ 276 $(SRC)/find_matches_gaia.$(ARCH).o \ 277 $(SRC)/loadgaia_catalog.$(ARCH).o \ 278 $(SRC)/loadgaia_make_subset.$(ARCH).o \ 279 $(SRC)/loadgaia_readstars.$(ARCH).o \ 280 $(SRC)/loadgaia_table.$(ARCH).o \ 281 $(SRC)/resort_catalog.$(ARCH).o \ 282 $(SRC)/build_links.$(ARCH).o \ 283 $(SRC)/strhash.$(ARCH).o \ 284 $(SRC)/sortIDs.$(ARCH).o \ 285 $(SRC)/psps_ids.$(ARCH).o 273 286 274 287 LOAD-STARPAR = \ … … 493 506 $(LOAD-2MASS) : $(INC)/addstar.h $(INC)/2mass.h 494 507 $(LOAD-GALPHOT) : $(INC)/addstar.h $(INC)/loadgalphot.h 508 $(LOAD-GAIA) : $(INC)/addstar.h $(INC)/gaia.h 495 509 $(LOAD-STARPAR) : $(INC)/addstar.h $(INC)/loadstarpar.h 496 510 $(LOAD-STARPAR-CLIENT) : $(INC)/addstar.h $(INC)/loadstarpar.h … … 514 528 $(BIN)/loadbsc.$(ARCH) : $(LOAD-BSC) 515 529 $(BIN)/loadgalphot.$(ARCH) : $(LOAD-GALPHOT) 530 $(BIN)/loadgaia.$(ARCH) : $(LOAD-GAIA) 516 531 $(BIN)/loadstarpar.$(ARCH) : $(LOAD-STARPAR) 517 532 $(BIN)/loadstarpar_client.$(ARCH) : $(LOAD-STARPAR-CLIENT) -
trunk/Ohana/src/addstar/src/psps_ids.c
r34701 r39926 42 42 43 43 uint64_t part1, part2, part3; 44 part1 = (uint64_t)( izone * 10000000000000LL) ; 44 part1 = (uint64_t)( izone * 10000000000000LL) ; // 10,000,000,000,000 45 45 part2 = ((uint64_t)(ra * 1000000.)) * 10000 ; // 0 - 360*1e6 = 3.6e8 (< 29 bits) 46 46 part3 = (int) (zresid * 10000.0) ; // 0 - 10000 (1 bit == 30/10000 arcsec) (< 14 bits) … … 48 48 return part1 + part2 + part3; 49 49 } 50 51 // 10 000 000 000 000 -
trunk/Ohana/src/delstar/include/delstar.h
r39692 r39926 95 95 int SAVE_DELETES; 96 96 int SKIP_IMAGES; 97 char *BACKUP_EXTNAME; 97 98 98 99 time_t START; … … 111 112 112 113 // for DELETE_MEASURES_BY_MATCH, these are the ranges to delete: 114 int DELETE_MIN_DET_ID; 115 int DELETE_MAX_DET_ID; 116 int DELETE_MIN_CAT_ID; 117 int DELETE_MAX_CAT_ID; 118 113 119 int DELETE_MIN_IMAGE_ID; 114 120 int DELETE_MAX_IMAGE_ID; … … 118 124 int DELETE_MIN_TIME; 119 125 int DELETE_MAX_TIME; 120 121 126 122 127 /*** delstar prototypes ***/ -
trunk/Ohana/src/delstar/src/args.c
r39692 r39926 202 202 } 203 203 204 DELETE_MIN_DET_ID = 0; 205 DELETE_MAX_DET_ID = 0; 206 DELETE_MIN_CAT_ID = 0; 207 DELETE_MAX_CAT_ID = 0; 204 208 DELETE_MIN_IMAGE_ID = 0; 205 209 DELETE_MAX_IMAGE_ID = 0; … … 209 213 DELETE_MAX_TIME = 0; 210 214 215 if ((N = get_argument (argc, argv, "-delete-min-detID"))) { remove_argument (N, &argc, argv); DELETE_MIN_DET_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 216 if ((N = get_argument (argc, argv, "-delete-max-detID"))) { remove_argument (N, &argc, argv); DELETE_MAX_DET_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 217 if ((N = get_argument (argc, argv, "-delete-min-catID"))) { remove_argument (N, &argc, argv); DELETE_MIN_CAT_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 218 if ((N = get_argument (argc, argv, "-delete-max-catID"))) { remove_argument (N, &argc, argv); DELETE_MAX_CAT_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 211 219 if ((N = get_argument (argc, argv, "-delete-min-imageID"))) { remove_argument (N, &argc, argv); DELETE_MIN_IMAGE_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 212 220 if ((N = get_argument (argc, argv, "-delete-max-imageID"))) { remove_argument (N, &argc, argv); DELETE_MAX_IMAGE_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } … … 221 229 remove_argument (N, &argc, argv); 222 230 } 231 232 BACKUP_EXTNAME = NULL; 233 if ((N = get_argument (argc, argv, "-backup-extname"))) { 234 remove_argument (N, &argc, argv); 235 BACKUP_EXTNAME = strcreate (argv[N]); 236 remove_argument (N, &argc, argv); 237 } 238 if (!BACKUP_EXTNAME) BACKUP_EXTNAME = strcreate (".bck"); 239 223 240 SAVE_DELETES = FALSE; 224 241 if ((N = get_argument (argc, argv, "-save-deletes"))) { … … 471 488 remove_argument (N, &argc, argv); 472 489 } 490 473 491 if ((N = get_argument (argc, argv, "-delete-measures-by-match"))) { 474 492 if (MODE != MODE_NONE) usage(); … … 477 495 SKIP_IMAGES = TRUE; // we do not need to load the images for -dup-measures 478 496 } 497 498 DELETE_MIN_DET_ID = 0; 499 DELETE_MAX_DET_ID = 0; 500 DELETE_MIN_CAT_ID = 0; 501 DELETE_MAX_CAT_ID = 0; 479 502 DELETE_MIN_IMAGE_ID = 0; 480 503 DELETE_MAX_IMAGE_ID = 0; … … 484 507 DELETE_MAX_TIME = 0; 485 508 509 if ((N = get_argument (argc, argv, "-delete-min-detID"))) { remove_argument (N, &argc, argv); DELETE_MIN_DET_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 510 if ((N = get_argument (argc, argv, "-delete-max-detID"))) { remove_argument (N, &argc, argv); DELETE_MAX_DET_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 511 if ((N = get_argument (argc, argv, "-delete-min-catID"))) { remove_argument (N, &argc, argv); DELETE_MIN_CAT_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 512 if ((N = get_argument (argc, argv, "-delete-max-catID"))) { remove_argument (N, &argc, argv); DELETE_MAX_CAT_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 486 513 if ((N = get_argument (argc, argv, "-delete-min-imageID"))) { remove_argument (N, &argc, argv); DELETE_MIN_IMAGE_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } 487 514 if ((N = get_argument (argc, argv, "-delete-max-imageID"))) { remove_argument (N, &argc, argv); DELETE_MAX_IMAGE_ID = atoi(argv[N]); remove_argument (N, &argc, argv); } … … 496 523 remove_argument (N, &argc, argv); 497 524 } 525 BACKUP_EXTNAME = NULL; 526 if ((N = get_argument (argc, argv, "-backup-extname"))) { 527 remove_argument (N, &argc, argv); 528 BACKUP_EXTNAME = strcreate (argv[N]); 529 remove_argument (N, &argc, argv); 530 } 531 if (!BACKUP_EXTNAME) BACKUP_EXTNAME = strcreate (".bck"); 498 532 499 533 if ((N = get_argument (argc, argv, "-fix-LAP"))) { -
trunk/Ohana/src/delstar/src/delete_duplicate_measures.c
r39692 r39926 111 111 112 112 // save backup of original cpm file 113 if (!dvo_catalog_subset_backup (&catalog, ".dl x")) {113 if (!dvo_catalog_subset_backup (&catalog, ".dlz")) { 114 114 fprintf (stderr, "ERROR: failed to make backup cpt table for catalog %s\n", catalog.filename); 115 115 exit (1); 116 116 } 117 if (!dvo_catalog_subset_backup (catalog.measure_catalog, ".d1 x")) {117 if (!dvo_catalog_subset_backup (catalog.measure_catalog, ".d1z")) { 118 118 fprintf (stderr, "ERROR: failed to make backup cpm table for catalog %s\n", catalog.filename); 119 119 exit (1); 120 120 } 121 if (!dvo_catalog_subset_backup (catalog.secfilt_catalog, ".dl x")) {121 if (!dvo_catalog_subset_backup (catalog.secfilt_catalog, ".dlz")) { 122 122 fprintf (stderr, "ERROR: failed to make backup cps table for catalog %s\n", catalog.filename); 123 123 exit (1); … … 377 377 if (SAVE_DUPLICATES) { 378 378 char savename[DVO_MAX_PATH]; 379 snprintf (savename, DVO_MAX_PATH, "%s.save.091 2", catalog->filename);379 snprintf (savename, DVO_MAX_PATH, "%s.save.0914", catalog->filename); 380 380 struct stat filestat; 381 381 int myStatus = stat (savename, &filestat); -
trunk/Ohana/src/delstar/src/delete_measures_by_match.c
r39692 r39926 13 13 14 14 int validOptions = FALSE; 15 validOptions |= DELETE_MAX_CAT_ID; 16 validOptions |= DELETE_MIN_CAT_ID; 17 validOptions |= DELETE_MAX_DET_ID; 18 validOptions |= DELETE_MIN_DET_ID; 15 19 validOptions |= DELETE_MAX_IMAGE_ID; 16 20 validOptions |= DELETE_MIN_IMAGE_ID; … … 26 30 fprintf (stderr, "deleting measurements matching the following\n"); 27 31 fprintf (stderr, "image ID range : %d to %d\n", DELETE_MIN_IMAGE_ID, DELETE_MAX_IMAGE_ID); 32 fprintf (stderr, "det ID range : %d to %d\n", DELETE_MIN_DET_ID, DELETE_MAX_DET_ID); 33 fprintf (stderr, "cat ID range : %d to %d\n", DELETE_MIN_CAT_ID, DELETE_MAX_CAT_ID); 28 34 fprintf (stderr, "photcode range : %d to %d\n", DELETE_MIN_PHOTCODE, DELETE_MAX_PHOTCODE); 29 35 fprintf (stderr, "time range (UNIX) : %d to %d\n", DELETE_MIN_TIME, DELETE_MAX_TIME); … … 133 139 134 140 // save backup of original cpm file 135 if (!dvo_catalog_subset_backup (&catalog, ".dlz")) {141 if (!dvo_catalog_subset_backup (&catalog, BACKUP_EXTNAME)) { 136 142 fprintf (stderr, "ERROR: failed to make backup cpt table for catalog %s\n", catalog.filename); 137 143 exit (1); 138 144 } 139 if (!dvo_catalog_subset_backup (catalog.measure_catalog, ".d1z")) {145 if (!dvo_catalog_subset_backup (catalog.measure_catalog, BACKUP_EXTNAME)) { 140 146 fprintf (stderr, "ERROR: failed to make backup cpm table for catalog %s\n", catalog.filename); 141 147 exit (1); 142 148 } 143 if (!dvo_catalog_subset_backup (catalog.secfilt_catalog, ".dlz")) {149 if (!dvo_catalog_subset_backup (catalog.secfilt_catalog, BACKUP_EXTNAME)) { 144 150 fprintf (stderr, "ERROR: failed to make backup cps table for catalog %s\n", catalog.filename); 145 151 exit (1); … … 214 220 UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 215 221 222 if (DELETE_MIN_DET_ID) strextend (&command, "-delete-min-detID %d", DELETE_MIN_DET_ID); 223 if (DELETE_MAX_DET_ID) strextend (&command, "-delete-max-detID %d", DELETE_MAX_DET_ID); 224 if (DELETE_MIN_CAT_ID) strextend (&command, "-delete-min-catID %d", DELETE_MIN_CAT_ID); 225 if (DELETE_MAX_CAT_ID) strextend (&command, "-delete-max-catID %d", DELETE_MAX_CAT_ID); 226 216 227 if (DELETE_MIN_IMAGE_ID) strextend (&command, "-delete-min-imageID %d", DELETE_MIN_IMAGE_ID); 217 228 if (DELETE_MAX_IMAGE_ID) strextend (&command, "-delete-max-imageID %d", DELETE_MAX_IMAGE_ID); … … 234 245 if (UPDATE) { strextend (&command, "-update"); } 235 246 if (SAVE_DELETES) { strextend (&command, "-save-deletes"); } 247 248 if (BACKUP_EXTNAME) { strextend (&command, "-backup-extname %s", BACKUP_EXTNAME); } 236 249 237 250 fprintf (stderr, "command: %s\n", command); … … 356 369 357 370 // does this measure match our selection criteria? 371 if (measure[i].detID > DELETE_MAX_DET_ID) continue; 372 if (measure[i].detID < DELETE_MIN_DET_ID) continue; 373 374 if (measure[i].catID > DELETE_MAX_CAT_ID) continue; 375 if (measure[i].catID < DELETE_MIN_CAT_ID) continue; 376 358 377 if (measure[i].imageID > DELETE_MAX_IMAGE_ID) continue; 359 378 if (measure[i].imageID < DELETE_MIN_IMAGE_ID) continue; … … 367 386 measureDrop[i] = TRUE; 368 387 off_t N = measure[i].averef; 369 if (VERBOSE) fprintf (stderr, "0x%08x 0x%08x %8.4f %8.4f %5d\n", measure[i].imageID, measure[i].detID, average[N].R, average[N].D, measure[i].photcode);388 if (VERBOSE) fprintf (stderr, "0x%08x 0x%08x 0x%08x %8.4f %8.4f %5d\n", measure[i].imageID, measure[i].detID, measure[i].catID, average[N].R, average[N].D, measure[i].photcode); 370 389 if (fsave) { 371 fprintf (fsave, "0x%08x 0x%08x %8.4f %8.4f %5d\n", measure[i].imageID, measure[i].detID, average[N].R, average[N].D, measure[i].photcode);390 fprintf (fsave, "0x%08x 0x%08x 0x%08x %8.4f %8.4f %5d\n", measure[i].imageID, measure[i].detID, measure[i].catID, average[N].R, average[N].D, measure[i].photcode); 372 391 } 373 392 if (isGPC1chip(measure[i].photcode)) { -
trunk/Ohana/src/dvomerge/include/dvomerge.h
r39536 r39926 61 61 int SKIP_MEASURE; 62 62 int SKIP_LENSING; 63 int SKIP_LENSOBJ; 63 64 int SKIP_STARPAR; 64 65 int SKIP_GALPHOT; … … 171 172 off_t *build_measure_links PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure)); 172 173 off_t *init_measure_links PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure)); 173 int add_meas _linkPROTO((Average *average, off_t *next, off_t Nmeasure, off_t NMEASURE));174 int add_measure_link PROTO((Average *average, off_t *next, off_t Nmeasure, off_t NMEASURE)); 174 175 Measure *sort_measure PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next)); 175 176 176 177 off_t *build_lensing_links PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing)); 177 178 off_t *init_lensing_links PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing)); 178 int add_lens _linkPROTO((Average *average, off_t *next, off_t Nlensing, off_t NLENSING));179 int add_lensing_link PROTO((Average *average, off_t *next, off_t Nlensing, off_t NLENSING)); 179 180 Lensing *sort_lensing PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing, off_t *next)); 181 182 off_t *build_lensobj_links PROTO((Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj)); 183 off_t *init_lensobj_links PROTO((Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj)); 184 int add_lensobj_link PROTO((Average *average, off_t *next, off_t Nlensobj, off_t NLENSOBJ)); 185 Lensobj *sort_lensobj PROTO((Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj, off_t *next)); 180 186 181 187 off_t *build_starpar_links PROTO((Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar)); 182 188 off_t *init_starpar_links PROTO((Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar)); 183 int add_star _link PROTO((Average *average, off_t *next, off_t Nstarpar, off_t NSTARPAR));189 int add_starpar_link PROTO((Average *average, off_t *next, off_t Nstarpar, off_t NSTARPAR)); 184 190 StarPar *sort_starpar PROTO((Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar, off_t *next)); 185 191 186 192 off_t *build_galphot_links PROTO((Average *average, off_t Naverage, GalPhot *galphot, off_t Ngalphot)); 187 193 off_t *init_galphot_links PROTO((Average *average, off_t Naverage, GalPhot *galphot, off_t Ngalphot)); 188 int add_galp _link PROTO((Average *average, off_t *next, off_t Ngalphot, off_t NGALPHOT));194 int add_galphot_link PROTO((Average *average, off_t *next, off_t Ngalphot, off_t NGALPHOT)); 189 195 GalPhot *sort_galphot PROTO((Average *average, off_t Naverage, GalPhot *galphot, off_t Ngalphot, off_t *next)); 190 196 191 197 off_t *init_missing_links PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing)); 192 int add_miss _link PROTO((Average *average, off_t *next, off_t Nmissing));198 int add_missing_link PROTO((Average *average, off_t *next, off_t Nmissing)); 193 199 Missing *sort_missing PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss)); 194 200 -
trunk/Ohana/src/dvomerge/src/LoadCatalog.c
r39536 r39926 9 9 10 10 // always load all of the data (if any exists) 11 // XXXX TEMP HACK : skip GALPHOT12 11 13 catalog[0].catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT | DVO_LOAD_LENSOBJ;12 catalog[0].catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT; 14 13 15 14 if (SKIP_MEASURE) { … … 23 22 } else { 24 23 catalog[0].catflags = catalog[0].catflags | DVO_LOAD_LENSING; 24 } 25 26 if (SKIP_LENSOBJ) { 27 catalog[0].catflags = catalog[0].catflags | DVO_SKIP_LENSOBJ; 28 } else { 29 catalog[0].catflags = catalog[0].catflags | DVO_LOAD_LENSOBJ; 25 30 } 26 31 -
trunk/Ohana/src/dvomerge/src/args.c
r39536 r39926 56 56 if ((N = get_argument (*argc, argv, "-skip-lensing"))) { 57 57 SKIP_LENSING = TRUE; 58 remove_argument (N, argc, argv); 59 } 60 SKIP_LENSOBJ = FALSE; 61 if ((N = get_argument (*argc, argv, "-skip-lensobj"))) { 62 SKIP_LENSOBJ = TRUE; 58 63 remove_argument (N, argc, argv); 59 64 } … … 340 345 remove_argument (N, argc, argv); 341 346 } 347 SKIP_LENSOBJ = FALSE; 348 if ((N = get_argument (*argc, argv, "-skip-lensobj"))) { 349 SKIP_LENSOBJ = TRUE; 350 remove_argument (N, argc, argv); 351 } 342 352 SKIP_STARPAR = FALSE; 343 353 if ((N = get_argument (*argc, argv, "-skip-starpar"))) { -
trunk/Ohana/src/dvomerge/src/build_links.c
r39536 r39926 15 15 data: they refer to the sequence number in the data blocks. 16 16 17 next_meas is a list of the equivalent sequence of the measure block as if it were sorted.17 next_measure is a list of the equivalent sequence of the measure block as if it were sorted. 18 18 19 19 to find the sequence of measurements for a given average: 20 20 n_0 = average->measureOffset 21 n_1 = next_meas [n_0]22 n_i = next_meas [n_i-1]21 n_1 = next_measure[n_0] 22 n_i = next_measure[n_i-1] 23 23 24 24 */ … … 31 31 32 32 off_t i, j, N; 33 off_t *next_meas ;33 off_t *next_measure; 34 34 35 35 if (!measure) return NULL; … … 38 38 N = 0; 39 39 40 ALLOCATE (next_meas , off_t, Nmeasure);40 ALLOCATE (next_measure, off_t, Nmeasure); 41 41 for (i = 0; i < Naverage; i++) { 42 42 if (!average[i].Nmeasure) continue; … … 45 45 for (j = 0; j < average[i].Nmeasure - 1; j++, N++) { 46 46 myAssert (measure[m+j+1].averef == i, "not sorted"); 47 next_meas [N] = N + 1;47 next_measure[N] = N + 1; 48 48 if (N >= Nmeasure) { 49 49 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 50 50 } 51 51 } 52 next_meas [N] = -1;52 next_measure[N] = -1; 53 53 if (N >= Nmeasure) { 54 54 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 61 61 N++; 62 62 } 63 return (next_meas );63 return (next_measure); 64 64 } 65 65 … … 74 74 75 75 off_t i, m, k, Nm, averef; 76 off_t *next_meas ;77 78 ALLOCATE (next_meas , off_t, Nmeasure);76 off_t *next_measure; 77 78 ALLOCATE (next_measure, off_t, Nmeasure); 79 79 80 80 /* reset the Nm, offset values for average */ … … 87 87 averef = measure[Nm].averef; 88 88 m = average[averef].measureOffset; 89 next_meas [Nm] = -1;89 next_measure[Nm] = -1; 90 90 91 91 if (m == -1) { /* no links yet for source */ … … 95 95 } 96 96 97 for (k = 0; next_meas [m] != -1; k++) {98 m = next_meas [m];97 for (k = 0; next_measure[m] != -1; k++) { 98 m = next_measure[m]; 99 99 if (m >= Nmeasure) { 100 100 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 103 103 104 104 average[averef].Nmeasure = k + 2; 105 next_meas [m] = Nm;105 next_measure[m] = Nm; 106 106 if (m >= Nmeasure) { 107 107 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 108 108 } 109 109 } 110 return (next_meas );110 return (next_measure); 111 111 } 112 112 113 113 /* average[].measureOffset, average[].Nmeasure are valid within an addstar run */ 114 int add_meas _link (Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE) {114 int add_measure_link (Average *average, off_t *next_measure, off_t Nmeasure, off_t NMEASURE) { 115 115 116 116 off_t k, m; 117 117 118 /* if we have trouble, check validity of next_meas [m] : m < Nmeasure */118 /* if we have trouble, check validity of next_measure[m] : m < Nmeasure */ 119 119 m = average[0].measureOffset; 120 120 121 121 for (k = 0; k < average[0].Nmeasure - 1; k++) { 122 m = next_meas [m];122 m = next_measure[m]; 123 123 if (m >= NMEASURE) { 124 124 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 127 127 128 128 /* set up references */ 129 next_meas [Nmeasure] = -1;129 next_measure[Nmeasure] = -1; 130 130 if (Nmeasure >= NMEASURE) { 131 131 fprintf (stderr, "WARNING: Nmeasure out of bounds (1)\n"); … … 136 136 average[0].measureOffset = Nmeasure; 137 137 } else { 138 next_meas [m] = Nmeasure;138 next_measure[m] = Nmeasure; 139 139 if (m >= NMEASURE) { 140 140 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 145 145 } 146 146 147 Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_meas ) {147 Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_measure) { 148 148 149 149 off_t i, k, n, np, N; … … 169 169 tmpmeasure[N].averef = i; 170 170 np = n; 171 n = next_meas [n];171 n = next_measure[n]; 172 172 } 173 173 } … … 183 183 184 184 off_t i, j, N; 185 off_t *next_miss ;185 off_t *next_missing; 186 186 187 187 N = 0; 188 188 189 ALLOCATE (next_miss , off_t, Nmissing);189 ALLOCATE (next_missing, off_t, Nmissing); 190 190 for (i = 0; i < Naverage; i++) { 191 191 for (j = 0; j < average[i].Nmissing - 1; j++, N++) { 192 next_miss [N] = N + 1;192 next_missing[N] = N + 1; 193 193 } 194 194 if (average[i].Nmissing > 0) { 195 next_miss [N] = -1;195 next_missing[N] = -1; 196 196 if (N >= Nmissing) { 197 197 fprintf (stderr, "overflow in init_missing_links"); … … 202 202 203 203 } 204 return (next_miss );205 } 206 207 int add_miss _link (Average *average, off_t *next_miss, off_t Nmissing) {204 return (next_missing); 205 } 206 207 int add_missing_link (Average *average, off_t *next_missing, off_t Nmissing) { 208 208 209 209 off_t k, m; … … 212 212 if (average[0].Nmissing < 1) { 213 213 average[0].missingOffset = Nmissing; 214 next_miss [Nmissing] = -1;214 next_missing[Nmissing] = -1; 215 215 return (TRUE); 216 216 } 217 217 218 218 m = average[0].missingOffset; 219 for (k = 0; k < average[0].Nmissing - 1; k++) m = next_miss [m];219 for (k = 0; k < average[0].Nmissing - 1; k++) m = next_missing[m]; 220 220 /* set up references */ 221 next_miss [Nmissing] = -1;222 next_miss [m] = Nmissing;221 next_missing[Nmissing] = -1; 222 next_missing[m] = Nmissing; 223 223 return (TRUE); 224 224 } … … 227 227 we must always save the missing table, if it exists */ 228 228 229 Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss ) {229 Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_missing) { 230 230 231 231 off_t i, k, n, N; … … 240 240 for (k = 0; k < average[i].Nmissing; k++, N++) { 241 241 tmpmissing[N] = missing[n]; 242 n = next_miss [n];242 n = next_missing[n]; 243 243 } 244 244 } … … 254 254 255 255 off_t i, j, N; 256 off_t *next_lens ;256 off_t *next_lensing; 257 257 258 258 if (!lensing) return NULL; … … 261 261 N = 0; 262 262 263 ALLOCATE (next_lens , off_t, Nlensing);263 ALLOCATE (next_lensing, off_t, Nlensing); 264 264 for (i = 0; i < Naverage; i++) { 265 265 if (!average[i].Nlensing) continue; … … 268 268 for (j = 0; j < average[i].Nlensing - 1; j++, N++) { 269 269 myAssert (lensing[m+j+1].averef == i, "not sorted"); 270 next_lens [N] = N + 1;270 next_lensing[N] = N + 1; 271 271 if (N >= Nlensing) { 272 272 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 273 273 } 274 274 } 275 next_lens [N] = -1;275 next_lensing[N] = -1; 276 276 if (N >= Nlensing) { 277 277 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 284 284 N++; 285 285 } 286 return (next_lens );286 return (next_lensing); 287 287 } 288 288 … … 297 297 298 298 off_t i, m, k, Nm, averef; 299 off_t *next_lens ;300 301 ALLOCATE (next_lens , off_t, Nlensing);299 off_t *next_lensing; 300 301 ALLOCATE (next_lensing, off_t, Nlensing); 302 302 303 303 /* reset the Nm, offset values for average */ … … 310 310 averef = lensing[Nm].averef; 311 311 m = average[averef].lensingOffset; 312 next_lens [Nm] = -1;312 next_lensing[Nm] = -1; 313 313 314 314 if (m == -1) { /* no links yet for source */ … … 318 318 } 319 319 320 for (k = 0; next_lens [m] != -1; k++) {321 m = next_lens [m];320 for (k = 0; next_lensing[m] != -1; k++) { 321 m = next_lensing[m]; 322 322 if (m >= Nlensing) { 323 323 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 326 326 327 327 average[averef].Nlensing = k + 2; 328 next_lens [m] = Nm;328 next_lensing[m] = Nm; 329 329 if (m >= Nlensing) { 330 330 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 331 331 } 332 332 } 333 return (next_lens );333 return (next_lensing); 334 334 } 335 335 336 336 /* average[].lensingOffset, average[].Nlensing are valid within an addstar run */ 337 int add_lens _link (Average *average, off_t *next_lens, off_t Nlensing, off_t NLENSING) {337 int add_lensing_link (Average *average, off_t *next_lensing, off_t Nlensing, off_t NLENSING) { 338 338 339 339 off_t k, m; 340 340 341 /* if we have trouble, check validity of next_lens [m] : m < Nlensing */341 /* if we have trouble, check validity of next_lensing[m] : m < Nlensing */ 342 342 m = average[0].lensingOffset; 343 343 344 344 for (k = 0; k < average[0].Nlensing - 1; k++) { 345 m = next_lens [m];345 m = next_lensing[m]; 346 346 if (m >= NLENSING) { 347 347 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 350 350 351 351 /* set up references */ 352 next_lens [Nlensing] = -1;352 next_lensing[Nlensing] = -1; 353 353 if (Nlensing >= NLENSING) { 354 354 fprintf (stderr, "WARNING: Nlensing out of bounds (1)\n"); … … 359 359 average[0].lensingOffset = Nlensing; 360 360 } else { 361 next_lens [m] = Nlensing;361 next_lensing[m] = Nlensing; 362 362 if (m >= NLENSING) { 363 363 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 368 368 } 369 369 370 Lensing *sort_lensing (Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing, off_t *next_lens ) {370 Lensing *sort_lensing (Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing, off_t *next_lensing) { 371 371 372 372 off_t i, k, n, np, N; … … 392 392 tmplensing[N].averef = i; 393 393 np = n; 394 n = next_lens [n];394 n = next_lensing[n]; 395 395 } 396 396 } 397 397 free (lensing); 398 398 return (tmplensing); 399 } 400 401 /*** Lensobj ****************************************************************************************/ 402 403 /* build the initial links assuming the table is sorted, 404 not partial, and has a correct set of average[].lensobjOffset,Nlensobj values */ 405 off_t *init_lensobj_links (Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj) { 406 407 off_t i, j, N; 408 off_t *next_lensobj; 409 410 if (!lensobj) return NULL; 411 if (SKIP_LENSOBJ) return NULL; 412 413 N = 0; 414 415 ALLOCATE (next_lensobj, off_t, Nlensobj); 416 for (i = 0; i < Naverage; i++) { 417 if (!average[i].Nlensobj) continue; 418 // off_t m = average[i].lensobjOffset; 419 // myAssert (lensobj[m].averef == i, "not sorted"); 420 for (j = 0; j < average[i].Nlensobj - 1; j++, N++) { 421 // myAssert (lensobj[m+j+1].averef == i, "not sorted"); 422 next_lensobj[N] = N + 1; 423 if (N >= Nlensobj) { 424 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 425 } 426 } 427 next_lensobj[N] = -1; 428 if (N >= Nlensobj) { 429 fprintf (stderr, "WARNING: N out of bounds (2)\n"); 430 } 431 432 if (N >= Nlensobj) { 433 fprintf (stderr, "overflow in init_lensobj_links\n"); 434 abort (); 435 } 436 N++; 437 } 438 return (next_lensobj); 439 } 440 441 /* construct lensobj links which are valid FOR THIS LOAD 442 * - if we have a full load, we will get links which can 443 * be used by other programs (eg, relphot, etc) 444 * - if we have a partial load, the links are only valid 445 * for that partial load 446 */ 447 448 off_t *build_lensobj_links (Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj) { 449 450 fprintf (stderr, "input is not sorted but contains lensobj -- trouble\n"); 451 exit (2); 452 453 # if (0) 454 455 off_t i, m, k, Nm, averef; 456 off_t *next_lensobj; 457 458 ALLOCATE (next_lensobj, off_t, Nlensobj); 459 460 /* reset the Nm, offset values for average */ 461 for (i = 0; i < Naverage; i++) { 462 average[i].lensobjOffset = -1; 463 average[i].Nlensobj = 0; 464 } 465 466 for (Nm = 0; Nm < Nlensobj; Nm++) { 467 averef = lensobj[Nm].averef; 468 m = average[averef].lensobjOffset; 469 next_lensobj[Nm] = -1; 470 471 if (m == -1) { /* no links yet for source */ 472 average[averef].lensobjOffset = Nm; 473 average[averef].Nlensobj = 1; 474 continue; 475 } 476 477 for (k = 0; next_lensobj[m] != -1; k++) { 478 m = next_lensobj[m]; 479 if (m >= Nlensobj) { 480 fprintf (stderr, "WARNING: m out of bounds (1)\n"); 481 } 482 } 483 484 average[averef].Nlensobj = k + 2; 485 next_lensobj[m] = Nm; 486 if (m >= Nlensobj) { 487 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 488 } 489 } 490 return (next_lensobj); 491 # endif 492 } 493 494 /* average[].lensobjOffset, average[].Nlensobj are valid within an addstar run */ 495 int add_lensobj_link (Average *average, off_t *next_lensobj, off_t Nlensobj, off_t NLENSOBJ) { 496 497 off_t k, m; 498 499 /* if we have trouble, check validity of next_lensobj[m] : m < Nlensobj */ 500 m = average[0].lensobjOffset; 501 502 for (k = 0; k < average[0].Nlensobj - 1; k++) { 503 m = next_lensobj[m]; 504 if (m >= NLENSOBJ) { 505 fprintf (stderr, "WARNING: m out of bounds (3)\n"); 506 } 507 } 508 509 /* set up references */ 510 next_lensobj[Nlensobj] = -1; 511 if (Nlensobj >= NLENSOBJ) { 512 fprintf (stderr, "WARNING: Nlensobj out of bounds (1)\n"); 513 } 514 515 // if Nlensobj is 0, m may have been mis-set; add to the end 516 if ((average[0].Nlensobj == 0) || (m == -1)) { 517 average[0].lensobjOffset = Nlensobj; 518 } else { 519 next_lensobj[m] = Nlensobj; 520 if (m >= NLENSOBJ) { 521 fprintf (stderr, "WARNING: m out of bounds (4)\n"); 522 } 523 } 524 525 return (TRUE); 526 } 527 528 Lensobj *sort_lensobj (Average *average, off_t Naverage, Lensobj *lensobj, off_t Nlensobj, off_t *next_lensobj) { 529 530 off_t i, k, n, np, N; 531 Lensobj *tmplensobj; 532 533 /* fix order of Lensobj (memory intensive, but fast) */ 534 np = -1; 535 N = 0; 536 ALLOCATE (tmplensobj, Lensobj, Nlensobj); 537 for (i = 0; i < Naverage; i++) { 538 if (!average[i].Nlensobj) continue; 539 n = average[i].lensobjOffset; 540 average[i].lensobjOffset = N; 541 int myObjID = average[i].objID; 542 for (k = 0; k < average[i].Nlensobj; k++, N++) { 543 if (n == -1) { 544 fprintf (stderr, "entry after %d has a problem\n", (int) np); 545 abort(); 546 } 547 tmplensobj[N] = lensobj[n]; 548 // myAssert (lensobj[n].averef == i, "error in averef"); 549 myAssert ((lensobj[n].objID == myObjID) || (lensobj[n].objID == -1), "error in objID?"); 550 // tmplensobj[N].averef = i; 551 np = n; 552 n = next_lensobj[n]; 553 } 554 } 555 free (lensobj); 556 return (tmplensobj); 399 557 } 400 558 … … 406 564 407 565 off_t i, j, N; 408 off_t *next_star ;566 off_t *next_starpar; 409 567 410 568 if (!starpar) return NULL; … … 415 573 // NOTE that is we choose DVO_SKIP_STARPAR, catalog.starpar is NULL. 416 574 // this code will let merge_catalogs_old.c do nothing for starpar 417 ALLOCATE (next_star , off_t, Nstarpar);418 if (!starpar) return next_star ;575 ALLOCATE (next_starpar, off_t, Nstarpar); 576 if (!starpar) return next_starpar; 419 577 420 578 for (i = 0; i < Naverage; i++) { … … 424 582 for (j = 0; j < average[i].Nstarpar - 1; j++, N++) { 425 583 myAssert (starpar[m+j+1].averef == i, "not sorted"); 426 next_star [N] = N + 1;584 next_starpar[N] = N + 1; 427 585 if (N >= Nstarpar) { 428 586 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 429 587 } 430 588 } 431 next_star [N] = -1;589 next_starpar[N] = -1; 432 590 if (N >= Nstarpar) { 433 591 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 440 598 N++; 441 599 } 442 return (next_star );600 return (next_starpar); 443 601 } 444 602 … … 453 611 454 612 off_t i, m, k, Nm, averef; 455 off_t *next_star ;456 457 ALLOCATE (next_star , off_t, Nstarpar);458 if (!starpar) return next_star ;613 off_t *next_starpar; 614 615 ALLOCATE (next_starpar, off_t, Nstarpar); 616 if (!starpar) return next_starpar; 459 617 460 618 /* reset the Nm, offset values for average */ … … 467 625 averef = starpar[Nm].averef; 468 626 m = average[averef].starparOffset; 469 next_star [Nm] = -1;627 next_starpar[Nm] = -1; 470 628 471 629 if (m == -1) { /* no links yet for source */ … … 475 633 } 476 634 477 for (k = 0; next_star [m] != -1; k++) {478 m = next_star [m];635 for (k = 0; next_starpar[m] != -1; k++) { 636 m = next_starpar[m]; 479 637 if (m >= Nstarpar) { 480 638 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 483 641 484 642 average[averef].Nstarpar = k + 2; 485 next_star [m] = Nm;643 next_starpar[m] = Nm; 486 644 if (m >= Nstarpar) { 487 645 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 488 646 } 489 647 } 490 return (next_star );648 return (next_starpar); 491 649 } 492 650 493 651 /* average[].starparOffset, average[].Nstarpar are valid within an addstar run */ 494 int add_star _link (Average *average, off_t *next_star, off_t Nstarpar, off_t NSTARPAR) {652 int add_starpar_link (Average *average, off_t *next_starpar, off_t Nstarpar, off_t NSTARPAR) { 495 653 496 654 off_t k, m; 497 655 498 /* if we have trouble, check validity of next_star [m] : m < Nstarpar */656 /* if we have trouble, check validity of next_starpar[m] : m < Nstarpar */ 499 657 m = average[0].starparOffset; 500 658 501 659 for (k = 0; k < average[0].Nstarpar - 1; k++) { 502 m = next_star [m];660 m = next_starpar[m]; 503 661 if (m >= NSTARPAR) { 504 662 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 507 665 508 666 /* set up references */ 509 next_star [Nstarpar] = -1;667 next_starpar[Nstarpar] = -1; 510 668 if (Nstarpar >= NSTARPAR) { 511 669 fprintf (stderr, "WARNING: Nstarpar out of bounds (1)\n"); … … 516 674 average[0].starparOffset = Nstarpar; 517 675 } else { 518 next_star [m] = Nstarpar;676 next_starpar[m] = Nstarpar; 519 677 if (m >= NSTARPAR) { 520 678 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 525 683 } 526 684 527 StarPar *sort_starpar (Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar, off_t *next_star ) {685 StarPar *sort_starpar (Average *average, off_t Naverage, StarPar *starpar, off_t Nstarpar, off_t *next_starpar) { 528 686 529 687 off_t i, k, n, np, N; … … 552 710 tmpstarpar[N].averef = i; 553 711 np = n; 554 n = next_star [n];712 n = next_starpar[n]; 555 713 } 556 714 } … … 566 724 567 725 off_t i, j, N; 568 off_t *next_galp ;726 off_t *next_galphot; 569 727 570 728 if (galphot) return NULL; … … 573 731 N = 0; 574 732 575 ALLOCATE (next_galp , off_t, Ngalphot);733 ALLOCATE (next_galphot, off_t, Ngalphot); 576 734 for (i = 0; i < Naverage; i++) { 577 735 if (!average[i].Ngalphot) continue; … … 580 738 for (j = 0; j < average[i].Ngalphot - 1; j++, N++) { 581 739 myAssert (galphot[m+j+1].averef == i, "not sorted"); 582 next_galp [N] = N + 1;740 next_galphot[N] = N + 1; 583 741 if (N >= Ngalphot) { 584 742 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 585 743 } 586 744 } 587 next_galp [N] = -1;745 next_galphot[N] = -1; 588 746 if (N >= Ngalphot) { 589 747 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 596 754 N++; 597 755 } 598 return (next_galp );756 return (next_galphot); 599 757 } 600 758 … … 609 767 610 768 off_t i, m, k, Nm, averef; 611 off_t *next_galp ;612 613 ALLOCATE (next_galp , off_t, Ngalphot);769 off_t *next_galphot; 770 771 ALLOCATE (next_galphot, off_t, Ngalphot); 614 772 615 773 /* reset the Nm, offset values for average */ … … 622 780 averef = galphot[Nm].averef; 623 781 m = average[averef].galphotOffset; 624 next_galp [Nm] = -1;782 next_galphot[Nm] = -1; 625 783 626 784 if (m == -1) { /* no links yet for source */ … … 630 788 } 631 789 632 for (k = 0; next_galp [m] != -1; k++) {633 m = next_galp [m];790 for (k = 0; next_galphot[m] != -1; k++) { 791 m = next_galphot[m]; 634 792 if (m >= Ngalphot) { 635 793 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 638 796 639 797 average[averef].Ngalphot = k + 2; 640 next_galp [m] = Nm;798 next_galphot[m] = Nm; 641 799 if (m >= Ngalphot) { 642 800 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 643 801 } 644 802 } 645 return (next_galp );803 return (next_galphot); 646 804 } 647 805 648 806 /* average[].galphotOffset, average[].Ngalphot are valid within an addstar run */ 649 int add_galp _link (Average *average, off_t *next_galp, off_t Ngalphot, off_t NGALPHOT) {807 int add_galphot_link (Average *average, off_t *next_galphot, off_t Ngalphot, off_t NGALPHOT) { 650 808 651 809 off_t k, m; 652 810 653 /* if we have trouble, check validity of next_galp [m] : m < Ngalphot */811 /* if we have trouble, check validity of next_galphot[m] : m < Ngalphot */ 654 812 m = average[0].galphotOffset; 655 813 656 814 for (k = 0; k < average[0].Ngalphot - 1; k++) { 657 m = next_galp [m];815 m = next_galphot[m]; 658 816 if (m >= NGALPHOT) { 659 817 fprintf (stderr, "WARNING: m out of bounds (3)\n"); … … 662 820 663 821 /* set up references */ 664 next_galp [Ngalphot] = -1;822 next_galphot[Ngalphot] = -1; 665 823 if (Ngalphot >= NGALPHOT) { 666 824 fprintf (stderr, "WARNING: Ngalphot out of bounds (1)\n"); … … 671 829 average[0].galphotOffset = Ngalphot; 672 830 } else { 673 next_galp [m] = Ngalphot;831 next_galphot[m] = Ngalphot; 674 832 if (m >= NGALPHOT) { 675 833 fprintf (stderr, "WARNING: m out of bounds (4)\n"); … … 680 838 } 681 839 682 GalPhot *sort_galphot (Average *average, off_t Naverage, GalPhot *galphot, off_t Ngalphot, off_t *next_galp ) {840 GalPhot *sort_galphot (Average *average, off_t Naverage, GalPhot *galphot, off_t Ngalphot, off_t *next_galphot) { 683 841 684 842 off_t i, k, n, np, N; … … 704 862 tmpgalphot[N].averef = i; 705 863 np = n; 706 n = next_galp [n];864 n = next_galphot[n]; 707 865 } 708 866 } -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
r39536 r39926 336 336 if (SKIP_MEASURE) { strextend (&command, "-skip-measure"); } 337 337 if (SKIP_LENSING) { strextend (&command, "-skip-lensing"); } 338 if (SKIP_LENSOBJ) { strextend (&command, "-skip-lensobj"); } 338 339 if (SKIP_GALPHOT) { strextend (&command, "-skip-galphot"); } 339 340 if (SKIP_STARPAR) { strextend (&command, "-skip-starpar"); } -
trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c
r39342 r39926 14 14 double *X1, *Y1, *X2, *Y2; 15 15 double dX, dY, dR; 16 off_t *N1, *N2, *next_meas , *next_lens, *next_star, *next_galp;17 off_t Nave, NAVE, Nmeas , NMEAS, Nmatch, Nlens, NLENS, Nstar, NSTAR, Ngalp, NGALP;16 off_t *N1, *N2, *next_measure, *next_lensing, *next_lensobj, *next_starpar, *next_galphot; 17 off_t Nave, NAVE, Nmeasure, NMEASURE, Nmatch, Nlensing, NLENSING, Nlensobj, NLENSOBJ, Nstarpar, NSTARPAR, Ngalphot, NGALPHOT; 18 18 int NsecfiltIn; 19 19 int NsecfiltOut; … … 51 51 /* internal counters */ 52 52 Nmatch = 0; 53 NMEAS = Nmeas = output[0].Nmeasure; 54 NLENS = Nlens = output[0].Nlensing; 55 NSTAR = Nstar = output[0].Nstarpar; 56 NGALP = Ngalp = output[0].Ngalphot; 53 NMEASURE = Nmeasure = output[0].Nmeasure; 54 NLENSING = Nlensing = output[0].Nlensing; 55 NLENSOBJ = Nlensobj = output[0].Nlensobj; 56 NSTARPAR = Nstarpar = output[0].Nstarpar; 57 NGALPHOT = Ngalphot = output[0].Ngalphot; 57 58 58 59 // current max obj ID for this catalog … … 116 117 // this version is only valid if we have done a full catalog load, and if the catalog 117 118 // is sorted while processed 118 next_meas = init_measure_links (output[0].average, Nave, output[0].measure, Nmeas); 119 next_lens = init_lensing_links (output[0].average, Nave, output[0].lensing, Nlens); 120 next_star = init_starpar_links (output[0].average, Nave, output[0].starpar, Nstar); 121 next_galp = init_galphot_links (output[0].average, Nave, output[0].galphot, Ngalp); 119 next_measure = init_measure_links (output[0].average, Nave, output[0].measure, Nmeasure); 120 next_lensing = init_lensing_links (output[0].average, Nave, output[0].lensing, Nlensing); 121 next_lensobj = init_lensobj_links (output[0].average, Nave, output[0].lensobj, Nlensobj); 122 next_starpar = init_starpar_links (output[0].average, Nave, output[0].starpar, Nstarpar); 123 next_galphot = init_galphot_links (output[0].average, Nave, output[0].galphot, Ngalphot); 122 124 } else { 123 next_meas = build_measure_links (output[0].average, Nave, output[0].measure, Nmeas); 124 next_lens = build_lensing_links (output[0].average, Nave, output[0].lensing, Nlens); 125 next_star = build_starpar_links (output[0].average, Nave, output[0].starpar, Nstar); 126 next_galp = build_galphot_links (output[0].average, Nave, output[0].galphot, Ngalp); 125 next_measure = build_measure_links (output[0].average, Nave, output[0].measure, Nmeasure); 126 next_lensing = build_lensing_links (output[0].average, Nave, output[0].lensing, Nlensing); 127 next_lensobj = build_lensobj_links (output[0].average, Nave, output[0].lensobj, Nlensobj); 128 next_starpar = build_starpar_links (output[0].average, Nave, output[0].starpar, Nstarpar); 129 next_galphot = build_galphot_links (output[0].average, Nave, output[0].galphot, Ngalphot); 127 130 } 128 131 … … 183 186 184 187 /* make sure there is space for next Nmeasure entries */ 185 if (Nmeas + input[0].average[N].Nmeasure >= NMEAS) { 186 NMEAS = Nmeas + input[0].average[N].Nmeasure + 1000; 187 REALLOCATE (next_meas, off_t, NMEAS); 188 REALLOCATE (output[0].measure, Measure, NMEAS); 189 } 190 if (Nlens + input[0].average[N].Nlensing >= NLENS) { 191 NLENS = Nlens + input[0].average[N].Nlensing + 1000; 192 REALLOCATE (next_lens, off_t, NLENS); 193 REALLOCATE (output[0].lensing, Lensing, NLENS); 194 } 195 if (Nstar + input[0].average[N].Nstarpar >= NSTAR) { 196 NSTAR = Nstar + input[0].average[N].Nstarpar + 1000; 197 REALLOCATE (next_star, off_t, NSTAR); 198 REALLOCATE (output[0].starpar, StarPar, NSTAR); 199 } 200 if (Ngalp + input[0].average[N].Ngalphot >= NGALP) { 201 NGALP = Ngalp + input[0].average[N].Ngalphot + 1000; 202 REALLOCATE (next_galp, off_t, NGALP); 203 REALLOCATE (output[0].galphot, GalPhot, NGALP); 188 if (Nmeasure + input[0].average[N].Nmeasure >= NMEASURE) { 189 NMEASURE = Nmeasure + input[0].average[N].Nmeasure + 1000; 190 REALLOCATE (next_measure, off_t, NMEASURE); 191 REALLOCATE (output[0].measure, Measure, NMEASURE); 192 } 193 if (Nlensing + input[0].average[N].Nlensing >= NLENSING) { 194 NLENSING = Nlensing + input[0].average[N].Nlensing + 1000; 195 REALLOCATE (next_lensing, off_t, NLENSING); 196 REALLOCATE (output[0].lensing, Lensing, NLENSING); 197 } 198 if (Nlensobj + input[0].average[N].Nlensobj >= NLENSOBJ) { 199 NLENSOBJ = Nlensobj + input[0].average[N].Nlensobj + 1000; 200 REALLOCATE (next_lensobj, off_t, NLENSOBJ); 201 REALLOCATE (output[0].lensobj, Lensobj, NLENSOBJ); 202 } 203 if (Nstarpar + input[0].average[N].Nstarpar >= NSTARPAR) { 204 NSTARPAR = Nstarpar + input[0].average[N].Nstarpar + 1000; 205 REALLOCATE (next_starpar, off_t, NSTARPAR); 206 REALLOCATE (output[0].starpar, StarPar, NSTARPAR); 207 } 208 if (Ngalphot + input[0].average[N].Ngalphot >= NGALPHOT) { 209 NGALPHOT = Ngalphot + input[0].average[N].Ngalphot + 1000; 210 REALLOCATE (next_galphot, off_t, NGALPHOT); 211 REALLOCATE (output[0].galphot, GalPhot, NGALPHOT); 204 212 } 205 213 … … 212 220 if (REPLACE_TYCHO) { 213 221 int Minp = input[0].average[N].measureOffset; 214 Nreplace = replace_tycho (&output[0].average[n], output[0].measure, next_meas , &input[0].average[N], &input[0].measure[Minp]);222 Nreplace = replace_tycho (&output[0].average[n], output[0].measure, next_measure, &input[0].average[N], &input[0].measure[Minp]); 215 223 if (Nreplace == 6) { 216 output[0].found_t[n] = Nmeas ;224 output[0].found_t[n] = Nmeasure; 217 225 i++; 218 226 continue; … … 227 235 // index to first measure for this object 228 236 // XXX this does not support lensing, starpar, or galphot measurements 229 if (replace_match (&output[0].average[n], output[0].measure, next_meas , &input[0].average[N], &input[0].measure[offset])) {237 if (replace_match (&output[0].average[n], output[0].measure, next_measure, &input[0].average[N], &input[0].measure[offset])) { 230 238 continue; 231 239 } 232 240 } 233 241 /* add to end of measurement list */ 234 add_meas _link (&output[0].average[n], next_meas, Nmeas, NMEAS);242 add_measure_link (&output[0].average[n], next_measure, Nmeasure, NMEASURE); 235 243 236 244 // set the new measurements 237 output[0].measure[Nmeas ] = input[0].measure[offset];245 output[0].measure[Nmeasure] = input[0].measure[offset]; 238 246 239 247 // old code: find R,D using average_in[0], the get offset relative to average_out[0]. no longer … … 241 249 // Rin = input[0].average[N].R - input[0].measure[offset].dR / 3600.0; 242 250 // Din = input[0].average[N].D - input[0].measure[offset].dD / 3600.0; 243 // output[0].measure[Nmeas ].dR = 3600.0*(output[0].average[n].R - Rin);244 // output[0].measure[Nmeas ].dD = 3600.0*(output[0].average[n].D - Din);245 246 output[0].measure[Nmeas ].dbFlags = 0; // XXX why reset these?247 output[0].measure[Nmeas ].averef = n;248 output[0].measure[Nmeas ].objID = output[0].average[n].objID;249 output[0].measure[Nmeas ].catID = output[0].catID;250 251 assert (output[0].measure[Nmeas ].averef < Nave);252 253 // fprintf (stderr, "Nave : "OFF_T_FMT", Nmeas : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n", n, Nmeas, output[0].measure[Nmeas].dR, output[0].measure[Nmeas].dD, output[0].measure[i].catID);254 255 float dRoff = dvoOffsetR(&output[0].measure[Nmeas ], &output[0].average[n]);251 // output[0].measure[Nmeasure].dR = 3600.0*(output[0].average[n].R - Rin); 252 // output[0].measure[Nmeasure].dD = 3600.0*(output[0].average[n].D - Din); 253 254 output[0].measure[Nmeasure].dbFlags = 0; // XXX why reset these? 255 output[0].measure[Nmeasure].averef = n; 256 output[0].measure[Nmeasure].objID = output[0].average[n].objID; 257 output[0].measure[Nmeasure].catID = output[0].catID; 258 259 assert (output[0].measure[Nmeasure].averef < Nave); 260 261 // fprintf (stderr, "Nave : "OFF_T_FMT", Nmeasure : "OFF_T_FMT", dR: %f, dD: %f, catID: %d\n", n, Nmeasure, output[0].measure[Nmeasure].dR, output[0].measure[Nmeasure].dD, output[0].measure[i].catID); 262 263 float dRoff = dvoOffsetR(&output[0].measure[Nmeasure], &output[0].average[n]); 256 264 257 265 // rationalize R 258 266 if (dRoff > +180.0*3600.0) { 259 267 // average on high end of boundary, move star up 260 output[0].measure[Nmeas ].R += 360.0;268 output[0].measure[Nmeasure].R += 360.0; 261 269 dRoff -= 360.0*3600.0; 262 270 } 263 271 if (dRoff < -180.0*3600.0) { 264 272 // average on low end of boundary, move star down 265 output[0].measure[Nmeas ].R -= 360.0;273 output[0].measure[Nmeasure].R -= 360.0; 266 274 dRoff += 360.0*3600.0; 267 275 } … … 272 280 fprintf (stderr, "error: %10.6f,%10.6f vs %10.6f,%10.6f (%f,%f vs %f,%f)\n", 273 281 output[0].average[n].R, output[0].average[n].D, 274 output[0].measure[Nmeas ].R, output[0].measure[Nmeas].D,282 output[0].measure[Nmeasure].R, output[0].measure[Nmeasure].D, 275 283 X1[i], X2[Jmin], Y1[i], Y2[Jmin]); 276 284 // XXX abort on this? -- this is a bad failure... … … 278 286 } 279 287 output[0].average[n].Nmeasure ++; 280 Nmeas ++;288 Nmeasure ++; 281 289 } 282 290 } … … 286 294 for (Nin = 0; Nin < input[0].average[N].Nlensing; Nin++) { 287 295 /* add to end of lensing list */ 288 add_lens _link (&output[0].average[n], next_lens, Nlens, NLENS);296 add_lensing_link (&output[0].average[n], next_lensing, Nlensing, NLENSING); 289 297 290 298 // set the new lensing 291 299 off_t lensoff = input[0].average[N].lensingOffset + Nin; 292 output[0].lensing[Nlens ] = input[0].lensing[lensoff];293 294 output[0].lensing[Nlens ].averef = n;295 output[0].lensing[Nlens ].objID = output[0].average[n].objID;296 output[0].lensing[Nlens ].catID = output[0].catID;300 output[0].lensing[Nlensing] = input[0].lensing[lensoff]; 301 302 output[0].lensing[Nlensing].averef = n; 303 output[0].lensing[Nlensing].objID = output[0].average[n].objID; 304 output[0].lensing[Nlensing].catID = output[0].catID; 297 305 output[0].average[n].Nlensing ++; 298 Nlens ++; 306 Nlensing ++; 307 } 308 } 309 310 // if lensobj measurements exist, add them too 311 if (output[0].lensobj && !SKIP_LENSOBJ) { 312 for (Nin = 0; Nin < input[0].average[N].Nlensobj; Nin++) { 313 /* add to end of lensobj list */ 314 add_lensobj_link (&output[0].average[n], next_lensobj, Nlensobj, NLENSOBJ); 315 316 // set the new lensobj 317 off_t lensoff = input[0].average[N].lensobjOffset + Nin; 318 output[0].lensobj[Nlensobj] = input[0].lensobj[lensoff]; 319 320 // output[0].lensobj[Nlensobj].averef = n; 321 output[0].lensobj[Nlensobj].objID = output[0].average[n].objID; 322 output[0].lensobj[Nlensobj].catID = output[0].catID; 323 output[0].average[n].Nlensobj ++; 324 Nlensobj ++; 299 325 } 300 326 } … … 304 330 for (Nin = 0; Nin < input[0].average[N].Nstarpar; Nin++) { 305 331 /* add to end of lensing list */ 306 add_star _link (&output[0].average[n], next_star, Nstar, NSTAR);332 add_starpar_link (&output[0].average[n], next_starpar, Nstarpar, NSTARPAR); 307 333 308 334 // set the new starpar 309 335 off_t staroff = input[0].average[N].starparOffset + Nin; 310 output[0].starpar[Nstar ] = input[0].starpar[staroff];311 312 output[0].starpar[Nstar ].averef = n;313 output[0].starpar[Nstar ].objID = output[0].average[n].objID;314 output[0].starpar[Nstar ].catID = output[0].catID;336 output[0].starpar[Nstarpar] = input[0].starpar[staroff]; 337 338 output[0].starpar[Nstarpar].averef = n; 339 output[0].starpar[Nstarpar].objID = output[0].average[n].objID; 340 output[0].starpar[Nstarpar].catID = output[0].catID; 315 341 output[0].average[n].Nstarpar ++; 316 Nstar ++;342 Nstarpar ++; 317 343 } 318 344 } … … 322 348 for (Nin = 0; Nin < input[0].average[N].Ngalphot; Nin++) { 323 349 /* add to end of galphot list */ 324 add_galp _link (&output[0].average[n], next_galp, Ngalp, NGALP);350 add_galphot_link (&output[0].average[n], next_galphot, Ngalphot, NGALPHOT); 325 351 326 352 // set the new galphot 327 353 off_t galpoff = input[0].average[N].galphotOffset + Nin; 328 output[0].galphot[Ngalp ] = input[0].galphot[galpoff];329 330 output[0].galphot[Ngalp ].averef = n;331 output[0].galphot[Ngalp ].objID = output[0].average[n].objID;332 output[0].galphot[Ngalp ].catID = output[0].catID;354 output[0].galphot[Ngalphot] = input[0].galphot[galpoff]; 355 356 output[0].galphot[Ngalphot].averef = n; 357 output[0].galphot[Ngalphot].objID = output[0].average[n].objID; 358 output[0].galphot[Ngalphot].catID = output[0].catID; 333 359 output[0].average[n].Ngalphot ++; 334 Ngalp ++;360 Ngalphot ++; 335 361 } 336 362 } … … 373 399 /* Nm is updated, but not written out in -update mode (for existing entries) 374 400 Nm is recalculated in build_meas_links if loaded table is not sorted */ 375 output[0].found_t[n] = Nmeas ;401 output[0].found_t[n] = Nmeasure; 376 402 i++; 377 403 } 378 // MARKTIME("find matched stars: %f sec for "OFF_T_FMT","OFF_T_FMT" stars ("OFF_T_FMT" meas)\n", dtime, Nstars, Nave, Nmeas );404 // MARKTIME("find matched stars: %f sec for "OFF_T_FMT","OFF_T_FMT" stars ("OFF_T_FMT" meas)\n", dtime, Nstars, Nave, Nmeasure); 379 405 380 406 /** incorporate unmatched image stars, if this star is in field of this catalog **/ … … 384 410 385 411 /* make sure there is space for next entry */ 386 if (Nmeas + input[0].average[N].Nmeasure >= NMEAS) { 387 NMEAS = Nmeas + input[0].average[N].Nmeasure + 1000; 388 REALLOCATE (next_meas, off_t, NMEAS); 389 REALLOCATE (output[0].measure, Measure, NMEAS); 390 } 391 if (Nlens + input[0].average[N].Nlensing >= NLENS) { 392 NLENS = Nlens + input[0].average[N].Nlensing + 1000; 393 REALLOCATE (next_lens, off_t, NLENS); 394 REALLOCATE (output[0].lensing, Lensing, NLENS); 395 } 396 if (Nstar + input[0].average[N].Nstarpar >= NSTAR) { 397 NSTAR = Nstar + input[0].average[N].Nstarpar + 1000; 398 REALLOCATE (next_star, off_t, NSTAR); 399 REALLOCATE (output[0].starpar, StarPar, NSTAR); 400 } 401 if (Ngalp + input[0].average[N].Ngalphot >= NGALP) { 402 NGALP = Ngalp + input[0].average[N].Ngalphot + 1000; 403 REALLOCATE (next_galp, off_t, NGALP); 404 REALLOCATE (output[0].galphot, GalPhot, NGALP); 412 if (Nmeasure + input[0].average[N].Nmeasure >= NMEASURE) { 413 NMEASURE = Nmeasure + input[0].average[N].Nmeasure + 1000; 414 REALLOCATE (next_measure, off_t, NMEASURE); 415 REALLOCATE (output[0].measure, Measure, NMEASURE); 416 } 417 if (Nlensing + input[0].average[N].Nlensing >= NLENSING) { 418 NLENSING = Nlensing + input[0].average[N].Nlensing + 1000; 419 REALLOCATE (next_lensing, off_t, NLENSING); 420 REALLOCATE (output[0].lensing, Lensing, NLENSING); 421 } 422 if (Nlensobj + input[0].average[N].Nlensobj >= NLENSOBJ) { 423 NLENSOBJ = Nlensobj + input[0].average[N].Nlensobj + 1000; 424 REALLOCATE (next_lensobj, off_t, NLENSOBJ); 425 REALLOCATE (output[0].lensobj, Lensobj, NLENSOBJ); 426 } 427 if (Nstarpar + input[0].average[N].Nstarpar >= NSTARPAR) { 428 NSTARPAR = Nstarpar + input[0].average[N].Nstarpar + 1000; 429 REALLOCATE (next_starpar, off_t, NSTARPAR); 430 REALLOCATE (output[0].starpar, StarPar, NSTARPAR); 431 } 432 if (Ngalphot + input[0].average[N].Ngalphot >= NGALPHOT) { 433 NGALPHOT = Ngalphot + input[0].average[N].Ngalphot + 1000; 434 REALLOCATE (next_galphot, off_t, NGALPHOT); 435 REALLOCATE (output[0].galphot, GalPhot, NGALPHOT); 405 436 } 406 437 if (Nave >= NAVE) { … … 465 496 /** add measurements for this input average object **/ 466 497 if (output[0].measure && !SKIP_MEASURE && input[0].average[N].Nmeasure) { 467 output[0].average[Nave].measureOffset = Nmeas ;498 output[0].average[Nave].measureOffset = Nmeasure; 468 499 for (Nin = 0; Nin < input[0].average[N].Nmeasure; Nin ++) { 469 500 offset = input[0].average[N].measureOffset + Nin; 470 501 471 502 // supply the measurments from this detection 472 output[0].measure[Nmeas ] = input[0].measure[offset];503 output[0].measure[Nmeasure] = input[0].measure[offset]; 473 504 474 505 // the following measure elements cannot be set until here: 475 output[0].measure[Nmeas ].dbFlags = 0;476 output[0].measure[Nmeas ].averef = Nave;477 output[0].measure[Nmeas ].objID = output[0].average[Nave].objID;478 output[0].measure[Nmeas ].catID = output[0].catID;506 output[0].measure[Nmeasure].dbFlags = 0; 507 output[0].measure[Nmeasure].averef = Nave; 508 output[0].measure[Nmeasure].objID = output[0].average[Nave].objID; 509 output[0].measure[Nmeasure].catID = output[0].catID; 479 510 480 511 // as we add measurements, update Nmeasure to match 481 512 output[0].average[Nave].Nmeasure ++; 482 513 483 /* we set next[Nmeas ] to -1 here, and update correctly below */484 next_meas [Nmeas] = -1;485 Nmeas ++;514 /* we set next[Nmeasure] to -1 here, and update correctly below */ 515 next_measure[Nmeasure] = -1; 516 Nmeasure ++; 486 517 } 487 518 int Ngroup = input[0].average[N].Nmeasure; 488 519 for (j = 0; j < Ngroup - 1; j++) { 489 next_meas [Nmeas - Ngroup + j] = Nmeas- Ngroup + j + 1;520 next_measure[Nmeasure - Ngroup + j] = Nmeasure - Ngroup + j + 1; 490 521 } 491 522 } … … 493 524 /** add lensing for this input average object **/ 494 525 if (output[0].lensing && !SKIP_LENSING && input[0].average[N].Nlensing) { 495 output[0].average[Nave].lensingOffset = Nlens ;526 output[0].average[Nave].lensingOffset = Nlensing; 496 527 for (Nin = 0; Nin < input[0].average[N].Nlensing; Nin ++) { 497 528 // supply the lensing values from this detection 498 529 off_t lensoff = input[0].average[N].lensingOffset + Nin; 499 output[0].lensing[Nlens ] = input[0].lensing[lensoff];530 output[0].lensing[Nlensing] = input[0].lensing[lensoff]; 500 531 501 532 // the following lensing elements cannot be set until here: 502 output[0].lensing[Nlens ].averef = Nave;503 output[0].lensing[Nlens ].objID = output[0].average[Nave].objID;504 output[0].lensing[Nlens ].catID = output[0].catID;533 output[0].lensing[Nlensing].averef = Nave; 534 output[0].lensing[Nlensing].objID = output[0].average[Nave].objID; 535 output[0].lensing[Nlensing].catID = output[0].catID; 505 536 506 537 // as we add lensing, update Nlensing to match 507 538 output[0].average[Nave].Nlensing ++; 508 539 509 /* we set next[Nlens ] to -1 here, and update correctly below */510 next_lens [Nlens] = -1;511 Nlens ++;540 /* we set next[Nlensing] to -1 here, and update correctly below */ 541 next_lensing[Nlensing] = -1; 542 Nlensing ++; 512 543 } 513 544 int Ngroup = input[0].average[N].Nlensing; 514 545 for (j = 0; j < Ngroup - 1; j++) { 515 next_lens[Nlens - Ngroup + j] = Nlens - Ngroup + j + 1; 546 next_lensing[Nlensing - Ngroup + j] = Nlensing - Ngroup + j + 1; 547 } 548 } 549 550 /** add lensobj for this input average object **/ 551 if (output[0].lensobj && !SKIP_LENSOBJ && input[0].average[N].Nlensobj) { 552 output[0].average[Nave].lensobjOffset = Nlensobj; 553 for (Nin = 0; Nin < input[0].average[N].Nlensobj; Nin ++) { 554 // supply the lensobj values from this detection 555 off_t lensoff = input[0].average[N].lensobjOffset + Nin; 556 output[0].lensobj[Nlensobj] = input[0].lensobj[lensoff]; 557 558 // the following lensobj elements cannot be set until here: 559 // output[0].lensobj[Nlensobj].averef = Nave; 560 output[0].lensobj[Nlensobj].objID = output[0].average[Nave].objID; 561 output[0].lensobj[Nlensobj].catID = output[0].catID; 562 563 // as we add lensobj, update Nlensobj to match 564 output[0].average[Nave].Nlensobj ++; 565 566 /* we set next[Nlensobj] to -1 here, and update correctly below */ 567 next_lensobj[Nlensobj] = -1; 568 Nlensobj ++; 569 } 570 int Ngroup = input[0].average[N].Nlensobj; 571 for (j = 0; j < Ngroup - 1; j++) { 572 next_lensobj[Nlensobj - Ngroup + j] = Nlensobj - Ngroup + j + 1; 516 573 } 517 574 } … … 519 576 /** add starpar for this input average object **/ 520 577 if (output[0].starpar && !SKIP_STARPAR && input[0].average[N].Nstarpar) { 521 output[0].average[Nave].starparOffset = Nstar ;578 output[0].average[Nave].starparOffset = Nstarpar; 522 579 for (Nin = 0; Nin < input[0].average[N].Nstarpar; Nin ++) { 523 580 // supply the starpar values from this detection 524 581 off_t staroff = input[0].average[N].starparOffset + Nin; 525 output[0].starpar[Nstar ] = input[0].starpar[staroff];582 output[0].starpar[Nstarpar] = input[0].starpar[staroff]; 526 583 527 584 // the following starpar elements cannot be set until here: 528 output[0].starpar[Nstar ].averef = Nave;529 output[0].starpar[Nstar ].objID = output[0].average[Nave].objID;530 output[0].starpar[Nstar ].catID = output[0].catID;585 output[0].starpar[Nstarpar].averef = Nave; 586 output[0].starpar[Nstarpar].objID = output[0].average[Nave].objID; 587 output[0].starpar[Nstarpar].catID = output[0].catID; 531 588 532 589 // as we add starpar, update Nstarpar to match 533 590 output[0].average[Nave].Nstarpar ++; 534 591 535 /* we set next[Nstar ] to -1 here, and update correctly below */536 next_star [Nstar] = -1;537 Nstar ++;592 /* we set next[Nstarpar] to -1 here, and update correctly below */ 593 next_starpar[Nstarpar] = -1; 594 Nstarpar ++; 538 595 } 539 596 int Ngroup = input[0].average[N].Nstarpar; 540 597 for (j = 0; j < Ngroup - 1; j++) { 541 next_star [Nstar - Ngroup + j] = Nstar - Ngroup + j + 1;598 next_starpar[Nstarpar - Ngroup + j] = Nstarpar - Ngroup + j + 1; 542 599 } 543 600 } … … 545 602 /** add galphot for this input average object **/ 546 603 if (output[0].galphot && !SKIP_GALPHOT && input[0].average[N].Ngalphot) { 547 output[0].average[Nave].galphotOffset = Ngalp ;604 output[0].average[Nave].galphotOffset = Ngalphot; 548 605 for (Nin = 0; Nin < input[0].average[N].Ngalphot; Nin ++) { 549 606 // supply the galphot values from this detection 550 607 off_t galpoff = input[0].average[N].galphotOffset + Nin; 551 output[0].galphot[Ngalp ] = input[0].galphot[galpoff];608 output[0].galphot[Ngalphot] = input[0].galphot[galpoff]; 552 609 553 610 // the following galphot elements cannot be set until here: 554 output[0].galphot[Ngalp ].averef = Nave;555 output[0].galphot[Ngalp ].objID = output[0].average[Nave].objID;556 output[0].galphot[Ngalp ].catID = output[0].catID;611 output[0].galphot[Ngalphot].averef = Nave; 612 output[0].galphot[Ngalphot].objID = output[0].average[Nave].objID; 613 output[0].galphot[Ngalphot].catID = output[0].catID; 557 614 558 615 // as we add galphot, update Ngalphot to match 559 616 output[0].average[Nave].Ngalphot ++; 560 617 561 /* we set next[Ngalp ] to -1 here, and update correctly below */562 next_galp [Ngalp] = -1;563 Ngalp ++;618 /* we set next[Ngalphot] to -1 here, and update correctly below */ 619 next_galphot[Ngalphot] = -1; 620 Ngalphot ++; 564 621 } 565 622 int Ngroup = input[0].average[N].Ngalphot; 566 623 for (j = 0; j < Ngroup - 1; j++) { 567 next_galp [Ngalp - Ngroup + j] = Ngalp- Ngroup + j + 1;624 next_galphot[Ngalphot - Ngroup + j] = Ngalphot - Ngroup + j + 1; 568 625 } 569 626 } … … 575 632 576 633 REALLOCATE (output[0].average, Average, Nave); 577 if (!SKIP_MEASURE) { REALLOCATE (output[0].measure, Measure, Nmeas); } 578 if (!SKIP_LENSING) { REALLOCATE (output[0].lensing, Lensing, Nlens); } 579 if (!SKIP_STARPAR) { REALLOCATE (output[0].starpar, StarPar, Nstar); } 580 if (!SKIP_GALPHOT) { REALLOCATE (output[0].galphot, GalPhot, Ngalp); } 634 if (!SKIP_MEASURE) { REALLOCATE (output[0].measure, Measure, Nmeasure); } 635 if (!SKIP_LENSING) { REALLOCATE (output[0].lensing, Lensing, Nlensing); } 636 if (!SKIP_LENSOBJ) { REALLOCATE (output[0].lensobj, Lensobj, Nlensobj); } 637 if (!SKIP_STARPAR) { REALLOCATE (output[0].starpar, StarPar, Nstarpar); } 638 if (!SKIP_GALPHOT) { REALLOCATE (output[0].galphot, GalPhot, Ngalphot); } 581 639 582 640 # define NOSORT 0 … … 585 643 } else { 586 644 output[0].sorted = TRUE; 587 if (!SKIP_MEASURE) { output[0].measure = sort_measure (output[0].average, Nave, output[0].measure, Nmeas, next_meas); } 588 if (!SKIP_LENSING) { output[0].lensing = sort_lensing (output[0].average, Nave, output[0].lensing, Nlens, next_lens); } 589 if (!SKIP_STARPAR) { output[0].starpar = sort_starpar (output[0].average, Nave, output[0].starpar, Nstar, next_star); } 590 if (!SKIP_GALPHOT) { output[0].galphot = sort_galphot (output[0].average, Nave, output[0].galphot, Ngalp, next_galp); } 645 if (!SKIP_MEASURE) { output[0].measure = sort_measure (output[0].average, Nave, output[0].measure, Nmeasure, next_measure); } 646 if (!SKIP_LENSING) { output[0].lensing = sort_lensing (output[0].average, Nave, output[0].lensing, Nlensing, next_lensing); } 647 if (!SKIP_LENSOBJ) { output[0].lensobj = sort_lensobj (output[0].average, Nave, output[0].lensobj, Nlensobj, next_lensobj); } 648 if (!SKIP_STARPAR) { output[0].starpar = sort_starpar (output[0].average, Nave, output[0].starpar, Nstarpar, next_starpar); } 649 if (!SKIP_GALPHOT) { output[0].galphot = sort_galphot (output[0].average, Nave, output[0].galphot, Ngalphot, next_galphot); } 591 650 } 592 651 … … 594 653 output[0].objID = objID; // new max value, save on catalog close 595 654 output[0].Naverage = Nave; 596 if (!SKIP_MEASURE) { output[0].Nmeasure = Nmeas; } 597 if (!SKIP_LENSING) { output[0].Nlensing = Nlens; } 598 if (!SKIP_STARPAR) { output[0].Nstarpar = Nstar; } 599 if (!SKIP_GALPHOT) { output[0].Ngalphot = Ngalp; } 655 if (!SKIP_MEASURE) { output[0].Nmeasure = Nmeasure; } 656 if (!SKIP_LENSING) { output[0].Nlensing = Nlensing; } 657 if (!SKIP_LENSOBJ) { output[0].Nlensobj = Nlensobj; } 658 if (!SKIP_STARPAR) { output[0].Nstarpar = Nstarpar; } 659 if (!SKIP_GALPHOT) { output[0].Ngalphot = Ngalphot; } 600 660 output[0].Nsecfilt_mem = Nave*NsecfiltOut; 601 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nlens, Ngalp: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n", Nstars, Nave, Nmeas, Nlens, Ngalp, Nmatch); 602 603 free (next_meas); 604 free (next_lens); 605 free (next_star); 606 free (next_galp); 661 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeasure, Nlensing, Ngalphot: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n", Nstars, Nave, Nmeasure, Nlensing, Ngalphot, Nmatch); 662 663 free (next_measure); 664 free (next_lensing); 665 free (next_lensobj); 666 free (next_starpar); 667 free (next_galphot); 607 668 608 669 free (X2); … … 625 686 images have boundaries which are lines in pixels coords, but curve in RA and DEC 626 687 627 output[0].found_t[Ncat] but stars[Nstar ].found688 output[0].found_t[Ncat] but stars[Nstars].found 628 689 629 690 */ -
trunk/Ohana/src/fakeastro/Makefile
r39242 r39926 53 53 $(SRC)/match_fake_stars.$(ARCH).o \ 54 54 $(SRC)/fakeastro_2mass.$(ARCH).o \ 55 $(SRC)/fakeastro_gaia.$(ARCH).o \ 55 56 $(SRC)/make_2mass_measures.$(ARCH).o \ 57 $(SRC)/make_gaia_measures.$(ARCH).o \ 56 58 $(SRC)/remote_hosts.$(ARCH).o 57 59 -
trunk/Ohana/src/fakeastro/include/fakeastro.h
r38986 r39926 8 8 # define RESETTIME { gettimeofday (&startTimer, (void *) NULL); } 9 9 10 typedef enum {OP_NONE, OP_GALAXY, OP_IMAGES, OP_2MASS } FakeastroOp;10 typedef enum {OP_NONE, OP_GALAXY, OP_IMAGES, OP_2MASS, OP_GAIA} FakeastroOp; 11 11 12 12 typedef struct { … … 87 87 int VERBOSE; 88 88 int VERBOSE2; 89 int TESTING;90 89 int ONE_BIG_CHIP; 90 91 float TEST_SCALE; 92 char *GALAXY_MODEL; 91 93 92 94 int FORCE; … … 101 103 char FAKEASTRO_REF_EPOCH[80]; 102 104 char FAKEASTRO_2MASS_EPOCH[80]; 105 char FAKEASTRO_GAIA_EPOCH[80]; 103 106 104 107 float RADIUS; 105 108 float MAX_MAG_2MASS; 109 float MAX_MAG_GAIA; 106 110 107 111 SkyRegion UserPatch; … … 198 202 int fakeastro_2mass (); 199 203 int make_2mass_measures (Catalog *catalog); 204 205 int fakeastro_gaia (); 206 int make_gaia_measures (Catalog *catalog); -
trunk/Ohana/src/fakeastro/src/ConfigInit.c
r37807 r39926 19 19 // if (!ScanConfig (config, "ADDSTAR_RADIUS", "%lf", 0, &ADDSTAR_RADIUS)) ADDSTAR_RADIUS = 1.0; 20 20 21 if ((FAKEASTRO_OP == OP_GALAXY) || (FAKEASTRO_OP == OP_2MASS) ) {21 if ((FAKEASTRO_OP == OP_GALAXY) || (FAKEASTRO_OP == OP_2MASS) || (FAKEASTRO_OP == OP_GAIA)) { 22 22 // force CATDIR to be absolute (so parallel mode will work) 23 23 GetConfig (config, "CATDIR", "%s", 0, CATDIR); … … 60 60 strcpy (FAKEASTRO_2MASS_EPOCH, "2000/01/01,00:00:00"); // epoch of 2MASS astrometry 61 61 } 62 if (!ScanConfig (config, "FAKEASTRO_GAIA_EPOCH", "%s", 0, FAKEASTRO_GAIA_EPOCH)) { 63 strcpy (FAKEASTRO_GAIA_EPOCH, "2015/01/01,00:00:00"); // epoch of GAIA astrometry 64 } 62 65 63 66 /* set the default search radius */ … … 76 79 77 80 // OP_2MASS is adding detections to an existing db, the others require and empty db 78 if ( FAKEASTRO_OP != OP_2MASS) {81 if ((FAKEASTRO_OP != OP_2MASS) && (FAKEASTRO_OP != OP_GAIA)) { 79 82 // check for existence of CATDIR 80 83 struct stat filestat; -
trunk/Ohana/src/fakeastro/src/args.c
r38986 r39926 26 26 } 27 27 28 TESTING = FALSE; 28 if ((N = get_argument (*argc, argv, "-gaia"))) { 29 remove_argument (N, argc, argv); 30 FAKEASTRO_OP = OP_GAIA; 31 } 32 33 GALAXY_MODEL = NULL; 34 if ((N = get_argument (*argc, argv, "-galaxy-model"))) { 35 remove_argument (N, argc, argv); 36 GALAXY_MODEL = strcreate(argv[N]); 37 remove_argument (N, argc, argv); 38 } 39 if (!GALAXY_MODEL) GALAXY_MODEL = strcreate ("ROESER"); 40 41 TEST_SCALE = 1.0; 29 42 if ((N = get_argument (*argc, argv, "-testing"))) { 30 43 remove_argument (N, argc, argv); 31 TESTING = TRUE; 44 TEST_SCALE = atof(argv[N]); 45 remove_argument (N, argc, argv); 32 46 } 33 47 ONE_BIG_CHIP = FALSE; … … 114 128 } 115 129 130 MAX_MAG_GAIA = 21.0; 131 if ((N = get_argument (*argc, argv, "-gaia-limit"))) { 132 remove_argument (N, argc, argv); 133 MAX_MAG_GAIA = atof(argv[N]); 134 remove_argument (N, argc, argv); 135 } 136 116 137 FORCE = FALSE; 117 138 if ((N = get_argument (*argc, argv, "-force"))) { … … 250 271 // } 251 272 273 GALAXY_MODEL = NULL; 274 if ((N = get_argument (*argc, argv, "-galaxy-model"))) { 275 remove_argument (N, argc, argv); 276 GALAXY_MODEL = strcreate(argv[N]); 277 remove_argument (N, argc, argv); 278 } 279 if (!GALAXY_MODEL) GALAXY_MODEL = strcreate ("FEAST-HIPPARCOS"); 280 252 281 VERBOSE = VERBOSE2 = FALSE; 253 282 if ((N = get_argument (*argc, argv, "-v"))) { … … 273 302 fprintf (stderr, " additional options: \n"); 274 303 fprintf (stderr, " -region RA RA DEC DEC\n"); 275 fprintf (stderr, " -catalog (ra) (dec)\n\n"); 304 fprintf (stderr, " -catalog (ra) (dec)\n"); 305 fprintf (stderr, " -testing (scale)\n\n"); 276 306 fprintf (stderr, " -v\n"); 277 307 fprintf (stderr, " -vv\n"); -
trunk/Ohana/src/fakeastro/src/fakeastro.c
r39248 r39926 41 41 exit (0); 42 42 43 case OP_GAIA: 44 fakeastro_gaia (); 45 /* make_gaia_measures() 46 */ 47 exit (0); 48 43 49 default: 44 50 fprintf (stderr, "impossible!\n"); -
trunk/Ohana/src/fakeastro/src/initialize.c
r37807 r39926 17 17 18 18 // XXX add to config? 19 if (!InitGalaxyModel ( "ROESER")) {20 fprintf (stderr, "failed to init galaxy model \n");19 if (!InitGalaxyModel (GALAXY_MODEL)) { 20 fprintf (stderr, "failed to init galaxy model %s\n", GALAXY_MODEL); 21 21 exit (2); 22 22 } … … 30 30 31 31 // XXX add to config? 32 if (!InitGalaxyModel ( "ROESER")) {33 fprintf (stderr, "failed to init galaxy model \n");32 if (!InitGalaxyModel (GALAXY_MODEL)) { 33 fprintf (stderr, "failed to init galaxy model %s\n", GALAXY_MODEL); 34 34 exit (2); 35 35 } -
trunk/Ohana/src/fakeastro/src/make_fake_stars_catalog.c
r39248 r39926 116 116 double dDsee = ohana_gaussdev_rnd (0.0, 1.0 / SN); 117 117 118 // XXX TEST 119 // dDsee = dRsee = 0.0; 120 118 121 double dRoff = (dRpm + dRsee) / 3600.0; 119 122 double dDoff = (dDpm + dDsee) / 3600.0; -
trunk/Ohana/src/fakeastro/src/make_fakestars.c
r39589 r39926 35 35 // we can generate a distribution which is uniform on the sky, in which case 36 36 // we can limit to the selected patch analyically 37 38 // note: r & z are generated in parsec 37 39 r = pow(drand48(), 0.33333) * FAKEASTRO_RGAL; 38 40 z = 0.0; … … 48 50 int inPatch = FALSE; 49 51 while (!inPatch) { 52 // note: r & z are generated in parsec 50 53 z = ohana_gaussdev_rnd (0.0, FAKEASTRO_ZGAL); 51 54 r = sqrt(drand48()) * FAKEASTRO_RGAL; … … 68 71 // double y = r*sin(L); 69 72 73 // distance here is in parsec 70 74 double distance = sqrt (SQ(r) + SQ(z)); 71 75 … … 74 78 75 79 double uL_sol, uB_sol; 76 SolarMotionModel_radians(&uL_sol, &uB_sol, Lrad, Brad, distance); 80 SolarMotionModel_radians(&uL_sol, &uB_sol, Lrad, Brad, distance / 1000.0); 81 // note: SolarMotionModel wants distance in kpc 77 82 78 83 double uL = uL_gal + uL_sol; … … 80 85 81 86 // XXX: amplify motion to make tests easier: 82 if (TESTING) { 83 uL *= 100.0; 84 uB *= 100.0; 85 } 87 uL *= TEST_SCALE; 88 uB *= TEST_SCALE; 86 89 87 90 double uR, uD; -
trunk/Ohana/src/kapa2/include/prototypes.h
r39457 r39926 32 32 void DrawLabelsRaw PROTO((Graphic *graphic, KapaGraphWidget *graph, int color)); 33 33 void DrawTextlines PROTO((KapaGraphWidget *graph)); 34 void DrawConnect PROTO(( KapaGraphWidget *graph, Gobjects *objects));35 void DrawHistogram PROTO(( KapaGraphWidget *graph, Gobjects *objects));36 int DrawObjectN PROTO(( KapaGraphWidget *graph, Gobjects *objects));37 void DrawPoints PROTO(( KapaGraphWidget *graph, Gobjects *objects));38 void ClipLine PROTO(( double x0, double y0, double x1, double y1, double X0, double Y0, double X1, double Y1));39 void DrawXErrors PROTO(( KapaGraphWidget *graph, Gobjects *objects));40 void DrawYErrors PROTO(( KapaGraphWidget *graph, Gobjects *objects));34 void DrawConnect PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 35 void DrawHistogram PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 36 int DrawObjectN PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 37 void DrawPoints PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 38 void ClipLine PROTO((Graphic *graphic, double x0, double y0, double x1, double y1, double X0, double Y0, double X1, double Y1)); 39 void DrawXErrors PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 40 void DrawYErrors PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 41 41 void DrawTick PROTO((Graphic *graphic, Axis *axis, int P, TickMarkData *tick, int naxis)); 42 42 void AxisTickScale PROTO((Axis *axis, double *range, double *major, double *minor, int *nsignif)); … … 115 115 void PSLabels PROTO((KapaGraphWidget *graph, FILE *f)); 116 116 void PSTextlines PROTO((KapaGraphWidget *graph, FILE *f)); 117 int PSObjectsN PROTO((KapaGraphWidget *graph, Gobjects *objects, FILE *f)); 117 118 void PSConnect PROTO((KapaGraphWidget *graph, Gobjects *objects, FILE *f)); 118 119 void PSHistogram PROTO((KapaGraphWidget *graph, Gobjects *objects, FILE *f)); … … 135 136 void bDrawLabels PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph)); 136 137 void bDrawTextlines PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph)); 138 int bDrawObjectsN PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 137 139 void bDrawConnect PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 138 140 void bDrawHistogram PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); -
trunk/Ohana/src/kapa2/src/DrawFrame.c
r39594 r39926 12 12 13 13 graphic = GetGraphic(); 14 15 P = 0.5 * (1 + 0.25*graph[0].axis[0].lweight) * (hypot (graph[0].axis[0].dfx, graph[0].axis[0].dfy) + hypot (graph[0].axis[0].dfx, graph[0].axis[0].dfy)); 14 16 15 17 /* each axis is drawn independently, but ticks and labels are placed according to perpendicular distance. */ … … 30 32 dfy = graph[0].axis[i].dfy + 2*dy; 31 33 32 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy);33 P *= (1 + 0.25*lweight);34 // P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy); 35 // P *= (1 + 0.25*lweight); 34 36 35 37 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineSolid, CapNotLast, JoinMiter); -
trunk/Ohana/src/kapa2/src/DrawObjects.c
r39594 r39926 8 8 # define FillCircle(X,Y,R) (XFillArc (graphic->display, graphic->window, graphic->gc, (int)(X-R), (int)(Y-R), abs(2*R+1), abs(2*R+1), 0, 23040)) 9 9 10 # define CONNECT 011 # define HISTOGRAM 112 # define POINTS 213 14 10 # define XCENTER 0.0 15 11 # define YCENTER 0.0 … … 17 13 # define JOINSTYLE JoinMiter 18 14 19 static Graphic *graphic; 15 // XXX this is not thread safe, but that is OK 16 // static Graphic *graphic; 20 17 21 18 /* draw all objects for this Graph */ … … 24 21 int i; 25 22 23 // the functions below use this global value 24 Graphic *graphic = GetGraphic(); 25 26 // this function calls all of the supporting Draw... functions below 26 27 for (i = 0; i < graph[0].Nobjects; i++) { 27 28 if (DEBUG) fprintf (stderr, "object: %d\n", i); 28 29 if (DEBUG) fprintf (stderr, "Npts: %d\n", graph[0].objects[i].Npts); 29 DrawObjectN (graph , &graph[0].objects[i]);30 DrawObjectN (graphic, graph, &graph[0].objects[i]); 30 31 } 32 XSetLineAttributes (graphic->display, graphic->gc, 0, LineSolid, CAPSTYLE, JOINSTYLE); 33 XSetForeground (graphic->display, graphic->gc, graphic->fore); 31 34 return (TRUE); 32 35 } 33 36 34 37 /* Draw a specific object in the graph */ 35 int DrawObjectN ( KapaGraphWidget *graph, Gobjects *object) {38 int DrawObjectN (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 36 39 37 40 static char dot[2] = {2,3}; … … 41 44 int lweight; 42 45 43 // this function calls all of the supporting Draw... functions below44 graphic = GetGraphic();45 46 46 lweight = MAX (1, MIN (10, object[0].lweight)); 47 47 … … 58 58 /* set line type */ 59 59 switch (object[0].ltype) { 60 case 0: 61 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineSolid, CAPSTYLE, JOINSTYLE); 62 break; 63 case 1: 60 case KAPA_LINE_DOT: 64 61 XSetDashes (graphic->display, graphic->gc, 1, dot, 2); 65 XSetLineAttributes (graphic->display, graphic->gc, lweight, Line OnOffDash, CAPSTYLE, JOINSTYLE);66 break; 67 case 2:62 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineDoubleDash, CAPSTYLE, JOINSTYLE); 63 break; 64 case KAPA_LINE_DASH_SHORT: 68 65 XSetDashes (graphic->display, graphic->gc, 1, short_dash, 2); 69 XSetLineAttributes (graphic->display, graphic->gc, lweight, Line OnOffDash, CAPSTYLE, JOINSTYLE);70 break; 71 case 3:66 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineDoubleDash, CAPSTYLE, JOINSTYLE); 67 break; 68 case KAPA_LINE_DASH_LONG: 72 69 XSetDashes (graphic->display, graphic->gc, 1, long_dash, 2); 73 XSetLineAttributes (graphic->display, graphic->gc, lweight, Line OnOffDash, CAPSTYLE, JOINSTYLE);74 break; 75 case 4:70 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineDoubleDash, CAPSTYLE, JOINSTYLE); 71 break; 72 case KAPA_LINE_DOT_DASH: 76 73 XSetDashes (graphic->display, graphic->gc, 1, dot_dash, 4); 77 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineOnOffDash, CAPSTYLE, JOINSTYLE); 78 break; 74 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineDoubleDash, CAPSTYLE, JOINSTYLE); 75 break; 76 case KAPA_LINE_SOLID: 79 77 default: 80 78 XSetLineAttributes (graphic->display, graphic->gc, lweight, LineSolid, CAPSTYLE, JOINSTYLE); … … 88 86 89 87 switch (object[0].style) { 90 case CONNECT: 91 DrawConnect (graph, object); 92 break; 93 case HISTOGRAM: 94 DrawHistogram (graph, object); 95 break; 96 case POINTS: 97 DrawPoints (graph, object); 88 case KAPA_PLOT_CONNECT: 89 DrawConnect (graphic, graph, object); 90 break; 91 case KAPA_PLOT_HISTOGRAM: 92 DrawHistogram (graphic, graph, object); 93 break; 94 case KAPA_PLOT_POINTS: 95 default: 96 DrawPoints (graphic, graph, object); 98 97 break; 99 98 } 100 99 101 100 if (object[0].etype & 0x01) { 102 DrawYErrors (graph , object);101 DrawYErrors (graphic, graph, object); 103 102 } 104 103 if (object[0].etype & 0x02) { 105 DrawXErrors (graph, object); 106 } 107 108 XSetLineAttributes (graphic->display, graphic->gc, 0, LineSolid, CAPSTYLE, JOINSTYLE); 109 XSetForeground (graphic->display, graphic->gc, graphic->fore); 104 DrawXErrors (graphic, graph, object); 105 } 110 106 return (TRUE); 111 107 } 112 108 113 109 /******/ 114 void DrawConnect ( KapaGraphWidget *graph, Gobjects *object) {110 void DrawConnect (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 115 111 116 112 int i; … … 149 145 sy1 = x[i]*myi + y[i]*myj + by + YCENTER; 150 146 151 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);147 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 152 148 /* DrawLine (sx0, sy0, sx1, sy1); */ 153 149 sx0 = sx1; sy0 = sy1; … … 156 152 } 157 153 158 void ClipLine ( double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0) {154 void ClipLine (Graphic *graphic, double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0) { 159 155 160 156 /* skip line segement if both points are beyond box */ … … 212 208 /* simplify the code abit by finding triplets, watch out for a histogram of 2 points */ 213 209 # if (1) 214 void DrawHistogram ( KapaGraphWidget *graph, Gobjects *object) {210 void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 215 211 216 212 int i; … … 298 294 # else 299 295 300 void DrawHistogram ( KapaGraphWidget *graph, Gobjects *object) {296 void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 301 297 302 298 int i; … … 407 403 408 404 /******/ 409 void DrawPoints ( KapaGraphWidget *graph, Gobjects *object) {405 void DrawPoints (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 410 406 411 407 int i; … … 427 423 by = byi + byj; 428 424 429 Graphic *graphic = GetGraphic(); 430 431 /**** points are scaled by object.z ***/ 425 /**** point sizes are scaled by object.size, colors by object.color ***/ 432 426 int scaleSize = (object[0].size < 0); 433 427 int scaleColor = (object[0].color < 0); … … 437 431 x = object[0].x; y = object[0].y; z = object[0].z; 438 432 439 if (object[0].ptype == 0) { /* filled box */ 440 for (i = 0; i < object[0].Npts; i++) { 441 if (!(finite(x[i]) && finite(y[i]))) continue; 442 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 443 sy = x[i]*myi + y[i]*myj + by + YCENTER; 444 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 445 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 446 if (scaleColor) { 447 if (!finite(z[i])) continue; 448 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 449 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 450 } 451 D = scaleSize ? dz*z[i] : ds; 452 FillRectangle (sx - D, sy - D, 2*D + 1, 2*D + 1); 453 } 433 switch (object[0].ptype) { 434 case KAPA_POINT_BOX_OPEN: /* open box */ 435 for (i = 0; i < object[0].Npts; i++) { 436 if (!(finite(x[i]) && finite(y[i]))) continue; 437 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 438 sy = x[i]*myi + y[i]*myj + by + YCENTER; 439 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 440 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 441 if (scaleColor) { 442 if (!finite(z[i])) continue; 443 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 444 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 445 } 446 D = scaleSize ? dz*z[i] : ds; 447 DrawRectangle (sx - D, sy - D, 2*D, 2*D); 448 } 449 } 450 break; 451 case KAPA_POINT_CROSS: /* cross */ 452 for (i = 0; i < object[0].Npts; i++) { 453 if (!(finite(x[i]) && finite(y[i]))) continue; 454 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 455 sy = x[i]*myi + y[i]*myj + by + YCENTER; 456 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 457 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 458 if (scaleColor) { 459 if (!finite(z[i])) continue; 460 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 461 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 462 } 463 D = scaleSize ? dz*z[i] : ds; 464 DrawLine (sx - D, sy, sx + D + 1, sy); 465 DrawLine (sx, sy - D, sx, sy + D + 1); 466 } 467 } 468 break; 469 case KAPA_POINT_X: /* x */ 470 for (i = 0; i < object[0].Npts; i++) { 471 if (!(finite(x[i]) && finite(y[i]))) continue; 472 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 473 sy = x[i]*myi + y[i]*myj + by + YCENTER; 474 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 475 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 476 if (scaleColor) { 477 if (!finite(z[i])) continue; 478 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 479 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 480 } 481 D = scaleSize ? dz*z[i] : ds; 482 DrawLine (sx - D, sy + D, sx + D + 1, sy - D - 1); 483 DrawLine (sx - D, sy - D, sx + D + 1, sy + D + 1); 484 } 485 } 486 break; 487 case KAPA_POINT_TRIANGLE_SOLID: /* filled triangle */ 488 for (i = 0; i < object[0].Npts; i++) { 489 if (!(finite(x[i]) && finite(y[i]))) continue; 490 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 491 sy = x[i]*myi + y[i]*myj + by + YCENTER; 492 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 493 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 494 if (scaleColor) { 495 if (!finite(z[i])) continue; 496 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 497 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 498 } 499 D = scaleSize ? dz*z[i] : ds; 500 501 XPoint points[4]; 502 points[0].x = sx - D; points[0].y = sy + 0.58*D; 503 points[1].x = sx + D; points[1].y = sy + 0.58*D; 504 points[2].x = sx; points[2].y = sy - 1.15*D; 505 points[3].x = sx - D; points[3].y = sy + 0.58*D; 506 XFillPolygon (graphic->display, graphic->window, graphic->gc, points, 4, Convex, CoordModeOrigin); 507 } 508 } 509 break; 510 case KAPA_POINT_TRIANGLE_SOLID_DOWN: /* filled triangle (down) */ 511 for (i = 0; i < object[0].Npts; i++) { 512 if (!(finite(x[i]) && finite(y[i]))) continue; 513 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 514 sy = x[i]*myi + y[i]*myj + by + YCENTER; 515 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 516 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 517 if (scaleColor) { 518 if (!finite(z[i])) continue; 519 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 520 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 521 } 522 D = scaleSize ? dz*z[i] : ds; 523 524 XPoint points[4]; 525 points[0].x = sx - D; points[0].y = sy - 0.58*D; 526 points[1].x = sx + D; points[1].y = sy - 0.58*D; 527 points[2].x = sx; points[2].y = sy + 1.15*D; 528 points[3].x = sx - D; points[3].y = sy - 0.58*D; 529 XFillPolygon (graphic->display, graphic->window, graphic->gc, points, 4, Convex, CoordModeOrigin); 530 } 531 } 532 break; 533 case KAPA_POINT_TRIANGLE_OPEN: /* open triangle */ 534 for (i = 0; i < object[0].Npts; i++) { 535 if (!(finite(x[i]) && finite(y[i]))) continue; 536 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 537 sy = x[i]*myi + y[i]*myj + by + YCENTER; 538 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 539 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 540 if (scaleColor) { 541 if (!finite(z[i])) continue; 542 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 543 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 544 } 545 D = scaleSize ? dz*z[i] : ds; 546 DrawLine (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D); 547 DrawLine (sx + D, sy + 0.58*D, sx, sy - 1.15*D); 548 DrawLine (sx, sy - 1.15*D, sx - D, sy + 0.58*D); 549 } 550 } 551 break; 552 case KAPA_POINT_TRIANGLE_OPEN_DOWN: /* upside-down open triangle */ 553 for (i = 0; i < object[0].Npts; i++) { 554 if (!(finite(x[i]) && finite(y[i]))) continue; 555 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 556 sy = x[i]*myi + y[i]*myj + by + YCENTER; 557 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 558 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 559 if (scaleColor) { 560 if (!finite(z[i])) continue; 561 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 562 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 563 } 564 D = scaleSize ? dz*z[i] : ds; 565 DrawLine (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D); 566 DrawLine (sx + D, sy - 0.58*D, sx, sy + 1.15*D); 567 DrawLine (sx, sy + 1.15*D, sx - D, sy - 0.58*D); 568 } 569 } 570 break; 571 case KAPA_POINT_Y: /* Y */ 572 for (i = 0; i < object[0].Npts; i++) { 573 if (!(finite(x[i]) && finite(y[i]))) continue; 574 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 575 sy = x[i]*myi + y[i]*myj + by + YCENTER; 576 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 577 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 578 if (scaleColor) { 579 if (!finite(z[i])) continue; 580 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 581 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 582 } 583 D = scaleSize ? dz*z[i] : ds; 584 DrawLine (sx, sy, sx - D, sy - 0.58*D); 585 DrawLine (sx, sy, sx + D, sy - 0.58*D); 586 DrawLine (sx, sy, sx, sy + 1.15*D); 587 } 588 } 589 break; 590 case KAPA_POINT_Y_DOWN: /* upside-down Y */ 591 for (i = 0; i < object[0].Npts; i++) { 592 if (!(finite(x[i]) && finite(y[i]))) continue; 593 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 594 sy = x[i]*myi + y[i]*myj + by + YCENTER; 595 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 596 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 597 if (scaleColor) { 598 if (!finite(z[i])) continue; 599 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 600 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 601 } 602 D = scaleSize ? dz*z[i] : ds; 603 DrawLine (sx, sy, sx - D, sy + 0.58*D); 604 DrawLine (sx, sy, sx + D, sy + 0.58*D); 605 DrawLine (sx, sy, sx, sy - 1.15*D); 606 } 607 } 608 break; 609 case KAPA_POINT_CIRCLE_OPEN: /* 0 */ 610 for (i = 0; i < object[0].Npts; i++) { 611 if (!(finite(x[i]) && finite(y[i]))) continue; 612 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 613 sy = x[i]*myi + y[i]*myj + by + YCENTER; 614 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 615 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 616 if (scaleColor) { 617 if (!finite(z[i])) continue; 618 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 619 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 620 } 621 D = scaleSize ? dz*z[i] : ds; 622 DrawCircle (sx, sy, D); 623 } 624 } 625 break; 626 case KAPA_POINT_CIRCLE_SOLID: /* filled 0 */ 627 for (i = 0; i < object[0].Npts; i++) { 628 if (!(finite(x[i]) && finite(y[i]))) continue; 629 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 630 sy = x[i]*myi + y[i]*myj + by + YCENTER; 631 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 632 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 633 if (scaleColor) { 634 if (!finite(z[i])) continue; 635 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 636 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 637 } 638 D = scaleSize ? dz*z[i] : ds; 639 FillCircle (sx, sy, D); 640 DrawCircle (sx, sy, D); 641 } 642 } 643 break; 644 case KAPA_POINT_PENTAGON: /* pentagon */ 645 for (i = 0; i < object[0].Npts; i++) { 646 if (!(finite(x[i]) && finite(y[i]))) continue; 647 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 648 sy = x[i]*myi + y[i]*myj + by + YCENTER; 649 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 650 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 651 if (scaleColor) { 652 if (!finite(z[i])) continue; 653 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 654 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 655 } 656 D = scaleSize ? dz*z[i] : ds; 657 DrawLine (sx + 0.00*D, sy - 1.00*D, sx + 0.95*D, sy - 0.31*D); 658 DrawLine (sx + 0.95*D, sy - 0.31*D, sx + 0.58*D, sy + 0.81*D); 659 DrawLine (sx + 0.58*D, sy + 0.81*D, sx - 0.58*D, sy + 0.81*D); 660 DrawLine (sx - 0.58*D, sy + 0.81*D, sx - 0.95*D, sy - 0.31*D); 661 DrawLine (sx - 0.95*D, sy - 0.31*D, sx + 0.00*D, sy - 1.00*D); 662 } 663 } 664 break; 665 case KAPA_POINT_HEXAGON: /* hexagon */ 666 for (i = 0; i < object[0].Npts; i++) { 667 if (!(finite(x[i]) && finite(y[i]))) continue; 668 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 669 sy = x[i]*myi + y[i]*myj + by + YCENTER; 670 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 671 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 672 if (scaleColor) { 673 if (!finite(z[i])) continue; 674 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 675 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 676 } 677 D = scaleSize ? dz*z[i] : ds; 678 DrawLine (sx - D, sy, sx - 0.50*D, sy + 0.87*D); 679 DrawLine (sx - 0.50*D, sy + 0.87*D, sx + 0.50*D, sy + 0.87*D); 680 DrawLine (sx + 0.50*D, sy + 0.87*D, sx + D, sy); 681 682 DrawLine (sx + D, sy, sx + 0.50*D, sy - 0.87*D); 683 DrawLine (sx + 0.50*D, sy - 0.87*D, sx - 0.50*D, sy - 0.87*D); 684 DrawLine (sx - 0.50*D, sy - 0.87*D, sx - D, sy); 685 } 686 } 687 break; 688 case KAPA_POINT_PAIR_CONNECT: { /* connect pairs of points */ 689 double X0 = graph[0].axis[0].fx; 690 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 691 double Y0 = graph[0].axis[1].fy; 692 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 693 694 for (i = 0; i + 1 < object[0].Npts; i+=2) { 695 if (!(finite(x[i]) && finite(y[i]))) continue; 696 sx1 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 697 sy1 = x[i]*myi + y[i]*myj + by + YCENTER; 698 if (!(finite(x[i+1]) && finite(y[i+1]))) continue; 699 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx + XCENTER; 700 sy2 = x[i+1]*myi + y[i+1]*myj + by + YCENTER; 701 ClipLine (graphic, sx1, sy1, sx2, sy2, X0, Y0, X1, Y1); 702 } 703 break; 454 704 } 455 } 456 if (object[0].ptype == 1) { /* open box */ 457 for (i = 0; i < object[0].Npts; i++) { 458 if (!(finite(x[i]) && finite(y[i]))) continue; 459 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 460 sy = x[i]*myi + y[i]*myj + by + YCENTER; 461 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 462 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 463 if (scaleColor) { 464 if (!finite(z[i])) continue; 465 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 466 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 467 } 468 D = scaleSize ? dz*z[i] : ds; 469 DrawRectangle (sx - D, sy - D, 2*D, 2*D); 470 } 471 } 472 } 473 if (object[0].ptype == 2) { /* cross */ 474 for (i = 0; i < object[0].Npts; i++) { 475 if (!(finite(x[i]) && finite(y[i]))) continue; 476 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 477 sy = x[i]*myi + y[i]*myj + by + YCENTER; 478 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 479 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 480 if (scaleColor) { 481 if (!finite(z[i])) continue; 482 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 483 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 484 } 485 D = scaleSize ? dz*z[i] : ds; 486 DrawLine (sx - D, sy, sx + D + 1, sy); 487 DrawLine (sx, sy - D, sx, sy + D + 1); 488 } 489 } 490 } 491 if (object[0].ptype == 3) { /* x */ 492 for (i = 0; i < object[0].Npts; i++) { 493 if (!(finite(x[i]) && finite(y[i]))) continue; 494 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 495 sy = x[i]*myi + y[i]*myj + by + YCENTER; 496 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 497 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 498 if (scaleColor) { 499 if (!finite(z[i])) continue; 500 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 501 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 502 } 503 D = scaleSize ? dz*z[i] : ds; 504 DrawLine (sx - D, sy + D, sx + D + 1, sy - D - 1); 505 DrawLine (sx - D, sy - D, sx + D + 1, sy + D + 1); 506 } 507 } 508 } 509 if (object[0].ptype == 4) { /* filled triangle */ 510 XPoint points[4]; 511 for (i = 0; i < object[0].Npts; i++) { 512 if (!(finite(x[i]) && finite(y[i]))) continue; 513 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 514 sy = x[i]*myi + y[i]*myj + by + YCENTER; 515 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 516 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 517 if (scaleColor) { 518 if (!finite(z[i])) continue; 519 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 520 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 521 } 522 D = scaleSize ? dz*z[i] : ds; 523 points[0].x = sx - D; points[0].y = sy + 0.58*D; 524 points[1].x = sx + D; points[1].y = sy + 0.58*D; 525 points[2].x = sx; points[2].y = sy - 1.15*D; 526 points[3].x = sx - D; points[3].y = sy + 0.58*D; 527 XFillPolygon (graphic->display, graphic->window, graphic->gc, points, 4, Convex, CoordModeOrigin); 528 } 529 } 530 } 531 if (object[0].ptype == 5) { /* open triangle */ 532 for (i = 0; i < object[0].Npts; i++) { 533 if (!(finite(x[i]) && finite(y[i]))) continue; 534 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 535 sy = x[i]*myi + y[i]*myj + by + YCENTER; 536 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 537 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 538 if (scaleColor) { 539 if (!finite(z[i])) continue; 540 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 541 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 542 } 543 D = scaleSize ? dz*z[i] : ds; 544 DrawLine (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D); 545 DrawLine (sx + D, sy + 0.58*D, sx, sy - 1.15*D); 546 DrawLine (sx, sy - 1.15*D, sx - D, sy + 0.58*D); 547 } 548 } 549 } 550 if (object[0].ptype == 6) { /* Y */ 551 for (i = 0; i < object[0].Npts; i++) { 552 if (!(finite(x[i]) && finite(y[i]))) continue; 553 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 554 sy = x[i]*myi + y[i]*myj + by + YCENTER; 555 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 556 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 557 if (scaleColor) { 558 if (!finite(z[i])) continue; 559 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 560 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 561 } 562 D = scaleSize ? dz*z[i] : ds; 563 DrawLine (sx, sy, sx - D, sy - 0.58*D); 564 DrawLine (sx, sy, sx + D, sy - 0.58*D); 565 DrawLine (sx, sy, sx, sy + 1.15*D); 566 } 567 } 568 } 569 if (object[0].ptype == 7) { /* 0 */ 570 for (i = 0; i < object[0].Npts; i++) { 571 if (!(finite(x[i]) && finite(y[i]))) continue; 572 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 573 sy = x[i]*myi + y[i]*myj + by + YCENTER; 574 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 575 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 576 if (scaleColor) { 577 if (!finite(z[i])) continue; 578 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 579 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 580 } 581 D = scaleSize ? dz*z[i] : ds; 582 DrawCircle (sx, sy, D); 583 } 584 } 585 } 586 if (object[0].ptype == 8) { /* pentagon */ 587 for (i = 0; i < object[0].Npts; i++) { 588 if (!(finite(x[i]) && finite(y[i]))) continue; 589 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 590 sy = x[i]*myi + y[i]*myj + by + YCENTER; 591 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 592 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 593 if (scaleColor) { 594 if (!finite(z[i])) continue; 595 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 596 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 597 } 598 D = scaleSize ? dz*z[i] : ds; 599 DrawLine (sx + 0.00*D, sy - 1.00*D, sx + 0.95*D, sy - 0.31*D); 600 DrawLine (sx + 0.95*D, sy - 0.31*D, sx + 0.58*D, sy + 0.81*D); 601 DrawLine (sx + 0.58*D, sy + 0.81*D, sx - 0.58*D, sy + 0.81*D); 602 DrawLine (sx - 0.58*D, sy + 0.81*D, sx - 0.95*D, sy - 0.31*D); 603 DrawLine (sx - 0.95*D, sy - 0.31*D, sx + 0.00*D, sy - 1.00*D); 604 } 605 } 606 } 607 if (object[0].ptype == 9) { /* hexagon */ 608 for (i = 0; i < object[0].Npts; i++) { 609 if (!(finite(x[i]) && finite(y[i]))) continue; 610 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 611 sy = x[i]*myi + y[i]*myj + by + YCENTER; 612 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 613 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 614 if (scaleColor) { 615 if (!finite(z[i])) continue; 616 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 617 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 618 } 619 D = scaleSize ? dz*z[i] : ds; 620 DrawLine (sx - D, sy, sx - 0.50*D, sy + 0.87*D); 621 DrawLine (sx - 0.50*D, sy + 0.87*D, sx + 0.50*D, sy + 0.87*D); 622 DrawLine (sx + 0.50*D, sy + 0.87*D, sx + D, sy); 623 624 DrawLine (sx + D, sy, sx + 0.50*D, sy - 0.87*D); 625 DrawLine (sx + 0.50*D, sy - 0.87*D, sx - 0.50*D, sy - 0.87*D); 626 DrawLine (sx - 0.50*D, sy - 0.87*D, sx - D, sy); 627 } 628 } 629 } 630 if (object[0].ptype == 10) { /* filled 0 */ 631 for (i = 0; i < object[0].Npts; i++) { 632 if (!(finite(x[i]) && finite(y[i]))) continue; 633 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 634 sy = x[i]*myi + y[i]*myj + by + YCENTER; 635 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 636 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 637 if (scaleColor) { 638 if (!finite(z[i])) continue; 639 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 640 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 641 } 642 D = scaleSize ? dz*z[i] : ds; 643 FillCircle (sx, sy, D); 644 } 645 } 646 } 647 if (object[0].ptype == 12) { /* filled triangle (down) */ 648 XPoint points[4]; 649 for (i = 0; i < object[0].Npts; i++) { 650 if (!(finite(x[i]) && finite(y[i]))) continue; 651 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 652 sy = x[i]*myi + y[i]*myj + by + YCENTER; 653 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 654 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 655 if (scaleColor) { 656 if (!finite(z[i])) continue; 657 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 658 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 659 } 660 D = scaleSize ? dz*z[i] : ds; 661 points[0].x = sx - D; points[0].y = sy - 0.58*D; 662 points[1].x = sx + D; points[1].y = sy - 0.58*D; 663 points[2].x = sx; points[2].y = sy + 1.15*D; 664 points[3].x = sx - D; points[3].y = sy - 0.58*D; 665 XFillPolygon (graphic->display, graphic->window, graphic->gc, points, 4, Convex, CoordModeOrigin); 666 } 667 } 668 } 669 if (object[0].ptype == 14) { /* upside-down filled triangle */ 670 XPoint points[4]; 671 for (i = 0; i < object[0].Npts; i++) { 672 if (!(finite(x[i]) && finite(y[i]))) continue; 673 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 674 sy = x[i]*myi + y[i]*myj + by + YCENTER; 675 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 676 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 677 if (scaleColor) { 678 if (!finite(z[i])) continue; 679 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 680 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 681 } 682 D = scaleSize ? dz*z[i] : ds; 683 points[0].x = sx - D; points[0].y = sy - 0.58*D; 684 points[1].x = sx + D; points[1].y = sy - 0.58*D; 685 points[2].x = sx; points[2].y = sy + 1.15*D; 686 points[3].x = sx - D; points[3].y = sy - 0.58*D; 687 XFillPolygon (graphic->display, graphic->window, graphic->gc, points, 4, Convex, CoordModeOrigin); 688 } 689 } 690 } 691 if (object[0].ptype == 15) { /* upside-down open triangle */ 692 for (i = 0; i < object[0].Npts; i++) { 693 if (!(finite(x[i]) && finite(y[i]))) continue; 694 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 695 sy = x[i]*myi + y[i]*myj + by + YCENTER; 696 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 697 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 698 if (scaleColor) { 699 if (!finite(z[i])) continue; 700 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 701 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 702 } 703 D = scaleSize ? dz*z[i] : ds; 704 DrawLine (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D); 705 DrawLine (sx + D, sy - 0.58*D, sx, sy + 1.15*D); 706 DrawLine (sx, sy + 1.15*D, sx - D, sy - 0.58*D); 707 } 708 } 709 } 710 if (object[0].ptype == 16) { /* upside-down Y */ 711 for (i = 0; i < object[0].Npts; i++) { 712 if (!(finite(x[i]) && finite(y[i]))) continue; 713 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 714 sy = x[i]*myi + y[i]*myj + by + YCENTER; 715 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 716 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 717 if (scaleColor) { 718 if (!finite(z[i])) continue; 719 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 720 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 721 } 722 D = scaleSize ? dz*z[i] : ds; 723 DrawLine (sx, sy, sx - D, sy + 0.58*D); 724 DrawLine (sx, sy, sx + D, sy + 0.58*D); 725 DrawLine (sx, sy, sx, sy - 1.15*D); 726 } 727 } 728 } 729 if (object[0].ptype == 100) { /* connect a pair of points */ 730 731 double X0 = graph[0].axis[0].fx; 732 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 733 double Y0 = graph[0].axis[1].fy; 734 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 735 736 for (i = 0; i + 1 < object[0].Npts; i+=2) { 737 if (!(finite(x[i]) && finite(y[i]))) continue; 738 sx1 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 739 sy1 = x[i]*myi + y[i]*myj + by + YCENTER; 740 if (!(finite(x[i+1]) && finite(y[i+1]))) continue; 741 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx + XCENTER; 742 sy2 = x[i+1]*myi + y[i+1]*myj + by + YCENTER; 743 ClipLine (sx1, sy1, sx2, sy2, X0, Y0, X1, Y1); 744 } 705 case KAPA_POINT_BOX_SOLID: /* filled box */ 706 default: 707 for (i = 0; i < object[0].Npts; i++) { 708 if (!(finite(x[i]) && finite(y[i]))) continue; 709 sx = x[i]*mxi + y[i]*mxj + bx + XCENTER; 710 sy = x[i]*myi + y[i]*myj + by + YCENTER; 711 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 712 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 713 if (scaleColor) { 714 if (!finite(z[i])) continue; 715 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 716 XSetForeground (graphic->display, graphic->gc, graphic->cmap[pixel].pixel); 717 } 718 D = scaleSize ? dz*z[i] : ds; 719 FillRectangle (sx - D, sy - D, 2*D + 1, 2*D + 1); 720 } 721 } 722 break; 745 723 } 746 724 } 747 725 748 726 /******/ 749 void DrawXErrors ( KapaGraphWidget *graph, Gobjects *object) {727 void DrawXErrors (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 750 728 751 729 int i, bar, dz, ds, D; … … 800 778 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 801 779 { 802 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);780 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 803 781 if (bar) { 804 782 sx10 = sy1 - sz; 805 783 sx11 = sy1 + sz; 806 ClipLine ( sx1, sx10, sx1, sx11, X0, Y0, X1, Y1);784 ClipLine (graphic, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 807 785 } 808 786 } … … 819 797 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 820 798 { 821 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);799 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 822 800 if (bar) { 823 801 sx10 = sy1 - sz; 824 802 sx11 = sy1 + sz; 825 ClipLine ( sx1, sx10, sx1, sx11, X0, Y0, X1, Y1);803 ClipLine (graphic, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 826 804 } 827 805 } … … 830 808 831 809 /******/ 832 void DrawYErrors ( KapaGraphWidget *graph, Gobjects *object) {810 void DrawYErrors (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 833 811 834 812 int i, bar, dz, ds, D; … … 883 861 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 884 862 { 885 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);863 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 886 864 if (bar) { 887 865 sx10 = sx1 - sz; 888 866 sx11 = sx1 + sz; 889 ClipLine ( sx10, sy1, sx11, sy1, X0, Y0, X1, Y1);867 ClipLine (graphic, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 890 868 } 891 869 } … … 904 882 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 905 883 { 906 ClipLine ( sx0, sy0, sx1, sy1, X0, Y0, X1, Y1);884 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 907 885 if (bar) { 908 886 sx10 = sx1 - sz; 909 887 sx11 = sx1 + sz; 910 ClipLine ( sx10, sy1, sx11, sy1, X0, Y0, X1, Y1);888 ClipLine (graphic, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 911 889 } 912 890 } -
trunk/Ohana/src/kapa2/src/LoadObject.c
r31665 r39926 102 102 if (DEBUG) fprintf (stderr, "loaded %d objects, using object %d\n", graph[0].objects[N].Npts, N); 103 103 104 if (USE_XWINDOW) DrawObjectN (graph, &graph[0].objects[graph[0].Nobjects-1]); 104 if (USE_XWINDOW) { 105 Graphic *graphic = GetGraphic(); 106 DrawObjectN (graphic, graph, &graph[0].objects[graph[0].Nobjects-1]); 107 } 105 108 FlushDisplay (); 106 109 -
trunk/Ohana/src/kapa2/src/PSFrame.c
r38986 r39926 11 11 12 12 graphic = GetGraphic(); 13 14 P = 0.5 * (1 + 0.25*graph[0].axis[0].lweight) * (hypot (graph[0].axis[0].dfx, graph[0].axis[0].dfy) + hypot (graph[0].axis[0].dfx, graph[0].axis[0].dfy)); 13 15 14 16 /* each axis is drawn independently */ … … 30 32 dfy = -graph[0].axis[i].dfy + 2*dy; 31 33 32 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy);33 P *= (1 + 0.25*lweight);34 // P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy); 35 // P *= (1 + 0.25*lweight); 34 36 35 37 fprintf (f, "%.1f setlinewidth\n", lweight); -
trunk/Ohana/src/kapa2/src/PSObjects.c
r38153 r39926 7 7 # define FillCircle(X1,Y1,R) (fprintf (f, " %6.2f %6.2f %6.2f FC\n", (X1), (graphic->dy - Y1), (R))) 8 8 # define FillTriangle(X1,Y1,X2,Y2, X3, Y3) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f TF\n", (X1), (graphic->dy-Y1), (X2), (graphic->dy-Y2), (X3), (graphic->dy-Y3))) 9 # define CONNECT 0 10 # define HISTOGRAM 1 11 # define POINTS 2 12 9 10 # define CAPSTYLE 1 /* CapButt */ 11 # define JOINSTYLE 0 /* JoinMiter */ 12 13 // XXX this is not thread safe, but that is OK 13 14 static Graphic *graphic; 14 15 … … 16 17 17 18 int i; 18 double lweight; 19 static char dash[] = "5"; 20 static char dot[] = "3"; 21 19 20 // the functions below use this global value 22 21 graphic = GetGraphic(); 23 22 23 // this function calls all of the supporting Draw... functions below 24 24 for (i = 0; i < graph[0].Nobjects; i++) { 25 switch (graph[0].objects[i].ltype) { 26 case 0: 27 break; 28 case 1: 29 fprintf (f, "[%s] 0 setdash\n", dash); 30 break; 31 case 2: 25 PSObjectsN (graph, &graph[0].objects[i], f); 26 } 27 // reset to default color and style 28 fprintf (f, "[] 0 setdash\n"); 29 fprintf (f, "0.00 0.00 0.00 setrgbcolor\n"); 30 31 return (TRUE); 32 } 33 34 int PSObjectsN (KapaGraphWidget *graph, Gobjects *object, FILE *f) { 35 36 static char short_dash[] = "4 4"; 37 static char long_dash[] = "8 8"; 38 static char dot_dash[] = "2 4 4 4"; 39 static char dot[] = "2 3"; 40 41 double lweight = MAX (0, MIN (10, object->lweight)); 42 fprintf (f, "%.1f setlinewidth\n", lweight); 43 fprintf (f, "%d setlinecap %d setlinejoin\n", CAPSTYLE, JOINSTYLE); 44 45 switch (object->ltype) { 46 case KAPA_LINE_DOT: 32 47 fprintf (f, "[%s] 0 setdash\n", dot); 33 48 break; 49 case KAPA_LINE_DASH_SHORT: 50 fprintf (f, "[%s] 0 setdash\n", short_dash); 51 break; 52 case KAPA_LINE_DASH_LONG: 53 fprintf (f, "[%s] 0 setdash\n", long_dash); 54 break; 55 case KAPA_LINE_DOT_DASH: 56 fprintf (f, "[%s] 0 setdash\n", dot_dash); 57 break; 58 case KAPA_LINE_SOLID: // no need to call 'setdash' as solid is the default 34 59 default: 35 60 break; 36 }61 } 37 62 38 lweight = MAX (0, MIN (10, graph[0].objects[i].lweight)); 39 fprintf (f, "%.1f setlinewidth\n", lweight); 40 41 if (graph[0].objects[i].color >= 0) { 42 fprintf (f, "%s setrgbcolor\n", KapaColorRGBString(graph[0].objects[i].color)); 43 } 44 45 switch (graph[0].objects[i].style) { 46 case CONNECT: 47 PSConnect (graph, &graph[0].objects[i], f); 48 break; 49 case HISTOGRAM: 50 PSHistogram (graph, &graph[0].objects[i], f); 51 break; 52 case POINTS: 53 PSPoints (graph, &graph[0].objects[i], f); 54 break; 55 } 56 57 if (graph[0].objects[i].etype & 0x01) { 58 PSYErrors (graph, &graph[0].objects[i], f); 59 } 60 if (graph[0].objects[i].etype & 0x02) { 61 PSXErrors (graph, &graph[0].objects[i], f); 62 } 63 fprintf (f, "[] 0 setdash\n"); 64 fprintf (f, "0.00 0.00 0.00 setrgbcolor\n"); 63 if (object->color >= 0) { 64 fprintf (f, "%s setrgbcolor\n", KapaColorRGBString(object->color)); 65 } 66 67 switch (object->style) { 68 case KAPA_PLOT_CONNECT: 69 PSConnect (graph, object, f); 70 break; 71 case KAPA_PLOT_HISTOGRAM: 72 PSHistogram (graph, object, f); 73 break; 74 case KAPA_PLOT_POINTS: 75 default: 76 PSPoints (graph, object, f); 77 break; 78 } 79 80 if (object->etype & 0x01) { 81 PSYErrors (graph, object, f); 82 } 83 if (object->etype & 0x02) { 84 PSXErrors (graph, object, f); 65 85 } 66 86 return (TRUE); … … 303 323 } 304 324 305 // black, I think306 325 // fprintf (f, "0.00 0.00 0.00 setrgbcolor\n"); 307 326 308 /**** point s are scaled by object.z***/327 /**** point sizes are scaled by object.size, colors by object.color ***/ 309 328 int scaleSize = (object[0].size < 0); 310 329 int scaleColor = (object[0].color < 0); … … 314 333 x = object[0].x; y = object[0].y; z = object[0].z; 315 334 316 if (object[0].ptype == 0) { /* filled box */ 317 for (i = 0; i < object[0].Npts; i++) { 318 if (!(finite(x[i]) && finite(y[i]))) continue; 319 sx = x[i]*mxi + y[i]*mxj + bx; 320 sy = x[i]*myi + y[i]*myj + by; 321 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 322 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 323 { 324 if (scaleColor) { 325 if (!finite(z[i])) continue; 326 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 327 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 328 } 329 D = scaleSize ? dz*z[i] : ds; 330 FillRectangle (sx, sy, 2*D, 2*D); 331 } 335 switch (object[0].ptype) { 336 case KAPA_POINT_BOX_OPEN: /* open box */ 337 for (i = 0; i < object[0].Npts; i++) { 338 if (!(finite(x[i]) && finite(y[i]))) continue; 339 sx = x[i]*mxi + y[i]*mxj + bx; 340 sy = x[i]*myi + y[i]*myj + by; 341 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 342 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 343 if (scaleColor) { 344 if (!finite(z[i])) continue; 345 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 346 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 347 } 348 D = scaleSize ? dz*z[i] : ds; 349 DrawRectangle (sx, sy, 2*D, 2*D); 350 } 351 } 352 break; 353 case KAPA_POINT_CROSS: /* cross */ 354 for (i = 0; i < object[0].Npts; i++) { 355 if (!(finite(x[i]) && finite(y[i]))) continue; 356 sx = x[i]*mxi + y[i]*mxj + bx; 357 sy = x[i]*myi + y[i]*myj + by; 358 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 359 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 360 if (scaleColor) { 361 if (!finite(z[i])) continue; 362 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 363 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 364 } 365 D = scaleSize ? dz*z[i] : ds; 366 DrawLine (sx - D, sy, sx + D, sy); 367 DrawLine (sx, sy - D, sx, sy + D); 368 } 369 } 370 break; 371 case KAPA_POINT_X: /* x */ 372 for (i = 0; i < object[0].Npts; i++) { 373 if (!(finite(x[i]) && finite(y[i]))) continue; 374 sx = x[i]*mxi + y[i]*mxj + bx; 375 sy = x[i]*myi + y[i]*myj + by; 376 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 377 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 378 if (scaleColor) { 379 if (!finite(z[i])) continue; 380 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 381 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 382 } 383 D = scaleSize ? dz*z[i] : ds; 384 DrawLine (sx + D, sy - D, sx - D, sy + D); 385 DrawLine (sx - D, sy - D, sx + D, sy + D); 386 } 387 } 388 break; 389 case KAPA_POINT_TRIANGLE_SOLID: /* filled triangle */ 390 for (i = 0; i < object[0].Npts; i++) { 391 if (!(finite(x[i]) && finite(y[i]))) continue; 392 sx = x[i]*mxi + y[i]*mxj + bx; 393 sy = x[i]*myi + y[i]*myj + by; 394 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 395 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 396 if (scaleColor) { 397 if (!finite(z[i])) continue; 398 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 399 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 400 } 401 D = scaleSize ? dz*z[i] : ds; 402 FillTriangle (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 403 } 404 } 405 break; 406 case KAPA_POINT_TRIANGLE_SOLID_DOWN: /* open triangle */ 407 for (i = 0; i < object[0].Npts; i++) { 408 if (!(finite(x[i]) && finite(y[i]))) continue; 409 sx = x[i]*mxi + y[i]*mxj + bx; 410 sy = x[i]*myi + y[i]*myj + by; 411 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 412 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 413 if (scaleColor) { 414 if (!finite(z[i])) continue; 415 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 416 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 417 } 418 D = scaleSize ? dz*z[i] : ds; 419 FillTriangle (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D, sx, sy - 1.15*D); 420 } 421 } 422 break; 423 case KAPA_POINT_TRIANGLE_OPEN: /* open triangle */ 424 for (i = 0; i < object[0].Npts; i++) { 425 if (!(finite(x[i]) && finite(y[i]))) continue; 426 sx = x[i]*mxi + y[i]*mxj + bx; 427 sy = x[i]*myi + y[i]*myj + by; 428 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 429 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 430 if (scaleColor) { 431 if (!finite(z[i])) continue; 432 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 433 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 434 } 435 D = scaleSize ? dz*z[i] : ds; 436 DrawLine (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D); 437 DrawLine (sx + D, sy - 0.58*D, sx, sy + 1.15*D); 438 DrawLine (sx, sy + 1.15*D, sx - D, sy - 0.58*D); 439 } 440 } 441 break; 442 case KAPA_POINT_TRIANGLE_OPEN_DOWN: /* upside-down open triangle */ 443 for (i = 0; i < object[0].Npts; i++) { 444 if (!(finite(x[i]) && finite(y[i]))) continue; 445 sx = x[i]*mxi + y[i]*mxj + bx; 446 sy = x[i]*myi + y[i]*myj + by; 447 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 448 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 449 if (scaleColor) { 450 if (!finite(z[i])) continue; 451 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 452 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 453 } 454 D = scaleSize ? dz*z[i] : ds; 455 DrawLine (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D); 456 DrawLine (sx + D, sy + 0.58*D, sx, sy - 1.15*D); 457 DrawLine (sx, sy - 1.15*D, sx - D, sy + 0.58*D); 458 } 459 } 460 break; 461 case KAPA_POINT_Y: /* Y */ 462 for (i = 0; i < object[0].Npts; i++) { 463 if (!(finite(x[i]) && finite(y[i]))) continue; 464 sx = x[i]*mxi + y[i]*mxj + bx; 465 sy = x[i]*myi + y[i]*myj + by; 466 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 467 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 468 if (scaleColor) { 469 if (!finite(z[i])) continue; 470 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 471 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 472 } 473 D = scaleSize ? dz*z[i] : ds; 474 DrawLine (sx, sy, sx - D, sy + 0.58*D); 475 DrawLine (sx, sy, sx + D, sy + 0.58*D); 476 DrawLine (sx, sy, sx, sy - 1.15*D); 477 } 478 } 479 break; 480 case KAPA_POINT_Y_DOWN: /* upside-down Y */ 481 for (i = 0; i < object[0].Npts; i++) { 482 if (!(finite(x[i]) && finite(y[i]))) continue; 483 sx = x[i]*mxi + y[i]*mxj + bx; 484 sy = x[i]*myi + y[i]*myj + by; 485 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 486 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 487 if (scaleColor) { 488 if (!finite(z[i])) continue; 489 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 490 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 491 } 492 D = scaleSize ? dz*z[i] : ds; 493 DrawLine (sx, sy, sx - D, sy - 0.58*D); 494 DrawLine (sx, sy, sx + D, sy - 0.58*D); 495 DrawLine (sx, sy, sx, sy + 1.15*D); 496 } 497 } 498 break; 499 case KAPA_POINT_CIRCLE_OPEN: /* 0 */ 500 for (i = 0; i < object[0].Npts; i++) { 501 if (!(finite(x[i]) && finite(y[i]))) continue; 502 sx = x[i]*mxi + y[i]*mxj + bx; 503 sy = x[i]*myi + y[i]*myj + by; 504 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 505 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 506 if (scaleColor) { 507 if (!finite(z[i])) continue; 508 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 509 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 510 } 511 D = scaleSize ? dz*z[i] : ds; 512 DrawCircle (sx, sy, D); 513 } 514 } 515 break; 516 case KAPA_POINT_CIRCLE_SOLID: /* filled 0 */ 517 for (i = 0; i < object[0].Npts; i++) { 518 if (!(finite(x[i]) && finite(y[i]))) continue; 519 sx = x[i]*mxi + y[i]*mxj + bx; 520 sy = x[i]*myi + y[i]*myj + by; 521 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 522 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 523 if (scaleColor) { 524 if (!finite(z[i])) continue; 525 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 526 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 527 } 528 D = scaleSize ? dz*z[i] : ds; 529 FillCircle (sx, sy, D); 530 } 531 } 532 break; 533 case KAPA_POINT_PENTAGON: /* pentagon */ 534 for (i = 0; i < object[0].Npts; i++) { 535 if (!(finite(x[i]) && finite(y[i]))) continue; 536 sx = x[i]*mxi + y[i]*mxj + bx; 537 sy = x[i]*myi + y[i]*myj + by; 538 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 539 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 540 if (scaleColor) { 541 if (!finite(z[i])) continue; 542 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 543 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 544 } 545 D = scaleSize ? dz*z[i] : ds; 546 DrawLine (sx + 0.00*D, sy + 1.00*D, sx + 0.95*D, sy + 0.31*D); 547 DrawLine (sx + 0.95*D, sy + 0.31*D, sx + 0.58*D, sy - 0.81*D); 548 DrawLine (sx + 0.58*D, sy - 0.81*D, sx - 0.58*D, sy - 0.81*D); 549 DrawLine (sx - 0.58*D, sy - 0.81*D, sx - 0.95*D, sy + 0.31*D); 550 DrawLine (sx - 0.95*D, sy + 0.31*D, sx + 0.00*D, sy + 1.00*D); 551 } 552 } 553 break; 554 case KAPA_POINT_HEXAGON: /* hexagon */ 555 for (i = 0; i < object[0].Npts; i++) { 556 if (!(finite(x[i]) && finite(y[i]))) continue; 557 sx = x[i]*mxi + y[i]*mxj + bx; 558 sy = x[i]*myi + y[i]*myj + by; 559 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 560 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 561 if (scaleColor) { 562 if (!finite(z[i])) continue; 563 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 564 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 565 } 566 D = scaleSize ? dz*z[i] : ds; 567 DrawLine (sx - D, sy, sx - 0.50*D, sy + 0.87*D); 568 DrawLine (sx - 0.50*D, sy + 0.87*D, sx + 0.50*D, sy + 0.87*D); 569 DrawLine (sx + 0.50*D, sy + 0.87*D, sx + D, sy); 570 571 DrawLine (sx + D, sy, sx + 0.50*D, sy - 0.87*D); 572 DrawLine (sx + 0.50*D, sy - 0.87*D, sx - 0.50*D, sy - 0.87*D); 573 DrawLine (sx - 0.50*D, sy - 0.87*D, sx - D, sy); 574 } 575 } 576 break; 577 case KAPA_POINT_PAIR_CONNECT: { /* connect pairs of points */ 578 double X0 = graph[0].axis[0].fx; 579 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 580 double Y0 = graph[0].axis[1].fy; 581 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 582 583 for (i = 0; i + 1 < object[0].Npts; i+=2) { 584 if (!(finite(x[i]) && finite(y[i]))) continue; 585 sx1 = x[i]*mxi + y[i]*mxj + bx; 586 sy1 = x[i]*myi + y[i]*myj + by; 587 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 588 sy2 = x[i+1]*myi + y[i+1]*myj + by; 589 ClipLinePS (sx1, sy1, sx2, sy2, X0, Y0, X1, Y1, f); 590 } 591 break; 332 592 } 333 } 334 if (object[0].ptype == 1) { /* open box */ 335 for (i = 0; i < object[0].Npts; i++) { 336 if (!(finite(x[i]) && finite(y[i]))) continue; 337 sx = x[i]*mxi + y[i]*mxj + bx; 338 sy = x[i]*myi + y[i]*myj + by; 339 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 340 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 341 { 342 if (scaleColor) { 343 if (!finite(z[i])) continue; 344 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 345 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 346 } 347 D = scaleSize ? dz*z[i] : ds; 348 DrawRectangle (sx, sy, 2*D, 2*D); 349 } 350 } 351 } 352 if (object[0].ptype == 2) { /* cross */ 353 for (i = 0; i < object[0].Npts; i++) { 354 if (!(finite(x[i]) && finite(y[i]))) continue; 355 sx = x[i]*mxi + y[i]*mxj + bx; 356 sy = x[i]*myi + y[i]*myj + by; 357 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 358 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 359 { 360 if (scaleColor) { 361 if (!finite(z[i])) continue; 362 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 363 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 364 } 365 D = scaleSize ? dz*z[i] : ds; 366 DrawLine (sx - D, sy, sx + D, sy); 367 DrawLine (sx, sy - D, sx, sy + D); 368 } 369 } 370 } 371 if (object[0].ptype == 3) { /* x */ 372 for (i = 0; i < object[0].Npts; i++) { 373 if (!(finite(x[i]) && finite(y[i]))) continue; 374 sx = x[i]*mxi + y[i]*mxj + bx; 375 sy = x[i]*myi + y[i]*myj + by; 376 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 377 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 378 { 379 if (scaleColor) { 380 if (!finite(z[i])) continue; 381 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 382 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 383 } 384 D = scaleSize ? dz*z[i] : ds; 385 DrawLine (sx + D, sy - D, sx - D, sy + D); 386 DrawLine (sx - D, sy - D, sx + D, sy + D); 387 } 388 } 389 } 390 if (object[0].ptype == 4) { /* filled triangle */ 391 for (i = 0; i < object[0].Npts; i++) { 392 if (!(finite(x[i]) && finite(y[i]))) continue; 393 sx = x[i]*mxi + y[i]*mxj + bx; 394 sy = x[i]*myi + y[i]*myj + by; 395 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 396 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 397 { 398 if (scaleColor) { 399 if (!finite(z[i])) continue; 400 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 401 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 402 } 403 D = scaleSize ? dz*z[i] : ds; 404 FillTriangle (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 405 } 406 } 407 } 408 if (object[0].ptype == 14) { /* filled triangle */ 409 for (i = 0; i < object[0].Npts; i++) { 410 if (!(finite(x[i]) && finite(y[i]))) continue; 411 sx = x[i]*mxi + y[i]*mxj + bx; 412 sy = x[i]*myi + y[i]*myj + by; 413 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 414 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 415 { 416 if (scaleColor) { 417 if (!finite(z[i])) continue; 418 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 419 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 420 } 421 D = scaleSize ? dz*z[i] : ds; 422 FillTriangle (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D, sx, sy - 1.15*D); 423 } 424 } 425 } 426 if (object[0].ptype == 5) { /* open triangle */ 427 for (i = 0; i < object[0].Npts; i++) { 428 if (!(finite(x[i]) && finite(y[i]))) continue; 429 sx = x[i]*mxi + y[i]*mxj + bx; 430 sy = x[i]*myi + y[i]*myj + by; 431 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 432 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 433 { 434 if (scaleColor) { 435 if (!finite(z[i])) continue; 436 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 437 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 438 } 439 D = scaleSize ? dz*z[i] : ds; 440 DrawLine (sx - D, sy - 0.58*D, sx + D, sy - 0.58*D); 441 DrawLine (sx + D, sy - 0.58*D, sx, sy + 1.15*D); 442 DrawLine (sx, sy + 1.15*D, sx - D, sy - 0.58*D); 443 } 444 } 445 } 446 if (object[0].ptype == 15) { /* upside-down open triangle */ 447 for (i = 0; i < object[0].Npts; i++) { 448 if (!(finite(x[i]) && finite(y[i]))) continue; 449 sx = x[i]*mxi + y[i]*mxj + bx; 450 sy = x[i]*myi + y[i]*myj + by; 451 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 452 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 453 { 454 if (scaleColor) { 455 if (!finite(z[i])) continue; 456 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 457 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 458 } 459 D = scaleSize ? dz*z[i] : ds; 460 DrawLine (sx - D, sy + 0.58*D, sx + D, sy + 0.58*D); 461 DrawLine (sx + D, sy + 0.58*D, sx, sy - 1.15*D); 462 DrawLine (sx, sy - 1.15*D, sx - D, sy + 0.58*D); 463 } 464 } 465 } 466 if (object[0].ptype == 6) { /* Y */ 467 for (i = 0; i < object[0].Npts; i++) { 468 if (!(finite(x[i]) && finite(y[i]))) continue; 469 sx = x[i]*mxi + y[i]*mxj + bx; 470 sy = x[i]*myi + y[i]*myj + by; 471 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 472 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 473 { 474 if (scaleColor) { 475 if (!finite(z[i])) continue; 476 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 477 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 478 } 479 D = scaleSize ? dz*z[i] : ds; 480 DrawLine (sx, sy, sx - D, sy + 0.58*D); 481 DrawLine (sx, sy, sx + D, sy + 0.58*D); 482 DrawLine (sx, sy, sx, sy - 1.15*D); 483 } 484 } 485 } 486 if (object[0].ptype == 16) { /* Y */ 487 for (i = 0; i < object[0].Npts; i++) { 488 if (!(finite(x[i]) && finite(y[i]))) continue; 489 sx = x[i]*mxi + y[i]*mxj + bx; 490 sy = x[i]*myi + y[i]*myj + by; 491 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 492 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 493 { 494 if (scaleColor) { 495 if (!finite(z[i])) continue; 496 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 497 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 498 } 499 D = scaleSize ? dz*z[i] : ds; 500 DrawLine (sx, sy, sx - D, sy - 0.58*D); 501 DrawLine (sx, sy, sx + D, sy - 0.58*D); 502 DrawLine (sx, sy, sx, sy + 1.15*D); 503 } 504 } 505 } 506 if (object[0].ptype == 7) { /* 0 */ 507 for (i = 0; i < object[0].Npts; i++) { 508 if (!(finite(x[i]) && finite(y[i]))) continue; 509 sx = x[i]*mxi + y[i]*mxj + bx; 510 sy = x[i]*myi + y[i]*myj + by; 511 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 512 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 513 { 514 if (scaleColor) { 515 if (!finite(z[i])) continue; 516 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 517 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 518 } 519 D = scaleSize ? dz*z[i] : ds; 520 DrawCircle (sx, sy, D); 521 } 522 } 523 } 524 if (object[0].ptype == 8) { /* pentagon */ 525 for (i = 0; i < object[0].Npts; i++) { 526 if (!(finite(x[i]) && finite(y[i]))) continue; 527 sx = x[i]*mxi + y[i]*mxj + bx; 528 sy = x[i]*myi + y[i]*myj + by; 529 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 530 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 531 { 532 if (scaleColor) { 533 if (!finite(z[i])) continue; 534 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 535 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 536 } 537 D = scaleSize ? dz*z[i] : ds; 538 DrawLine (sx + 0.00*D, sy + 1.00*D, sx + 0.95*D, sy + 0.31*D); 539 DrawLine (sx + 0.95*D, sy + 0.31*D, sx + 0.58*D, sy - 0.81*D); 540 DrawLine (sx + 0.58*D, sy - 0.81*D, sx - 0.58*D, sy - 0.81*D); 541 DrawLine (sx - 0.58*D, sy - 0.81*D, sx - 0.95*D, sy + 0.31*D); 542 DrawLine (sx - 0.95*D, sy + 0.31*D, sx + 0.00*D, sy + 1.00*D); 543 } 544 } 545 } 546 if (object[0].ptype == 9) { /* hexagon */ 547 for (i = 0; i < object[0].Npts; i++) { 548 if (!(finite(x[i]) && finite(y[i]))) continue; 549 sx = x[i]*mxi + y[i]*mxj + bx; 550 sy = x[i]*myi + y[i]*myj + by; 551 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 552 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 553 { 554 if (scaleColor) { 555 if (!finite(z[i])) continue; 556 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 557 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 558 } 559 D = scaleSize ? dz*z[i] : ds; 560 DrawLine (sx - D, sy, sx - 0.50*D, sy + 0.87*D); 561 DrawLine (sx - 0.50*D, sy + 0.87*D, sx + 0.50*D, sy + 0.87*D); 562 DrawLine (sx + 0.50*D, sy + 0.87*D, sx + D, sy); 563 564 DrawLine (sx + D, sy, sx + 0.50*D, sy - 0.87*D); 565 DrawLine (sx + 0.50*D, sy - 0.87*D, sx - 0.50*D, sy - 0.87*D); 566 DrawLine (sx - 0.50*D, sy - 0.87*D, sx - D, sy); 567 } 568 } 569 } 570 if (object[0].ptype == 10) { /* 0 */ 571 for (i = 0; i < object[0].Npts; i++) { 572 if (!(finite(x[i]) && finite(y[i]))) continue; 573 sx = x[i]*mxi + y[i]*mxj + bx; 574 sy = x[i]*myi + y[i]*myj + by; 575 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 576 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 577 { 578 if (scaleColor) { 579 if (!finite(z[i])) continue; 580 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 581 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 582 } 583 D = scaleSize ? dz*z[i] : ds; 584 FillCircle (sx, sy, D); 585 } 586 } 587 } 588 if (object[0].ptype == 100) { /* connect a pair of points */ 589 double X0 = graph[0].axis[0].fx; 590 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 591 double Y0 = graph[0].axis[1].fy; 592 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 593 594 for (i = 0; i + 1 < object[0].Npts; i+=2) { 595 if (!(finite(x[i]) && finite(y[i]))) continue; 596 sx1 = x[i]*mxi + y[i]*mxj + bx; 597 sy1 = x[i]*myi + y[i]*myj + by; 598 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 599 sy2 = x[i+1]*myi + y[i+1]*myj + by; 600 ClipLinePS (sx1, sy1, sx2, sy2, X0, Y0, X1, Y1, f); 601 } 602 } 603 593 case KAPA_POINT_BOX_SOLID: /* filled box */ 594 default: 595 for (i = 0; i < object[0].Npts; i++) { 596 if (!(finite(x[i]) && finite(y[i]))) continue; 597 sx = x[i]*mxi + y[i]*mxj + bx; 598 sy = x[i]*myi + y[i]*myj + by; 599 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 600 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 601 if (scaleColor) { 602 if (!finite(z[i])) continue; 603 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 604 fprintf (f, "%4.2f %4.2f %4.2f setrgbcolor\n", pixel1[pixel], pixel2[pixel], pixel3[pixel]); 605 } 606 D = scaleSize ? dz*z[i] : ds; 607 FillRectangle (sx, sy, 2*D, 2*D); 608 } 609 } 610 break; 611 } 604 612 free (pixel1); 605 613 free (pixel2); -
trunk/Ohana/src/kapa2/src/bDrawFrame.c
r38986 r39926 11 11 12 12 // don't need graphic, unlink DrawFrame 13 14 P = 0.5 * (1 + 0.25*graph[0].axis[0].lweight) * (hypot (graph[0].axis[0].dfx, graph[0].axis[0].dfy) + hypot (graph[0].axis[0].dfx, graph[0].axis[0].dfy)); 13 15 14 16 /* each axis is drawn independently */ … … 28 30 dfx = graph[0].axis[i].dfx + 2*dx; 29 31 dfy = graph[0].axis[i].dfy + 2*dy; 30 P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy); 31 P *= (1 + 0.25*lweight); 32 33 // P = hypot (graph[0].axis[(i+1)%2].dfx, graph[0].axis[(i+1)%2].dfy); 34 // P *= (1 + 0.25*lweight); 32 35 33 36 bDrawSetStyle (buffer, color, lweight, 0); -
trunk/Ohana/src/kapa2/src/bDrawObjects.c
r38153 r39926 18 18 19 19 int i; 20 int type; 21 int weight; 22 bDrawColor color; 23 bDrawColor black; 24 20 21 // the functions below use this global value 25 22 graphic = GetGraphic(); 26 23 27 black = KapaColorByName ("black");24 // this function calls all of the supporting bDraw... functions below 28 25 for (i = 0; i < graph[0].Nobjects; i++) { 29 30 weight = MAX (0, MIN (10, graph[0].objects[i].lweight)); 31 type = graph[0].objects[i].ltype; 32 color = graph[0].objects[i].color; 33 bDrawSetStyle (buffer, color, weight, type); 34 35 switch (graph[0].objects[i].style) { 36 case CONNECT: 37 bDrawConnect (buffer, graph, &graph[0].objects[i]); 38 break; 39 case HISTOGRAM: 40 bDrawHistogram (buffer, graph, &graph[0].objects[i]); 41 break; 42 case POINTS: 43 bDrawPoints (buffer, graph, &graph[0].objects[i]); 44 break; 45 } 46 47 if (graph[0].objects[i].etype & 0x01) { 48 bDrawYErrors (buffer, graph, &graph[0].objects[i]); 49 } 50 if (graph[0].objects[i].etype & 0x02) { 51 bDrawXErrors (buffer, graph, &graph[0].objects[i]); 52 } 53 } 26 bDrawObjectsN (buffer, graph, &graph[0].objects[i]); 27 } 28 bDrawColor black = KapaColorByName ("black"); 54 29 bDrawSetStyle (buffer, black, 0, 0); 30 return (TRUE); 31 } 32 33 int bDrawObjectsN (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object) { 34 35 int weight = MAX (0, MIN (10, object->lweight)); 36 bDrawSetStyle (buffer, object->color, weight, object->ltype); 37 38 switch (object->style) { 39 case KAPA_PLOT_CONNECT: 40 bDrawConnect (buffer, graph, object); 41 break; 42 case KAPA_PLOT_HISTOGRAM: 43 bDrawHistogram (buffer, graph, object); 44 break; 45 case KAPA_PLOT_POINTS: 46 default: 47 bDrawPoints (buffer, graph, object); 48 break; 49 } 50 51 if (object->etype & 0x01) { 52 bDrawYErrors (buffer, graph, object); 53 } 54 if (object->etype & 0x02) { 55 bDrawXErrors (buffer, graph, object); 56 } 57 55 58 return (TRUE); 56 59 } … … 298 301 x = object[0].x; y = object[0].y; z = object[0].z; 299 302 300 if (object[0].ptype == 0) { /* filled box */ 301 for (i = 0; i < object[0].Npts; i++) { 302 if (!(finite(x[i]) && finite(y[i]))) continue; 303 sx = x[i]*mxi + y[i]*mxj + bx; 304 sy = x[i]*myi + y[i]*myj + by; 305 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 306 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 307 { 308 if (scaleColor) { 309 if (!finite(z[i])) continue; 310 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 311 buffer->bColor_R = pixel1[pixel]; 312 buffer->bColor_G = pixel2[pixel]; 313 buffer->bColor_B = pixel3[pixel]; 314 } 315 D = scaleSize ? dz*z[i] : ds; 316 FillRectangle (buffer, sx, sy, 2*D, 2*D); 317 // plot range saturated by bDrawRectFill 318 } 303 switch (object[0].ptype) { 304 case KAPA_POINT_BOX_OPEN: /* open box */ 305 for (i = 0; i < object[0].Npts; i++) { 306 if (!(finite(x[i]) && finite(y[i]))) continue; 307 sx = x[i]*mxi + y[i]*mxj + bx; 308 sy = x[i]*myi + y[i]*myj + by; 309 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 310 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 311 if (scaleColor) { 312 if (!finite(z[i])) continue; 313 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 314 buffer->bColor_R = pixel1[pixel]; 315 buffer->bColor_G = pixel2[pixel]; 316 buffer->bColor_B = pixel3[pixel]; 317 } 318 D = scaleSize ? dz*z[i] : ds; 319 DrawRectangle (buffer, sx, sy, 2*D, 2*D); 320 // plot range saturated by bDrawRectOpen 321 } 322 } 323 break; 324 case KAPA_POINT_CROSS: /* cross */ 325 for (i = 0; i < object[0].Npts; i++) { 326 if (!(finite(x[i]) && finite(y[i]))) continue; 327 sx = x[i]*mxi + y[i]*mxj + bx; 328 sy = x[i]*myi + y[i]*myj + by; 329 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 330 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 331 if (scaleColor) { 332 if (!finite(z[i])) continue; 333 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 334 buffer->bColor_R = pixel1[pixel]; 335 buffer->bColor_G = pixel2[pixel]; 336 buffer->bColor_B = pixel3[pixel]; 337 } 338 D = scaleSize ? dz*z[i] : ds; 339 DrawLine (buffer, sx - D, sy, sx + D, sy); 340 DrawLine (buffer, sx, sy - D, sx, sy + D); 341 // out-of-range points skipped by bDrawPoint 342 } 343 } 344 break; 345 case KAPA_POINT_X: /* x */ 346 for (i = 0; i < object[0].Npts; i++) { 347 if (!(finite(x[i]) && finite(y[i]))) continue; 348 sx = x[i]*mxi + y[i]*mxj + bx; 349 sy = x[i]*myi + y[i]*myj + by; 350 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 351 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 352 if (scaleColor) { 353 if (!finite(z[i])) continue; 354 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 355 buffer->bColor_R = pixel1[pixel]; 356 buffer->bColor_G = pixel2[pixel]; 357 buffer->bColor_B = pixel3[pixel]; 358 } 359 D = scaleSize ? dz*z[i] : ds; 360 DrawLine (buffer, sx + D, sy - D, sx - D, sy + D); 361 DrawLine (buffer, sx - D, sy - D, sx + D, sy + D); 362 // out-of-range points skipped by bDrawPoint 363 } 364 } 365 break; 366 case KAPA_POINT_TRIANGLE_SOLID: /* filled triangle */ 367 for (i = 0; i < object[0].Npts; i++) { 368 if (!(finite(x[i]) && finite(y[i]))) continue; 369 sx = x[i]*mxi + y[i]*mxj + bx; 370 sy = x[i]*myi + y[i]*myj + by; 371 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 372 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 373 if (scaleColor) { 374 if (!finite(z[i])) continue; 375 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 376 buffer->bColor_R = pixel1[pixel]; 377 buffer->bColor_G = pixel2[pixel]; 378 buffer->bColor_B = pixel3[pixel]; 379 } 380 D = scaleSize ? dz*z[i] : ds; 381 // FillTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 382 FillTriangle (buffer, sx, sy + 0.58*D, D, -1.73*D); 383 // out-of-range points skipped by bDrawPoint 384 } 385 } 386 break; 387 case KAPA_POINT_TRIANGLE_SOLID_DOWN: /* open triangle */ 388 for (i = 0; i < object[0].Npts; i++) { 389 if (!(finite(x[i]) && finite(y[i]))) continue; 390 sx = x[i]*mxi + y[i]*mxj + bx; 391 sy = x[i]*myi + y[i]*myj + by; 392 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 393 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 394 if (scaleColor) { 395 if (!finite(z[i])) continue; 396 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 397 buffer->bColor_R = pixel1[pixel]; 398 buffer->bColor_G = pixel2[pixel]; 399 buffer->bColor_B = pixel3[pixel]; 400 } 401 D = scaleSize ? dz*z[i] : ds; 402 // FillTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 403 FillTriangle (buffer, sx, sy - 0.58*D, D, +1.73*D); 404 // out-of-range points skipped by bDrawPoint 405 } 406 } 407 break; 408 case KAPA_POINT_TRIANGLE_OPEN: /* open triangle */ 409 for (i = 0; i < object[0].Npts; i++) { 410 if (!(finite(x[i]) && finite(y[i]))) continue; 411 sx = x[i]*mxi + y[i]*mxj + bx; 412 sy = x[i]*myi + y[i]*myj + by; 413 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 414 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 415 if (scaleColor) { 416 if (!finite(z[i])) continue; 417 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 418 buffer->bColor_R = pixel1[pixel]; 419 buffer->bColor_G = pixel2[pixel]; 420 buffer->bColor_B = pixel3[pixel]; 421 } 422 D = scaleSize ? dz*z[i] : ds; 423 OpenTriangle (buffer, sx - D, sy + 0.58*D, sx + D, sy + 0.58*D, sx, sy - 1.15*D); 424 // out-of-range points skipped by bDrawPoint 425 } 426 } 427 break; 428 case KAPA_POINT_TRIANGLE_OPEN_DOWN: /* upside-down open triangle */ 429 for (i = 0; i < object[0].Npts; i++) { 430 if (!(finite(x[i]) && finite(y[i]))) continue; 431 sx = x[i]*mxi + y[i]*mxj + bx; 432 sy = x[i]*myi + y[i]*myj + by; 433 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 434 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 435 if (scaleColor) { 436 if (!finite(z[i])) continue; 437 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 438 buffer->bColor_R = pixel1[pixel]; 439 buffer->bColor_G = pixel2[pixel]; 440 buffer->bColor_B = pixel3[pixel]; 441 } 442 D = scaleSize ? dz*z[i] : ds; 443 OpenTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 444 // out-of-range points skipped by bDrawPoint 445 } 446 } 447 break; 448 case KAPA_POINT_Y: /* Y */ 449 for (i = 0; i < object[0].Npts; i++) { 450 if (!(finite(x[i]) && finite(y[i]))) continue; 451 sx = x[i]*mxi + y[i]*mxj + bx; 452 sy = x[i]*myi + y[i]*myj + by; 453 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 454 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 455 if (scaleColor) { 456 if (!finite(z[i])) continue; 457 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 458 buffer->bColor_R = pixel1[pixel]; 459 buffer->bColor_G = pixel2[pixel]; 460 buffer->bColor_B = pixel3[pixel]; 461 } 462 D = scaleSize ? dz*z[i] : ds; 463 DrawLine (buffer, sx, sy, sx - D, sy - 0.58*D); 464 DrawLine (buffer, sx, sy, sx + D, sy - 0.58*D); 465 DrawLine (buffer, sx, sy, sx, sy + 1.15*D); 466 // out-of-range points skipped by bDrawPoint 467 } 468 } 469 break; 470 case KAPA_POINT_Y_DOWN: /* upside-down Y */ 471 for (i = 0; i < object[0].Npts; i++) { 472 if (!(finite(x[i]) && finite(y[i]))) continue; 473 sx = x[i]*mxi + y[i]*mxj + bx; 474 sy = x[i]*myi + y[i]*myj + by; 475 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 476 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 477 if (scaleColor) { 478 if (!finite(z[i])) continue; 479 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 480 buffer->bColor_R = pixel1[pixel]; 481 buffer->bColor_G = pixel2[pixel]; 482 buffer->bColor_B = pixel3[pixel]; 483 } 484 D = scaleSize ? dz*z[i] : ds; 485 DrawLine (buffer, sx, sy, sx - D, sy + 0.58*D); 486 DrawLine (buffer, sx, sy, sx + D, sy + 0.58*D); 487 DrawLine (buffer, sx, sy, sx, sy - 1.15*D); 488 // out-of-range points skipped by bDrawPoint 489 } 490 } 491 break; 492 case KAPA_POINT_CIRCLE_OPEN: /* 0 */ 493 for (i = 0; i < object[0].Npts; i++) { 494 if (!(finite(x[i]) && finite(y[i]))) continue; 495 sx = x[i]*mxi + y[i]*mxj + bx; 496 sy = x[i]*myi + y[i]*myj + by; 497 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 498 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 499 if (scaleColor) { 500 if (!finite(z[i])) continue; 501 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 502 buffer->bColor_R = pixel1[pixel]; 503 buffer->bColor_G = pixel2[pixel]; 504 buffer->bColor_B = pixel3[pixel]; 505 } 506 D = scaleSize ? dz*z[i] : ds; 507 DrawCircle (buffer, sx, sy, D); 508 // out-of-range points skipped by bDrawPoint 509 } 510 } 511 break; 512 case KAPA_POINT_CIRCLE_SOLID: /* filled 0 */ 513 for (i = 0; i < object[0].Npts; i++) { 514 if (!(finite(x[i]) && finite(y[i]))) continue; 515 sx = x[i]*mxi + y[i]*mxj + bx; 516 sy = x[i]*myi + y[i]*myj + by; 517 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 518 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 519 if (scaleColor) { 520 if (!finite(z[i])) continue; 521 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 522 buffer->bColor_R = pixel1[pixel]; 523 buffer->bColor_G = pixel2[pixel]; 524 buffer->bColor_B = pixel3[pixel]; 525 } 526 D = scaleSize ? dz*z[i] : ds; 527 FillCircle (buffer, sx, sy, D); 528 // out-of-range points skipped by bDrawLineHorizontal 529 } 530 } 531 break; 532 case KAPA_POINT_PENTAGON: /* pentagon */ 533 for (i = 0; i < object[0].Npts; i++) { 534 if (!(finite(x[i]) && finite(y[i]))) continue; 535 sx = x[i]*mxi + y[i]*mxj + bx; 536 sy = x[i]*myi + y[i]*myj + by; 537 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 538 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 539 if (scaleColor) { 540 if (!finite(z[i])) continue; 541 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 542 buffer->bColor_R = pixel1[pixel]; 543 buffer->bColor_G = pixel2[pixel]; 544 buffer->bColor_B = pixel3[pixel]; 545 } 546 D = scaleSize ? dz*z[i] : ds; 547 DrawLine (buffer, sx + 0.00*D, sy - 1.00*D, sx + 0.95*D, sy - 0.31*D); 548 DrawLine (buffer, sx + 0.95*D, sy - 0.31*D, sx + 0.58*D, sy + 0.81*D); 549 DrawLine (buffer, sx + 0.58*D, sy + 0.81*D, sx - 0.58*D, sy + 0.81*D); 550 DrawLine (buffer, sx - 0.58*D, sy + 0.81*D, sx - 0.95*D, sy - 0.31*D); 551 DrawLine (buffer, sx - 0.95*D, sy - 0.31*D, sx + 0.00*D, sy - 1.00*D); 552 // out-of-range points skipped by bDrawPoint 553 } 554 } 555 break; 556 case KAPA_POINT_HEXAGON: /* hexagon */ 557 for (i = 0; i < object[0].Npts; i++) { 558 if (!(finite(x[i]) && finite(y[i]))) continue; 559 sx = x[i]*mxi + y[i]*mxj + bx; 560 sy = x[i]*myi + y[i]*myj + by; 561 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 562 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 563 if (scaleColor) { 564 if (!finite(z[i])) continue; 565 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 566 buffer->bColor_R = pixel1[pixel]; 567 buffer->bColor_G = pixel2[pixel]; 568 buffer->bColor_B = pixel3[pixel]; 569 } 570 D = scaleSize ? dz*z[i] : ds; 571 DrawLine (buffer, sx - D, sy, sx - 0.50*D, sy + 0.87*D); 572 DrawLine (buffer, sx - 0.50*D, sy + 0.87*D, sx + 0.50*D, sy + 0.87*D); 573 DrawLine (buffer, sx + 0.50*D, sy + 0.87*D, sx + D, sy); 574 DrawLine (buffer, sx + D, sy, sx + 0.50*D, sy - 0.87*D); 575 DrawLine (buffer, sx + 0.50*D, sy - 0.87*D, sx - 0.50*D, sy - 0.87*D); 576 DrawLine (buffer, sx - 0.50*D, sy - 0.87*D, sx - D, sy); 577 // out-of-range points skipped by bDrawPoint 578 } 579 } 580 break; 581 case KAPA_POINT_PAIR_CONNECT: { /* connect pairs of points */ 582 583 double X0 = graph[0].axis[0].fx; 584 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 585 double Y0 = graph[0].axis[1].fy; 586 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 587 588 for (i = 0; i + 1 < object[0].Npts; i+=2) { 589 if (!(finite(x[i]) && finite(y[i]))) continue; 590 sx1 = x[i]*mxi + y[i]*mxj + bx; 591 sy1 = x[i]*myi + y[i]*myj + by; 592 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 593 sy2 = x[i+1]*myi + y[i+1]*myj + by; 594 bDrawClipLine (buffer, sx1, sy1, sx2, sy2, X0, Y0, X1, Y1); 595 } 596 break; 319 597 } 320 } 321 if (object[0].ptype == 1) { /* open box */ 322 for (i = 0; i < object[0].Npts; i++) { 323 if (!(finite(x[i]) && finite(y[i]))) continue; 324 sx = x[i]*mxi + y[i]*mxj + bx; 325 sy = x[i]*myi + y[i]*myj + by; 326 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 327 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 328 { 329 if (scaleColor) { 330 if (!finite(z[i])) continue; 331 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 332 buffer->bColor_R = pixel1[pixel]; 333 buffer->bColor_G = pixel2[pixel]; 334 buffer->bColor_B = pixel3[pixel]; 335 } 336 D = scaleSize ? dz*z[i] : ds; 337 DrawRectangle (buffer, sx, sy, 2*D, 2*D); 338 // plot range saturated by bDrawRectOpen 339 } 340 } 341 } 342 if (object[0].ptype == 2) { /* cross */ 343 for (i = 0; i < object[0].Npts; i++) { 344 if (!(finite(x[i]) && finite(y[i]))) continue; 345 sx = x[i]*mxi + y[i]*mxj + bx; 346 sy = x[i]*myi + y[i]*myj + by; 347 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 348 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 349 { 350 if (scaleColor) { 351 if (!finite(z[i])) continue; 352 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 353 buffer->bColor_R = pixel1[pixel]; 354 buffer->bColor_G = pixel2[pixel]; 355 buffer->bColor_B = pixel3[pixel]; 356 } 357 D = scaleSize ? dz*z[i] : ds; 358 DrawLine (buffer, sx - D, sy, sx + D, sy); 359 DrawLine (buffer, sx, sy - D, sx, sy + D); 360 // out-of-range points skipped by bDrawPoint 361 } 362 } 363 } 364 if (object[0].ptype == 3) { /* x */ 365 for (i = 0; i < object[0].Npts; i++) { 366 if (!(finite(x[i]) && finite(y[i]))) continue; 367 sx = x[i]*mxi + y[i]*mxj + bx; 368 sy = x[i]*myi + y[i]*myj + by; 369 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 370 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 371 { 372 if (scaleColor) { 373 if (!finite(z[i])) continue; 374 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 375 buffer->bColor_R = pixel1[pixel]; 376 buffer->bColor_G = pixel2[pixel]; 377 buffer->bColor_B = pixel3[pixel]; 378 } 379 D = scaleSize ? dz*z[i] : ds; 380 DrawLine (buffer, sx + D, sy - D, sx - D, sy + D); 381 DrawLine (buffer, sx - D, sy - D, sx + D, sy + D); 382 // out-of-range points skipped by bDrawPoint 383 } 384 } 385 } 386 if (object[0].ptype == 4) { /* filled triangle */ 387 for (i = 0; i < object[0].Npts; i++) { 388 if (!(finite(x[i]) && finite(y[i]))) continue; 389 sx = x[i]*mxi + y[i]*mxj + bx; 390 sy = x[i]*myi + y[i]*myj + by; 391 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 392 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 393 { 394 if (scaleColor) { 395 if (!finite(z[i])) continue; 396 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 397 buffer->bColor_R = pixel1[pixel]; 398 buffer->bColor_G = pixel2[pixel]; 399 buffer->bColor_B = pixel3[pixel]; 400 } 401 D = scaleSize ? dz*z[i] : ds; 402 // FillTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 403 FillTriangle (buffer, sx, sy + 0.58*D, D, -1.73*D); 404 // out-of-range points skipped by bDrawPoint 405 } 406 } 407 } 408 if (object[0].ptype == 14) { /* filled triangle */ 409 for (i = 0; i < object[0].Npts; i++) { 410 if (!(finite(x[i]) && finite(y[i]))) continue; 411 sx = x[i]*mxi + y[i]*mxj + bx; 412 sy = x[i]*myi + y[i]*myj + by; 413 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 414 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 415 { 416 if (scaleColor) { 417 if (!finite(z[i])) continue; 418 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 419 buffer->bColor_R = pixel1[pixel]; 420 buffer->bColor_G = pixel2[pixel]; 421 buffer->bColor_B = pixel3[pixel]; 422 } 423 D = scaleSize ? dz*z[i] : ds; 424 // FillTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 425 FillTriangle (buffer, sx, sy - 0.58*D, D, +1.73*D); 426 // out-of-range points skipped by bDrawPoint 427 } 428 } 429 } 430 if (object[0].ptype == 5) { /* open triangle */ 431 for (i = 0; i < object[0].Npts; i++) { 432 if (!(finite(x[i]) && finite(y[i]))) continue; 433 sx = x[i]*mxi + y[i]*mxj + bx; 434 sy = x[i]*myi + y[i]*myj + by; 435 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 436 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 437 { 438 if (scaleColor) { 439 if (!finite(z[i])) continue; 440 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 441 buffer->bColor_R = pixel1[pixel]; 442 buffer->bColor_G = pixel2[pixel]; 443 buffer->bColor_B = pixel3[pixel]; 444 } 445 D = scaleSize ? dz*z[i] : ds; 446 OpenTriangle (buffer, sx - D, sy + 0.58*D, sx + D, sy + 0.58*D, sx, sy - 1.15*D); 447 // out-of-range points skipped by bDrawPoint 448 } 449 } 450 } 451 if (object[0].ptype == 15) { /* open triangle */ 452 for (i = 0; i < object[0].Npts; i++) { 453 if (!(finite(x[i]) && finite(y[i]))) continue; 454 sx = x[i]*mxi + y[i]*mxj + bx; 455 sy = x[i]*myi + y[i]*myj + by; 456 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 457 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 458 { 459 if (scaleColor) { 460 if (!finite(z[i])) continue; 461 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 462 buffer->bColor_R = pixel1[pixel]; 463 buffer->bColor_G = pixel2[pixel]; 464 buffer->bColor_B = pixel3[pixel]; 465 } 466 D = scaleSize ? dz*z[i] : ds; 467 OpenTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 468 // out-of-range points skipped by bDrawPoint 469 } 470 } 471 } 472 if (object[0].ptype == 6) { /* Y */ 473 for (i = 0; i < object[0].Npts; i++) { 474 if (!(finite(x[i]) && finite(y[i]))) continue; 475 sx = x[i]*mxi + y[i]*mxj + bx; 476 sy = x[i]*myi + y[i]*myj + by; 477 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 478 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 479 { 480 if (scaleColor) { 481 if (!finite(z[i])) continue; 482 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 483 buffer->bColor_R = pixel1[pixel]; 484 buffer->bColor_G = pixel2[pixel]; 485 buffer->bColor_B = pixel3[pixel]; 486 } 487 D = scaleSize ? dz*z[i] : ds; 488 DrawLine (buffer, sx, sy, sx - D, sy - 0.58*D); 489 DrawLine (buffer, sx, sy, sx + D, sy - 0.58*D); 490 DrawLine (buffer, sx, sy, sx, sy + 1.15*D); 491 // out-of-range points skipped by bDrawPoint 492 } 493 } 494 } 495 if (object[0].ptype == 16) { /* Y */ 496 for (i = 0; i < object[0].Npts; i++) { 497 if (!(finite(x[i]) && finite(y[i]))) continue; 498 sx = x[i]*mxi + y[i]*mxj + bx; 499 sy = x[i]*myi + y[i]*myj + by; 500 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 501 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 502 { 503 if (scaleColor) { 504 if (!finite(z[i])) continue; 505 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 506 buffer->bColor_R = pixel1[pixel]; 507 buffer->bColor_G = pixel2[pixel]; 508 buffer->bColor_B = pixel3[pixel]; 509 } 510 D = scaleSize ? dz*z[i] : ds; 511 DrawLine (buffer, sx, sy, sx - D, sy + 0.58*D); 512 DrawLine (buffer, sx, sy, sx + D, sy + 0.58*D); 513 DrawLine (buffer, sx, sy, sx, sy - 1.15*D); 514 // out-of-range points skipped by bDrawPoint 515 } 516 } 517 } 518 if (object[0].ptype == 7) { /* 0 */ 519 for (i = 0; i < object[0].Npts; i++) { 520 if (!(finite(x[i]) && finite(y[i]))) continue; 521 sx = x[i]*mxi + y[i]*mxj + bx; 522 sy = x[i]*myi + y[i]*myj + by; 523 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 524 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 525 { 526 if (scaleColor) { 527 if (!finite(z[i])) continue; 528 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 529 buffer->bColor_R = pixel1[pixel]; 530 buffer->bColor_G = pixel2[pixel]; 531 buffer->bColor_B = pixel3[pixel]; 532 } 533 D = scaleSize ? dz*z[i] : ds; 534 DrawCircle (buffer, sx, sy, D); 535 // out-of-range points skipped by bDrawPoint 536 } 537 } 538 } 539 if (object[0].ptype == 8) { /* pentagon */ 540 for (i = 0; i < object[0].Npts; i++) { 541 if (!(finite(x[i]) && finite(y[i]))) continue; 542 sx = x[i]*mxi + y[i]*mxj + bx; 543 sy = x[i]*myi + y[i]*myj + by; 544 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 545 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 546 { 547 if (scaleColor) { 548 if (!finite(z[i])) continue; 549 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 550 buffer->bColor_R = pixel1[pixel]; 551 buffer->bColor_G = pixel2[pixel]; 552 buffer->bColor_B = pixel3[pixel]; 553 } 554 D = scaleSize ? dz*z[i] : ds; 555 DrawLine (buffer, sx + 0.00*D, sy - 1.00*D, sx + 0.95*D, sy - 0.31*D); 556 DrawLine (buffer, sx + 0.95*D, sy - 0.31*D, sx + 0.58*D, sy + 0.81*D); 557 DrawLine (buffer, sx + 0.58*D, sy + 0.81*D, sx - 0.58*D, sy + 0.81*D); 558 DrawLine (buffer, sx - 0.58*D, sy + 0.81*D, sx - 0.95*D, sy - 0.31*D); 559 DrawLine (buffer, sx - 0.95*D, sy - 0.31*D, sx + 0.00*D, sy - 1.00*D); 560 // out-of-range points skipped by bDrawPoint 561 } 562 } 563 } 564 if (object[0].ptype == 9) { /* hexagon */ 565 for (i = 0; i < object[0].Npts; i++) { 566 if (!(finite(x[i]) && finite(y[i]))) continue; 567 sx = x[i]*mxi + y[i]*mxj + bx; 568 sy = x[i]*myi + y[i]*myj + by; 569 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 570 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 571 { 572 if (scaleColor) { 573 if (!finite(z[i])) continue; 574 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 575 buffer->bColor_R = pixel1[pixel]; 576 buffer->bColor_G = pixel2[pixel]; 577 buffer->bColor_B = pixel3[pixel]; 578 } 579 D = scaleSize ? dz*z[i] : ds; 580 DrawLine (buffer, sx - D, sy, sx - 0.50*D, sy + 0.87*D); 581 DrawLine (buffer, sx - 0.50*D, sy + 0.87*D, sx + 0.50*D, sy + 0.87*D); 582 DrawLine (buffer, sx + 0.50*D, sy + 0.87*D, sx + D, sy); 583 DrawLine (buffer, sx + D, sy, sx + 0.50*D, sy - 0.87*D); 584 DrawLine (buffer, sx + 0.50*D, sy - 0.87*D, sx - 0.50*D, sy - 0.87*D); 585 DrawLine (buffer, sx - 0.50*D, sy - 0.87*D, sx - D, sy); 586 // out-of-range points skipped by bDrawPoint 587 } 588 } 589 } 590 if (object[0].ptype == 10) { /* filled circle */ 591 for (i = 0; i < object[0].Npts; i++) { 592 if (!(finite(x[i]) && finite(y[i]))) continue; 593 sx = x[i]*mxi + y[i]*mxj + bx; 594 sy = x[i]*myi + y[i]*myj + by; 595 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 596 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 597 { 598 if (scaleColor) { 599 if (!finite(z[i])) continue; 600 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 601 buffer->bColor_R = pixel1[pixel]; 602 buffer->bColor_G = pixel2[pixel]; 603 buffer->bColor_B = pixel3[pixel]; 604 } 605 D = scaleSize ? dz*z[i] : ds; 606 FillCircle (buffer, sx, sy, D); 607 // out-of-range points skipped by bDrawLineHorizontal 608 } 609 } 610 } 611 if (object[0].ptype == 12) { /* filled triangle (down) */ 612 for (i = 0; i < object[0].Npts; i++) { 613 if (!(finite(x[i]) && finite(y[i]))) continue; 614 sx = x[i]*mxi + y[i]*mxj + bx; 615 sy = x[i]*myi + y[i]*myj + by; 616 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 617 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) 618 { 619 if (scaleColor) { 620 if (!finite(z[i])) continue; 621 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 622 buffer->bColor_R = pixel1[pixel]; 623 buffer->bColor_G = pixel2[pixel]; 624 buffer->bColor_B = pixel3[pixel]; 625 } 626 D = scaleSize ? dz*z[i] : ds; 627 // FillTriangle (buffer, sx - D, sy - 0.58*D, sx + D, sy - 0.58*D, sx, sy + 1.15*D); 628 FillTriangle (buffer, sx, sy + 0.58*D, D, 1.73*D); 629 // out-of-range points skipped by bDrawPoint 630 } 631 } 632 } 633 if (object[0].ptype == 100) { /* connect a pair of points */ 634 635 double X0 = graph[0].axis[0].fx; 636 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 637 double Y0 = graph[0].axis[1].fy; 638 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 639 640 for (i = 0; i + 1 < object[0].Npts; i+=2) { 641 if (!(finite(x[i]) && finite(y[i]))) continue; 642 sx1 = x[i]*mxi + y[i]*mxj + bx; 643 sy1 = x[i]*myi + y[i]*myj + by; 644 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 645 sy2 = x[i+1]*myi + y[i+1]*myj + by; 646 bDrawClipLine (buffer, sx1, sy1, sx2, sy2, X0, Y0, X1, Y1); 647 } 648 } 649 598 case KAPA_POINT_BOX_SOLID: /* filled box */ 599 for (i = 0; i < object[0].Npts; i++) { 600 if (!(finite(x[i]) && finite(y[i]))) continue; 601 sx = x[i]*mxi + y[i]*mxj + bx; 602 sy = x[i]*myi + y[i]*myj + by; 603 if ((sx > graph[0].axis[0].fx) && (sx < graph[0].axis[0].fx + graph[0].axis[0].dfx) && 604 (sy < graph[0].axis[1].fy) && (sy > graph[0].axis[1].fy + graph[0].axis[1].dfy)) { 605 if (scaleColor) { 606 if (!finite(z[i])) continue; 607 int pixel = MIN (graphic->Npixels - 2, MAX (0, z[i]*(graphic->Npixels - 1))); 608 buffer->bColor_R = pixel1[pixel]; 609 buffer->bColor_G = pixel2[pixel]; 610 buffer->bColor_B = pixel3[pixel]; 611 } 612 D = scaleSize ? dz*z[i] : ds; 613 FillRectangle (buffer, sx, sy, 2*D, 2*D); 614 // plot range saturated by bDrawRectFill 615 } 616 } 617 break; 618 } 650 619 free (pixel1); 651 620 free (pixel2); -
trunk/Ohana/src/libdvo/include/dvo.h
r39670 r39926 114 114 /* Measure.flags values -- these values are 32 bit (as of PS1_V1) */ 115 115 typedef enum { 116 ID_MEAS_NOCAL = 0x00000001, // detection ignored for this analysis (photcode, time range) -- internal only 117 ID_MEAS_POOR_PHOTOM = 0x00000002, // detection is photometry outlier 118 ID_MEAS_SKIP_PHOTOM = 0x00000004, // detection was ignored for photometry measurement 119 ID_MEAS_AREA = 0x00000008, // detection near image edge 120 ID_MEAS_POOR_ASTROM = 0x00000010, // detection is astrometry outlier 121 ID_MEAS_SKIP_ASTROM = 0x00000020, // detection was ignored for astrometry measurement 122 ID_MEAS_USED_OBJ = 0x00000040, // detection was used during update objects 123 ID_MEAS_USED_CHIP = 0x00000080, // detection was used during update chips (XXX this probably does not make it into the db) 124 ID_MEAS_BLEND_MEAS = 0x00000100, // detection is within radius of multiple objects 125 ID_MEAS_BLEND_OBJ = 0x00000200, // multiple detections within radius of object 126 ID_MEAS_WARP_USED = 0x00000400, // measurement used to find mean warp photometry 127 ID_MEAS_UNMASKED_ASTRO = 0x00000800, // measurement was not masked in final astrometry fit 128 ID_MEAS_BLEND_MEAS_X = 0x00001000, // detection is within radius of multiple objects across catalogs 129 ID_MEAS_ARTIFACT = 0x00002000, // detection is thought to be non-astronomical 130 ID_MEAS_SYNTH_MAG = 0x00004000, // magnitude is synthetic 131 ID_MEAS_PHOTOM_UBERCAL = 0x00008000, // externally-supplied zero point from ubercal analysis 132 ID_MEAS_STACK_PRIMARY = 0x00010000, // this stack measurement is in the primary skycell 133 ID_MEAS_STACK_PHOT_SRC = 0x00020000, // this measurement supplied the stack photometry 134 ID_MEAS_ICRF_QSO = 0x00040000, // this measurement is an ICRF reference position 135 ID_MEAS_IMAGE_EPOCH = 0x00080000, // this measurement is registered to the image epoch (not tied to ref catalog epoch) 136 ID_MEAS_PHOTOM_PSF = 0x00100000, // this measurement is used for the mean psf mag 137 ID_MEAS_PHOTOM_APER = 0x00200000, // this measurement is used for the mean ap mag 138 ID_MEAS_PHOTOM_KRON = 0x00400000, // this measurement is used for the mean kron mag 139 ID_MEAS_MASKED_PSF = 0x01000000, // this measurement is masked based on IRLS weights for mean psf mag 140 ID_MEAS_MASKED_APER = 0x02000000, // this measurement is masked based on IRLS weights for mean ap mag 141 ID_MEAS_MASKED_KRON = 0x04000000, // this measurement is masked based on IRLS weights for mean kron mag 116 ID_MEAS_NOCAL = 0x00000001, // detection ignored for this analysis (photcode, time range) -- internal only 117 ID_MEAS_POOR_PHOTOM = 0x00000002, // detection is photometry outlier 118 ID_MEAS_SKIP_PHOTOM = 0x00000004, // detection was ignored for photometry measurement 119 ID_MEAS_AREA = 0x00000008, // detection near image edge 120 ID_MEAS_POOR_ASTROM = 0x00000010, // detection is astrometry outlier 121 ID_MEAS_SKIP_ASTROM = 0x00000020, // detection was ignored for astrometry measurement 122 ID_MEAS_USED_OBJ = 0x00000040, // detection was used during update objects 123 ID_MEAS_USED_CHIP = 0x00000080, // detection was used during update chips (XXX this probably does not make it into the db) 124 ID_MEAS_BLEND_MEAS = 0x00000100, // detection is within radius of multiple objects 125 ID_MEAS_BLEND_OBJ = 0x00000200, // multiple detections within radius of object 126 ID_MEAS_WARP_USED = 0x00000400, // measurement used to find mean warp photometry 127 ID_MEAS_UNMASKED_ASTRO = 0x00000800, // measurement was not masked in final astrometry fit 128 ID_MEAS_BLEND_MEAS_X = 0x00001000, // detection is within radius of multiple objects across catalogs 129 ID_MEAS_ARTIFACT = 0x00002000, // detection is thought to be non-astronomical 130 ID_MEAS_SYNTH_MAG = 0x00004000, // magnitude is synthetic 131 ID_MEAS_PHOTOM_UBERCAL = 0x00008000, // externally-supplied zero point from ubercal analysis 132 ID_MEAS_STACK_PRIMARY = 0x00010000, // this stack measurement is in the primary skycell 133 ID_MEAS_STACK_PHOT_SRC = 0x00020000, // this measurement supplied the stack photometry 134 ID_MEAS_ICRF_QSO = 0x00040000, // this measurement is an ICRF reference position 135 ID_MEAS_IMAGE_EPOCH = 0x00080000, // this measurement is registered to the image epoch (not tied to ref catalog epoch) 136 ID_MEAS_PHOTOM_PSF = 0x00100000, // this measurement is used for the mean psf mag 137 ID_MEAS_PHOTOM_APER = 0x00200000, // this measurement is used for the mean ap mag 138 ID_MEAS_PHOTOM_KRON = 0x00400000, // this measurement is used for the mean kron mag 139 ID_MEAS_MASKED_PSF = 0x01000000, // this measurement is masked based on IRLS weights for mean psf mag 140 ID_MEAS_MASKED_APER = 0x02000000, // this measurement is masked based on IRLS weights for mean ap mag 141 ID_MEAS_MASKED_KRON = 0x04000000, // this measurement is masked based on IRLS weights for mean kron mag 142 ID_MEAS_OBJECT_HAS_2MASS = 0x10000000, // measurement comes from an object with 2mass data 143 ID_MEAS_OBJECT_HAS_GAIA = 0x20000000, // measurement comes from an object with gaia data 144 ID_MEAS_OBJECT_HAS_TYCHO = 0x40000000, // measurement comes from an object with tycho data 142 145 } DVOMeasureFlags; 143 146 … … 233 236 ID_SECF_STACK_BESTDET = 0x00008000, // PS1 stack best measurement is a detection (not forced) 234 237 ID_SECF_STACK_PRIMDET = 0x00010000, // PS1 stack primary measurement is a detection (not forced) 238 239 ID_SECF_HAS_SDSS = 0x00100000, // this photcode has SDSS photometry 240 ID_SECF_HAS_HSC = 0x00200000, // this photcode has HSC photometry 241 ID_SECF_HAS_CFH = 0x00400000, // this photcode has CFH photometry (mostly Megacam) 242 ID_SECF_HAS_DES = 0x00800000, // this photcode has DES photometry 243 235 244 ID_SECF_OBJ_EXT = 0x01000000, // extended in this band 236 245 -
trunk/Ohana/src/libdvo/src/ImageMetadataSelection.c
r37807 r39926 59 59 } 60 60 61 // note that this function is called by the dvo clients and uses the 'metadata' table 62 // generated by the dvo shell for the mosaic images only. 61 63 Coords *MatchMosaicMetadata (unsigned int imageID) { 62 64 … … 73 75 mosaic.crval2 = image[m].crval2; 74 76 77 // note that image->theta is calculated based on pc1_1, pc1_2 when the metadata file is 78 // generated 75 79 mosaic.pc1_1 = cos(RAD_DEG*image[m].theta); 76 80 mosaic.pc1_2 = sin(RAD_DEG*image[m].theta); -
trunk/Ohana/src/libdvo/src/coordops.c
r39608 r39926 84 84 85 85 /** extra polynomial terms **/ 86 // for ZPN, these are used to modify the radial distance and not the X,Y coords 86 87 if ((coords[0].Npolyterms > 1) && (proj != PROJ_ZPN)) { 87 88 X2 = X*X; … … 126 127 if (proj == PROJ_WRP) { 127 128 if (!coords->mosaic) { 128 myAbort ("missing mosaic element"); 129 // myAbort ("missing mosaic element"); 130 *ra = L; 131 *dec = M; 129 132 return (FALSE); 130 133 } … … 157 160 ctht = 0.0; 158 161 } else { 159 T = DEG_RAD / R; 160 stht = T / sqrt ( 1.0 + T*T); 161 ctht = 1.0 / sqrt ( 1.0 + T*T); 162 // T = DEG_RAD / R; // T in 1/radians 163 // stht = T / sqrt ( 1.0 + T*T); 164 // ctht = 1.0 / sqrt ( 1.0 + T*T); 165 166 T = RAD_DEG * R; 167 stht = 1.0 / sqrt ( 1.0 + T*T); 168 ctht = T / sqrt ( 1.0 + T*T); 162 169 } 170 break; 171 case PROJ_SIN: 172 // R = (180/pi) cos (theta) 173 ctht = RAD_DEG * R; 174 stht = sqrt (1 - ctht*ctht); 163 175 break; 164 176 case PROJ_STG: … … 167 179 ctht = sqrt (1 - stht*stht); 168 180 break; 169 case PROJ_SIN:170 // R = (180/pi) cos (theta)171 ctht = RAD_DEG * R;172 stht = sqrt (1 - ctht*ctht);173 break;174 181 case PROJ_ARC: 175 182 // R = 90 - theta (degrees) … … 177 184 stht = cos (RAD_DEG * R); 178 185 break; 179 180 case PROJ_ZPN:181 // R = 90 - theta (degrees)182 // this is wrong because we are ignoring the distortion183 // XXX For now, just solve for terms up to n = 3184 185 // Ro = (pi/180)(90 - theta)186 // R = (180/pi)sum (P_i R^i)187 188 if (UKIRT_ONLY) {189 double Ro = RAD_DEG * R;190 double P1 = coords[0].polyterms[0][1];191 double P3 = coords[0].polyterms[0][3];192 193 // find the roots of f(gamma) = P1 gamma + P3 gamma^3 - Ro194 // starting guess for gamma is Ro / P1195 double gamma = Ro / P1;196 197 int i;198 for (i = 0; i < 5; i++) {199 double F = P1*gamma + P3*gamma*gamma*gamma - Ro;200 double dFdgamma = P1 + 3.0*P3*gamma*gamma;201 202 double gamma_new = gamma - F / dFdgamma;203 gamma = gamma_new;204 }205 206 double theta = 90.0 - gamma * DEG_RAD ;207 ctht = cos (RAD_DEG * theta);208 stht = sin (RAD_DEG * theta);209 break;210 }211 186 212 187 case PROJ_ZEA: … … 220 195 ctht = sqrt (1 - stht*stht); 221 196 break; 197 198 case PROJ_ZPN: 199 200 // the forward projection is: 201 // theta = atan2(stht, ctht) 202 // gamma = (pi/2 - theta) : theta in radians 203 // Ro = sum (P_i gamma^i) 204 // R = (180/pi) Ro 205 206 // given R, we need to find theta: 207 // Ro = R * (pi / 180) = sum (P_i gamma^i) 208 // solve sum (P_i gamma^i) - Ro = 0 using Newton-Raphson 209 210 // use Ro to get a guess for gamma and iterate 211 212 { 213 double Ro = RAD_DEG * R; 214 215 // find the roots of f(gamma) - Ro = 0 216 // starting guess for gamma is (Ro - P0) / P1 217 double gamma = (Ro - coords[0].polyterms[0][0]) / coords[0].polyterms[1][0]; 218 219 int iter; 220 for (iter = 0; iter < 5; iter++) { 221 222 double Rc = 0.0; // this will hold the ander 223 double dR = 0.0; 224 for (int i = coords[0].Npolyterms - 1; i > 1; i--) { 225 double Pi = (i < 7) ? coords[0].polyterms[i][0] : coords[0].polyterms[i-7][1]; 226 Rc = (Rc + Pi)*gamma; 227 dR = (dR + i*Pi)*gamma; 228 } 229 double P0 = coords[0].polyterms[0][0]; 230 double P1 = coords[0].polyterms[1][0]; 231 Rc = (Rc + P1)*gamma + P0; 232 dR = (dR + P1); 233 234 double gamma_new = gamma - (Rc - Ro) / dR; 235 gamma = gamma_new; 236 } 237 238 double theta = 90.0 - gamma * DEG_RAD ; 239 ctht = cos (RAD_DEG * theta); 240 stht = sin (RAD_DEG * theta); 241 break; 242 } 243 222 244 default: 223 245 return (FALSE); … … 354 376 355 377 case PROJ_ZPN: 378 // the forward projection is: 379 // theta = atan2(stht, ctht) 380 // gamma = (pi/2 - theta) : theta in radians 381 // Ro = sum (P_i gamma^i) 382 // R = (180/pi) Ro 383 356 384 // Ro = (pi/180)(90 - theta) 357 385 // R = (180/pi)sum (P_i R^i) 386 387 // is ZPN defined for Npolyterms = 0 or 1? 388 358 389 ctht = hypot(sphi, cphi); 359 390 theta = atan2 (stht, ctht); 360 391 361 double Rc; 362 if (UKIRT_ONLY) { 363 double P1 = coords[0].polyterms[0][1]; 364 double P3 = coords[0].polyterms[0][3]; 365 double gamma = RAD_DEG * (90 - DEG_RAD * theta); 366 Rc = P1*gamma + P3*gamma*gamma*gamma; 367 } else { 368 double Ro = RAD_DEG * (90 - DEG_RAD * theta); 369 370 // i = 0 .. Npolyterms - 1 (1 <= Npolyterms <= 21) 371 i = coords[0].Npolyterms - 1; 372 Rc = 0.0; 373 while (i > 0) { 374 if (i < 7) { 375 Rc = (Rc + coords[0].polyterms[0][i])*Ro; 376 } else { 377 Rc = (Rc + coords[0].polyterms[1][i-7])*Ro; 378 } 379 i --; 380 } 381 Rc += coords[0].polyterms[0][i]; 392 double Ro; 393 double gamma = M_PI_2 - theta; 394 395 // i = 0 .. Npolyterms - 1 (1 <= Npolyterms <= 21) 396 Ro = 0.0; 397 for (i = coords[0].Npolyterms - 1; i > 0; i --) { 398 double Pi = (i < 7) ? coords[0].polyterms[i][0] : coords[0].polyterms[i-7][1]; 399 Ro = (Ro + Pi)*gamma; 382 400 } 383 Rc = DEG_RAD * Rc; 401 Ro += coords[0].polyterms[0][0]; 402 403 Rc = DEG_RAD * Ro; 384 404 385 405 *L = (ctht == 0.0) ? 0.0 : +Rc * sphi / ctht ; … … 609 629 enum {COORD_TYPE_NONE, COORD_TYPE_PC, COORD_TYPE_ROT, COORD_TYPE_CD, COORD_TYPE_LIN}; 610 630 631 int GetRadialZPN (Coords *coords, Header *header); 632 611 633 int GetCoords (Coords *coords, Header *header) { 612 634 613 int i,status, status1, status2, itmp, Polynomial, Polyterm;635 int status, status1, status2, itmp, Polynomial, Polyterm; 614 636 double Lambda, rotate, rotate1, rotate2, scale; 615 637 double equinox; … … 666 688 status &= gfits_scan (header, "PC002002", "%f", 1, &coords[0].pc2_2); 667 689 690 ctype = &coords[0].ctype[4]; 691 692 // read the ZPN coeffients PV2_i (i = 0 < 14) 693 // ZPN is inconsistent with the other Polynomial types 694 if (!strcmp (ctype, "-ZPN")) { 695 GetRadialZPN (coords, header); 696 break; 697 } 698 668 699 /* set NPLYTERM based on header. if NPLYTERM is missing, it should have a 669 700 value of 0, unless the projection type is one of PLY, DIS, WRP, in which 670 701 case it should be set to 3 */ 671 ctype = &coords[0].ctype[4];672 702 Polynomial = !strcmp (ctype, "-PLY") || !strcmp (ctype, "-DIS") || !strcmp (ctype, "-WRP"); 673 703 Polyterm = gfits_scan (header, "NPLYTERM", "%d", 1, &itmp); … … 723 753 coords[0].pc2_1 = sin(rotate*RAD_DEG) / Lambda; 724 754 coords[0].pc2_2 = cos(rotate*RAD_DEG); 755 756 // read the ZPN coeffients PV2_i (i = 0 < 14) 757 if (!strcmp (&coords[0].ctype[4], "-ZPN")) GetRadialZPN (coords, header); 725 758 break; 726 759 … … 744 777 coords[0].pc2_2 /= scale; 745 778 746 if (!strcmp (&coords[0].ctype[4], "-ZPN")) { 747 int found; 748 for (i = 0; i < 14; i++) { 749 char name[64]; 750 snprintf (name, 64, "PV2_%d", i); 751 if (i < 7) { 752 found = gfits_scan (header, name, "%f", 1, &coords[0].polyterms[0][i]); 753 } else { 754 found = gfits_scan (header, name, "%f", 1, &coords[0].polyterms[1][i-7]); 755 } 756 if ((i == 0) && !found) { 757 coords[0].polyterms[0][0] = 0.0; 758 continue; 759 } 760 if ((i == 1) && !found) { 761 coords[0].polyterms[0][1] = 1.0; 762 continue; 763 } 764 if (!found) { 765 coords[0].Npolyterms = i; 766 break; 767 } 768 } 769 } 779 // read the ZPN coeffients PV2_i (i = 0 < 14) 780 if (!strcmp (&coords[0].ctype[4], "-ZPN")) GetRadialZPN (coords, header); 770 781 break; 771 782 … … 819 830 } 820 831 return (status); 832 } 833 834 int GetRadialZPN (Coords *coords, Header *header) { 835 836 // RA---ZPN can have up to 14 radial polynomial terms. these are stored in 837 // polyterms[0][0] - [6][0] for the first 7 and [0][1] - [6][1] for the rest 838 // these terms are coeffients of a polynomial of the radial distances 839 840 // read the ZPN coeffients PV2_i (i = 0 < 14) 841 int found; 842 int Nmax = 0; 843 for (int i = 0; i < 14; i++) { 844 char name[64]; 845 snprintf (name, 64, "PV2_%d", i); 846 if (i < 7) { 847 coords[0].polyterms[i][0] = 0.0; 848 found = gfits_scan (header, name, "%f", 1, &coords[0].polyterms[i][0]); 849 } else { 850 coords[0].polyterms[i-7][1] = 0.0; 851 found = gfits_scan (header, name, "%f", 1, &coords[0].polyterms[i-7][1]); 852 } 853 // PV2_1 is implicit if not present 854 if ((i == 1) && !found) { 855 coords[0].polyterms[1][0] = 1.0; 856 continue; 857 } 858 // set Npolyterms based on the largest coefficient found 859 if (found) { 860 Nmax = i; 861 } 862 } 863 coords[0].Npolyterms = Nmax + 1; 864 return TRUE; 821 865 } 822 866 -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r39670 r39926 427 427 break; 428 428 case MEAS_TMEAN: /* OK */ 429 value.Flt = TimeValue (average[0].Tmean, TimeReference, TimeFormat); 430 break; 431 case MEAS_TRANGE: /* OK */ 429 432 value.Flt = GetTimeRange (average[0].Trange, TimeFormat); 430 break;431 case MEAS_TRANGE: /* OK */432 value.Flt = TimeValue (average[0].Trange, 0, TimeFormat);433 433 break; 434 434 case MEAS_NMEAS: /* OK */ … … 461 461 break; 462 462 case MEAS_RA_FIT_OFFSET: /* OK */ 463 // RA_epoch_fit = RA_mean + uR*(t - Tmean)/cos(dec) + plx*parR 464 // note that this extraction ignores parallax 463 465 dT = (measure[0].t - average[0].Tmean) / (86400*365.25); 464 dR = dvoOffsetR (measure, average); 465 value.Flt = average[0].uR * dT + dR; 466 dR = dvoOffsetR (measure, average); // RA_epoch - RA_mean (** NOT local linear distance **) 467 value.Flt = dR*cos(RAD_DEG*measure[0].D) - average[0].uR * dT; 468 // this is the local linear distance of the measurement from the fit 466 469 break; 467 470 case MEAS_DEC_FIT_OFFSET: /* OK */ 468 471 dT = (measure[0].t - average[0].Tmean) / (86400*365.25); 469 472 dD = dvoOffsetD (measure, average); 470 value.Flt = average[0].uD * dT + dD;473 value.Flt = dD - average[0].uD * dT; 471 474 break; 472 475 case MEAS_RA_OFFSET_ERR: /* OK */ -
trunk/Ohana/src/libdvo/src/galaxy_model.c
r39588 r39926 28 28 V_sol = 11.18; // km/sec 29 29 W_sol = 7.61; // km/sec 30 return TRUE; 31 } 32 if (!strcmp(version, "TEST-CONSTANT")) { 33 // use for testing 34 A_oort = +47.40; // km/sec/kpc 35 B_oort = -47.40; // km/sec/kpc 36 U_sol = 0.00; // km/sec 37 V_sol = 0.00; // km/sec 38 W_sol = 0.00; // km/sec 39 return TRUE; 40 } 41 if (!strcmp(version, "TEST-ZERO")) { 42 // use for testing 43 A_oort = 0.00; // km/sec/kpc 44 B_oort = 0.00; // km/sec/kpc 45 U_sol = 0.00; // km/sec 46 V_sol = 0.00; // km/sec 47 W_sol = 0.00; // km/sec 30 48 return TRUE; 31 49 } -
trunk/Ohana/src/libfits/header/F_H_field.c
r38986 r39926 90 90 ptr = buf + 9; // start of following keyword 91 91 if (strncmp (field, ptr, Nfield)) continue; 92 if (ptr[Nfield + 1] != '=') continue; // the strncmp above will match a longer string which matches the subset of field (e.g., FOO will match FOOBAR and FOO). test for the following '=' sign 92 93 Nfound ++; 93 94 if (Nfound == N) return (ptr); -
trunk/Ohana/src/libkapa/Makefile
r39590 r39926 34 34 $(SRC)/KapaWindow.$(ARCH).o \ 35 35 $(SRC)/KapaColors.$(ARCH).o \ 36 $(SRC)/KapaStyles.$(ARCH).o \ 36 37 $(SRC)/KapaOpen.$(ARCH).o 37 38 -
trunk/Ohana/src/libkapa/include/kapa.h
r38986 r39926 25 25 typedef struct sockaddr_in KapaSockAddress; 26 26 27 typedef struct { 28 float *data1d; 29 float **data2d; 30 int Nx; 31 int Ny; 32 } KiiImage; 33 34 typedef struct { 35 float x; 36 float y; 37 float dx; 38 float dy; 39 float angle; 40 int type; 41 } KiiOverlayBase; 42 43 typedef struct { 44 float x; 45 float y; 46 float dx; 47 float dy; 48 float angle; 49 int type; 50 char *text; 51 } KiiOverlay; 27 // retain historical numerical definitions: 28 typedef enum { 29 KAPA_LINE_INVALID_MIN = -1, 30 KAPA_LINE_SOLID = 0, 31 KAPA_LINE_DOT = 1, 32 KAPA_LINE_DASH_SHORT = 2, 33 KAPA_LINE_DASH_LONG = 3, 34 KAPA_LINE_DOT_DASH = 4, 35 KAPA_LINE_INVALID_MAX = 5, 36 } KapaLineType; 37 38 // retain historical numerical definitions: 39 typedef enum { 40 KAPA_PLOT_INVALID_MIN = -1, 41 KAPA_PLOT_CONNECT = 0, 42 KAPA_PLOT_HISTOGRAM = 1, 43 KAPA_PLOT_POINTS = 2, 44 KAPA_PLOT_INVALID_MAX = 3, 45 } KapaPlotStyle; 46 47 typedef enum { 48 KAPA_POINT_INVALID_MIN = -1, 49 KAPA_POINT_BOX_SOLID = 0, 50 KAPA_POINT_BOX_OPEN = 1, 51 KAPA_POINT_CROSS = 2, // OR PLUS 52 KAPA_POINT_X = 3, 53 KAPA_POINT_Y = 4, 54 KAPA_POINT_TRIANGLE_SOLID = 5, 55 KAPA_POINT_TRIANGLE_OPEN = 6, 56 KAPA_POINT_CIRCLE_OPEN = 7, 57 KAPA_POINT_PENTAGON = 8, 58 KAPA_POINT_HEXAGON = 9, 59 KAPA_POINT_CIRCLE_SOLID = 10, 60 KAPA_POINT_TRIANGLE_SOLID_DOWN = 11, 61 KAPA_POINT_TRIANGLE_OPEN_DOWN = 12, 62 KAPA_POINT_Y_DOWN = 13, 63 KAPA_POINT_INVALID_MAX = 14, 64 KAPA_POINT_PAIR_CONNECT = 100, // change to a plot style? 65 } KapaPointStyle; 66 // note that PAIR_CONNECT was historically 100 67 52 68 53 69 typedef enum { … … 75 91 KAPA_PS_RAWPAGE 76 92 } KapaPSmode; 93 94 typedef struct { 95 float *data1d; 96 float **data2d; 97 int Nx; 98 int Ny; 99 } KiiImage; 100 101 typedef struct { 102 float x; 103 float y; 104 float dx; 105 float dy; 106 float angle; 107 int type; 108 } KiiOverlayBase; 109 110 typedef struct { 111 float x; 112 float y; 113 float dx; 114 float dy; 115 float angle; 116 int type; 117 char *text; 118 } KiiOverlay; 77 119 78 120 typedef struct { … … 219 261 unsigned long *KapaX11colors (Display *display, Colormap colormap, unsigned long default_color, int *Ncolors); 220 262 263 /* KapaStyles.c */ 264 KapaLineType KapaLineTypeFromString (char *string); 265 KapaPlotStyle KapaPlotStyleFromString (char *string); 266 KapaPointStyle KapaPointStyleFromString (char *string); 267 221 268 /* RotFont.c */ 222 269 void InitRotFonts PROTO((void)); -
trunk/Ohana/src/libkapa/src/KapaOpen.c
r39457 r39926 6 6 # define MY_PORT 2500 7 7 # define MY_PORT_MAX 2520 8 # define MY_WAIT 100000 8 # define MY_WAIT 1000000 9 9 # define DEBUG 0 10 10 -
trunk/Ohana/src/libkapa/src/KapaWindow.c
r39652 r39926 449 449 return (TRUE); 450 450 } 451 -
trunk/Ohana/src/libkapa/src/bDrawFuncs.c
r36488 r39926 222 222 e = 0; 223 223 for (X = X1, N = 0; X <= X2; X++, N++) { 224 if (buffer->bType == 1) { DashOn = (N % 10) < 5; } 225 if (buffer->bType == 2) { DashOn = (N % 6) < 3; } 224 if (buffer->bType == KAPA_LINE_DOT) { 225 DashOn = (N % 5) == 0 || (N % 5) == 1; 226 } 227 if (buffer->bType == KAPA_LINE_DASH_SHORT) { 228 DashOn = (N % 8) < 4; 229 } 230 if (buffer->bType == KAPA_LINE_DASH_LONG) { 231 DashOn = (N % 16) < 8; 232 } 233 if (buffer->bType == KAPA_LINE_DOT_DASH) { 234 DashOn = ((N % 12) < 2) || ((N % 12 >= 6) && (N % 12 < 10)) ; 235 } 226 236 if (swapcoords) { 227 237 if (DashOn) bDrawPoint (buffer, Y,X); -
trunk/Ohana/src/opihi/cmd.astro/csystem.c
r39591 r39926 125 125 opihi_flt *yptr = yvec[0].elements.Flt; 126 126 127 opihi_flt *uxptr = uxvec ? xvec[0].elements.Flt : NULL;128 opihi_flt *uyptr = uyvec ? yvec[0].elements.Flt : NULL;127 opihi_flt *uxptr = uxvec ? uxvec[0].elements.Flt : NULL; 128 opihi_flt *uyptr = uyvec ? uyvec[0].elements.Flt : NULL; 129 129 130 130 for (i = 0; i < xvec[0].Nelements; i++, xptr++, yptr++) { -
trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c
r39610 r39926 158 158 // now that the mask has been updated, we need to recalculate mean epoch and positions 159 159 // XXX make this conditional on actually masking unmasked points above 160 PlxSetMeanEpoch (R, D, T, &Rmean, &Dmean, &Tmean, mask, Ntotal);161 PlxSetEpochPosition (&fitdata, R, D, dR, dD, T, mask, Ntotal, &coords, Tmean);160 // PlxSetMeanEpoch (R, D, T, &Rmean, &Dmean, &Tmean, mask, Ntotal); 161 // PlxSetEpochPosition (&fitdata, R, D, dR, dD, T, mask, Ntotal, &coords, Tmean); 162 162 163 163 PlxFitData sample; … … 218 218 // fprintf (stderr, "%f +/- %f | %f %f\n", fit.p, fit.dp, fit.uR, fit.uD); 219 219 220 /* 221 FILE *f = fopen ("test.pf.dat", "w"); 220 Vector *dRresPMP, *dDresPMP, *dRresPLX, *dDresPLX; 221 222 // save fit residuals (with only pm removed, and pm and plx removed) 223 if ((dRresPMP = SelectVector ("dRresPMP", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dRresPMP"); 224 if ((dDresPMP = SelectVector ("dDresPMP", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPMP"); 225 if ((dRresPLX = SelectVector ("dRresPLX", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dRresPLX"); 226 if ((dDresPLX = SelectVector ("dDresPLX", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPLX"); 227 228 ResetVector (dRresPMP, OPIHI_FLT, Ntotal); 229 ResetVector (dDresPMP, OPIHI_FLT, Ntotal); 230 ResetVector (dRresPLX, OPIHI_FLT, Ntotal); 231 ResetVector (dDresPLX, OPIHI_FLT, Ntotal); 232 222 233 for (i = 0; i < Ntotal; i++) { 223 double Xf = fit.Ro + fit.uR*fitdata.t[i] + fit.p*fitdata.pX[i]; 224 double Yf = fit.Do + fit.uD*fitdata.t[i] + fit.p*fitdata.pY[i]; 225 fprintf (f, "%f : %f %f : %f %f : %f : %f %f : %f %f\n", T[i], R[i], D[i], Xf, Yf, fitdata.t[i], fitdata.X[i], fitdata.Y[i], fitdata.pX[i], fitdata.pY[i]); 226 } 227 fclose (f); 228 */ 234 235 double x0, y0; 236 RD_to_XY (&x0, &y0, R[i], D[i], &coords); 237 238 double pX0, pY0; 239 ParFactor (&pX0, &pY0, R[i], D[i], T[i]); 240 241 double t0 = (T[i] - Tmean)/365.25; 242 243 double Xpmp = fit.Ro + fit.uR*t0 + fit.p*pX0; 244 double Ypmp = fit.Do + fit.uD*t0 + fit.p*pY0; 245 double Xplx = fit.Ro + fit.uR*t0; 246 double Yplx = fit.Do + fit.uD*t0; 247 248 dRresPMP->elements.Flt[i] = x0 - Xpmp; 249 dDresPMP->elements.Flt[i] = y0 - Ypmp; 250 dRresPLX->elements.Flt[i] = x0 - Xplx; 251 dDresPLX->elements.Flt[i] = y0 - Yplx; 252 } 229 253 230 254 // fprintf (stderr, "Roff, Doff: %f, %f; dRo, dDo: %f, %f\n", fit.Ro, fit.Do, fit.dRo, fit.dDo); -
trunk/Ohana/src/opihi/cmd.astro/spex1dgas.c
r33662 r39926 108 108 IDList = NULL; 109 109 XoList = NULL; 110 {111 // init random numbers112 long A, B;113 A = time(NULL);114 for (B = 0; A == time(NULL); B++);115 srand48(B);116 }117 110 111 // srand48() is called by startup.c 112 118 113 if (argc != 11) goto usage; 119 114 -
trunk/Ohana/src/opihi/cmd.astro/spex2dgas.c
r33662 r39926 120 120 float XoMax, YoMax; 121 121 122 { 123 // init random numbers 124 long A, B; 125 A = time(NULL); 126 for (B = 0; A == time(NULL); B++); 127 srand48(B); 128 } 129 122 // srand48() is called by startup.c 123 130 124 if (argc != 9) goto usage; 131 125 -
trunk/Ohana/src/opihi/cmd.astro/spexseq.c
r39457 r39926 90 90 int Nobject = 0; 91 91 92 {93 // init random numbers94 long A, B;95 A = time(NULL);96 for (B = 0; A == time(NULL); B++);97 srand48(B);98 }99 100 92 if (argc != 6) goto usage; 93 94 // srand48() is called by startup.c 101 95 102 96 // XXX enforce matching lengths on the three vectors -
trunk/Ohana/src/opihi/cmd.data/Makefile
r39638 r39926 124 124 $(SRC)/resize.$(ARCH).o \ 125 125 $(SRC)/relocate.$(ARCH).o \ 126 $(SRC)/rndseed.$(ARCH).o \ 126 127 $(SRC)/roll.$(ARCH).o \ 127 128 $(SRC)/rotate.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r39638 r39926 113 113 int reindex PROTO((int, char **)); 114 114 int relocate PROTO((int, char **)); 115 int rndseed PROTO((int, char **)); 115 116 int roll PROTO((int, char **)); 116 117 int rotate PROTO((int, char **)); … … 293 294 {1, "relocate", relocate, "set graphics/image window position"}, 294 295 {1, "roll", roll, "roll image to new start point"}, 296 {1, "rndseed", rndseed, "set the pseudo-random seed"}, 295 297 {1, "rotate", rotate, "rotate image"}, 296 298 {1, "save", save, "save an SAOimage style image overlay"}, -
trunk/Ohana/src/opihi/cmd.data/match2d.c
r36084 r39926 1 1 # include "data.h" 2 2 3 int find_matches2d (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2 );3 int find_matches2d (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2, Vector *radiusMatch); 4 4 int find_matches2d_closest (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index); 5 6 int find_matches2d_sphere (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2, Vector *radiusMatch); 7 int find_matches2d_sphere_closest (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index); 5 8 6 9 // match2d (X1) (Y1) (X2) (Y2) (Radius) [-index1 (index1)] [-index2 (index2)] [-nomatch1 nomatch1] [-nomatch2 nomatch2] … … 23 26 } 24 27 28 int SPHERE_DISTANCE = FALSE; 29 if ((N = get_argument (argc, argv, "-sphere"))) { 30 remove_argument (N, &argc, argv); 31 SPHERE_DISTANCE = TRUE; 32 } 33 if ((N = get_argument (argc, argv, "-sky"))) { 34 remove_argument (N, &argc, argv); 35 SPHERE_DISTANCE = TRUE; 36 } 37 25 38 if ((N = get_argument (argc, argv, "-index1"))) { 26 39 remove_argument (N, &argc, argv); … … 37 50 } else { 38 51 if ((index2 = SelectVector ("index2", ANYVECTOR, TRUE)) == NULL) return (FALSE); 52 } 53 54 55 Vector *radiusMatch = NULL; 56 if ((N = get_argument (argc, argv, "-radius"))) { 57 if (CLOSEST) { 58 gprint (GP_ERR, "error: -radius and -closest are currently incompatible\n"); 59 return (FALSE); 60 } 61 remove_argument (N, &argc, argv); 62 if ((radiusMatch = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE); 63 remove_argument (N, &argc, argv); 39 64 } 40 65 … … 84 109 } 85 110 86 if (CLOSEST) { 111 if (SPHERE_DISTANCE) { 112 if (CLOSEST) { 113 find_matches2d_sphere_closest (X1vec, Y1vec, X2vec, Y2vec, Radius, index1); 114 find_matches2d_sphere_closest (X2vec, Y2vec, X1vec, Y1vec, Radius, index2); 115 } else { 116 find_matches2d_sphere (X1vec, Y1vec, X2vec, Y2vec, Radius, index1, index2, radiusMatch); 117 } 118 } else { 119 if (CLOSEST) { 87 120 find_matches2d_closest (X1vec, Y1vec, X2vec, Y2vec, Radius, index1); 88 121 find_matches2d_closest (X2vec, Y2vec, X1vec, Y1vec, Radius, index2); 89 } else {90 find_matches2d (X1vec, Y1vec, X2vec, Y2vec, Radius, index1, index2 );91 }92 122 } else { 123 find_matches2d (X1vec, Y1vec, X2vec, Y2vec, Radius, index1, index2, radiusMatch); 124 } 125 } 93 126 return (TRUE); 94 127 … … 108 141 gprint (GP_ERR, "use 'reindex' to generate new vectors based on these index vectors\n"); 109 142 143 gprint (GP_ERR, "if -sphere or -sky is supplied, (x1,y1) and (x2,y2) are treaded as (ra,dec) or (long,lat) pairs in degrees\n"); 144 145 gprint (GP_ERR, "if -radius (vector) is supplied, the vector will be filled with the distance between the matched pairs\n"); 146 gprint (GP_ERR, " not valid with -closest\n"); 110 147 return FALSE; 111 148 } 112 149 113 150 // we are not defining a relative offset DX,DY for now 114 int find_matches2d (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2 ) {151 int find_matches2d (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2, Vector *radiusMatch) { 115 152 116 153 off_t i, j, first_j, I, J, *N1, *N2, Nmatch, NMATCH, DMATCH; … … 122 159 ResetVector (index1, OPIHI_INT, NMATCH); 123 160 ResetVector (index2, OPIHI_INT, NMATCH); 161 if (radiusMatch) ResetVector (radiusMatch, OPIHI_FLT, NMATCH); 124 162 125 163 ALLOCATE (N1, off_t, X1->Nelements); … … 154 192 index1->elements.Int[Nmatch] = I; 155 193 index2->elements.Int[Nmatch] = J; 194 if (radiusMatch) radiusMatch->elements.Flt[Nmatch] = dR; 156 195 157 196 // XXX track matches 1 and 2 with internal vector, save new nomatch index vectors … … 163 202 REALLOCATE (index1->elements.Int, opihi_int, NMATCH); 164 203 REALLOCATE (index2->elements.Int, opihi_int, NMATCH); 204 if (radiusMatch) { REALLOCATE (radiusMatch->elements.Flt, opihi_flt, NMATCH); } 165 205 } 166 206 } … … 171 211 index1->Nelements = Nmatch; 172 212 index2->Nelements = Nmatch; 213 if (radiusMatch) radiusMatch->Nelements = Nmatch; 173 214 174 215 free (N1); … … 246 287 return (TRUE); 247 288 } 289 290 double gcdist (double r1, double d1, double r2, double d2) { 291 double num,den; 292 r1 *= RAD_DEG; 293 d1 *= RAD_DEG; 294 r2 *= RAD_DEG; 295 d2 *= RAD_DEG; 296 297 num = sqrt(pow((cos(d2) * sin(r2 - r1)),2) + 298 pow((cos(d1) * sin(d2) - 299 sin(d1) * cos(d2) * cos(r2 - r1)),2)); 300 den = (sin(d1) * sin(d2) + cos(d1) * cos(d2) * cos(r2 - r1)); 301 return(atan2(num,den) * (180 / M_PI)); 302 } 303 304 typedef struct { 305 double sD; 306 double cD; 307 double sR; 308 double cR; 309 } Match2D_PreCalc; 310 311 double gcdist_PreCalc_v0 (Match2D_PreCalc *p1, Match2D_PreCalc *p2) { 312 double num,den; 313 314 num = sqrt(pow((p2->cD * (p2->sR*p1->cR - p1->sR*p2->cR)),2) + 315 pow((p1->cD * p2->sD - 316 p1->sD * p2->cD * (p2->cR*p1->cR + p2->sR*p1->sR)),2)); 317 den = (p1->sD * p2->sD + p1->cD * p2->cD * (p2->cR*p1->cR + p2->sR*p1->sR)); 318 return(atan2(num,den) * (180 / M_PI)); 319 } 320 321 // we are not defining a relative offset DX,DY for now 322 double gcdist_PreCalc (Match2D_PreCalc *p1, Match2D_PreCalc *p2) { 323 double num,den; 324 325 // double Qd = p1->sD * p1->cD * p2->sD * p2->cD; 326 // double Qr = p1->sR * p1->cR * p2->sR * p2->cR; 327 328 // double Xa 329 // = SQ(p2->cD * p1->cR * p2->sR) 330 // + SQ(p2->cD * p1->sR * p2->cR) - 331 // - 2 * SQ(p2->cD) * Qr; 332 333 double cdR = (p2->cR*p1->cR + p2->sR*p1->sR); 334 335 double Xa = SQ(p2->cD * p2->sR * p1->cR - p2->cD * p1->sR * p2->cR); 336 double Xb = SQ(p1->cD * p2->sD - p1->sD * p2->cD * cdR); 337 338 num = sqrt(Xa + Xb); 339 den = (p1->sD * p2->sD + p1->cD * p2->cD * cdR); 340 return(atan2(num,den) * (180 / M_PI)); 341 } 342 343 // we are not defining a relative offset DX,DY for now 344 int find_matches2d_sphere (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2, Vector *radiusMatch) { 345 346 off_t i, j, first_j, I, J, *N1, *N2, Nmatch, NMATCH, DMATCH; 347 double dY, dR; 348 349 NMATCH = MAX(MAX(0.05*X1->Nelements, 0.05*X2->Nelements), 1000); 350 DMATCH = NMATCH; 351 352 ResetVector (index1, OPIHI_INT, NMATCH); 353 ResetVector (index2, OPIHI_INT, NMATCH); 354 if (radiusMatch) ResetVector (radiusMatch, OPIHI_FLT, NMATCH); 355 356 ALLOCATE (N1, off_t, X1->Nelements); 357 ALLOCATE (N2, off_t, X2->Nelements); 358 359 ALLOCATE_PTR (A1, Match2D_PreCalc, X1->Nelements); 360 ALLOCATE_PTR (A2, Match2D_PreCalc, X2->Nelements); 361 362 for (i = 0; i < X1->Nelements; i++) { 363 A1[i].sR = sin(RAD_DEG*X1->elements.Flt[i]); 364 A1[i].cR = cos(RAD_DEG*X1->elements.Flt[i]); 365 A1[i].sD = sin(RAD_DEG*Y1->elements.Flt[i]); 366 A1[i].cD = cos(RAD_DEG*Y1->elements.Flt[i]); 367 N1[i] = i; 368 } 369 for (i = 0; i < X2->Nelements; i++) { 370 A2[i].sR = sin(RAD_DEG*X2->elements.Flt[i]); 371 A2[i].cR = cos(RAD_DEG*X2->elements.Flt[i]); 372 A2[i].sD = sin(RAD_DEG*Y2->elements.Flt[i]); 373 A2[i].cD = cos(RAD_DEG*Y2->elements.Flt[i]); 374 N2[i] = i; 375 } 376 377 // sort from one pole to the other 378 sort_coords_indexonly (Y1->elements.Flt, X1->elements.Flt, N1, X1->Nelements); 379 sort_coords_indexonly (Y2->elements.Flt, X2->elements.Flt, N2, X2->Nelements); 380 381 Nmatch = 0; 382 for (i = j = 0; (i < X1->Nelements) && (j < X2->Nelements);) { 383 I = N1[i]; 384 J = N2[j]; 385 386 // we can use dY as minimal requirement: if dY > Radius, we are too far apart 387 dY = Y1->elements.Flt[I] - Y2->elements.Flt[J]; 388 389 if (dY <= -1.02*Radius) { i++; continue; } 390 if (dY >= +1.02*Radius) { j++; continue; } 391 392 // look for all matches of list2() to list1(i) 393 first_j = j; 394 for (j = first_j; (dY > -1.02*Radius) && (j < X2->Nelements); j++) { 395 J = N2[j]; 396 397 dR = gcdist_PreCalc (&A1[I], &A2[J]); 398 // dR = gcdist (X1->elements.Flt[I], Y1->elements.Flt[I], X2->elements.Flt[J], Y2->elements.Flt[J]); 399 400 if (dR < Radius) { 401 index1->elements.Int[Nmatch] = I; 402 index2->elements.Int[Nmatch] = J; 403 if (radiusMatch) radiusMatch->elements.Flt[Nmatch] = dR; 404 405 // XXX track matches 1 and 2 with internal vector, save new nomatch index vectors 406 // after this loop 407 408 Nmatch ++; 409 if (Nmatch >= NMATCH) { 410 NMATCH += DMATCH; 411 REALLOCATE (index1->elements.Int, opihi_int, NMATCH); 412 REALLOCATE (index2->elements.Int, opihi_int, NMATCH); 413 if (radiusMatch) { REALLOCATE (radiusMatch->elements.Flt, opihi_flt, NMATCH); } 414 } 415 } 416 } 417 j = first_j; 418 i++; 419 } 420 index1->Nelements = Nmatch; 421 index2->Nelements = Nmatch; 422 if (radiusMatch) radiusMatch->Nelements = Nmatch; 423 424 free (A1); 425 free (A2); 426 427 free (N1); 428 free (N2); 429 430 return (TRUE); 431 } 432 433 // we are not defining a relative offset DX,DY for now 434 int find_matches2d_sphere_closest (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index) { 435 436 off_t i, j, Jmin, Ji, I, J, *N1, *N2; 437 double dY, dR, Rmin; 438 439 ResetVector (index, OPIHI_INT, X1->Nelements); 440 for (i = 0; i < index->Nelements; i++) { index->elements.Int[i] = -1; } 441 442 ALLOCATE (N1, off_t, X1->Nelements); 443 ALLOCATE (N2, off_t, X2->Nelements); 444 445 ALLOCATE_PTR (A1, Match2D_PreCalc, X1->Nelements); 446 ALLOCATE_PTR (A2, Match2D_PreCalc, X2->Nelements); 447 448 for (i = 0; i < X1->Nelements; i++) { 449 A1[i].sR = sin(RAD_DEG*X1->elements.Flt[i]); 450 A1[i].cR = cos(RAD_DEG*X1->elements.Flt[i]); 451 A1[i].sD = sin(RAD_DEG*Y1->elements.Flt[i]); 452 A1[i].cD = cos(RAD_DEG*Y1->elements.Flt[i]); 453 N1[i] = i; 454 } 455 for (i = 0; i < X2->Nelements; i++) { 456 A2[i].sR = sin(RAD_DEG*X2->elements.Flt[i]); 457 A2[i].cR = cos(RAD_DEG*X2->elements.Flt[i]); 458 A2[i].sD = sin(RAD_DEG*Y2->elements.Flt[i]); 459 A2[i].cD = cos(RAD_DEG*Y2->elements.Flt[i]); 460 N2[i] = i; 461 } 462 463 // sort from one pole to the other 464 sort_coords_indexonly (Y1->elements.Flt, X1->elements.Flt, N1, X1->Nelements); 465 sort_coords_indexonly (Y2->elements.Flt, X2->elements.Flt, N2, X2->Nelements); 466 467 for (i = j = 0; (i < X1->Nelements) && (j < X2->Nelements);) { 468 I = N1[i]; 469 J = N2[j]; 470 471 // we can use dY as minimal requirement: if dY > Radius, we are too far apart 472 dY = Y1->elements.Flt[I] - Y2->elements.Flt[J]; 473 474 if (dY <= -1.02*Radius) { 475 // no match in list 2 to this entry 476 index->elements.Int[I] = -1; // (probably not needed --- index is init'ed above)o 477 i++; 478 continue; 479 } 480 if (dY >= +1.02*Radius) { j++; continue; } 481 482 // look for all matches of list2() to list1(i) 483 Jmin = -1; 484 Rmin = Radius; 485 for (Ji = j; (dY > -1.02*Radius) && (Ji < X2->Nelements); Ji++) { 486 J = N2[Ji]; 487 488 dR = gcdist_PreCalc (&A1[I], &A2[J]); 489 // dR = gcdist (X1->elements.Flt[I], Y1->elements.Flt[I], X2->elements.Flt[J], Y2->elements.Flt[J]); 490 491 if (dR < Rmin) { 492 Rmin = dR; 493 Jmin = J; 494 } 495 } 496 497 498 // no match in list 2 to this entry 499 if (Jmin == -1) { 500 index->elements.Int[I] = -1; 501 i++; 502 continue; 503 } 504 index->elements.Int[I] = Jmin; 505 i++; 506 } 507 508 free (A1); 509 free (A2); 510 511 free (N1); 512 free (N2); 513 514 return (TRUE); 515 } 516 517 -
trunk/Ohana/src/opihi/cmd.data/stats-new.c
r15274 r39926 129 129 ALLOCATE (values, float, Nsample); 130 130 131 A = time(NULL); 132 for (B = 0; A == time(NULL); B++); 133 srand48(B); 131 // srand48() is called by startup.c 134 132 135 133 *buffer = (float *) matrix[0].buffer; -
trunk/Ohana/src/opihi/dvo/imbox.c
r37807 r39926 15 15 16 16 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 17 18 char *xaxis = NULL; 19 if ((N = get_argument (argc, argv, "-xaxis"))) { 20 remove_argument (N, &argc, argv); 21 xaxis = strcreate (argv[N]); 22 remove_argument (N, &argc, argv); 23 } 24 char *yaxis = NULL; 25 if ((N = get_argument (argc, argv, "-yaxis"))) { 26 remove_argument (N, &argc, argv); 27 yaxis = strcreate (argv[N]); 28 remove_argument (N, &argc, argv); 29 } 17 30 18 31 SOLO_PHU = FALSE; … … 61 74 // XXX currently, image uses an unsigned short for NX,XY. this is rather restrictive 62 75 // and needs to be at least checked. 63 haveNx = gfits_scan (&header, "IMNAXIS1", "%d", 1, &Nx); 64 haveNy = gfits_scan (&header, "IMNAXIS2", "%d", 1, &Ny); 76 haveNx = FALSE; 77 if (xaxis) { 78 haveNx = gfits_scan (&header, xaxis, "%d", 1, &Nx); 79 } 80 if (!haveNx) { 81 haveNx = gfits_scan (&header, "IMNAXIS1", "%d", 1, &Nx); 82 } 83 if (!haveNx) { 84 haveNx = gfits_scan (&header, "ZNAXIS1", "%d", 1, &Nx); 85 } 86 if (!haveNx) { 87 haveNx = gfits_scan (&header, "NAXIS1", "%d", 1, &Nx); 88 } 65 89 66 if (!haveNx && !haveNy) { 67 haveNx = gfits_scan (&header, "ZNAXIS1", "%d", 1, &Nx); 90 haveNy = FALSE; 91 if (yaxis) { 92 haveNy = gfits_scan (&header, yaxis, "%d", 1, &Ny); 93 } 94 if (!haveNy) { 95 haveNy = gfits_scan (&header, "IMNAXIS2", "%d", 1, &Ny); 96 } 97 if (!haveNy) { 68 98 haveNy = gfits_scan (&header, "ZNAXIS2", "%d", 1, &Ny); 69 99 } 70 71 if (!haveNx && !haveNy) { 72 haveNx = gfits_scan (&header, "NAXIS1", "%d", 1, &Nx); 100 if (!haveNy) { 73 101 haveNy = gfits_scan (&header, "NAXIS2", "%d", 1, &Ny); 74 102 } … … 137 165 free (Xvec.elements.Flt); 138 166 free (Yvec.elements.Flt); 167 if (xaxis) free (xaxis); 168 if (yaxis) free (yaxis); 139 169 return (TRUE); 140 170 -
trunk/Ohana/src/opihi/dvo/imdense.c
r37807 r39926 4 4 int imdense (int argc, char **argv) { 5 5 6 long A, B;7 6 off_t i, Nimage; 8 7 int kapa, N, status, NPTS; … … 27 26 Rmax = graphmode.coords.crval1 + 182.0; 28 27 29 A = time(NULL); 30 for (B = 0; A == time(NULL); B++); 31 srand48(B); 28 // srand48() is called by startup.c 32 29 33 30 N = 0; -
trunk/Ohana/src/opihi/dvo/skycat.c
r39457 r39926 78 78 if (table) { 79 79 int hostID = (regions[i][0].hostFlags & DATA_USE_BCK) ? regions[i][0].backupID : regions[i][0].hostID; 80 int index = table->index[hostID]; 81 snprintf (hostfile, 1024, "%s/%s.cpt", table->hosts[index].pathname, regions[i][0].name); 80 if (hostID) { 81 int index = table->index[hostID]; 82 snprintf (hostfile, 1024, "%s/%s.cpt", table->hosts[index].pathname, regions[i][0].name); 83 } else { 84 strcpy (hostfile, skylist[0].filename[i]); 85 } 82 86 } else { 83 87 strcpy (hostfile, skylist[0].filename[i]); -
trunk/Ohana/src/opihi/lib.data/style_args.c
r13479 r39926 29 29 if ((N = get_argument (*argc, argv, "-lt"))) { 30 30 remove_argument (N, argc, argv); 31 graphmode[0].ltype = atof(argv[N]);31 graphmode[0].ltype = KapaLineTypeFromString(argv[N]); 32 32 remove_argument (N, argc, argv); 33 33 } … … 39 39 if ((N = get_argument (*argc, argv, "-pt"))) { 40 40 remove_argument (N, argc, argv); 41 graphmode[0].ptype = atof(argv[N]);41 graphmode[0].ptype = KapaPointStyleFromString(argv[N]); 42 42 remove_argument (N, argc, argv); 43 43 } … … 63 63 if ((N = get_argument (*argc, argv, "-x"))) { 64 64 remove_argument (N, argc, argv); 65 graphmode[0].style = atof(argv[N]);65 graphmode[0].style = KapaPlotStyleFromString(argv[N]); 66 66 remove_argument (N, argc, argv); 67 67 } -
trunk/Ohana/src/opihi/lib.shell/startup.c
r33963 r39926 51 51 gfits_set_unsign_mode (FALSE); 52 52 53 set_variable ("M_PI", M_PI); 54 set_variable ("M_E", M_E); 55 set_variable ("M_c", 299792459.0); // meter / second 56 set_variable ("M_c_cgs", 29979245900.0); // cm / second 57 58 set_variable ("M_h", 6.62607004e-34); // meter^2 kg / second (J s) 59 set_variable ("M_h_cgs", 6.62607004e-27); // erg s 60 61 set_variable ("M_kB", 1.38064853e-23); // J / K 62 set_variable ("M_kB_cgs", 1.38064853e-16); // erg / K 63 53 64 /* check history file permission */ 54 65 { -
trunk/Ohana/src/photdbc/src/make_subcatalog.c
r38441 r39926 7 7 int found; 8 8 off_t i, j, k, offset; 9 off_t N AVERAGE, NMEASURE, Naverage, Nmeasure, Nm, Nsecfilt;9 off_t Nm, Nsecfilt; 10 10 double mag, minMag, minSigma; 11 11 int keep, *secKeep; … … 27 27 28 28 /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */ 29 NAVERAGE = 50; 30 NMEASURE = 1000; 31 Nmeasure = Naverage = 0; 29 off_t NAVERAGE = 50; off_t Naverage = 0; 30 off_t NMEASURE = 1000; off_t Nmeasure = 0; 31 off_t NLENSING = 1000; off_t Nlensing = 0; 32 off_t NLENSOBJ = 1000; off_t Nlensobj = 0; 33 off_t NSTARPAR = 1000; off_t Nstarpar = 0; 34 off_t NGALPHOT = 1000; off_t Ngalphot = 0; 35 32 36 REALLOCATE (subcatalog[0].average, Average, NAVERAGE); 33 37 REALLOCATE (subcatalog[0].secfilt, SecFilt, NAVERAGE*Nsecfilt); 34 38 REALLOCATE (subcatalog[0].measure, Measure, NMEASURE); 39 REALLOCATE (subcatalog[0].lensing, Lensing, NLENSING); 40 REALLOCATE (subcatalog[0].lensobj, Lensobj, NLENSOBJ); 41 REALLOCATE (subcatalog[0].starpar, StarPar, NSTARPAR); 42 REALLOCATE (subcatalog[0].galphot, GalPhot, NGALPHOT); 35 43 36 44 for (i = 0; i < catalog[0].Naverage; i++) { … … 39 47 // XXX: temporary check make sure that this object belongs in this region 40 48 // used to fix the pole area in the reference catalog 41 {49 if (0) { 42 50 double R = catalog[0].average[i].R; 43 51 double D = catalog[0].average[i].D; … … 177 185 subcatalog[0].average[Naverage].Nmissing = 0; 178 186 subcatalog[0].average[Naverage].Nmeasure = Nm; 187 188 // **** lensing 189 Nm = 0; 190 subcatalog[0].average[Naverage].lensingOffset = Nlensing; 191 for (j = 0; j < catalog[0].average[i].Nlensing; j++) { 192 193 offset = catalog[0].average[i].lensingOffset + j; 194 195 subcatalog[0].lensing[Nlensing] = catalog[0].lensing[offset]; 196 subcatalog[0].lensing[Nlensing].averef = Naverage; 197 198 Nlensing ++; 199 Nm ++; 200 if (Nlensing == NLENSING) { 201 NLENSING += 1000; 202 REALLOCATE (subcatalog[0].lensing, Lensing, NLENSING); 203 } 204 } 205 subcatalog[0].average[Naverage].Nlensing = Nm; 206 207 // **** lensobj 208 Nm = 0; 209 subcatalog[0].average[Naverage].lensobjOffset = Nlensobj; 210 for (j = 0; j < catalog[0].average[i].Nlensobj; j++) { 211 212 offset = catalog[0].average[i].lensobjOffset + j; 213 214 subcatalog[0].lensobj[Nlensobj] = catalog[0].lensobj[offset]; 215 216 Nlensobj ++; 217 Nm ++; 218 if (Nlensobj == NLENSOBJ) { 219 NLENSOBJ += 1000; 220 REALLOCATE (subcatalog[0].lensobj, Lensobj, NLENSOBJ); 221 } 222 } 223 subcatalog[0].average[Naverage].Nlensobj = Nm; 224 225 // **** starpar 226 Nm = 0; 227 subcatalog[0].average[Naverage].starparOffset = Nstarpar; 228 for (j = 0; j < catalog[0].average[i].Nstarpar; j++) { 229 230 offset = catalog[0].average[i].starparOffset + j; 231 232 subcatalog[0].starpar[Nstarpar] = catalog[0].starpar[offset]; 233 subcatalog[0].starpar[Nstarpar].averef = Naverage; 234 235 Nstarpar ++; 236 Nm ++; 237 if (Nstarpar == NSTARPAR) { 238 NSTARPAR += 1000; 239 REALLOCATE (subcatalog[0].starpar, StarPar, NSTARPAR); 240 } 241 } 242 subcatalog[0].average[Naverage].Nstarpar = Nm; 243 244 // **** galphot 245 Nm = 0; 246 subcatalog[0].average[Naverage].galphotOffset = Ngalphot; 247 for (j = 0; j < catalog[0].average[i].Ngalphot; j++) { 248 249 offset = catalog[0].average[i].galphotOffset + j; 250 251 subcatalog[0].galphot[Ngalphot] = catalog[0].galphot[offset]; 252 subcatalog[0].galphot[Ngalphot].averef = Naverage; 253 254 Ngalphot ++; 255 Nm ++; 256 if (Ngalphot == NGALPHOT) { 257 NGALPHOT += 1000; 258 REALLOCATE (subcatalog[0].galphot, GalPhot, NGALPHOT); 259 } 260 } 261 subcatalog[0].average[Naverage].Ngalphot = Nm; 262 179 263 Naverage ++; 180 264 if (Naverage == NAVERAGE) { … … 187 271 REALLOCATE (subcatalog[0].measure, Measure, MAX (Nmeasure, 1)); 188 272 REALLOCATE (subcatalog[0].secfilt, SecFilt, Nsecfilt*MAX (Naverage, 1)); 273 REALLOCATE (subcatalog[0].lensing, Lensing, MAX (Nlensing, 1)); 274 REALLOCATE (subcatalog[0].lensobj, Lensobj, MAX (Nlensobj, 1)); 275 REALLOCATE (subcatalog[0].starpar, StarPar, MAX (Nstarpar, 1)); 276 REALLOCATE (subcatalog[0].galphot, GalPhot, MAX (Ngalphot, 1)); 277 189 278 subcatalog[0].Naverage = Naverage; 190 279 subcatalog[0].Nmeasure = Nmeasure; 191 280 subcatalog[0].Nsecfilt = Nsecfilt; 281 subcatalog[0].Nlensing = Nlensing; 282 subcatalog[0].Nlensobj = Nlensobj; 283 subcatalog[0].Nstarpar = Nstarpar; 284 subcatalog[0].Ngalphot = Ngalphot; 285 192 286 subcatalog[0].Nsecfilt_mem = Naverage * Nsecfilt; 193 287 -
trunk/Ohana/src/photdbc/src/photdbc_catalogs.c
r38986 r39926 26 26 incatalog.filename = hostID ? hostfile : skylist[0].filename[i]; 27 27 incatalog.Nsecfilt = GetPhotcodeNsecfilt (); 28 incatalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; 28 29 incatalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 30 incatalog.catflags |= DVO_LOAD_MEASURE | DVO_LOAD_MISSING; 31 incatalog.catflags |= DVO_LOAD_LENSING | DVO_LOAD_LENSOBJ; 32 incatalog.catflags |= DVO_LOAD_STARPAR | DVO_LOAD_GALPHOT; 29 33 30 34 // an error exit status here is a significant error … … 57 61 outcatalog.catcompress = CATCOMPRESS ? dvo_catalog_catcompress (CATCOMPRESS) : incatalog.catcompress; // set the default catcompress from config data 58 62 outcatalog.Nsecfilt = incatalog.Nsecfilt; // inherit from the incatalog 59 outcatalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT; 63 64 outcatalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 65 outcatalog.catflags |= DVO_LOAD_MEASURE | DVO_LOAD_MISSING; 66 outcatalog.catflags |= DVO_LOAD_LENSING | DVO_LOAD_LENSOBJ; 67 outcatalog.catflags |= DVO_LOAD_STARPAR | DVO_LOAD_GALPHOT; 60 68 61 69 // output catalogs always represent the same skyregions as the input catalogs -
trunk/Ohana/src/relastro/include/relastro.h
r39693 r39926 33 33 typedef enum {OP_NONE, OP_IMAGES, OP_HIGH_SPEED, OP_MERGE_SOURCE, OP_UPDATE_OBJECTS, OP_UPDATE_OFFSETS, OP_LOAD_OBJECTS, OP_HPM, OP_PARALLEL_REGIONS, OP_PARALLEL_IMAGES, OP_REPAIR_STACKS, OP_REPAIR_WARPS, OP_REPAIR_OBJECT_ID} RelastroOp; 34 34 35 typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS} FitTarget;35 typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, SET_CHIPS, TARGET_MOSAICS} FitTarget; 36 36 37 37 typedef enum { … … 144 144 int Nfit; 145 145 int converged; 146 int useWeight; 147 146 148 } FitAstromResult; 147 149 … … 296 298 } CheckMeasureResult; 297 299 298 # define ID_MEAS_OBJECT_HAS_2MASS ID_MEAS_POOR_PHOTOM300 // # define ID_MEAS_OBJECT_HAS_2MASS ID_MEAS_POOR_PHOTOM 299 301 300 302 /* global variables set in parameter file */ … … 315 317 int PARALLEL_REGIONS_MANUAL; 316 318 char *MANUAL_UNIQUER; 319 int CATCH_UP; 317 320 318 321 int HOST_ID; … … 352 355 int VERBOSE2; 353 356 357 float TEST_SCALE; 358 char *GALAXY_MODEL; 359 354 360 int USE_FIXED_PIXCOORDS; 355 361 int USE_GALAXY_MODEL; … … 363 369 int USE_IMAGE_COORDS_FOR_REPAIR; 364 370 int USE_ALL_IMAGES; 371 int KEEP_ALL_IMAGES_RA; 365 372 int CHECK_MEASURE_TO_IMAGE; 373 374 int SKIP_PS1_CHIP; 375 int SKIP_PS1_STACK; 376 int SKIP_HSC; 377 int SKIP_CFH; 378 379 int UPDATE_PS1_STACK_MEASURE; 380 int UPDATE_PS1_CHIP_MEASURE; 381 int UPDATE_HSC_MEASURE; 382 int UPDATE_CFH_MEASURE; 383 384 int APPLY_PROPER_MOTION; 366 385 367 386 int RESET; … … 383 402 int CHIPMAP; 384 403 404 int *ChipMapLoop; 405 int *ChipOrderLoop; 406 char *ChipMapLoopStr; 407 char *ChipOrderLoopStr; 408 385 409 int N_BOOTSTRAP_SAMPLES; 386 410 … … 407 431 408 432 float *LoopWeight2MASS; 433 char *LoopWeight2MASSstr; 434 409 435 float *LoopWeightTycho; 410 char *LoopWeight2MASSstr;411 436 char *LoopWeightTychostr; 437 438 float *LoopWeightGAIA; 439 char *LoopWeightGAIAstr; 412 440 413 441 int ImagSelect; … … 433 461 434 462 FitMode FIT_MODE; 463 int USE_IRLS; 464 int ALLOW_IRLS; 435 465 436 466 RelastroOp RELASTRO_OP; … … 498 528 void initGridBins PROTO((Catalog *catalog, int Ncatalog)); 499 529 void initImageBins PROTO((Catalog *catalog, int Ncatalog, int FULLINIT)); 500 void initImages PROTO((Image *input, off_t *line_number, off_t N ));530 void initImages PROTO((Image *input, off_t *line_number, off_t N, int isSubset)); 501 531 void freeImages PROTO((char *dbImagePtr)); 502 532 void initMosaicBins PROTO((Catalog *catalog, int Ncatalog)); … … 744 774 int isGPC1stack (int photcode); 745 775 int isGPC1warp (int photcode); 776 int isHSCchip (int photcode); 777 int isCFHchip (int photcode); 746 778 747 779 int save_astrom_table (); -
trunk/Ohana/src/relastro/src
- Property svn:mergeinfo changed
/branches/czw_branch/20160809/Ohana/src/relastro/src (added) merged: 39719,39730-39731,39735,39738,39746-39747,39751,39761,39765-39767,39771,39783,39794-39795,39811,39918
- Property svn:mergeinfo changed
-
trunk/Ohana/src/relastro/src/BootstrapOps.c
r39457 r39926 77 77 case FIT_RESULT_RA: 78 78 // result->Ro = median; 79 result->dRo = sigma;79 result->dRo = MAX(sigma, result->dRo); 80 80 break; 81 81 case FIT_RESULT_DEC: 82 82 // result->Do = median; 83 result->dDo = sigma;83 result->dDo = MAX(sigma, result->dDo); 84 84 break; 85 85 case FIT_RESULT_uR: 86 86 // result->uR = median; 87 result->duR = sigma;87 result->duR = MAX(sigma, result->duR); 88 88 break; 89 89 case FIT_RESULT_uD: 90 90 // result->uD = median; 91 result->duD = sigma;91 result->duD = MAX(sigma, result->duD); 92 92 break; 93 93 case FIT_RESULT_PLX: 94 94 // result->p = median; 95 result->dp = sigma;95 result->dp = MAX(sigma, result->dp); 96 96 break; 97 97 default: -
trunk/Ohana/src/relastro/src/BrightCatalog.c
r39457 r39926 353 353 /*** MeasureTiny ***/ 354 354 { 355 ohana_memcheck (1);355 // ohana_memcheck (1); 356 356 gfits_create_table_header (&theader, "BINTABLE", "MEASURE_TINY"); 357 357 358 ohana_memcheck (1);358 // ohana_memcheck (1); 359 359 360 360 gfits_define_bintable_column (&theader, "D", "RA", "ra", "degrees", 1.0, 0.0); … … 429 429 gfits_set_bintable_column (&theader, &ftable, "RA", R, catalog->Nmeasure); 430 430 431 fprintf (stderr, "--------------- after set_bintable RA --------------");432 ohana_memdump_file (stderr, TRUE);431 // fprintf (stderr, "--------------- after set_bintable RA --------------"); 432 // ohana_memdump_file (stderr, TRUE); 433 433 434 434 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); -
trunk/Ohana/src/relastro/src/ConfigInit.c
r39396 r39926 84 84 SetZeroPoint (25.0); 85 85 86 if (USE_GALAXY_MODEL) {87 if (!InitGalaxyModel ("FEAST-HIPPARCOS")) {88 fprintf (stderr, "failed to init galaxy model\n");89 exit (2);90 }91 }92 93 86 FreeConfigFile(); 94 87 free (config); -
trunk/Ohana/src/relastro/src/FitAstromOps.c
r39610 r39926 257 257 fit->converged = FALSE; 258 258 259 // this is an input value 260 // if true, use the IRLS modified weight 261 fit->useWeight = FALSE; 262 259 263 return; 260 264 } -
trunk/Ohana/src/relastro/src/FitChip.c
r39457 r39926 78 78 order_use = MIN(MIN(order_use, CHIPMAP), 6); // can only go up to 6th order map (can be user limited) 79 79 } else { 80 order_use = MIN( order_use, 3); // can only go up to 3rd order for polynomials80 order_use = MIN(MIN(order_use, CHIPORDER), 3); // can only go up to 3rd order for polynomials 81 81 } 82 82 … … 206 206 if (VERBOSE2) fprintf (stderr, "fit sigma: %f (%f, %f) : full: %f (%f, %f), scatter limit: %f (%d full, %d bright, %d fit, %d all) (%d %d %d %d %d)\n", dRsig, dLsig, dMsig, dRsigFull, dLsigFull, dMsigFull, dRmax, NstatFull, Nstat, fit[0].Npts, Nmatch, nMask1, nMask2, nMask3, nMask4, nMask5); 207 207 208 image[0].dXpixSys = dLsig; 209 image[0].dYpixSys = dMsig; 208 // need to convert dLsig, dMsig back to pixel scale (or up to arcsec) 209 210 float plateScale; 211 if (image[0].coords.mosaic) { 212 // NOTE: for the full pixel to sky plate scale, use this: 213 // float plateScaleX = 3600.0*image[0].coords.mosaic->cdelt1*image[0].coords.cdelt1; 214 // float plateScaleY = 3600.0*image[0].coords.mosaic->cdelt2*image[0].coords.cdelt2; 215 216 // since we are compare L,M values, just need to compensate for focal plate to sky: 217 float plateScaleX = 3600.0*fabs(image[0].coords.mosaic->cdelt1); 218 float plateScaleY = 3600.0*fabs(image[0].coords.mosaic->cdelt2); 219 plateScale = 0.5*(plateScaleX + plateScaleY); 220 } else { 221 // since we are compare L,M values, just need to compensate for arcsec vs degrees: 222 plateScale = 3600.0; 223 } 224 225 image[0].dXpixSys = plateScale*dLsig; 226 image[0].dYpixSys = plateScale*dMsig; 210 227 image[0].nFitAstrom = fit[0].Npts; 211 228 212 // fprintf (stderr, "%s %6.3f %4d %4d\n", image[0].name, image[0].refColor, Ncolor, image[0].nFitAstrom);229 if (VERBOSE2) fprintf (stderr, "%s | %6.3f %6.3f | %4d %4d | %6.3f %6.3f\n", image[0].name, image[0].refColorRed, image[0].refColorBlue, Ncolor, image[0].nFitAstrom, image[0].dXpixSys, image[0].dYpixSys); 213 230 214 231 if (fit) fit_free (fit); -
trunk/Ohana/src/relastro/src/FitPM.c
r39612 r39926 25 25 } 26 26 27 fit->useWeight = FALSE; // Ordinary Least Squares 27 28 if (!FitPM_MinChisq (fit, data, points, Npoints)) return FALSE; 28 29 if (!FitPM_SetChisq (fit, data, points, Npoints)) return FALSE; … … 47 48 48 49 // Solve OLS equation 50 fit->useWeight = FALSE; // Ordinary Least Squares 49 51 if (!FitPM_MinChisq(fit, data, points, Npoints)) { 50 52 return(FALSE); … … 69 71 70 72 // Iteratively reweight and solve 71 double sigma_hat = 0.0; // save for the error model73 // double sigma_hat = 0.0; // save for the error model 72 74 int converged = FALSE; 73 75 int iterations = 0; … … 90 92 91 93 // Solve with the new weights 94 fit->useWeight = TRUE; // Reweighted Least Squares 92 95 if (!FitPM_MinChisq(fit, data, points, Npoints)) { 93 96 … … 104 107 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 105 108 } 106 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;109 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 107 110 break; 108 111 } … … 119 122 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 120 123 } 121 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;124 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 122 125 123 126 // Check convergence … … 159 162 // NOTE EAM: in tests (fitpm.c), they seem to be too large by a factor of ~5.37 160 163 if (data->getError) { 161 double ax = 0.0, ay = 0.0; 162 double bx = 0.0, by = 0.0; 163 164 for (i = 0; i < Npoints; i++) { 165 ax += dpsi_cauchy(points[i].rx / points[i].dX); 166 ay += dpsi_cauchy(points[i].ry / points[i].dY); 167 168 bx += SQ(points[i].Wx); 169 by += SQ(points[i].Wy); 170 } 171 ax /= 1.0 * Npoints; // mean(psi_dot(r)) 172 ay /= 1.0 * Npoints; 173 bx /= 1.0 * (Npoints - data->Nterms); // mean(psi^2(r)) * (N / (N-p)) 174 by /= 1.0 * (Npoints - data->Nterms); 175 176 double lambda_x = 1.0 + (data->Nterms / Npoints) * (1 - ax) / ax; 177 double lambda_y = 1.0 + (data->Nterms / Npoints) * (1 - ay) / ay; 178 179 double sigma_robust_x = lambda_x * sqrt(bx) * sigma_hat * 2.385 / ax; 180 double sigma_robust_y = lambda_y * sqrt(by) * sigma_hat * 2.385 / ay; 181 182 // This is actually sigma^2, as that's the factor in the covariance (dumouchel 4.1) 183 double sigma_final_x = MAX(SQ(sigma_robust_x), (2 * Npoints * SQ(sigma_robust_x) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 184 double sigma_final_y = MAX(SQ(sigma_robust_y), (2 * Npoints * SQ(sigma_robust_y) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 185 186 fit[0].dRo = sqrt(data->Cov[0][0]); 187 fit[0].duR = sqrt(data->Cov[1][1]); 188 fit[0].dDo = sqrt(data->Cov[2][2]); 189 fit[0].duD = sqrt(data->Cov[3][3]); 190 191 fit[0].dRo *= sigma_final_x; 192 fit[0].duR *= sigma_final_x; 193 fit[0].dDo *= sigma_final_y; 194 fit[0].duD *= sigma_final_y; 164 FitAstromResult fitErrors; 165 FitAstromResultInit (&fitErrors); 166 fitErrors.useWeight = FALSE; 167 168 FitPM_MinChisq(&fitErrors, data, points, Npoints); 169 170 // we use the errors from a simple OLS, ignoring masked points 171 fit[0].dRo = fitErrors.dRo; 172 fit[0].duR = fitErrors.duR; 173 fit[0].dDo = fitErrors.dDo; 174 fit[0].duD = fitErrors.duD; 195 175 } 196 176 … … 212 192 Nfit ++; 213 193 214 wx = points[i].qx; 215 wy = points[i].qy; 194 if (fit->useWeight) { 195 wx = points[i].qx; 196 wy = points[i].qy; 197 } else { 198 wx = points[i].Qx; 199 wy = points[i].Qy; 200 } 216 201 217 202 Wx += wx; -
trunk/Ohana/src/relastro/src/FitPMandPar.c
r39612 r39926 25 25 } 26 26 27 fit->useWeight = FALSE; // Ordinary Least Squares 27 28 if (!FitPMandPar_MinChisq (fit, data, points, Npoints)) return FALSE; 28 29 if (!FitPMandPar_SetChisq (fit, data, points, Npoints)) return FALSE; … … 47 48 48 49 // Solve OLS equation: failure here means the chisq matrix is degenerate, give up entirely 50 fit->useWeight = FALSE; // Ordinary Least Squares 49 51 if (!FitPMandPar_MinChisq(fit, data, points, Npoints)) { 50 52 return(FALSE); … … 69 71 70 72 // Iteratively reweight and solve 71 double sigma_hat = 0.0; // save for the error model73 // double sigma_hat = 0.0; // save for the error model 72 74 int converged = FALSE; 73 75 int iterations = 0; … … 90 92 91 93 // Solve with the new weights 94 fit->useWeight = TRUE; // Reweighted Least Squares 92 95 if (!FitPMandPar_MinChisq(fit, data, points, Npoints)) { 93 96 … … 105 108 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 106 109 } 107 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;110 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 108 111 break; 109 112 } … … 120 123 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 121 124 } 122 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;125 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 123 126 124 127 // Check convergence … … 157 160 } 158 161 159 // this section calculates the formal error on the weightedfit using the covariance values160 // NOTE EAM: in tests (fitpm.c), they seem to be too large by a factor of ~5.37162 // this section calculates the formal error on the regular (unweighted) fit using the covariance values 163 // NOTE 20160929 : use only the unmasked points to calculate the error 161 164 if (data->getError) { 162 double ax = 0.0, ay = 0.0; 163 double bx = 0.0, by = 0.0; 164 165 for (i = 0; i < Npoints; i++) { 166 ax += dpsi_cauchy(points[i].rx / points[i].dX); 167 ay += dpsi_cauchy(points[i].ry / points[i].dY); 168 169 bx += SQ(points[i].Wx); 170 by += SQ(points[i].Wy); 171 } 172 ax /= 1.0 * Npoints; // mean(psi_dot(r)) 173 ay /= 1.0 * Npoints; 174 bx /= 1.0 * (Npoints - data->Nterms); // mean(psi^2(r)) * (N / (N-p)) 175 by /= 1.0 * (Npoints - data->Nterms); 176 177 double lambda_x = 1.0 + (data->Nterms / Npoints) * (1 - ax) / ax; 178 double lambda_y = 1.0 + (data->Nterms / Npoints) * (1 - ay) / ay; 179 180 double sigma_robust_x = lambda_x * sqrt(bx) * sigma_hat * 2.385 / ax; 181 double sigma_robust_y = lambda_y * sqrt(by) * sigma_hat * 2.385 / ay; 182 183 // This is actually sigma^2, as that's the factor in the covariance (dumouchel 4.1) 184 double sigma_final_x = MAX(SQ(sigma_robust_x), (2 * Npoints * SQ(sigma_robust_x) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 185 double sigma_final_y = MAX(SQ(sigma_robust_y), (2 * Npoints * SQ(sigma_robust_y) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 186 187 fit[0].dRo = sqrt(data->Cov[0][0]); 188 fit[0].duR = sqrt(data->Cov[1][1]); 189 fit[0].dDo = sqrt(data->Cov[2][2]); 190 fit[0].duD = sqrt(data->Cov[3][3]); 191 fit[0].dp = sqrt(data->Cov[4][4]); 192 193 fit[0].dRo *= sigma_final_x; 194 fit[0].duR *= sigma_final_x; 195 fit[0].dDo *= sigma_final_y; 196 fit[0].duD *= sigma_final_y; 197 fit[0].dp *= sqrt(sigma_final_x * sigma_final_y); 165 FitAstromResult fitErrors; 166 FitAstromResultInit (&fitErrors); 167 fitErrors.useWeight = FALSE; 168 169 FitPMandPar_MinChisq(&fitErrors, data, points, Npoints); 170 171 // we use the errors from a simple OLS, ignoring masked points 172 fit[0].dRo = fitErrors.dRo; 173 fit[0].duR = fitErrors.duR; 174 fit[0].dDo = fitErrors.dDo; 175 fit[0].duD = fitErrors.duD; 176 fit[0].dp = fitErrors.dp; 198 177 } 199 178 … … 219 198 Nfit ++; 220 199 221 wx = points[i].qx; 222 wy = points[i].qy; 200 if (fit->useWeight) { 201 wx = points[i].qx; 202 wy = points[i].qy; 203 } else { 204 wx = points[i].Qx; 205 wy = points[i].Qy; 206 } 223 207 224 208 Wx += wx; -
trunk/Ohana/src/relastro/src/FitPosPMfixed.c
r39612 r39926 54 54 } 55 55 56 fit->useWeight = FALSE; // Ordinary Least Squares 56 57 if (!FitPosPMfixed_MinChisq (fit, data, points, Npoints)) { 57 58 if (!FitPosPMfixed_Single (fit, points, Npoints)) return FALSE; … … 83 84 84 85 // Solve OLS equation 86 fit->useWeight = FALSE; // Ordinary Least Squares 85 87 if (!FitPosPMfixed_MinChisq(fit, data, points, Npoints)) { 86 88 return(FALSE); … … 105 107 106 108 // Iteratively reweight and solve 107 double sigma_hat = 0.0; // save for the error model109 // double sigma_hat = 0.0; // save for the error model 108 110 int converged = FALSE; 109 111 int iterations = 0; … … 126 128 127 129 // Solve with the new weights 130 fit->useWeight = TRUE; // Reweighted Least Squares 128 131 if (!FitPosPMfixed_MinChisq(fit, data, points, Npoints)) { 129 132 … … 138 141 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 139 142 } 140 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;143 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 141 144 break; 142 145 } … … 153 156 points[i].u = sqrt(SQ(points[i].rx / points[i].dX) + SQ(points[i].ry / points[i].dY)); 154 157 } 155 sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745;158 // sigma_hat = MedianAbsDeviation(points, Npoints) / 0.6745; 156 159 157 160 // Check convergence … … 193 196 // NOTE EAM: in tests (fitpm.c), they seem to be too large by a factor of ~5.37 194 197 if (data->getError) { 195 double ax = 0.0, ay = 0.0; 196 double bx = 0.0, by = 0.0; 197 198 for (i = 0; i < Npoints; i++) { 199 ax += dpsi_cauchy(points[i].rx / points[i].dX); 200 ay += dpsi_cauchy(points[i].ry / points[i].dY); 201 202 bx += SQ(points[i].Wx); 203 by += SQ(points[i].Wy); 204 } 205 ax /= 1.0 * Npoints; // mean(psi_dot(r)) 206 ay /= 1.0 * Npoints; 207 bx /= 1.0 * (Npoints - data->Nterms); // mean(psi^2(r)) * (N / (N-p)) 208 by /= 1.0 * (Npoints - data->Nterms); 209 210 double lambda_x = 1.0 + (data->Nterms / Npoints) * (1 - ax) / ax; 211 double lambda_y = 1.0 + (data->Nterms / Npoints) * (1 - ay) / ay; 212 213 double sigma_robust_x = lambda_x * sqrt(bx) * sigma_hat * 2.385 / ax; 214 double sigma_robust_y = lambda_y * sqrt(by) * sigma_hat * 2.385 / ay; 215 216 // This is actually sigma^2, as that's the factor in the covariance (dumouchel 4.1) 217 double sigma_final_x = MAX(SQ(sigma_robust_x), (2 * Npoints * SQ(sigma_robust_x) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 218 double sigma_final_y = MAX(SQ(sigma_robust_y), (2 * Npoints * SQ(sigma_robust_y) + SQ(data->Nterms * sigma_ols)) / (2 * Npoints + SQ(data->Nterms))); 219 220 fit[0].dRo = sqrt(data->Cov[0][0]); 221 fit[0].dDo = sqrt(data->Cov[1][1]); 222 223 fit[0].dRo *= sigma_final_x; 224 fit[0].dDo *= sigma_final_y; 198 FitAstromResult fitErrors; 199 FitAstromResultInit (&fitErrors); 200 fitErrors.useWeight = FALSE; 201 202 FitPosPMfixed_MinChisq(&fitErrors, data, points, Npoints); 203 204 // we use the errors from a simple OLS, ignoring masked points 205 fit[0].dRo = fitErrors.dRo; 206 fit[0].duR = fitErrors.duR; 207 fit[0].dDo = fitErrors.dDo; 208 fit[0].duD = fitErrors.duD; 209 fit[0].dp = fitErrors.dp; 225 210 } 226 211 … … 242 227 Nfit ++; 243 228 244 wx = points[i].qx; 245 wy = points[i].qy; 229 if (fit->useWeight) { 230 wx = points[i].qx; 231 wy = points[i].qy; 232 } else { 233 wx = points[i].Qx; 234 wy = points[i].Qy; 235 } 246 236 247 237 Wx += wx; -
trunk/Ohana/src/relastro/src/GetAstromError.c
r39457 r39926 48 48 if (isnan(code[0].astromErrSys)) return NAN; 49 49 50 if (measure[0].photcode == 1030) { 51 if (mode == ERROR_MODE_RA) { 52 dPobs = pow(10.0, (6.0 * measure[0].dXccd - 3.0)); // dXccd is a value in pixels 53 } 54 if (mode == ERROR_MODE_DEC) { 55 dPobs = pow(10.0, (6.0 * measure[0].dYccd - 3.0)); // dXccd is a value in pixels 56 } 57 } 58 50 59 AS = code[0].astromErrScale; 51 60 MS = code[0].astromErrMagScale; … … 69 78 // to match the 2MASS / Tycho / ICRS reference frame. As Nloop gets higher, the weight 70 79 // needs to drop to allow the ps1 measurements to drive the solution 80 int isGAIA = USE_GALAXY_MODEL && !isImage && (measure[0].photcode == 1030); 71 81 int is2MASS = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2011) && (measure[0].photcode <= 2013); 72 82 int isTycho = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2020) && (measure[0].photcode <= 2021); 83 84 int hasGAIA = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_GAIA); 73 85 int has2MASS = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_2MASS); 86 int hasTycho = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_TYCHO); 74 87 75 88 // modest hack: if the object has 2MASS or Tycho, we set this internal bit and adjust the … … 79 92 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 80 93 } 94 if (hasGAIA && LoopWeightGAIA && (Nloop >= 0)) { 95 dPtotal = dPtotal / LoopWeightGAIA[Nloop]; 96 } 97 if (hasTycho && LoopWeightTycho && (Nloop >= 0)) { 98 dPtotal = dPtotal / LoopWeightTycho[Nloop]; 99 } 100 81 101 if (is2MASS && LoopWeight2MASS && (Nloop >= 0)) { 82 102 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 103 } 104 if (isGAIA && LoopWeightGAIA && (Nloop >= 0)) { 105 dPtotal = dPtotal / LoopWeightGAIA[Nloop]; 83 106 } 84 107 if (isTycho && LoopWeightTycho && (Nloop >= 0)) { … … 120 143 // do not raise an exception, just send back the result 121 144 if (isnan(code[0].astromErrSys)) return NAN; 145 146 if (measure[0].photcode == 1030) { 147 if (mode == ERROR_MODE_RA) { 148 dPobs = pow(10.0, (6.0 * measure[0].dXccd - 3.0)); // dXccd is a value in pixels 149 } 150 if (mode == ERROR_MODE_DEC) { 151 dPobs = pow(10.0, (6.0 * measure[0].dYccd - 3.0)); // dXccd is a value in pixels 152 } 153 } 122 154 123 155 AS = code[0].astromErrScale; … … 143 175 // to match the 2MASS / Tycho / ICRS reference frame. As Nloop gets higher, the weight 144 176 // needs to drop to allow the ps1 measurements to drive the solution 177 int isGAIA = USE_GALAXY_MODEL && !isImage && (measure[0].photcode == 1030); 145 178 int is2MASS = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2011) && (measure[0].photcode <= 2013); 146 179 int isTycho = USE_GALAXY_MODEL && !isImage && (measure[0].photcode >= 2020) && (measure[0].photcode <= 2021); 180 181 int hasGAIA = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_GAIA); 147 182 int has2MASS = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_2MASS); 183 int hasTycho = USE_GALAXY_MODEL && isImage && (measure[0].dbFlags & ID_MEAS_OBJECT_HAS_TYCHO); 148 184 149 185 // modest hack: if the object has 2MASS or Tycho, we set this internal bit and adjust the … … 153 189 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 154 190 } 191 if (hasGAIA && LoopWeightGAIA && (Nloop >= 0)) { 192 dPtotal = dPtotal / LoopWeightGAIA[Nloop]; 193 } 194 if (hasTycho && LoopWeightTycho && (Nloop >= 0)) { 195 dPtotal = dPtotal / LoopWeightTycho[Nloop]; 196 } 197 155 198 if (is2MASS && LoopWeight2MASS) { 156 199 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 200 } 201 if (isGAIA && LoopWeightGAIA && (Nloop >= 0)) { 202 dPtotal = dPtotal / LoopWeightGAIA[Nloop]; 157 203 } 158 204 if (isTycho && LoopWeightTycho) { -
trunk/Ohana/src/relastro/src/ImageOps.c
r39580 r39926 6 6 static Image *image; // list of available images 7 7 static off_t Nimage; // number of available images 8 static int isImageSubset; 8 9 9 10 // if we read only a subset of the rows from the Image FITS, LineNumber tells us to which row … … 78 79 } 79 80 80 void initImages (Image *input, off_t *line_number, off_t N ) {81 void initImages (Image *input, off_t *line_number, off_t N, int isSubset) { 81 82 82 83 off_t i; 83 84 85 isImageSubset = isSubset; 84 86 image = input; 85 87 LineNumber = line_number; … … 136 138 // we call gfits_db_free as well as this function. sometimes those point at the same 137 139 // memory location, in which case we should only do the free once. 138 if (( void *) dbImagePtr != (void *) image) free (image);140 if (((void *) dbImagePtr != (void *) image) && isImageSubset) free (image); 139 141 free_astrom_table(); 140 142 } … … 793 795 ref[i].D = catalog[c].average[n].D; 794 796 797 int XVERB = FALSE; 798 XVERB |= (catalog[c].average[n].objID == OBJ_ID_SRC) && (catalog[c].average[n].catID == CAT_ID_SRC); 799 XVERB |= (catalog[c].average[n].objID == OBJ_ID_DST) && (catalog[c].average[n].catID == CAT_ID_DST); 800 if (XVERB) { 801 fprintf (stderr, "found test object\n"); 802 } 803 795 804 // if we are applying the galaxy model, move the reference position... 796 if ( USE_GALAXY_MODEL) {805 if (APPLY_PROPER_MOTION) { 797 806 // apply proper-motion from average position to measure epoch: 798 807 float dTime = (measure[0].t - catalog[c].average[n].Tmean) / (86400*365.25) ; // time relative to Tmean in years … … 934 943 } 935 944 936 # if (0)937 /** lifted from relphot/StarOps.clean_measures */938 void FlagOutliers2D(Catalog *catalog);939 940 // operates on Full values (not tiny)941 void FlagOutliers (Catalog *catalog) {942 943 // XXX FlagOutliers is now just using FlagOutliers2D944 FlagOutliers2D(catalog);945 return;946 947 int Ndel, Nave;948 off_t i, j, k, m, N, Nmax, TOOFEW, Nsecfilt;949 double Ns, theta, x, y;950 double *R, *D, *dR, *dD;951 StatType statsR, statsD;952 953 Nsecfilt = GetPhotcodeNsecfilt();954 assert(catalog[0].Nsecfilt == Nsecfilt);955 956 if (VERBOSE2) fprintf (stderr, "marking poor measures\n");957 Nmax = 0;958 for (i = 0; i < catalog[0].Naverage; i++) {959 Nmax = MAX (Nmax, catalog[0].average[i].Nmeasure);960 }961 962 ALLOCATE (R, double, Nmax);963 ALLOCATE (D, double, Nmax);964 ALLOCATE (dR, double, Nmax);965 ALLOCATE (dD, double, Nmax);966 967 /* it makes no sense to mark 3-sigma outliers with <5 measurements */968 TOOFEW = MAX (5, SRC_MEAS_TOOFEW);969 970 Ns = CLIP_THRESH;971 Ndel = Nave = 0;972 973 /* loop over each object in the catalog */974 for (j = 0; j < catalog[0].Naverage; j++) {975 976 // pointer to this set of measurements977 m = catalog[0].average[j].measureOffset;978 Measure *measure = &catalog[0].measure[m];979 980 /* accumulate list of valid measurements */981 N = 0;982 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {983 // skip measurements based on user selected criteria984 if (!MeasFilterTest(&measure[k], FALSE)) continue;985 R[N] = measure[k].R;986 D[N] = measure[k].D;987 dR[N] = GetAstromError (&measure[k], ERROR_MODE_RA);988 dD[N] = GetAstromError (&measure[k], ERROR_MODE_DEC);989 if (isnan(R[N]) || isnan(D[N])) continue;990 N++;991 }992 if (N <= TOOFEW) continue;993 994 /* 3-sigma clip based on stats of inner 50% */995 initstats ("MEAN");996 liststats (R, dR, N, &statsR);997 liststats (D, dD, N, &statsD);998 999 statsR.sigma = MAX (MIN_ERROR, statsR.sigma);1000 statsD.sigma = MAX (MIN_ERROR, statsD.sigma);1001 1002 /* compare per-object distance to this standard deviation, and flag outliers*/1003 N = 0;1004 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {1005 // reset flag on each invocation1006 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM;1007 1008 // skip measurements based on user selected criteria1009 if (!MeasFilterTest(&measure[k], FALSE)) continue;1010 1011 x = measure[k].R - statsR.median;1012 y = measure[k].D - statsD.median;1013 theta = atan2(y,x);1014 if ((x*x + y*y) > (SQR(statsR.sigma * Ns * cos(theta)) +1015 SQR(statsD.sigma * Ns * sin(theta)))) {1016 measure[k].dbFlags |= ID_MEAS_POOR_ASTROM;1017 Ndel++;1018 }1019 N++;1020 Nave ++;1021 }1022 1023 // examine results1024 // relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, catalog[0].average[j].Nmeasure, statsR, statsD, Ns);1025 }1026 1027 if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave);1028 free (R);1029 free (dR);1030 free (D);1031 free (dD);1032 }1033 1034 1035 /** an alternative outlier rejection scheme */1036 void FlagOutliers2D (Catalog *catalog) {1037 1038 int Ndel, Nave;1039 off_t i, j, k, m, N, Nmax, TOOFEW, Nsecfilt;1040 double *index;1041 double Ns, theta, x, y;1042 double *R, *D, *dR, *dD, *d2;1043 StatType statsR, statsD;1044 1045 // XXX we are not going to use this for now1046 return;1047 1048 Nsecfilt = GetPhotcodeNsecfilt();1049 assert(catalog[0].Nsecfilt == Nsecfilt);1050 1051 if (VERBOSE2) fprintf (stderr, "marking poor measures\n");1052 Nmax = 0;1053 for (i = 0; i < catalog[0].Naverage; i++) {1054 Nmax = MAX (Nmax, catalog[0].average[i].Nmeasure);1055 }1056 1057 ALLOCATE (R, double, Nmax);1058 ALLOCATE (D, double, Nmax);1059 ALLOCATE (dR, double, Nmax);1060 ALLOCATE (dD, double, Nmax);1061 ALLOCATE (d2, double, Nmax);1062 ALLOCATE (index, double, Nmax);1063 1064 /* it makes no sense to mark 3-sigma outliers with <5 measurements */1065 TOOFEW = MAX (5, SRC_MEAS_TOOFEW);1066 1067 Ns = CLIP_THRESH;1068 Ndel = Nave = 0;1069 1070 /* loop over each object in the catalog */1071 for (j = 0; j < catalog[0].Naverage; j++) {1072 1073 // pointer to this set of measurements1074 m = catalog[0].average[j].measureOffset;1075 Measure *measure = &catalog[0].measure[m];1076 1077 /* accumulate list of valid measurements */1078 N = 0;1079 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {1080 1081 // reset flag on each invocation1082 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM;1083 1084 // skip measurements based on user selected criteria1085 if (!MeasFilterTest(&measure[k], FALSE)) continue;1086 R[N] = measure[k].R;1087 D[N] = measure[k].D;1088 dR[N] = GetAstromError(&measure[k], ERROR_MODE_RA);1089 dD[N] = GetAstromError(&measure[k], ERROR_MODE_DEC);1090 if (isnan(R[N]) || isnan(D[N])) continue;1091 N++;1092 }1093 if (N <= TOOFEW) continue;1094 1095 /* calculate mean of all points*/1096 initstats ("MEAN");1097 liststats (R, dR, N, &statsR);1098 liststats (D, dD, N, &statsD);1099 statsR.sigma = MAX (MIN_ERROR, statsR.sigma);1100 statsD.sigma = MAX (MIN_ERROR, statsD.sigma);1101 1102 /* calculate deviations of all points*/1103 N = 0;1104 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {1105 // skip bad measurements1106 if (!MeasFilterTest(&measure[k], FALSE)) continue;1107 x = measure[k].R - statsR.median;1108 y = measure[k].D - statsD.median;1109 theta = atan2(y,x);1110 d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) +1111 SQR(statsD.sigma * Ns * sin(theta)));1112 index[N] = k;1113 N++;1114 }1115 1116 // sort d21117 dsortpair(d2, index, N);1118 N = (N/2 > (N-1)) ? N/2 : N-1;1119 1120 // recalculate image center, sigma based on closest 50% of points1121 for (k = 0; k < N; k++) {1122 off_t ind = (off_t) index[k];1123 R[k] = measure[ind].R;1124 D[k] = measure[ind].D;1125 dR[k] = GetAstromError(&measure[ind], ERROR_MODE_RA);1126 dD[k] = GetAstromError(&measure[ind], ERROR_MODE_DEC);1127 }1128 liststats (R, dR, N, &statsR);1129 liststats (D, dD, N, &statsD);1130 statsR.sigma = MAX (MIN_ERROR, statsR.sigma);1131 statsD.sigma = MAX (MIN_ERROR, statsD.sigma);1132 1133 // use these new statistics to flag outliers1134 N = 0;1135 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) {1136 //skip bad measurements1137 if (!MeasFilterTest(&measure[k], FALSE)) continue;1138 x = measure[k].R - statsR.median;1139 y = measure[k].D - statsD.median;1140 theta = atan2(y,x);1141 d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) +1142 SQR(statsD.sigma * Ns * sin(theta)));1143 if ((d2[N]) > 1) {1144 measure[k].dbFlags |= ID_MEAS_POOR_ASTROM;1145 Ndel ++;1146 }1147 N++;1148 Nave++;1149 } // done rejecting outliers1150 1151 // examine results1152 // relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, catalog[0].average[j].Nmeasure, statsR, statsD, Ns);1153 1154 } // done looping over objects1155 1156 if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave);1157 free (R);1158 free (dR);1159 free (D);1160 free (dD);1161 free (d2);1162 free (index);1163 }1164 1165 /** Determine whether a measurement should be included in the analysis, based on supplied filter criteria */1166 // we only optionally apply the sigma limit: for object averages, this should not be used1167 int MeasFilterTestTiny(MeasureTiny *measure, int applySigmaLim) {1168 int found, k;1169 long mask;1170 PhotCode *code;1171 float mag;1172 1173 if (!finite(measure[0].R) || !finite(measure[0].D)) return FALSE;1174 if (!finite(measure[0].M)) return FALSE; //XXX is this necessary for all relastro tasks?1175 if (!finite(measure[0].dM)) return FALSE; //XXX is this necessary for all relastro tasks?1176 1177 if ((MinBadQF > 0.0) && (isGPC1chip(measure[0].photcode) || isGPC1stack(measure[0].photcode))) {1178 if (!isfinite(measure[0].psfQF)) { return FALSE; };1179 if (measure[0].psfQF < MinBadQF) { return FALSE; };1180 }1181 1182 /* select measurements by photcode, or equiv photcode, if specified */1183 if (NphotcodesKeep > 0) {1184 found = FALSE;1185 for (k = 0; (k < NphotcodesKeep) && !found; k++) {1186 if (photcodesKeep[k][0].code == measure[0].photcode) found = TRUE;1187 if (photcodesKeep[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;1188 }1189 if (!found) return FALSE;1190 }1191 1192 if (NphotcodesSkip > 0) {1193 found = FALSE;1194 for (k = 0; (k < NphotcodesSkip) && !found; k++) {1195 if (photcodesSkip[k][0].code == measure[0].photcode) found = TRUE;1196 if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;1197 }1198 if (found) return FALSE;1199 }1200 1201 /* select measurements by time */1202 if (TimeSelect) {1203 if (measure[0].t < TSTART) return FALSE;1204 if (measure[0].t > TSTOP) return FALSE;1205 }1206 1207 /* select measurements by quality */1208 if (PhotFlagSelect) {1209 if (PhotFlagBad) {1210 mask = PhotFlagBad;1211 } else {1212 code = GetPhotcodebyCode (measure[0].photcode);1213 if (!code) return FALSE;1214 mask = code[0].astromBadMask;1215 }1216 if (mask & measure[0].photFlags) return FALSE;1217 }1218 1219 /* select measurements by measurement error */1220 // this is a bit convoluted: applySigmaLim is only TRUE when this function is1221 // called by bcatalog. for UpdateObjects, it is FALSE1222 if (applySigmaLim && (SIGMA_LIM > 0) && (measure[0].dM > SIGMA_LIM)) {1223 return FALSE;1224 }1225 1226 /* select measurements by mag limit */1227 if (ImagSelect) {1228 mag = PhotInstTiny (measure, MAG_CLASS_PSF);1229 if (mag < ImagMin || mag > ImagMax) return FALSE;1230 }1231 1232 return TRUE;1233 }1234 1235 # define SUPER_VERBOSE 01236 1237 /** Determine whether a measurement should be included in the analysis, based on supplied filter criteria */1238 // we only optionally apply the sigma limit: for object averages, this should not be used (should it?)1239 int MeasFilterTest(Measure *measure, int applySigmaLim) {1240 int found, k;1241 long mask;1242 PhotCode *code;1243 float mag;1244 1245 if (!finite(measure[0].R) || !finite(measure[0].D)) { if (SUPER_VERBOSE) fprintf (stderr, "filter 1\n"); return FALSE; };1246 if (!finite(measure[0].M)) { if (SUPER_VERBOSE) fprintf (stderr, "filter 2\n"); return FALSE; }; //XXX is this necessary for all relastro tasks?1247 if (!finite(measure[0].dM)) { if (SUPER_VERBOSE) fprintf (stderr, "filter 3\n"); return FALSE; }; //XXX is this necessary for all relastro tasks?1248 1249 /* select measurements by photcode, or equiv photcode, if specified */1250 if (NphotcodesKeep > 0) {1251 found = FALSE;1252 for (k = 0; (k < NphotcodesKeep) && !found; k++) {1253 if (photcodesKeep[k][0].code == measure[0].photcode) found = TRUE;1254 if (photcodesKeep[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;1255 }1256 if (!found) { if (SUPER_VERBOSE) fprintf (stderr, "filter 4\n"); return FALSE; };1257 }1258 1259 if (NphotcodesSkip > 0) {1260 found = FALSE;1261 for (k = 0; (k < NphotcodesSkip) && !found; k++) {1262 if (photcodesSkip[k][0].code == measure[0].photcode) found = TRUE;1263 if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE;1264 }1265 if (found) { if (SUPER_VERBOSE) fprintf (stderr, "filter 5\n"); return FALSE; };1266 }1267 1268 if ((MinBadQF > 0.0) && isGPC1chip(measure[0].photcode)) {1269 if (!isfinite(measure[0].psfQF)) { if (SUPER_VERBOSE) fprintf (stderr, "filter 6\n"); return FALSE; };1270 if (measure[0].psfQF < MinBadQF) { if (SUPER_VERBOSE) fprintf (stderr, "filter 7\n"); return FALSE; };1271 }1272 1273 /* select measurements by time */1274 if (TimeSelect) {1275 if (measure[0].t < TSTART) { if (SUPER_VERBOSE) fprintf (stderr, "filter 8\n"); return FALSE; };1276 if (measure[0].t > TSTOP) { if (SUPER_VERBOSE) fprintf (stderr, "filter 9\n"); return FALSE; };1277 }1278 1279 /* select measurements by quality */1280 if (PhotFlagSelect) {1281 if (PhotFlagBad) {1282 mask = PhotFlagBad;1283 } else {1284 code = GetPhotcodebyCode (measure[0].photcode);1285 if (!code) { if (SUPER_VERBOSE) fprintf (stderr, "filter 10\n"); return FALSE; };1286 mask = code[0].astromBadMask;1287 }1288 if (mask & measure[0].photFlags) { if (SUPER_VERBOSE) fprintf (stderr, "filter 11\n"); return FALSE; };1289 }1290 1291 /* select measurements by measurement error */1292 if (applySigmaLim && (SIGMA_LIM > 0) && (measure[0].dM > SIGMA_LIM)) {1293 { if (SUPER_VERBOSE) fprintf (stderr, "filter 12\n"); return FALSE; };1294 }1295 1296 /* select measurements by mag limit */1297 if (ImagSelect) {1298 mag = PhotInst (measure, MAG_CLASS_PSF);1299 if (mag < ImagMin || mag > ImagMax) { if (SUPER_VERBOSE) fprintf (stderr, "filter 13\n"); return FALSE; };1300 }1301 1302 return TRUE;1303 }1304 # endif -
trunk/Ohana/src/relastro/src/StarMaps.c
r39457 r39926 166 166 dLmax = dMmax = 0.0; 167 167 168 float plateScale; 169 if (images[N].coords.mosaic) { 170 // NOTE: for the full pixel to sky plate scale, use this: 171 // float plateScaleX = 3600.0*images[N].coords.mosaic->cdelt1*images[N].coords.cdelt1; 172 // float plateScaleY = 3600.0*images[N].coords.mosaic->cdelt2*images[N].coords.cdelt2; 173 174 // since we are compare L,M values, just need to compensate for focal plate to sky: 175 float plateScaleX = 3600.0*fabs(images[N].coords.mosaic->cdelt1); 176 float plateScaleY = 3600.0*fabs(images[N].coords.mosaic->cdelt2); 177 plateScale = 0.5*(plateScaleX + plateScaleY); 178 } else { 179 // since we are compare L,M values, just need to compensate for arcsec vs degrees: 180 plateScale = 3600.0; 181 } 182 168 183 for (i = 0; i < starmap[N].Npoints; i++) { 169 184 … … 171 186 XY_to_LM (&L, &M, starmap[N].points[i].X, starmap[N].points[i].Y, &images[N].coords); 172 187 173 starmap[N].points[i].dL = starmap[N].points[i].L - L;174 starmap[N].points[i].dM = starmap[N].points[i].M - M;188 starmap[N].points[i].dL = plateScale*(starmap[N].points[i].L - L); 189 starmap[N].points[i].dM = plateScale*(starmap[N].points[i].M - M); 175 190 176 191 dLmax = MAX(fabs(starmap[N].points[i].dL), dLmax); -
trunk/Ohana/src/relastro/src/UpdateChips.c
r39457 r39926 42 42 AstromErrorSetLoop (Nloop, TRUE); 43 43 44 // if ChipMapLoop or ChipOrderLoop is set use that to define the value of CHIPMAP and/or CHIPORDER this loop 45 if (ChipMapLoop) { CHIPMAP = ChipMapLoop[Nloop]; } 46 if (ChipOrderLoop) { CHIPORDER = ChipOrderLoop[Nloop]; } 47 44 48 if (NTHREADS) { 45 49 UpdateChips_threaded (catalog, Ncatalog); … … 60 64 for (i = 0; i < Nimage; i++) { 61 65 62 VERBOSE_IMAGE = !strcmp(image[i].name, "o5745g0516o.356887.cm.982631.smf[XY54]"); 66 VERBOSE = FALSE; 67 VERBOSE_IMAGE |= !strcmp(image[i].name, "o5745g0516o.356887.cm.982631.smf[XY45]"); 68 VERBOSE_IMAGE |= !strcmp(image[i].name, "o5745g0526o.356899.cm.982643.smf[XY45]"); 69 VERBOSE_IMAGE |= !strcmp(image[i].name, "o5748g0436o.358811.cm.982690.smf[XY34]"); 63 70 64 71 // XXX looks like everything below is thread safe : we can unroll this into a set of 65 72 // helper functions that grab the next available chip.... 66 73 74 // allow certain cameras to stay static 75 if (SKIP_PS1_CHIP && isGPC1chip (image[i].photcode)) { Nskip ++; mode[i] = 0; continue; } 76 if (SKIP_PS1_STACK && isGPC1stack(image[i].photcode)) { Nskip ++; mode[i] = 0; continue; } 77 if (SKIP_HSC && isHSCchip (image[i].photcode)) { Nskip ++; mode[i] = 0; continue; } 78 if (SKIP_CFH && isCFHchip (image[i].photcode)) { Nskip ++; mode[i] = 0; continue; } 79 67 80 /* skip all except WRP images */ 68 81 if (strcmp(&image[i].coords.ctype[4], "-WRP")) { … … 160 173 setImageRaw (catalog, Ncatalog, i, raw, Nraw, MODE_MOSAIC); 161 174 if (USE_GALAXY_MODEL) { 162 // XXX DEPRECATE?175 // the image calibration was calculated using a galaxy motion model 163 176 image[i].flags |= ID_IMAGE_ASTROM_GMM; 164 177 } … … 281 294 } 282 295 296 // allow certain cameras to stay static 297 if (SKIP_PS1_CHIP && isGPC1chip (image[i].photcode)) { threadinfo->Nskip ++; threadinfo->mode[i] = 0; continue; } 298 if (SKIP_PS1_STACK && isGPC1stack(image[i].photcode)) { threadinfo->Nskip ++; threadinfo->mode[i] = 0; continue; } 299 if (SKIP_HSC && isHSCchip (image[i].photcode)) { threadinfo->Nskip ++; threadinfo->mode[i] = 0; continue; } 300 if (SKIP_CFH && isCFHchip (image[i].photcode)) { threadinfo->Nskip ++; threadinfo->mode[i] = 0; continue; } 301 283 302 /* skip all except WRP images */ 284 303 if (strcmp(&image[i].coords.ctype[4], "-WRP")) { -
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r39624 r39926 115 115 116 116 // only modify the chip coordinates 117 if (isGPC1chip (measureT->photcode)) { 117 if (UPDATE_PS1_STACK_MEASURE && isGPC1stack (measureT->photcode)) { 118 measureT->R = R; 119 measureT->D = D; 120 if (measureB) { 121 measureB->R = R; 122 measureB->D = D; 123 } 124 } 125 // only modify the chip coordinates 126 if (UPDATE_PS1_CHIP_MEASURE && isGPC1chip (measureT->photcode)) { 127 measureT->R = R; 128 measureT->D = D; 129 if (measureB) { 130 measureB->R = R; 131 measureB->D = D; 132 } 133 } 134 // only modify the chip coordinates 135 if (UPDATE_HSC_MEASURE && isGPC1chip (measureT->photcode)) { 136 measureT->R = R; 137 measureT->D = D; 138 if (measureB) { 139 measureB->R = R; 140 measureB->D = D; 141 } 142 } 143 // only modify the chip coordinates 144 if (UPDATE_CFH_MEASURE && isGPC1chip (measureT->photcode)) { 118 145 measureT->R = R; 119 146 measureT->D = D; -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r39693 r39926 167 167 strextend (&command, "relastro_client -update-offsets"); 168 168 strextend (&command, "-hostID %d", group->hosts[i][0].hostID); 169 strextend (&command, "-hostdir %s", group->hosts[i][0].pathname); 170 169 171 strextend (&command, "-D CATDIR %s", CATDIR); 170 strextend (&command, "-hostdir %s", group->hosts[i][0].pathname);171 172 strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 172 173 strextend (&command, "-statmode %s", STATMODE); 173 174 strextend (&command, "-minerror %f", MIN_ERROR); 174 175 176 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 177 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 178 175 179 if (FIT_MODE == FIT_PM_ONLY) strextend (&command, "-pm"); 176 180 if (FIT_MODE == FIT_PAR_ONLY) strextend (&command, "-par"); … … 180 184 if (VERBOSE2) strextend (&command, "-vv"); 181 185 if (RESET) strextend (&command, "-reset"); 182 if (UPDATE) strextend (&command, "-update");183 184 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images");185 186 186 187 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 187 188 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 188 189 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");190 189 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 191 190 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 192 191 193 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images");194 192 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 195 196 if (REPAIR_STACKS) strextend (&command, "-repair-stacks-on-update");197 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures");198 199 193 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 200 194 if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); … … 204 198 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 205 199 206 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES);207 208 200 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 209 201 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); … … 213 205 } 214 206 207 if (REPAIR_STACKS) strextend (&command, "-repair-stacks-on-update"); 208 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures"); 209 210 if (UPDATE_PS1_STACK_MEASURE) strextend (&command, "-update-ps1-stack"); 211 if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip"); 212 if (UPDATE_HSC_MEASURE) strextend (&command, "-update-hsc"); 213 if (UPDATE_CFH_MEASURE) strextend (&command, "-update-cfh"); 214 215 if (UPDATE) strextend (&command, "-update"); 216 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images"); 217 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search"); 218 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 219 215 220 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); 216 221 if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset %f", MaxMeanOffset); 222 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 217 223 218 224 if (TimeSelect) { … … 300 306 strextend (&command, "relastro_client -update-offsets"); 301 307 strextend (&command, "-hostID %d", table->hosts[i].hostID); 308 strextend (&command, "-hostdir %s", table->hosts[i].pathname); 309 302 310 strextend (&command, "-D CATDIR %s", CATDIR); 303 strextend (&command, "-hostdir %s", table->hosts[i].pathname);304 311 strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 305 312 strextend (&command, "-statmode %s", STATMODE); 306 313 strextend (&command, "-minerror %f", MIN_ERROR); 307 314 315 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 316 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 317 308 318 if (FIT_MODE == FIT_PM_ONLY) strextend (&command, "-pm"); 309 319 if (FIT_MODE == FIT_PAR_ONLY) strextend (&command, "-par"); … … 313 323 if (VERBOSE2) strextend (&command, "-vv"); 314 324 if (RESET) strextend (&command, "-reset"); 315 if (UPDATE) strextend (&command, "-update");316 317 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images");318 325 319 326 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 320 327 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 321 322 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");323 328 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 324 329 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 325 330 326 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images");327 331 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 328 329 if (REPAIR_STACKS) strextend (&command, "-repair-stacks-on-update");330 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures");331 332 332 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 333 333 if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); … … 337 337 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 338 338 339 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES);340 341 339 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 342 340 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); … … 345 343 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 346 344 } 345 346 if (REPAIR_STACKS) strextend (&command, "-repair-stacks-on-update"); 347 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures"); 348 349 if (UPDATE_PS1_STACK_MEASURE) strextend (&command, "-update-ps1-stack"); 350 if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip"); 351 if (UPDATE_HSC_MEASURE) strextend (&command, "-update-hsc"); 352 if (UPDATE_CFH_MEASURE) strextend (&command, "-update-cfh"); 353 354 if (UPDATE) strextend (&command, "-update"); 355 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images"); 356 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search"); 357 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 358 359 if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 347 360 348 361 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r39617 r39926 5 5 # define PAR_MIN_NPTS 7 6 6 # define PAR_MIN_NPTS_BOOT 6 7 # define PM_MIN_NPTS 48 # define PM_MIN_NPTS_BOOT 39 # define POS_MIN_NPTS 310 # define POS_MIN_NPTS_BOOT 27 # define PM_MIN_NPTS 5 8 # define PM_MIN_NPTS_BOOT 4 9 # define POS_MIN_NPTS 4 10 # define POS_MIN_NPTS_BOOT 4 11 11 12 12 typedef enum { 13 SELECT_MEAS_HAS_DATA = 1, 14 SELECT_MEAS_HAS_STACK = 2, 15 SELECT_MEAS_HAS_2MASS = 4, 13 SELECT_MEAS_HAS_DATA = 0x01, 14 SELECT_MEAS_HAS_STACK = 0x02, 15 SELECT_MEAS_HAS_2MASS = 0x04, 16 SELECT_MEAS_HAS_GAIA = 0x08, 17 SELECT_MEAS_HAS_TYCHO = 0x10, 16 18 } SelectMeasureStatus; 17 19 … … 181 183 if (Trange < PM_DT_MIN) { 182 184 // not enough baseline for proper motion, only set mean position 183 mode = FIT_AVERAGE;184 185 goto justPosition; 185 186 } 186 187 if (parRange < PAR_FACTOR_MIN) { 187 188 // not enough parallax factor range, skip parallax 188 mode = FIT_PM_ONLY;189 189 goto skipParallax; 190 190 } 191 191 if (fitStats->Npoints < PAR_MIN_NPTS) { 192 192 // not enough data, skip parallax 193 mode = FIT_PM_ONLY;194 193 goto skipParallax; 195 194 } 196 195 197 196 // we are going to use the IRLS analysis to calculate the mean solution and the masking 198 // then run N_BOOTSTRAP_SAMPLES to measure the errors 199 fitStats->fitdataPar->getError = !N_BOOTSTRAP_SAMPLES; 200 if (!FitPMandPar_IRLS (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) { 201 mode = FIT_PM_ONLY; 202 goto skipParallax; 203 } 204 205 if (N_BOOTSTRAP_SAMPLES) { 197 // then run N_BOOTSTRAP_SAMPLES to measure the errors. We first measure the OLS error, 198 // and choose the max of the OLS and bootstrap errors 199 fitStats->fitdataPar->getError = TRUE; 200 if (USE_IRLS) { 201 if (!FitPMandPar_IRLS (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) { 202 goto skipParallax; 203 } 204 } else { 205 if (!FitPMandPar_Basic (&fitPar, fitStats->fitdataPar, fitStats->points, fitStats->Npoints)) { 206 goto skipParallax; 207 } 208 } 209 210 // in the fits above, we have saved the formal error for the unmasked points. 211 // if we do not have enough points for bootstrap, we will keep those errors 212 if (N_BOOTSTRAP_SAMPLES && (fitPar.Nfit >= PAR_MIN_NPTS_BOOT)) { 206 213 fitStats->Nfit = 0; 207 214 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 208 if (Nnomask < PAR_MIN_NPTS_BOOT) { 209 // if we do not have enough points to assess parallax error, we cannot dothe bootstrap analysis.210 mode = FIT_PM_ONLY; 211 goto skipParallax;212 } 215 216 // if we do not have enough points to assess parallax error, skip the bootstrap analysis. 217 // (I think the test above means we never do this skip) 218 if (Nnomask < PAR_MIN_NPTS_BOOT) goto skipParallaxBootstrap; 219 213 220 for (k = 0; k < fitStats->NfitAlloc; k++) { 214 221 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); … … 216 223 fitStats->Nfit ++; 217 224 } 218 // these calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above) 225 226 // These calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above) 227 // this call expects the fitted parameters to have the formal error set: it will apply the 228 // max of the formal and bootstrap errors 219 229 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 220 230 BootstrapRobustStats (&fitPar, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); … … 224 234 } 225 235 236 skipParallaxBootstrap: 226 237 // project Ro, Do back to RA,DEC 227 238 XY_to_RD (&fitPar.Ro, &fitPar.Do, fitPar.Ro, fitPar.Do, &fitStats->coords); … … 242 253 valid = valid && (fabs(fitPar.uD) < 4.0); 243 254 valid = valid && (fabs(fitPar.p) < 2.0); 244 if (!valid) { 245 mode = FIT_PM_ONLY; 246 } else { 255 if (valid) { 247 256 average[0].flags |= ID_OBJ_USE_PAR; 248 257 } … … 254 263 if ((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) { 255 264 if (Trange < PM_DT_MIN) { 256 mode = FIT_AVERAGE;257 265 goto justPosition; 258 266 } 259 267 if (fitStats->Npoints < PM_MIN_NPTS) { 260 mode = FIT_AVERAGE;261 268 goto justPosition; 262 269 } 263 270 264 271 // if we have fitted (and accepted) a parallax model, get the best pm fit and chisq 265 // given the set of points (mask is respected) 266 if (average[0].flags & ID_OBJ_USE_PAR) { 272 // given the set of points (mask is respected). Alternatively, if we do not request 273 // IRLS fitting, the just use OLS fitting (skip bootstrap) 274 if ((average[0].flags & ID_OBJ_USE_PAR) || !USE_IRLS) { 267 275 if (!FitPM_Basic (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 268 276 average[0].flags |= ID_OBJ_BAD_PM; 269 277 goto justPosition; 270 278 } 271 } else { 272 fitStats->fitdataPM->getError = !N_BOOTSTRAP_SAMPLES; 273 if (!FitPM_IRLS (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 274 mode = FIT_AVERAGE; 275 goto justPosition; 276 } 277 if (N_BOOTSTRAP_SAMPLES) { 278 fitStats->Nfit = 0; 279 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 280 if (Nnomask < PM_MIN_NPTS_BOOT) { 281 mode = FIT_AVERAGE; 282 goto justPosition; 283 } 284 for (k = 0; k < fitStats->NfitAlloc; k++) { 285 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); 286 if (!FitPM_Basic (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, Nnomask)) continue; 287 fitStats->Nfit ++; 288 } 289 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 290 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 291 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uR); 292 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uD); 293 } 294 } 295 279 goto skipProperMotionBootstrap; 280 } 281 282 // we are going to use the IRLS analysis to calculate the mean solution and the masking 283 // then run N_BOOTSTRAP_SAMPLES to measure the errors. We first measure the OLS error, 284 // and choose the max of the OLS and bootstrap errors 285 fitStats->fitdataPM->getError = TRUE; 286 if (!FitPM_IRLS (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 287 goto justPosition; 288 } 289 290 // in the fits above, we have saved the formal error for the unmasked points. 291 // if we do not have enough points for bootstrap, we will keep those errors 292 if (N_BOOTSTRAP_SAMPLES && (fitPM.Nfit >= PM_MIN_NPTS_BOOT)) { 293 fitStats->Nfit = 0; 294 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 295 296 // if we do not have enough points to assess p.m. error, skip the bootstrap analysis. 297 // (I think the test above means we never do this skip) 298 if (Nnomask < PM_MIN_NPTS_BOOT) goto skipProperMotionBootstrap; 299 300 for (k = 0; k < fitStats->NfitAlloc; k++) { 301 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); 302 if (!FitPM_Basic (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, Nnomask)) continue; 303 fitStats->Nfit ++; 304 } 305 306 // These calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above) 307 // this call expects the fitted parameters to have the formal error set: it will apply the 308 // max of the formal and bootstrap errors 309 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 310 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 311 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uR); 312 BootstrapRobustStats (&fitPM, fitStats->fit, fitStats->Nfit, FIT_RESULT_uD); 313 } 314 315 skipProperMotionBootstrap: 296 316 // project Ro, Do back to RA,DEC 297 317 XY_to_RD (&fitPM.Ro, &fitPM.Do, fitPM.Ro, fitPM.Do, &fitStats->coords); … … 300 320 fitStats->Npm ++; 301 321 322 // XXX a hard-wired hack... 302 323 // unless there is a clear problems (below) with the proper-motion fit or we have a parallax fit, we will use pm fit 303 324 int valid = TRUE; … … 309 330 valid = valid && (fabs(fitPM.uD) < 4.0); 310 331 if (!valid) { 311 mode = FIT_AVERAGE;312 332 average[0].flags |= ID_OBJ_BAD_PM; 313 333 } else { … … 323 343 // if we only have one point, this is silly... 324 344 345 // set the proper motion (to the galaxy model or average value, if desired; else to 0,0) 325 346 FitAstromResultSetPM (&fitPos, 1, average); 326 // fprintf (stderr, "fit 1: %f %f : %f %f\n", fitPos.Ro, fitPos.Do, fitPos.uR, fitPos.uD); 327 if (average[0].flags & (ID_OBJ_USE_PAR | ID_OBJ_USE_PM)) { 347 348 // if we already have a valid fit (pm or par), use OLS to fit the position 349 // alternatively, if we do not request IRLS, use OLS 350 // alternatively, if we do not have enough points, use OLS 351 if ((average[0].flags & (ID_OBJ_USE_PAR | ID_OBJ_USE_PM)) || (fitStats->Npoints < POS_MIN_NPTS) || !USE_IRLS) { 328 352 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 329 // if this fails, stick with the PM and/or PAR fit from above 353 // if this fails, stick with the PM and/or PAR fit from above, or use a single value 330 354 goto doneWithFit; 331 355 } 332 } else { 333 if (fitStats->Npoints < POS_MIN_NPTS) { 334 // I will not try to outlier-reject, just calculate the weighted average 335 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 336 // if we have tried this, we have not masked any points; we will find a single unmasked point below 337 goto doneWithFit; 338 } 356 // if we have not already gotten a good fit, use this fit 357 if (!(average[0].flags & (ID_OBJ_USE_PAR | ID_OBJ_USE_PM))) { 339 358 average[0].flags |= ID_OBJ_USE_AVE; 340 359 average[0].flags |= ID_OBJ_RAW_AVE; 341 goto useBasic; 342 } 343 if (!FitPosPMfixed_IRLS (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 344 // if the above fails, we need to clear the masks and try again below 345 FitPointsClearMasks (fitStats->points, fitStats->Npoints); 346 // just calculate the weighted average 347 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 348 // if this fails, find a single unmasked point below 349 goto doneWithFit; 350 } 351 average[0].flags |= ID_OBJ_USE_AVE; 352 average[0].flags |= ID_OBJ_RAW_AVE; 353 goto useBasic; 354 } 355 // fprintf (stderr, "fit 2: %f %f : %f %f\n", fitPos.Ro, fitPos.Do, fitPos.uR, fitPos.uD); 356 if (N_BOOTSTRAP_SAMPLES) { 357 fitStats->Nfit = 0; 358 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 359 if (Nnomask < POS_MIN_NPTS_BOOT) { 360 // if the above fails, we need to clear the masks and try again below 361 FitPointsClearMasks (fitStats->points, fitStats->Npoints); 362 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 363 // if this fails, find a single unmasked point below 364 goto doneWithFit; 365 } 366 average[0].flags |= ID_OBJ_USE_AVE; 367 average[0].flags |= ID_OBJ_RAW_AVE; 368 goto useBasic; 369 } 370 FitAstromResultSetPM (fitStats->fit, fitStats->NfitAlloc, average); 371 for (k = 0; k < fitStats->NfitAlloc; k++) { 372 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); 373 if (!FitPosPMfixed_Basic (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, Nnomask)) continue; 374 fitStats->Nfit ++; 375 } 376 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 377 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 360 } 361 goto useBasic; 362 } 363 364 // try the IRLS fitting, otherwise give up and use OLS 365 if (!FitPosPMfixed_IRLS (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 366 // if the above fails, we need to clear the masks and try again below 367 FitPointsClearMasks (fitStats->points, fitStats->Npoints); 368 // just calculate the weighted average 369 if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) { 370 // if this fails, find a single unmasked point below 371 goto doneWithFit; 378 372 } 379 373 average[0].flags |= ID_OBJ_USE_AVE; 374 average[0].flags |= ID_OBJ_RAW_AVE; 375 goto useBasic; 376 } 377 average[0].flags |= ID_OBJ_USE_AVE; 378 379 if (N_BOOTSTRAP_SAMPLES && (fitPos.Nfit >= POS_MIN_NPTS_BOOT)) { 380 fitStats->Nfit = 0; 381 int Nnomask = BootstrapSaveUnmasked (fitStats->nomask, fitStats->points, fitStats->Npoints); 382 383 if (Nnomask < POS_MIN_NPTS_BOOT) goto useBasic; 384 385 FitAstromResultSetPM (fitStats->fit, fitStats->NfitAlloc, average); 386 for (k = 0; k < fitStats->NfitAlloc; k++) { 387 BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask); 388 if (!FitPosPMfixed_Basic (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, Nnomask)) continue; 389 fitStats->Nfit ++; 390 } 391 392 // These calls set the ERRORS on the fit parameters, not the fit values (set in IRLS above) 393 // this call expects the fitted parameters to have the formal error set: it will apply the 394 // max of the formal and bootstrap errors 395 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_RA); 396 BootstrapRobustStats (&fitPos, fitStats->fit, fitStats->Nfit, FIT_RESULT_DEC); 380 397 } 381 398 … … 544 561 average[0].dP = fit.dp; // parallax error in arcsec 545 562 563 546 564 average[0].ChiSqAve = fitPos.chisq; 547 565 average[0].ChiSqPM = fitPM.chisq; … … 666 684 667 685 int has2MASS = FALSE; 686 int hasGAIA = FALSE; 687 int hasTycho = FALSE; 668 688 int hasStack = FALSE; 669 689 if (stackEntry) *stackEntry = -1; … … 774 794 Npoints++; 775 795 776 if ((measure[k].photcode >= 2011) && (measure[k].photcode <= 2013)) {777 has2MASS = TRUE;778 }796 hasGAIA = (measure[k].photcode == 1030); 797 has2MASS = ((measure[k].photcode >= 2011) && (measure[k].photcode <= 2013)); 798 hasTycho = ((measure[k].photcode >= 2020) && (measure[k].photcode <= 2021)); 779 799 780 800 myAssert (Npoints <= fit->NpointsAlloc, "oops"); … … 796 816 measure[k].dbFlags &= ~ID_MEAS_OBJECT_HAS_2MASS; 797 817 } 818 if (hasGAIA) { 819 measure[k].dbFlags |= ID_MEAS_OBJECT_HAS_GAIA; 820 } else { 821 measure[k].dbFlags &= ~ID_MEAS_OBJECT_HAS_GAIA; 822 } 823 if (hasTycho) { 824 measure[k].dbFlags |= ID_MEAS_OBJECT_HAS_TYCHO; 825 } else { 826 measure[k].dbFlags &= ~ID_MEAS_OBJECT_HAS_TYCHO; 827 } 798 828 } 799 829 … … 803 833 if (hasStack) status |= SELECT_MEAS_HAS_STACK; 804 834 if (has2MASS) status |= SELECT_MEAS_HAS_2MASS; 835 if (hasGAIA) status |= SELECT_MEAS_HAS_GAIA; 836 if (hasTycho) status |= SELECT_MEAS_HAS_TYCHO; 805 837 return status; 806 838 } … … 822 854 823 855 int i; 856 857 myAbort ("this should not be called anymore"); 824 858 825 859 // add up the chi square for the fit … … 852 886 int i; 853 887 854 if ( USE_GALAXY_MODEL) {888 if (APPLY_PROPER_MOTION) { 855 889 for (i = 0; i < Nfit; i++) { 856 fit[i].uR = average->uRgal; 857 fit[i].uD = average->uDgal; 890 if (USE_GALAXY_MODEL) { 891 fit[i].uR = average->uRgal; 892 fit[i].uD = average->uDgal; 893 } else { 894 fit[i].uR = average->uR; 895 fit[i].uD = average->uD; 896 } 858 897 } 859 898 } else { -
trunk/Ohana/src/relastro/src/UpdateStacks.c
r39457 r39926 3 3 // NOTE: we only measure the systematic floor of the astrometric scatter per stack, no change to the calibration 4 4 int UpdateStacks (Catalog *catalog, int Ncatalog) { 5 6 if (SKIP_PS1_STACK) return TRUE; 5 7 6 8 off_t Nimage; … … 46 48 47 49 // XXX: I need to convert dLsig, dMsig from degrees to pixels 48 dLsig *= 3600.0 / 0.25;49 dMsig *= 3600.0 / 0.25;50 dLsig *= 3600.0; 51 dMsig *= 3600.0; 50 52 51 53 image[i].dXpixSys = dLsig; -
trunk/Ohana/src/relastro/src/args.c
r39693 r39926 1 1 # include "relastro.h" 2 void usage ( void);3 void usage_client ( void);2 void usage (int argc, char **argv); 3 void usage_client (int argc, char **argv); 4 4 void usage_merge_source (void); 5 5 void usage_merge_source_id (char *name); 6 6 float *ParseLoopWeights (char *rawlist); 7 int *ParseLoopOrder (char *rawlist, int minValue); 7 8 8 9 int args (int argc, char **argv) { … … 39 40 remove_argument (N, &argc, argv); 40 41 41 if (argc != 1) usage ( );42 if (argc != 1) usage (argc, argv); 42 43 return TRUE; 43 44 } … … 76 77 remove_argument (N, &argc, argv); 77 78 CHECK_MEASURE_TO_IMAGE = TRUE; 79 } 80 81 // catch-up mode : for a re-run, allow the sync file to be ahead of the desired location: 82 CATCH_UP = FALSE; 83 if ((N = get_argument (argc, argv, "-catch-up"))) { 84 remove_argument (N, &argc, argv); 85 CATCH_UP = TRUE; 78 86 } 79 87 … … 105 113 remove_argument (N, &argc, argv); 106 114 RELASTRO_OP = OP_PARALLEL_IMAGES; 107 if (N >= argc) usage ();115 if (N >= argc) usage (argc, argv); 108 116 IMAGE_TABLE = strcreate (argv[N]); 109 117 remove_argument (N, &argc, argv); 110 if (!REGION_FILE) usage ();118 if (!REGION_FILE) usage (argc, argv); 111 119 } 112 120 … … 114 122 remove_argument (N, &argc, argv); 115 123 RELASTRO_OP = OP_IMAGES; 124 } 125 126 // used to decide if changes to the image parameters get applied to the measures 127 APPLY_OFFSETS = FALSE; 128 if ((N = get_argument (argc, argv, "-apply-offsets"))) { 129 remove_argument (N, &argc, argv); 130 APPLY_OFFSETS = TRUE; 131 } 132 133 APPLY_PROPER_MOTION = FALSE; 134 if ((N = get_argument (argc, argv, "-apply-proper-motion"))) { 135 remove_argument (N, &argc, argv); 136 APPLY_PROPER_MOTION = TRUE; 137 } 138 139 SKIP_PS1_CHIP = FALSE; 140 if ((N = get_argument (argc, argv, "-skip-ps1-chip"))) { 141 remove_argument (N, &argc, argv); 142 SKIP_PS1_CHIP = TRUE; 143 } 144 SKIP_PS1_STACK = FALSE; 145 if ((N = get_argument (argc, argv, "-skip-ps1-stack"))) { 146 remove_argument (N, &argc, argv); 147 SKIP_PS1_STACK = TRUE; 148 } 149 SKIP_HSC = FALSE; 150 if ((N = get_argument (argc, argv, "-skip-hsc"))) { 151 remove_argument (N, &argc, argv); 152 SKIP_HSC = TRUE; 153 } 154 SKIP_CFH = FALSE; 155 if ((N = get_argument (argc, argv, "-skip-cfh"))) { 156 remove_argument (N, &argc, argv); 157 SKIP_CFH = TRUE; 158 } 159 160 UPDATE_PS1_STACK_MEASURE = FALSE; 161 if ((N = get_argument (argc, argv, "-update-ps1-stack"))) { 162 remove_argument (N, &argc, argv); 163 UPDATE_PS1_STACK_MEASURE = TRUE; 164 } 165 UPDATE_PS1_CHIP_MEASURE = FALSE; 166 if ((N = get_argument (argc, argv, "-update-ps1-chip"))) { 167 remove_argument (N, &argc, argv); 168 UPDATE_PS1_CHIP_MEASURE = TRUE; 169 } 170 UPDATE_HSC_MEASURE = FALSE; 171 if ((N = get_argument (argc, argv, "-update-hsc"))) { 172 remove_argument (N, &argc, argv); 173 UPDATE_HSC_MEASURE = TRUE; 174 } 175 UPDATE_CFH_MEASURE = FALSE; 176 if ((N = get_argument (argc, argv, "-update-cfh"))) { 177 remove_argument (N, &argc, argv); 178 UPDATE_CFH_MEASURE = TRUE; 179 } 180 if (RELASTRO_OP == OP_UPDATE_OFFSETS) { 181 if (!UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 182 fprintf (stderr, "for -update-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 183 exit (2); 184 } 185 } 186 if ((RELASTRO_OP == OP_PARALLEL_IMAGES) || (RELASTRO_OP == OP_IMAGES)) { 187 if (APPLY_OFFSETS && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 188 fprintf (stderr, "for [-images or -parallel-images] with -apply-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 189 exit (2); 190 } 191 } 192 193 // for fitting objects, this is always the same as 'ALLOW_IRLS' below, but for fitting 194 // images, this is set to FALSE while doing the fit for the image parameters 195 USE_IRLS = TRUE; 196 ALLOW_IRLS = TRUE; 197 if ((N = get_argument (argc, argv, "-no-irls"))) { 198 remove_argument (N, &argc, argv); 199 USE_IRLS = FALSE; 200 ALLOW_IRLS = FALSE; 116 201 } 117 202 … … 120 205 remove_argument (N, &argc, argv); 121 206 RELASTRO_OP = OP_PARALLEL_REGIONS; 122 if (!REGION_FILE) usage ();207 if (!REGION_FILE) usage (argc, argv); 123 208 if ((N = get_argument (argc, argv, "-parallel-regions-manual"))) { 124 209 remove_argument (N, &argc, argv); … … 128 213 129 214 if ((N = get_argument (argc, argv, "-testobj1"))) { 130 if (N > argc - 3) usage ( );215 if (N > argc - 3) usage (argc, argv); 131 216 remove_argument (N, &argc, argv); 132 217 OBJ_ID_SRC = strtol(argv[N], &endptr, 0); 133 if (*endptr) usage ( );218 if (*endptr) usage (argc, argv); 134 219 remove_argument (N, &argc, argv); 135 220 CAT_ID_SRC = strtol(argv[N], &endptr, 0); 136 if (*endptr) usage ( );221 if (*endptr) usage (argc, argv); 137 222 remove_argument (N, &argc, argv); 138 223 } 139 224 140 225 if ((N = get_argument (argc, argv, "-testobj2"))) { 141 if (N > argc - 3) usage ( );226 if (N > argc - 3) usage (argc, argv); 142 227 remove_argument (N, &argc, argv); 143 228 OBJ_ID_DST = strtol(argv[N], &endptr, 0); 144 if (*endptr) usage ( );229 if (*endptr) usage (argc, argv); 145 230 remove_argument (N, &argc, argv); 146 231 CAT_ID_DST = strtol(argv[N], &endptr, 0); 147 if (*endptr) usage ( );232 if (*endptr) usage (argc, argv); 148 233 remove_argument (N, &argc, argv); 149 234 } … … 167 252 if ((N = get_argument (argc, argv, "-high-speed"))) { 168 253 // XXX include a parallax / no-parallax option 169 if (N >= argc - 4) usage ();254 if (N >= argc - 4) usage (argc, argv); 170 255 RELASTRO_OP = OP_HIGH_SPEED; 171 256 remove_argument (N, &argc, argv); … … 181 266 182 267 if ((N = get_argument (argc, argv, "-hpm"))) { 183 if (N >= argc - 2) usage ();268 if (N >= argc - 2) usage (argc, argv); 184 269 RELASTRO_OP = OP_HPM; 185 270 remove_argument (N, &argc, argv); … … 212 297 FIT_TARGET = TARGET_MOSAICS; 213 298 } 299 if ((N = get_argument (argc, argv, "-set-chips"))) { 300 remove_argument (N, &argc, argv); 301 FIT_TARGET = SET_CHIPS; 302 } 214 303 215 304 FlagOutlier = FALSE; … … 231 320 } 232 321 233 if (RELASTRO_OP == OP_NONE) usage ();234 235 if (((RELASTRO_OP == OP_IMAGES) || (RELASTRO_OP == OP_PARALLEL_REGIONS) || (RELASTRO_OP == OP_PARALLEL_IMAGES)) && (FIT_TARGET == TARGET_NONE)) usage ();322 if (RELASTRO_OP == OP_NONE) usage (argc, argv); 323 324 if (((RELASTRO_OP == OP_IMAGES) || (RELASTRO_OP == OP_PARALLEL_REGIONS) || (RELASTRO_OP == OP_PARALLEL_IMAGES)) && (FIT_TARGET == TARGET_NONE)) usage (argc, argv); 236 325 237 326 /* specify portion of the sky : allow default of all sky? */ … … 303 392 } 304 393 394 KEEP_ALL_IMAGES_RA = FALSE; 395 if ((N = get_argument (argc, argv, "-keep-all-images-ra"))) { 396 remove_argument (N, &argc, argv); 397 KEEP_ALL_IMAGES_RA = TRUE; 398 } 399 305 400 USE_BASIC_CHECK = FALSE; 306 401 if ((N = get_argument (argc, argv, "-basic-image-search"))) { … … 315 410 remove_argument (N, &argc, argv); 316 411 MaxDensityUse = TRUE; 317 }318 319 APPLY_OFFSETS = FALSE;320 if ((N = get_argument (argc, argv, "-apply-offsets"))) {321 remove_argument (N, &argc, argv);322 APPLY_OFFSETS = TRUE;323 412 } 324 413 … … 439 528 } 440 529 441 CHIPORDER = 0;442 if ((N = get_argument (argc, argv, "-chiporder"))) {443 remove_argument (N, &argc, argv);444 CHIPORDER = atoi(argv[N]);445 remove_argument (N, &argc, argv);446 }447 448 CHIPMAP = 0;449 if ((N = get_argument (argc, argv, "-chipmap"))) {450 remove_argument (N, &argc, argv);451 CHIPMAP = atoi(argv[N]);452 remove_argument (N, &argc, argv);453 454 }455 456 530 SAVEPLOT = FALSE; 457 531 PLOTSTUFF = FALSE; … … 580 654 } 581 655 656 // e.g., -chiporderloop 3,4,5 657 // NOTE: this must come after -nloop above 658 ChipOrderLoop = NULL; 659 ChipOrderLoopStr = NULL; 660 CHIPORDER = 1; 661 if ((N = get_argument (argc, argv, "-chiporder"))) { 662 remove_argument (N, &argc, argv); 663 CHIPORDER = atoi(argv[N]); 664 remove_argument (N, &argc, argv); 665 } 666 if ((N = get_argument (argc, argv, "-chiporderloop"))) { 667 remove_argument (N, &argc, argv); 668 ChipOrderLoopStr = strcreate(argv[N]); 669 ChipOrderLoop = ParseLoopOrder (argv[N], 1); 670 remove_argument (N, &argc, argv); 671 } 672 673 ChipMapLoop = NULL; 674 ChipMapLoopStr = NULL; 675 CHIPMAP = 0; 676 if ((N = get_argument (argc, argv, "-chipmap"))) { 677 remove_argument (N, &argc, argv); 678 CHIPMAP = atoi(argv[N]); 679 remove_argument (N, &argc, argv); 680 681 } 682 if ((N = get_argument (argc, argv, "-chipmaploop"))) { 683 remove_argument (N, &argc, argv); 684 ChipMapLoopStr = strcreate(argv[N]); 685 ChipMapLoop = ParseLoopOrder (argv[N], 0); 686 remove_argument (N, &argc, argv); 687 } 688 689 582 690 // e.g., -loop-weights-2mass 1000,300,300,200,200,100 583 691 // NOTE: this must come after -nloop above … … 591 699 } 592 700 LoopWeightTycho = NULL; 701 LoopWeightTychostr = NULL; 593 702 if ((N = get_argument (argc, argv, "-loop-weights-tycho"))) { 594 703 remove_argument (N, &argc, argv); … … 597 706 remove_argument (N, &argc, argv); 598 707 } 708 LoopWeightGAIA = NULL; 709 LoopWeightGAIAstr = NULL; 710 if ((N = get_argument (argc, argv, "-loop-weights-gaia"))) { 711 remove_argument (N, &argc, argv); 712 LoopWeightGAIAstr = strcreate(argv[N]); 713 LoopWeightGAIA = ParseLoopWeights (argv[N]); 714 remove_argument (N, &argc, argv); 715 } 716 717 GALAXY_MODEL = NULL; 718 if ((N = get_argument (argc, argv, "-galaxy-model"))) { 719 remove_argument (N, &argc, argv); 720 GALAXY_MODEL = strcreate(argv[N]); 721 remove_argument (N, &argc, argv); 722 } 723 if (!GALAXY_MODEL) GALAXY_MODEL = strcreate ("FEAST-HIPPARCOS"); 724 725 // for testing, allow the galaxy model scale to be non-unity 726 TEST_SCALE = 1.0; 727 if ((N = get_argument (argc, argv, "-testing"))) { 728 remove_argument (N, &argc, argv); 729 TEST_SCALE = atof(argv[N]); 730 remove_argument (N, &argc, argv); 731 } 599 732 600 733 NTHREADS = 0; … … 605 738 } 606 739 607 if (argc != 1) usage ( );740 if (argc != 1) usage (argc, argv); 608 741 return TRUE; 609 742 } … … 614 747 FREE (LoopWeight2MASSstr); 615 748 FREE (LoopWeightTychostr); 749 FREE (LoopWeightGAIAstr); 750 FREE (LoopWeight2MASS); 751 FREE (LoopWeightTycho); 752 FREE (LoopWeightGAIA); 753 754 FREE (ChipMapLoop); 755 FREE (ChipMapLoopStr); 756 FREE (ChipOrderLoop); 757 FREE (ChipOrderLoopStr); 616 758 617 759 FREE (PHOTCODE_SKIP_LIST); … … 628 770 FREE (BCATALOG); 629 771 FREE (HOSTDIR); 772 FREE (GALAXY_MODEL); 630 773 631 774 // these are set in initialize … … 673 816 remove_argument (N, &argc, argv); 674 817 } 675 if (!HOST_ID) usage_client ();818 if (!HOST_ID) usage_client (argc, argv); 676 819 677 820 HOSTDIR = NULL; … … 681 824 remove_argument (N, &argc, argv); 682 825 } 683 if (!HOSTDIR) usage_client ();826 if (!HOSTDIR) usage_client (argc, argv); 684 827 685 828 if ((N = get_argument (argc, argv, "-load-objects"))) { … … 726 869 } 727 870 871 SKIP_PS1_CHIP = FALSE; 872 if ((N = get_argument (argc, argv, "-skip-ps1-chip"))) { 873 remove_argument (N, &argc, argv); 874 SKIP_PS1_CHIP = TRUE; 875 } 876 SKIP_PS1_STACK = FALSE; 877 if ((N = get_argument (argc, argv, "-skip-ps1-stack"))) { 878 remove_argument (N, &argc, argv); 879 SKIP_PS1_STACK = TRUE; 880 } 881 SKIP_HSC = FALSE; 882 if ((N = get_argument (argc, argv, "-skip-hsc"))) { 883 remove_argument (N, &argc, argv); 884 SKIP_HSC = TRUE; 885 } 886 SKIP_CFH = FALSE; 887 if ((N = get_argument (argc, argv, "-skip-cfh"))) { 888 remove_argument (N, &argc, argv); 889 SKIP_CFH = TRUE; 890 } 891 892 UPDATE_PS1_STACK_MEASURE = FALSE; 893 if ((N = get_argument (argc, argv, "-update-ps1-stack"))) { 894 remove_argument (N, &argc, argv); 895 UPDATE_PS1_STACK_MEASURE = TRUE; 896 } 897 UPDATE_PS1_CHIP_MEASURE = FALSE; 898 if ((N = get_argument (argc, argv, "-update-ps1-chip"))) { 899 remove_argument (N, &argc, argv); 900 UPDATE_PS1_CHIP_MEASURE = TRUE; 901 } 902 UPDATE_HSC_MEASURE = FALSE; 903 if ((N = get_argument (argc, argv, "-update-hsc"))) { 904 remove_argument (N, &argc, argv); 905 UPDATE_HSC_MEASURE = TRUE; 906 } 907 UPDATE_CFH_MEASURE = FALSE; 908 if ((N = get_argument (argc, argv, "-update-cfh"))) { 909 remove_argument (N, &argc, argv); 910 UPDATE_CFH_MEASURE = TRUE; 911 } 912 if (RELASTRO_OP == OP_UPDATE_OFFSETS) { 913 if (!UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 914 fprintf (stderr, "for -update-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 915 exit (2); 916 } 917 } 918 728 919 // check for object fitting modes 729 920 if ((N = get_argument (argc, argv, "-pm"))) { … … 742 933 if ((N = get_argument (argc, argv, "-high-speed"))) { 743 934 // XXX include a parallax / no-parallax option 744 if (N >= argc - 5) usage_client ();935 if (N >= argc - 5) usage_client (argc, argv); 745 936 RELASTRO_OP = OP_HIGH_SPEED; 746 937 remove_argument (N, &argc, argv); … … 756 947 757 948 if ((N = get_argument (argc, argv, "-hpm"))) { 758 if (N >= argc - 3) usage ();949 if (N >= argc - 3) usage_client (argc, argv); 759 950 RELASTRO_OP = OP_HPM; 760 951 remove_argument (N, &argc, argv); … … 766 957 767 958 if ((N = get_argument (argc, argv, "-testobj1"))) { 768 if (N > argc - 3) usage ();959 if (N > argc - 3) usage_client (argc, argv); 769 960 remove_argument (N, &argc, argv); 770 961 OBJ_ID_SRC = strtol(argv[N], &endptr, 0); 771 if (*endptr) usage ();962 if (*endptr) usage_client (argc, argv); 772 963 remove_argument (N, &argc, argv); 773 964 CAT_ID_SRC = strtol(argv[N], &endptr, 0); 774 if (*endptr) usage ();965 if (*endptr) usage_client (argc, argv); 775 966 remove_argument (N, &argc, argv); 776 967 } 777 968 778 969 if ((N = get_argument (argc, argv, "-testobj2"))) { 779 if (N > argc - 3) usage ();970 if (N > argc - 3) usage_client (argc, argv); 780 971 remove_argument (N, &argc, argv); 781 972 OBJ_ID_DST = strtol(argv[N], &endptr, 0); 782 if (*endptr) usage ();973 if (*endptr) usage_client (argc, argv); 783 974 remove_argument (N, &argc, argv); 784 975 CAT_ID_DST = strtol(argv[N], &endptr, 0); 785 if (*endptr) usage ();976 if (*endptr) usage_client (argc, argv); 786 977 remove_argument (N, &argc, argv); 787 978 } … … 805 996 } 806 997 807 if (RELASTRO_OP == OP_NONE) usage_client(); 998 GALAXY_MODEL = NULL; 999 if ((N = get_argument (argc, argv, "-galaxy-model"))) { 1000 remove_argument (N, &argc, argv); 1001 GALAXY_MODEL = strcreate(argv[N]); 1002 remove_argument (N, &argc, argv); 1003 } 1004 if (!GALAXY_MODEL) GALAXY_MODEL = strcreate ("FEAST-HIPPARCOS"); 1005 1006 // for testing, allow the galaxy model scale to be non-unity 1007 TEST_SCALE = 1.0; 1008 if ((N = get_argument (argc, argv, "-testing"))) { 1009 remove_argument (N, &argc, argv); 1010 TEST_SCALE = atof(argv[N]); 1011 remove_argument (N, &argc, argv); 1012 } 1013 1014 if (RELASTRO_OP == OP_NONE) usage_client (argc, argv); 808 1015 809 1016 /* specify portion of the sky : allow default of all sky? */ … … 1032 1239 } 1033 1240 1034 if (argc != 1) usage_client ( );1241 if (argc != 1) usage_client (argc, argv); 1035 1242 return TRUE; 1036 1243 } … … 1049 1256 FREE(HIGH_SPEED_DIR); 1050 1257 FREE(BCATALOG); 1051 FREE (HOSTDIR); 1258 FREE(HOSTDIR); 1259 FREE(GALAXY_MODEL); 1052 1260 1053 1261 // these are set in initialize … … 1066 1274 } 1067 1275 1068 void usage ( ) {1276 void usage (int argc, char **argv) { 1069 1277 fprintf (stderr, "ERROR: USAGE: relastro -images -update-simple [options]\n"); 1070 1278 fprintf (stderr, " OR: relastro -images -update-chips [options]\n"); … … 1116 1324 fprintf (stderr, " -v\n"); 1117 1325 fprintf (stderr, " \n"); 1326 1327 fprintf (stderr, "remaining args: "); 1328 for (int i = 0; i < argc; i++) { 1329 fprintf (stderr, "%s ", argv[i]); 1330 } 1331 fprintf (stderr, "\n"); 1332 1118 1333 exit (2); 1119 1334 } 1120 1335 1121 void usage_client ( ) {1336 void usage_client (int argc, char **argv) { 1122 1337 fprintf (stderr, "ERROR: USAGE: relastro_client -load\n"); 1123 1338 fprintf (stderr, " OR: relastro_client -update-offsets\n"); … … 1150 1365 fprintf (stderr, " -v\n"); 1151 1366 fprintf (stderr, " \n"); 1367 1368 fprintf (stderr, "remaining args: "); 1369 for (int i = 0; i < argc; i++) { 1370 fprintf (stderr, "%s ", argv[i]); 1371 } 1372 fprintf (stderr, "\n"); 1373 1152 1374 exit (2); 1153 1375 } … … 1189 1411 } 1190 1412 1413 // this sets the last loops to match the last value... 1191 1414 while (Nloop < NLOOP) { 1192 1415 weights[Nloop] = weights[Nloop - 1]; 1193 1416 Nloop ++; 1194 1417 } 1418 1195 1419 return weights; 1196 1420 } 1421 1422 int *ParseLoopOrder (char *rawlist, int minValue) { 1423 1424 int *orders = NULL; 1425 ALLOCATE (orders, int, NLOOP); 1426 1427 int Nloop = 0; 1428 1429 /* parse the comma-separated list of photcodes */ 1430 char *myList = strcreate(rawlist); 1431 char *list = myList; 1432 char *entry = NULL; 1433 char *ptr = NULL; 1434 while ((Nloop < NLOOP) && ((entry = strtok_r (list, ",", &ptr)) != NULL)) { 1435 list = NULL; // pass NULL on successive strtok_r calls 1436 1437 orders[Nloop] = atoi(entry); 1438 if (orders[Nloop] < minValue) { 1439 fprintf (stderr, "order cannot be < %d: %s\n", minValue, rawlist); 1440 exit (3); 1441 } 1442 1443 Nloop ++; 1444 } 1445 free (myList); 1446 1447 if (Nloop == 0) { 1448 fprintf (stderr, "syntax error parsing orders: %s\n", rawlist); 1449 exit (3); 1450 } 1451 1452 // this sets the last loops to match the last value... 1453 while (Nloop < NLOOP) { 1454 orders[Nloop] = orders[Nloop - 1]; 1455 Nloop ++; 1456 } 1457 1458 return orders; 1459 } -
trunk/Ohana/src/relastro/src/assign_images.c
r39457 r39926 40 40 41 41 // register the image array with ImageOps.c for later getimageByID calls 42 initImages (image, NULL, Nimage );42 initImages (image, NULL, Nimage, FALSE); 43 43 44 44 if (VERBOSE) fprintf (stderr, "finding images\n"); … … 72 72 73 73 for (j = 0; j < Nimage; j++) { 74 75 // allow certain cameras to stay static 76 if (SKIP_PS1_CHIP && isGPC1chip (image[j].photcode)) continue; 77 if (SKIP_PS1_STACK && isGPC1stack(image[j].photcode)) continue; 78 if (SKIP_HSC && isHSCchip (image[j].photcode)) continue; 79 if (SKIP_CFH && isCFHchip (image[j].photcode)) continue; 74 80 75 81 /* select images by photcode, or equiv photcode, if specified */ -
trunk/Ohana/src/relastro/src/bcatalog.c
r39587 r39926 72 72 73 73 int myNskip1 = 0, myNskip2 = 0, myNskip3 = 0, myNskip4 = 0, myNskip5 = 0, myNskip6 = 0; 74 75 int NgaiaObject = 0; 74 76 75 77 /* exclude stars not in range or with too few measurements */ … … 187 189 if (isGPC1warp(catalog[0].measure[offset].photcode)) continue; 188 190 191 // allow certain cameras to stay static 192 if (SKIP_PS1_CHIP && isGPC1chip(catalog[0].measure[offset].photcode)) continue; 193 if (SKIP_PS1_STACK && isGPC1stack(catalog[0].measure[offset].photcode)) continue; 194 if (SKIP_HSC && isHSCchip(catalog[0].measure[offset].photcode)) continue; 195 if (SKIP_CFH && isCFHchip(catalog[0].measure[offset].photcode)) continue; 196 189 197 // filter objects based on user supplied criteria, including SIGMA_LIM 190 198 if (!MeasFilterTest(&catalog[0].measure[offset], TRUE)) { … … 250 258 } 251 259 260 if (catalog[0].measure[offset].photcode == 1030) { NgaiaObject ++; } 261 252 262 CopyMeasureToTiny (&subcatalog[0].measureT[Nmeasure], &catalog[0].measure[offset]); 253 263 // subcatalog[0].measure[Nmeasure] = catalog[0].measure[offset]; … … 281 291 } 282 292 } 283 fprintf (stderr, "skips: %d %d %d %d %d %d \n", myNskip1, myNskip2, myNskip3, myNskip4, myNskip5, myNskip6);293 fprintf (stderr, "skips: %d %d %d %d %d %d, Ngaia: %d\n", myNskip1, myNskip2, myNskip3, myNskip4, myNskip5, myNskip6, NgaiaObject); 284 294 REALLOCATE (subcatalog[0].average, Average, MAX (Naverage, 1)); 285 295 REALLOCATE (subcatalog[0].measureT, MeasureTiny, MAX (Nmeasure, 1)); -
trunk/Ohana/src/relastro/src/extra.c
r37261 r39926 39 39 return FALSE; 40 40 } 41 42 // for now (20160925) I need to identify HSC chips explicitly. generalize in the future 43 int isHSCchip (int photcode) { 44 45 if ((photcode >= 20000) && (photcode <= 20111)) return TRUE; // g-band 46 if ((photcode >= 21000) && (photcode <= 21111)) return TRUE; // r-band 47 if ((photcode >= 22000) && (photcode <= 22111)) return TRUE; // i-band 48 if ((photcode >= 23000) && (photcode <= 23111)) return TRUE; // z-band 49 if ((photcode >= 24000) && (photcode <= 24111)) return TRUE; // y-band 50 51 return FALSE; 52 } 53 54 // for now (20160925) I need to identify CFH chips explicitly. generalize in the future 55 int isCFHchip (int photcode) { 56 57 if ((photcode >= 100) && (photcode <= 152)) return TRUE; // g-band 58 if ((photcode >= 200) && (photcode <= 252)) return TRUE; // r-band 59 if ((photcode >= 300) && (photcode <= 352)) return TRUE; // i-band 60 if ((photcode >= 400) && (photcode <= 452)) return TRUE; // z-band 61 if ((photcode >= 500) && (photcode <= 552)) return TRUE; // y-band 62 63 return FALSE; 64 } -
trunk/Ohana/src/relastro/src/initialize.c
r39457 r39926 11 11 ConfigInit (&argc, argv); 12 12 args (argc, argv); 13 14 if (USE_GALAXY_MODEL) { 15 if (!InitGalaxyModel (GALAXY_MODEL)) { 16 fprintf (stderr, "failed to init galaxy model %s\n", GALAXY_MODEL); 17 exit (2); 18 } 19 } 13 20 14 21 if (RELASTRO_OP == OP_MERGE_SOURCE) return; -
trunk/Ohana/src/relastro/src/launch_region_hosts.c
r39457 r39926 81 81 strextend (&command, "-region-hosts %s", REGION_FILE); 82 82 strextend (&command, "-region-hostID %d", host->hostID); 83 83 84 strextend (&command, "-D CATDIR %s", CATDIR); 84 85 strextend (&command, "-region %f %f %f %f", host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat); 85 86 strextend (&command, "-statmode %s", STATMODE); 86 87 strextend (&command, "-minerror %f", MIN_ERROR); 87 strextend (&command, "-nloop %d", NLOOP); 88 strextend (&command, "-threads %d", NTHREADS); 88 89 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 90 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 91 92 strextend (&command, " -D RELASTRO_MIN_DISTANCE_MOD %f", MIN_DISTANCE_MOD); 93 strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD %f", MAX_DISTANCE_MOD); 94 strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD_ERR %f", MAX_DISTANCE_MOD_ERR); 95 96 strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 97 strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 98 99 strextend (&command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX); 100 strextend (&command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS); 101 102 strextend (&command, "-D USE_ICRF_LOCAL %d", USE_ICRF_LOCAL); 103 strextend (&command, "-D USE_ICRF_SHFIT %d", USE_ICRF_SHFIT); 104 strextend (&command, "-D USE_ICRF_POLE %d", USE_ICRF_POLE); 89 105 90 106 switch (FIT_TARGET) { … … 98 114 strextend (&command, "-update-mosaics"); 99 115 break; 116 case SET_CHIPS: 117 strextend (&command, "-set-chips"); 118 break; 100 119 case TARGET_NONE: 101 120 abort(); … … 105 124 if (VERBOSE2) strextend (&command, "-vv"); 106 125 if (RESET) strextend (&command, "-reset"); 126 127 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 128 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 129 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 130 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 131 132 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 133 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 134 if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); 135 if (PhotFlagSelect) strextend (&command, "+photflags"); 136 if (PhotFlagBad) strextend (&command, "+photflagbad %d", PhotFlagBad); 137 if (PhotFlagPoor) strextend (&command, "+photflagpoor %d", PhotFlagPoor); 138 139 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 140 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 141 } 142 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 143 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 144 } 145 146 if (TEST_SCALE != 1.0) strextend (&command, "-testing %f", TEST_SCALE); 147 148 if (SKIP_PS1_CHIP) strextend (&command, "-skip-ps1-chip"); 149 if (SKIP_PS1_STACK) strextend (&command, "-skip-ps1-stack"); 150 if (SKIP_HSC) strextend (&command, "-skip-hsc"); 151 if (SKIP_CFH) strextend (&command, "-skip-cfh"); 152 153 strextend (&command, "-nloop %d", NLOOP); 154 strextend (&command, "-threads %d", NTHREADS); 155 156 if (PHOTCODE_RESET_LIST) strextend (&command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST); 157 107 158 if (UPDATE) strextend (&command, "-update"); 108 159 if (PARALLEL) strextend (&command, "-parallel"); 109 160 if (PARALLEL_MANUAL) strextend (&command, "-parallel-manual"); 110 161 if (PARALLEL_SERIAL) strextend (&command, "-parallel-serial"); 111 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 112 if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); 113 if (PHOTCODE_RESET_LIST) strextend (&command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST); 114 115 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 116 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 117 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 118 119 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 120 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 121 } 122 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 123 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 124 } 125 126 if (PhotFlagSelect) strextend (&command, "+photflags"); 127 if (PhotFlagBad) strextend (&command, "+photflagbad %d", PhotFlagBad); 128 if (PhotFlagPoor) strextend (&command, "+photflagpoor %d", PhotFlagPoor); 129 162 163 strextend (&command, "-chiporder %d", CHIPORDER); 130 164 if (CHIPMAP) strextend (&command, "-chipmap %d", CHIPMAP); 165 if (ChipMapLoop) strextend (&command, "-chipmaploop %s", ChipMapLoopStr); 166 if (ChipOrderLoop) strextend (&command, "-chiporderloop %s", ChipOrderLoopStr); 167 131 168 if (RESET_IMAGES) strextend (&command, "-reset-images"); 132 169 … … 136 173 if (LoopWeight2MASS) { strextend (&command, "-loop-weights-2mass %s", LoopWeight2MASSstr); } 137 174 if (LoopWeightTycho) { strextend (&command, "-loop-weights-tycho %s", LoopWeightTychostr); } 138 139 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 140 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 141 strextend (&command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX); 142 strextend (&command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS); 143 144 strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 145 146 strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 147 strextend (&command, "-D USE_ICRF_LOCAL %d", USE_ICRF_LOCAL); 148 strextend (&command, "-D USE_ICRF_SHFIT %d", USE_ICRF_SHFIT); 149 strextend (&command, "-D USE_ICRF_POLE %d", USE_ICRF_POLE); 150 151 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 175 if (LoopWeightGAIA) { strextend (&command, "-loop-weights-gaia %s", LoopWeightGAIAstr); } 176 if (APPLY_PROPER_MOTION) strextend (&command, "-apply-proper-motion"); 152 177 153 178 if (TimeSelect) { -
trunk/Ohana/src/relastro/src/load_catalogs.c
r39466 r39926 178 178 strextend (&command, "relastro_client -load-objects %s", table->hosts[i].results); 179 179 strextend (&command, " -hostID %d", table->hosts[i].hostID); 180 strextend (&command, " -hostdir %s", table->hosts[i].pathname); 181 180 182 strextend (&command, " -D CATDIR %s", CATDIR); 181 strextend (&command, " -hostdir %s", table->hosts[i].pathname);182 183 strextend (&command, " -region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 183 184 strextend (&command, " -statmode %s", STATMODE); 184 185 strextend (&command, " -minerror %f", MIN_ERROR); 186 185 187 strextend (&command, " -D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 188 strextend (&command, " -D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 189 186 190 strextend (&command, " -D RELASTRO_MIN_DISTANCE_MOD %f", MIN_DISTANCE_MOD); 187 191 strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD %f", MAX_DISTANCE_MOD); 188 192 strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD_ERR %f", MAX_DISTANCE_MOD_ERR); 189 193 194 strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 195 strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 196 190 197 if (FIT_MODE == FIT_PM_ONLY) strextend (&command, "-pm"); 191 198 if (FIT_MODE == FIT_PAR_ONLY) strextend (&command, "-par"); 192 199 if (FIT_MODE == FIT_PM_AND_PAR) strextend (&command, "-pmpar"); 193 200 194 if (VERBOSE) strextend (&command, "-v"); 195 if (VERBOSE2) strextend (&command, "-vv"); 196 if (RESET) strextend (&command, "-reset"); 197 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 198 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 199 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 200 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 201 202 if (USE_ICRF_CORRECT) strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT); 203 if (USE_GALAXY_MODEL) strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL); 204 205 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 206 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 207 } 208 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 209 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 210 } 211 212 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 201 if (VERBOSE) strextend (&command, "-v"); 202 if (VERBOSE2) strextend (&command, "-vv"); 203 if (RESET) strextend (&command, "-reset"); 204 205 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 206 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 207 if (FlagOutlier) strextend (&command, "-clip %d", CLIP_THRESH); 208 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 209 213 210 if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 214 211 if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); … … 217 214 if (PhotFlagBad) strextend (&command, "+photflagbad %d", PhotFlagBad); 218 215 if (PhotFlagPoor) strextend (&command, "+photflagpoor %d", PhotFlagPoor); 216 217 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 218 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 219 } 220 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 221 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 222 } 223 224 if (SKIP_PS1_CHIP) strextend (&command, "-skip-ps1-chip"); 225 if (SKIP_PS1_STACK) strextend (&command, "-skip-ps1-stack"); 226 if (SKIP_HSC) strextend (&command, "-skip-hsc"); 227 if (SKIP_CFH) strextend (&command, "-skip-cfh"); 228 229 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 230 219 231 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 220 232 … … 282 294 CatalogSplitter *catalogs = BrightCatalogSplitInit (Nsecfilt); 283 295 296 ohana_memstats (TRUE); 297 284 298 for (i = 0; i < table->Nhosts; i++) { 285 299 … … 296 310 free (bcatalog->secfilt); 297 311 free (bcatalog); 312 313 ohana_memstats (TRUE); 298 314 } 299 315 … … 320 336 321 337 BrightCatalogSplitFree (catalogs); 338 ohana_memstats (TRUE); 322 339 323 340 return (catalog); -
trunk/Ohana/src/relastro/src/load_images.c
r39474 r39926 66 66 } 67 67 68 initImages (subset, LineNumber, Nsubset );68 initImages (subset, LineNumber, Nsubset, !USE_ALL_IMAGES); 69 69 MARKTIME(" init images: %f sec\n", dtime); 70 70 -
trunk/Ohana/src/relastro/src/relastro_images.c
r39580 r39926 16 16 int finalPassMode = FIT_MODE; // start with the globally-defined fit mode 17 17 FIT_MODE = FIT_AVERAGE; 18 19 int RESET_ON_UPDATE = RESET; 20 RESET = TRUE; // we need to reset when we load the bright catalog subset 18 21 19 22 /* lock and load the image db table */ … … 65 68 // XXX NOTE : for 2mass reset, photcodesKeep should now limit to 2MASS measurements 66 69 70 USE_IRLS = FALSE; // do not use IRLS yet -- leads to excessive outlier rejections in the loops 71 67 72 /* major modes */ 68 73 switch (FIT_TARGET) { … … 90 95 break; 91 96 97 case SET_CHIPS: 98 // we just want to fit the selected chips to the mean positions 99 UpdateChips (catalog, Ncatalog, 0); // measure.X,Y -> R,D, fit image.coords 100 MARKTIME("update chips: %f sec\n", dtime); 101 102 break; 103 92 104 case TARGET_MOSAICS: 93 105 for (i = 0; i < NLOOP; i++) { … … 102 114 } 103 115 104 if (!UPDATE) {105 freeStarMaps();106 gfits_db_free (&db);107 ohana_memcheck (VERBOSE);108 ohana_memdump (VERBOSE);109 exit (0);110 }111 112 116 // free the image / measurement pointers 113 117 freeImageBins (Ncatalog); … … 117 121 free (catalog); 118 122 freeMosaics (); 123 124 if (!UPDATE) { 125 freeStarMaps(); 126 dvo_image_unlock (&db); 127 freeImages (db.ftable.buffer); 128 gfits_db_free (&db); 129 return TRUE; 130 } 119 131 120 132 // If we did NOT use all images, then we applied the measured corrections to a subset of … … 154 166 // iterate over catalogs to make detection coordinates consistant 155 167 if (APPLY_OFFSETS) { 168 USE_IRLS = ALLOW_IRLS; // now that we have fitted the images, choose the user's option 169 RESET = RESET_ON_UPDATE; 156 170 UpdateObjectOffsets (skylist, 0, NULL); 157 171 } -
trunk/Ohana/src/relastro/src/relastro_objects.c
r39457 r39926 159 159 strextend (&command, "relastro_client -update-objects"); 160 160 strextend (&command, "-hostID %d", table->hosts[i].hostID); 161 strextend (&command, "-hostdir %s", table->hosts[i].pathname); 162 161 163 strextend (&command, "-D CATDIR %s", CATDIR); 162 strextend (&command, "-hostdir %s", table->hosts[i].pathname);163 164 strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax); 164 165 strextend (&command, "-statmode %s", STATMODE); 166 strextend (&command, "-minerror %f", MIN_ERROR); 167 168 strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 169 strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 165 170 166 171 if (FIT_MODE == FIT_PM_ONLY) { strextend (&command, "-pm"); } … … 171 176 if (VERBOSE2) { strextend (&command, "-vv"); } 172 177 if (RESET) { strextend (&command, "-reset"); } 173 if (UPDATE) { strextend (&command, "-update"); } 178 174 179 if (ImagSelect) { strextend (&command, "-instmag %f %f", ImagMin, ImagMax); } 175 180 if (MaxDensityUse) { strextend (&command, "-max-density %f", MaxDensityValue); } 176 181 if (FlagOutlier) { strextend (&command, "-clip %d", CLIP_THRESH); } 177 178 if (USE_ALL_IMAGES) { strextend (&command, "-use-all-images"); } 182 if (ExcludeBogus) strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius); 183 179 184 if (USE_FIXED_PIXCOORDS) { strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); } 180 185 if (PHOTCODE_KEEP_LIST) { strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); } … … 185 190 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 186 191 192 if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) { 193 strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 194 } 195 if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) { 196 strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 197 } 198 199 if (UPDATE) { strextend (&command, "-update"); } 200 if (USE_ALL_IMAGES) { strextend (&command, "-use-all-images"); } 201 187 202 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); 188 203 if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset %f", MaxMeanOffset); -
trunk/Ohana/src/relastro/src/relastro_parallel_images.c
r39580 r39926 61 61 initMosaics (image, Nimage); 62 62 63 initImages (image, NULL, Nimage );63 initImages (image, NULL, Nimage, FALSE); 64 64 65 65 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); … … 103 103 104 104 client_logger_message ("starting the loops: %s\n", myHostName); 105 106 RESET = TRUE; // we need to reset when we load the bright catalog subset 107 FIT_MODE = FIT_AVERAGE; // we need to only fit the average 108 USE_IRLS = FALSE; // do not use IRLS yet -- leads to excessive outlier rejections in the loops 105 109 106 110 /* major modes */ -
trunk/Ohana/src/relastro/src/select_images.c
r39474 r39926 121 121 } 122 122 123 // allow certain cameras to stay static 124 if (SKIP_PS1_CHIP && isGPC1chip (timage[i].photcode)) continue; 125 if (SKIP_PS1_STACK && isGPC1stack(timage[i].photcode)) continue; 126 if (SKIP_HSC && isHSCchip (timage[i].photcode)) continue; 127 if (SKIP_CFH && isCFHchip (timage[i].photcode)) continue; 128 123 129 /* select images by photcode, or equiv photcode, if specified */ 124 130 if (NphotcodesKeep > 0) { … … 187 193 if (DmaxImage < DminSkyRegion) continue; 188 194 195 if (KEEP_ALL_IMAGES_RA) goto found_it; 196 189 197 // the sky region RA is defined to be 0 - 360.0 190 198 if (RminImage > RmaxSkyRegion) continue; -
trunk/Ohana/src/relastro/src/syncfile.c
r36871 r39926 39 39 int loop; 40 40 sscanf (message, "%*s %d", &loop); 41 if (CATCH_UP && (nloop < loop)) return TRUE; // if I am behind this machine, I need to catch up! 41 42 if (loop != nloop) { 42 43 usleep (2000000); -
trunk/Ohana/src/relphot/include/relphot.h
r39648 r39926 309 309 int RESET_ZEROPTS; 310 310 int REPAIR_WARPS; 311 int PRESERVE_PS1; 311 312 int UPDATE; 312 313 int SAVE_IMAGE_UPDATES; … … 616 617 int isTYCHO (int photcode); 617 618 619 int isHSCchip (int photcode); 620 int isCFHchip (int photcode); 621 618 622 int magStatsByRanking (StatDataSet *dataset, StatType *stats); 619 623 -
trunk/Ohana/src/relphot/src/args.c
r39642 r39926 226 226 remove_argument (N, &argc, argv); 227 227 REPAIR_WARPS = TRUE; 228 } 229 230 PRESERVE_PS1 = FALSE; 231 if ((N = get_argument (argc, argv, "-preserve-ps1"))) { 232 remove_argument (N, &argc, argv); 233 PRESERVE_PS1 = TRUE; 228 234 } 229 235 … … 672 678 } 673 679 680 PRESERVE_PS1 = FALSE; 681 if ((N = get_argument (argc, argv, "-preserve-ps1"))) { 682 remove_argument (N, &argc, argv); 683 PRESERVE_PS1 = TRUE; 684 } 685 674 686 REPAIR_WARPS = FALSE; 675 687 if ((N = get_argument (argc, argv, "-repair-warps"))) { -
trunk/Ohana/src/relphot/src/extra.c
r38993 r39926 2 2 3 3 // for now (20140710) I need to identify gpc1 chips explicitly. generalize in the future 4 // note that the 4000, 14000, 15000 sets are SIMTEST (*not* synthetic) 4 5 int whichGPC1filter (int photcode) { 5 6 6 if (((photcode > 10000) && (photcode < 10077)) || (photcode == 4100)) return PS1_g; // g-band 7 if (((photcode > 10000) && (photcode < 10077)) || (photcode == 4100)) return PS1_g; // g-band 7 8 if (((photcode > 10100) && (photcode < 10177)) || (photcode == 4200)) return PS1_r; // r-band 8 9 if (((photcode > 10200) && (photcode < 10277)) || (photcode == 4300)) return PS1_i; // i-band … … 83 84 } 84 85 86 // for now (20160925) I need to identify HSC chips explicitly. generalize in the future 87 int isHSCchip (int photcode) { 88 89 if ((photcode >= 20000) && (photcode <= 20111)) return TRUE; // g-band 90 if ((photcode >= 21000) && (photcode <= 21111)) return TRUE; // r-band 91 if ((photcode >= 22000) && (photcode <= 22111)) return TRUE; // i-band 92 if ((photcode >= 23000) && (photcode <= 23111)) return TRUE; // z-band 93 if ((photcode >= 24000) && (photcode <= 24111)) return TRUE; // y-band 94 95 return FALSE; 96 } 97 98 // for now (20160925) I need to identify CFH chips explicitly. generalize in the future 99 int isCFHchip (int photcode) { 100 101 if ((photcode >= 100) && (photcode <= 152)) return TRUE; // g-band 102 if ((photcode >= 200) && (photcode <= 252)) return TRUE; // r-band 103 if ((photcode >= 300) && (photcode <= 352)) return TRUE; // i-band 104 if ((photcode >= 400) && (photcode <= 452)) return TRUE; // z-band 105 if ((photcode >= 500) && (photcode <= 552)) return TRUE; // y-band 106 107 return FALSE; 108 } 109 -
trunk/Ohana/src/relphot/src/reload_catalogs.c
r39511 r39926 239 239 if (RESET) { strextend (&command, "-reset"); } 240 240 if (RESET_ZEROPTS) { strextend (&command, "-reset-zpts"); } 241 if (PRESERVE_PS1) { strextend (&command, "-preserve-ps1"); } 241 242 if (UPDATE) { strextend (&command, "-update"); } 242 243 if (IS_DIFF_DB) { strextend (&command, "-is-diff-db"); } -
trunk/Ohana/src/relphot/src/relphot_objects.c
r39643 r39926 243 243 if (RESET_ZEROPTS) { strextend (&command, "-reset-zpts"); } 244 244 if (REPAIR_WARPS) { strextend (&command, "-repair-warps"); } 245 if (PRESERVE_PS1) { strextend (&command, "-preserve-ps1"); } 245 246 if (IS_DIFF_DB) { strextend (&command, "-is-diff-db"); } 246 247 if (UPDATE) { strextend (&command, "-update"); } -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r39636 r39926 142 142 int Galaxy2MASS = FALSE; 143 143 int haveTYCHO = FALSE; 144 int haveHSC = FALSE; 145 int haveCFH = FALSE; 144 146 145 147 float stargalmax = 0.0; … … 163 165 164 166 if (isTYCHO(measureT[k].photcode)) { haveTYCHO = TRUE; } 167 if (isHSCchip(measureT[k].photcode)) { haveHSC = TRUE; } 168 if (isCFHchip(measureT[k].photcode)) { haveCFH = TRUE; } 165 169 166 170 if (is2MASS(measureT[k].photcode)) { … … 317 321 // now calculate the mean stats for the Nsec bands. 318 322 for (Nsec = 0; Nsec < Nsecfilt; Nsec++) { 319 dvo_secfilt_init (&secfilt[Nsec], SECFILT_RESET_CHIP); // this does not reset astrometry or STACK bits 323 324 // if we detected this object in PS1, or do not request -preserve-ps1, keep the mean photometry values 325 if (!PRESERVE_PS1 || !(secfilt[Nsec].flags & ID_SECF_HAS_PS1)) { 326 dvo_secfilt_init (&secfilt[Nsec], SECFILT_RESET_CHIP); // this does not reset astrometry or STACK bits 327 } 328 329 if (haveTYCHO) { 330 secfilt[Nsec].flags |= ID_SECF_HAS_TYCHO; 331 } 332 if (haveHSC) { 333 secfilt[Nsec].flags |= ID_SECF_HAS_HSC; 334 } 335 if (haveCFH) { 336 secfilt[Nsec].flags |= ID_SECF_HAS_CFH; 337 } 338 339 if (PRESERVE_PS1 && (secfilt[Nsec].flags & ID_SECF_HAS_PS1)) continue; 340 // if -preserve-ps1 is set and this object has PS1 data, skip the rest of the steps: 320 341 321 342 // XXX hardwired grizy = (01234) JHK = (567) w = (8) … … 324 345 } else { 325 346 secfilt[Nsec].Ncode = results->Nmeas[Nsec]; // 2MASS data if it exists 326 }327 328 if (haveTYCHO) {329 secfilt[Nsec].flags |= ID_SECF_HAS_TYCHO;330 347 } 331 348 -
trunk/Ohana/src/uniphot/include/setgalmodel.h
r38986 r39926 10 10 char *HOSTDIR; 11 11 int VERBOSE; 12 int TESTING;13 12 int UPDATE; 14 13 int PARALLEL; … … 18 17 char *SINGLE_CPT; 19 18 19 float TEST_SCALE; 20 char *GALAXY_MODEL; 20 21 SkyRegion UserPatch; 21 22 -
trunk/Ohana/src/uniphot/include/setphot.h
r39356 r39926 67 67 int VERBOSE; 68 68 int RESET; 69 int PHOTCODE_MIN; 70 int PHOTCODE_MAX; 69 71 int UBERCAL; // load the supplied ubercal zero point fits table (with flat-field corrections) 70 72 int NO_METADATA; // the supplied ubercal data has no descriptive metadata -
trunk/Ohana/src/uniphot/src/initialize_setgalmodel.c
r39225 r39926 45 45 46 46 // XXX add to config? 47 if (!InitGalaxyModel ( "FEAST-HIPPARCOS")) {48 fprintf (stderr, "failed to init galaxy model \n");47 if (!InitGalaxyModel (GALAXY_MODEL)) { 48 fprintf (stderr, "failed to init galaxy model %s\n", GALAXY_MODEL); 49 49 exit (2); 50 50 } … … 92 92 } 93 93 94 TESTING = FALSE; 94 GALAXY_MODEL = NULL; 95 if ((N = get_argument (argc, argv, "-galaxy-model"))) { 96 remove_argument (N, &argc, argv); 97 GALAXY_MODEL = strcreate(argv[N]); 98 remove_argument (N, &argc, argv); 99 } 100 if (!GALAXY_MODEL) GALAXY_MODEL = strcreate ("FEAST-HIPPARCOS"); 101 102 TEST_SCALE = 1.0; 95 103 if ((N = get_argument (argc, argv, "-testing"))) { 96 TESTING = TRUE; 104 remove_argument (N, &argc, argv); 105 TEST_SCALE = atof(argv[N]); 97 106 remove_argument (N, &argc, argv); 98 107 } … … 171 180 } 172 181 173 // XXX add to config?174 if (!InitGalaxyModel ( "ROESER")) {182 // from args 183 if (!InitGalaxyModel (GALAXY_MODEL)) { 175 184 fprintf (stderr, "failed to init galaxy model\n"); 176 185 exit (2); … … 212 221 } 213 222 214 TESTING = FALSE; 223 GALAXY_MODEL = NULL; 224 if ((N = get_argument (argc, argv, "-galaxy-model"))) { 225 remove_argument (N, &argc, argv); 226 GALAXY_MODEL = strcreate(argv[N]); 227 remove_argument (N, &argc, argv); 228 } 229 if (!GALAXY_MODEL) GALAXY_MODEL = strcreate ("FEAST-HIPPARCOS"); 230 231 TEST_SCALE = 1.0; 215 232 if ((N = get_argument (argc, argv, "-testing"))) { 216 TESTING = TRUE; 233 remove_argument (N, &argc, argv); 234 TEST_SCALE = atof(argv[N]); 217 235 remove_argument (N, &argc, argv); 218 236 } -
trunk/Ohana/src/uniphot/src/initialize_setphot.c
r39356 r39926 109 109 if ((N = get_argument (argc, argv, "-reset"))) { 110 110 RESET = TRUE; 111 remove_argument (N, &argc, argv); 112 } 113 114 PHOTCODE_MIN = 0; 115 PHOTCODE_MAX = 0; 116 if ((N = get_argument (argc, argv, "-photcode-range"))) { 117 remove_argument (N, &argc, argv); 118 PHOTCODE_MIN = atoi (argv[N]); 119 remove_argument (N, &argc, argv); 120 PHOTCODE_MAX = atoi (argv[N]); 111 121 remove_argument (N, &argc, argv); 112 122 } -
trunk/Ohana/src/uniphot/src/initialize_setphot_client.c
r39356 r39926 96 96 } 97 97 98 PHOTCODE_MIN = 0; 99 PHOTCODE_MAX = 0; 100 if ((N = get_argument (argc, argv, "-photcode-range"))) { 101 remove_argument (N, &argc, argv); 102 PHOTCODE_MIN = atoi (argv[N]); 103 remove_argument (N, &argc, argv); 104 PHOTCODE_MAX = atoi (argv[N]); 105 remove_argument (N, &argc, argv); 106 } 107 98 108 // region of interest 99 109 UserPatch.Rmin = 0; -
trunk/Ohana/src/uniphot/src/update_catalog_setgalmodel.c
r39586 r39926 33 33 34 34 // fake or real QSOs are marked with FeH = +/- 100.0 35 if (fabs(starpar->FeH) > 99.0) continue; 35 if (fabs(starpar->FeH) > 99.0) { 36 starpar->uRA = 0.0; 37 starpar->uDEC = 0.0; 38 average[i].uRgal = 0.0; 39 average[i].uDgal = 0.0; 40 continue; 41 } 36 42 37 // NOTE: distance is in kiloparsec43 // NOTE: DistMag is standard (10pc reference). SolarMotionModel wants distance in kiloparsec: 38 44 double distance = pow(10.0, 0.2*(starpar->DistMag + 5.0)) / 1000.0; 39 45 … … 51 57 52 58 // XXX: amplify motion to make tests easier: 53 if (TESTING) { 54 uL *= 100.0; 55 uB *= 100.0; 56 } 59 uL *= TEST_SCALE; 60 uB *= TEST_SCALE; 57 61 58 62 double uR, uD; -
trunk/Ohana/src/uniphot/src/update_catalog_setphot.c
r39457 r39926 1 1 # include "setphot.h" 2 3 // XXX I need to add a few things for HSC + MC + GPC1: 4 // * I can generate a zpt table for the MC exposures using the nominal zero points 5 // * for the HSC data, I need to add a function to define Mflat as a function of Xmos, Ymos 2 6 3 7 void update_catalog_setphot (Catalog *catalog, Image *image, off_t *index, off_t Nimage, CamPhotomCorrection *camcorr) { … … 14 18 Measure *measure = &catalog[0].measure[i]; 15 19 16 // only do GPC1 data for now17 if (measure[0].photcode < 10000) continue;18 if (measure[0].photcode > 10600) continue;20 // XXX deprecated 2016.09.22 : only do GPC1 data for now 21 // if (measure[0].photcode < 10000) continue; 22 // if (measure[0].photcode > 10600) continue; 19 23 24 // only do DEP photcodes (skip REF, etc) 25 PhotCode *code = GetPhotcodebyCode (measure[0].photcode); 26 if (!code) continue; // invalid photcode 27 if (code->type != PHOT_DEP) continue; 28 29 // allow a restriction on the modified zpts: 30 if (PHOTCODE_MAX) { 31 if (measure[0].photcode < PHOTCODE_MIN) continue; 32 if (measure[0].photcode > PHOTCODE_MAX) continue; 33 } 34 20 35 off_t idx = measure[0].imageID; 21 36 if (idx <= 0) continue; // detections with imageID == 0 do not have a valid image (eg, ref photcode) … … 33 48 Mflat = CamPhotomCorrectionValue (camcorr, flat_id, measure[0].Xccd, measure[0].Yccd); 34 49 } 50 51 # if (0) 52 // the mosaic lookup is broken : fix it then redo this block 53 if (radialZP) { 54 mosaic = MatchMosaicMetadata (measure[0].imageID); 55 if (mosaic == NULL) break; 56 double Rm = measure[0].R; 57 double Dm = measure[0].D; 58 RD_to_XY (&XMOS_MEAS, &YMOS_MEAS, Rm, Dm, mosaic); 59 Mflat = RadialZPtrend (XMOS_MEAS, XMOS_MEAS); 60 } 61 # endif 35 62 36 63 measure[0].Mcal = Mcal; -
trunk/Ohana/src/uniphot/src/update_dvo_setgalmodel.c
r39225 r39926 98 98 99 99 if (VERBOSE) { strextend (&command, "-v"); } 100 if (TEST ING) { strextend (&command, "-testing"); }100 if (TEST_SCALE != 1.0){ strextend (&command, "-testing %f", TEST_SCALE); } 101 101 if (UPDATE) { strextend (&command, "-update"); } 102 102 if (UPDATE_CATFORMAT) { strextend (&command, "-update-catformat %s", UPDATE_CATFORMAT); } -
trunk/Ohana/src/uniphot/src/update_dvo_setphot.c
r39356 r39926 179 179 if (DCR_RESET) { strextend (&command, "-DCR-reset"); } 180 180 if (CAM_RESET) { strextend (&command, "-CAM-reset"); } 181 182 if (PHOTCODE_MAX) { strextend (&command, "-photcode-range %d %d", PHOTCODE_MIN, PHOTCODE_MAX); } 181 183 182 184 fprintf (stderr, "command: %s\n", command);
Note:
See TracChangeset
for help on using the changeset viewer.
