Changeset 29001
- Timestamp:
- Aug 20, 2010, 12:05:07 PM (16 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 83 edited
- 4 copied
-
. (modified) (1 prop)
-
src/addstar/src/FilterStars.c (modified) (1 diff)
-
src/addstar/src/LoadData.c (modified) (1 diff)
-
src/addstar/src/ReadStarsFITS.c (modified) (7 diffs)
-
src/addstar/src/find_matches_refstars.c (modified) (2 diffs)
-
src/addstar/test/dvomerge.dvo (modified) (1 diff)
-
src/delstar/src/delete_imagename.c (modified) (1 diff)
-
src/delstar/src/delete_times.c (modified) (1 diff)
-
src/delstar/src/find_image_db.c (modified) (1 diff)
-
src/dvomerge/Makefile (modified) (2 diffs)
-
src/dvomerge/include/dvomerge.h (modified) (1 diff)
-
src/dvomerge/src/SkyTablePopulatedRange.c (modified) (1 diff)
-
src/dvomerge/src/args.c (modified) (2 diffs)
-
src/dvomerge/src/dvo_image_merge_dbs.c (modified) (2 diffs)
-
src/dvomerge/src/dvoconvert.c (modified) (1 diff)
-
src/dvomerge/src/dvomergeUpdate.c (modified) (5 diffs)
-
src/dvomerge/src/dvosecfilt.c (copied) (copied from branches/eam_branches/ipp-20100621/Ohana/src/dvomerge/src/dvosecfilt.c )
-
src/dvomerge/src/dvoverify.c (modified) (1 diff)
-
src/dvomerge/src/help.c (modified) (3 diffs)
-
src/gastro2/src/rfits.c (modified) (1 diff)
-
src/getstar/src/dvoImageExtract.c (modified) (1 diff)
-
src/getstar/src/dvoImageOverlaps.c (modified) (1 diff)
-
src/getstar/src/dvoImagesAtCoords.c (modified) (1 diff)
-
src/imregister/src/detsearch.c (modified) (1 diff)
-
src/imregister/src/imphotsearch.c (modified) (1 diff)
-
src/imregister/src/imregtable.c (modified) (1 diff)
-
src/imregister/src/imsearch.c (modified) (1 diff)
-
src/imregister/src/imstatreg.c (modified) (2 diffs)
-
src/imregister/src/photsearch.c (modified) (1 diff)
-
src/imregister/src/spsearch.c (modified) (1 diff)
-
src/libautocode/def/autocode.c (modified) (1 diff)
-
src/libdvo/include/dvo.h (modified) (2 diffs)
-
src/libdvo/src/LoadPhotcodesFITS.c (modified) (8 diffs)
-
src/libdvo/src/cmf-ps1-v1-alt.c (modified) (1 diff)
-
src/libdvo/src/coordops.c (modified) (12 diffs)
-
src/libdvo/src/dvo_catalog_mef.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog_split.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert.c (modified) (9 diffs)
-
src/libdvo/src/skyregion_io.c (modified) (1 diff)
-
src/markstar/src/find_images.c (modified) (1 diff)
-
src/mosastro/src/rfits.c (modified) (1 diff)
-
src/opihi/cmd.astro/cgrid.c (modified) (1 diff)
-
src/opihi/cmd.data/Makefile (modified) (2 diffs)
-
src/opihi/cmd.data/applyfit2d.c (modified) (1 diff)
-
src/opihi/cmd.data/applyfit3d.c (copied) (copied from branches/eam_branches/ipp-20100621/Ohana/src/opihi/cmd.data/applyfit3d.c )
-
src/opihi/cmd.data/fit2d.c (modified) (2 diffs)
-
src/opihi/cmd.data/fit3d.c (copied) (copied from branches/eam_branches/ipp-20100621/Ohana/src/opihi/cmd.data/fit3d.c )
-
src/opihi/cmd.data/init.c (modified) (4 diffs)
-
src/opihi/cmd.data/vgauss.c (modified) (1 diff)
-
src/opihi/dvo/LoadImages.c (modified) (2 diffs)
-
src/opihi/dvo/cmpReadFile.c (modified) (1 diff)
-
src/photdbc/src/copy_images.c (modified) (1 diff)
-
src/photdbc/src/find_images.c (modified) (2 diffs)
-
src/photdbc/src/flag_measures.c (modified) (1 diff)
-
src/relastro/Makefile (modified) (1 diff)
-
src/relastro/doc/notes.txt (modified) (1 diff)
-
src/relastro/include/relastro.h (modified) (7 diffs)
-
src/relastro/src/ConfigInit.c (modified) (1 diff)
-
src/relastro/src/FitChip.c (modified) (10 diffs)
-
src/relastro/src/FitMosaic.c (modified) (1 diff)
-
src/relastro/src/FitSimple.c (modified) (1 diff)
-
src/relastro/src/ImageOps.c (modified) (5 diffs)
-
src/relastro/src/StarMaps.c (copied) (copied from branches/eam_branches/ipp-20100621/Ohana/src/relastro/src/StarMaps.c )
-
src/relastro/src/UpdateChips.c (modified) (1 diff)
-
src/relastro/src/UpdateMeasures.c (modified) (2 diffs)
-
src/relastro/src/bcatalog.c (modified) (2 diffs)
-
src/relastro/src/fitpoly.c (modified) (5 diffs)
-
src/relastro/src/initialize.c (modified) (1 diff)
-
src/relastro/src/load_catalogs.c (modified) (2 diffs)
-
src/relastro/src/load_images.c (modified) (2 diffs)
-
src/relastro/src/mkpolyterm.c (modified) (1 diff)
-
src/relastro/src/relastro.c (modified) (4 diffs)
-
src/relastro/src/select_images.c (modified) (3 diffs)
-
src/relphot/src/ImageOps.c (modified) (4 diffs)
-
src/relphot/src/MosaicOps.c (modified) (5 diffs)
-
src/relphot/src/StarOps.c (modified) (5 diffs)
-
src/relphot/src/initialize.c (modified) (1 diff)
-
src/relphot/src/load_images.c (modified) (1 diff)
-
src/relphot/src/select_images.c (modified) (1 diff)
-
src/relphot/src/setMrelFinal.c (modified) (1 diff)
-
src/uniphot/src/find_image_sgroups.c (modified) (3 diffs)
-
src/uniphot/src/find_image_tgroups.c (modified) (2 diffs)
-
src/uniphot/src/initialize.c (modified) (1 diff)
-
src/uniphot/src/load_images.c (modified) (1 diff)
-
src/uniphot/src/match_zpts_to_images.c (modified) (1 diff)
-
src/uniphot/src/subset_images.c (modified) (3 diffs)
-
src/uniphot/src/update.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo deleted
-
trunk/Ohana/src/addstar/src/FilterStars.c
r28965 r29001 1 1 # include "addstar.h" 2 #include "pslib/psMetadata.h"3 #include "psmodules/pmSourceMasks.h"4 2 # define EXTERNAL_ID TRUE 5 3 -
trunk/Ohana/src/addstar/src/LoadData.c
r28966 r29001 80 80 81 81 inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar); 82 if (!inStars) { 83 // XXX need to free the data here or in ReadStarsFITS on error 84 continue; 85 } 82 86 inStars = FilterStars (inStars, &images[0][Nvalid], Nvalid, options); 83 87 *stars = MergeStars (*stars, Nstars, inStars, images[0][Nvalid].nstar); -
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r27435 r29001 49 49 if (stars == NULL) { 50 50 fprintf (stderr, "ERROR: invalid table type %s\n", type); 51 exit (1);51 return (NULL); 52 52 } 53 53 // Nstars is not necessarily == *nstars (The former is the number of detections, the … … 69 69 swapped = FALSE; 70 70 smpdata = gfits_table_get_SMPData (table, &Nstars, &swapped); 71 if (!smpdata) { 72 fprintf (stderr, "skipping inconsistent entry\n"); 73 return (NULL); 74 } 71 75 ZeroPt = GetZeroPoint(); 72 76 … … 108 112 109 113 ps1data = gfits_table_get_PS1_DEV_0 (table, &Nstars, NULL); 114 if (!ps1data) { 115 fprintf (stderr, "skipping inconsistent entry\n"); 116 return (NULL); 117 } 110 118 ZeroPt = GetZeroPoint(); 111 119 … … 153 161 154 162 ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL); 163 if (!ps1data) { 164 fprintf (stderr, "skipping inconsistent entry\n"); 165 return (NULL); 166 } 155 167 ZeroPt = GetZeroPoint(); 156 168 … … 212 224 213 225 ps1data = gfits_table_get_CMF_PS1_V1 (table, &Nstars, NULL); 226 if (!ps1data) { 227 fprintf (stderr, "skipping inconsistent entry\n"); 228 return (NULL); 229 } 214 230 ZeroPt = GetZeroPoint(); 215 231 … … 284 300 285 301 ps1data = gfits_table_get_CMF_PS1_V1_Alt (table, &Nstars, NULL); 302 if (!ps1data) { 303 fprintf (stderr, "skipping inconsistent entry\n"); 304 return (NULL); 305 } 286 306 ZeroPt = GetZeroPoint(); 287 307 … … 348 368 349 369 ps1data = gfits_table_get_CMF_PS1_V2 (table, &Nstars, NULL); 370 if (!ps1data) { 371 fprintf (stderr, "skipping inconsistent entry\n"); 372 return (NULL); 373 } 350 374 ZeroPt = GetZeroPoint(); 351 375 -
trunk/Ohana/src/addstar/src/find_matches_refstars.c
r28241 r29001 218 218 } 219 219 220 N = N1[i];220 N = i; 221 221 if (stars[N][0].found > -1) continue; 222 222 if (!IN_REGION (stars[N][0].average.R, stars[N][0].average.D)) continue; … … 286 286 287 287 for (j = 0; j < NREFSTAR_GROUP; j++) { 288 N = N1[i + j];288 N = i + j; 289 289 290 290 catalog[0].measure[Nmeas] = stars[N][0].measure; -
trunk/Ohana/src/addstar/test/dvomerge.dvo
r28368 r29001 95 95 subset T = t if (id == imageID[$i]) 96 96 set dT = T - time[$i] 97 vstat -qdT97 vstat dT 98 98 tapOK {abs($MEAN) < 0.00001} "time for measure ID $i (MEAN)" 99 99 tapOK {abs($SIGMA) < 0.00001} "time for measure ID $i (SIGMA)" -
trunk/Ohana/src/delstar/src/delete_imagename.c
r28241 r29001 19 19 20 20 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 21 if (!image) { 22 fprintf (stderr, "ERROR: failed to read images\n"); 23 exit (2); 24 } 21 25 22 26 /* find image in db by name */ -
trunk/Ohana/src/delstar/src/delete_times.c
r27435 r29001 26 26 27 27 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 28 if (!image) { 29 fprintf (stderr, "ERROR: failed to read images\n"); 30 exit (2); 31 } 28 32 29 33 /* find images for time range, delete each image */ -
trunk/Ohana/src/delstar/src/find_image_db.c
r27435 r29001 17 17 18 18 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 19 if (!image) { 20 fprintf (stderr, "ERROR: failed to read images\n"); 21 exit (2); 22 } 19 23 20 24 Nlist = 0; -
trunk/Ohana/src/dvomerge/Makefile
r27583 r29001 20 20 dvomerge : $(BIN)/dvoconvert.$(ARCH) 21 21 22 all: dvomerge dvoconvert 22 all: dvomerge dvoconvert dvosecfilt 23 23 24 24 DVOMERGE = \ … … 58 58 $(BIN)/dvoconvert.$(ARCH) : $(DVOCONVERT) 59 59 60 INSTALL = dvomerge dvoconvert 60 DVOSECFILT = \ 61 $(SRC)/dvosecfilt.$(ARCH).o \ 62 $(SRC)/SetSignals.$(ARCH).o \ 63 $(SRC)/ConfigInit.$(ARCH).o \ 64 $(SRC)/Shutdown.$(ARCH).o \ 65 $(SRC)/help.$(ARCH).o \ 66 $(SRC)/args.$(ARCH).o 67 68 $(DVOSECFILT) : $(INC)/dvomerge.h 69 70 $(BIN)/dvosecfilt.$(ARCH) : $(DVOSECFILT) 71 72 INSTALL = dvomerge dvoconvert dvosecfilt 61 73 62 74 # dependancy rules for binary code ######################### -
trunk/Ohana/src/dvomerge/include/dvomerge.h
r28855 r29001 55 55 int dvoconvert_args PROTO((int *argc, char **argv)); 56 56 57 void dvosecfilt_usage PROTO((void)); 58 void dvosecfilt_help PROTO((int argc, char **argv)); 59 int dvosecfilt_args PROTO((int *argc, char **argv)); 60 57 61 int SkyTablePopulatedRange PROTO((off_t *ns, off_t *ne, SkyTable *sky, off_t Nstart)); 62 int SkyListPopulatedRange PROTO((off_t *ns, off_t *ne, SkyList *sky, off_t Nstart)); 58 63 59 64 SkyList *SkyTablePopulatedList PROTO((SkyTable *sky)); -
trunk/Ohana/src/dvomerge/src/SkyTablePopulatedRange.c
r27435 r29001 12 12 Ns = sky[0].regions[Nstart].childS; 13 13 Ne = sky[0].regions[Nstart].childE; 14 if (Ns == 0) { 15 fprintf (stderr, "no populated tables at an appropriate depth\n"); 16 exit (1); 17 } 18 Nstart = Ns; 19 } 20 21 *ns = Ns; 22 *ne = Ne; 23 return (TRUE); 24 } 25 26 int SkyListPopulatedRange (off_t *ns, off_t *ne, SkyList *sky, off_t Nstart) { 27 28 off_t Ns, Ne; 29 30 // given the starting sky region, find the populated range at or below this region 31 32 Ns = Nstart; 33 Ne = Nstart + 1; 34 while (!sky[0].regions[Nstart][0].table) { 35 Ns = sky[0].regions[Nstart][0].childS; 36 Ne = sky[0].regions[Nstart][0].childE; 14 37 if (Ns == 0) { 15 38 fprintf (stderr, "no populated tables at an appropriate depth\n"); -
trunk/Ohana/src/dvomerge/src/args.c
r28855 r29001 15 15 remove_argument (N, argc, argv); 16 16 ALTERNATE_PHOTCODE_FILE = strdup(argv[N]); 17 remove_argument (N, argc, argv); 18 } 19 20 /*** provide additional data ***/ 21 /* restrict to a portion of the sky? */ 22 UserPatch.Rmin = 0; 23 UserPatch.Rmax= 360; 24 UserPatch.Dmin = -90; 25 UserPatch.Dmax = +90; 26 if ((N = get_argument (*argc, argv, "-region"))) { 27 remove_argument (N, argc, argv); 28 UserPatch.Rmin = atof (argv[N]); 29 remove_argument (N, argc, argv); 30 UserPatch.Rmax = atof (argv[N]); 31 remove_argument (N, argc, argv); 32 UserPatch.Dmin = atof (argv[N]); 33 remove_argument (N, argc, argv); 34 UserPatch.Dmax = atof (argv[N]); 17 35 remove_argument (N, argc, argv); 18 36 } … … 37 55 return TRUE; 38 56 } 57 58 /*** check for command line options ***/ 59 int dvosecfilt_args (int *argc, char **argv) { 60 61 int N; 62 63 /* extra error messages */ 64 VERBOSE = FALSE; 65 if ((N = get_argument (*argc, argv, "-v"))) { 66 VERBOSE = TRUE; 67 remove_argument (N, argc, argv); 68 } 69 70 if (*argc != 3) dvosecfilt_usage(); 71 return TRUE; 72 } -
trunk/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c
r28354 r29001 13 13 14 14 images = gfits_table_get_Image (&in[0].ftable, &Nimages, &in[0].swapped); 15 if (!images) { 16 fprintf (stderr, "ERROR: failed to read images\n"); 17 exit (2); 18 } 19 15 20 ALLOCATE (IDmap->old, off_t, Nimages); 16 21 ALLOCATE (IDmap->new, off_t, Nimages); … … 59 64 60 65 off_t Nlo, Nhi, N; 66 67 if (!IDmap->Nmap) return 0; 61 68 62 69 // find the a close entry below desired ID -
trunk/Ohana/src/dvomerge/src/dvoconvert.c
r28855 r29001 148 148 // convert the raw image table to Image type (byteswap if needed) 149 149 images = gfits_table_get_Image (&inDB.ftable, &Nimages, &inDB.swapped); 150 if (!images) { 151 fprintf (stderr, "ERROR: failed to read images\n"); 152 exit (2); 153 } 150 154 151 155 // update additional metadata -
trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c
r28857 r29001 6 6 off_t i, j, Ns, Ne; 7 7 SkyTable *outsky, *insky; 8 SkyList * inlist;8 SkyList *outlist, *inlist; 9 9 Catalog incatalog, outcatalog; 10 10 char filename[256], *input, *output; … … 70 70 SkyTableSetFilenames (insky, input, "cpt"); 71 71 72 // XXX apply this...generate the subset matching the user-selected region 73 inlist = SkyListByPatch (insky, -1, &UserPatch); 74 72 75 // generate an output table populated at the desired depth 73 76 outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); … … 79 82 // loop over the populatable output tables; check for data in input in the corresponding regions 80 83 81 Sky TablePopulatedRange (&Ns, &Ne, insky, 0);82 depth = in sky[0].regions[Ns].depth;84 SkyListPopulatedRange (&Ns, &Ne, inlist, 0); 85 depth = inlist[0].regions[Ns][0].depth; 83 86 84 // loop over the populat able output regions85 for (i = 0; i < outsky[0].Nregions; i++) {86 if (! outsky[0].regions[i].table) continue;87 if (VERBOSE) fprintf (stderr, " output: %s\n", outsky[0].regions[i].name);87 // loop over the populated input regions 88 for (i = 0; i < inlist[0].Nregions; i++) { 89 if (!inlist[0].regions[i][0].table) continue; 90 if (VERBOSE) fprintf (stderr, "input: %s\n", inlist[0].regions[i][0].name); 88 91 89 SetPhotcodeTable( outputPhotcodes);92 SetPhotcodeTable(inputPhotcodes); 90 93 // load / create output catalog (if catalog does not exist, it will be created) 91 LoadCatalog (&outcatalog, &outsky[0].regions[i], outsky[0].filename[i], "w"); 94 LoadCatalog (&incatalog, &inlist[0].regions[i][0], inlist[0].filename[i], "r"); 95 // skip empty input catalogs 96 if (!incatalog.Naves_disk) { 97 dvo_catalog_unlock (&incatalog); 98 dvo_catalog_free (&incatalog); 99 continue; 100 } 92 101 93 102 // combine only tables at equal or larger depth … … 97 106 // compare to a slightly reduced footprint 98 107 float dPos = 2.0/3600.0; 99 inlist = SkyListByBounds (insky, depth, outsky[0].regions[i].Rmin + dPos, outsky[0].regions[i].Rmax - dPos, outsky[0].regions[i].Dmin + dPos, outsky[0].regions[i].Dmax - dPos);100 for (j = 0; j < inlist[0].Nregions; j++) {101 if (VERBOSE) fprintf (stderr, " input : %s\n", inlist[0].regions[j][0].name);108 outlist = SkyListByBounds (outsky, depth, inlist[0].regions[i][0].Rmin + dPos, inlist[0].regions[i][0].Rmax - dPos, inlist[0].regions[i][0].Dmin + dPos, inlist[0].regions[i][0].Dmax - dPos); 109 for (j = 0; j < outlist[0].Nregions; j++) { 110 if (VERBOSE) fprintf (stderr, "output : %s\n", outlist[0].regions[j][0].name); 102 111 103 112 // load input catalog 104 SetPhotcodeTable( inputPhotcodes);105 LoadCatalog (& incatalog, inlist[0].regions[j], inlist[0].filename[j], "r");113 SetPhotcodeTable(outputPhotcodes); 114 LoadCatalog (&outcatalog, outlist[0].regions[j], outlist[0].filename[j], "w"); 106 115 107 // skip empty input catalogs108 if (!incatalog.Naves_disk) {109 dvo_catalog_unlock (&incatalog);110 dvo_catalog_free (&incatalog);111 continue;112 }113 116 dvo_update_image_IDs (&IDmap, &incatalog); 114 merge_catalogs_old (&outsky[0].regions[i], &outcatalog, &incatalog, RADIUS, secfiltMap); 115 dvo_catalog_unlock (&incatalog); 116 dvo_catalog_free (&incatalog); 117 merge_catalogs_old (&outsky[0].regions[j], &outcatalog, &incatalog, RADIUS, secfiltMap); 117 118 118 fprintf (stderr, "merged %s into %s\n", outsky[0].regions[i].name, inlist[0].regions[j][0].name); 119 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 120 121 // if we receive a signal which would cause us to exit, wait until the full catalog is written 122 SetProtect (TRUE); 123 dvo_catalog_save (&outcatalog, VERBOSE); 124 SetProtect (FALSE); 125 126 dvo_catalog_unlock (&outcatalog); 127 dvo_catalog_free (&outcatalog); 128 129 fprintf (stderr, "merged %s into %s\n", inlist[0].regions[i][0].name, outlist[0].regions[j][0].name); 119 130 } 120 SkyListFree ( inlist);131 SkyListFree (outlist); 121 132 122 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 123 dvo_catalog_save (&outcatalog, VERBOSE); 124 dvo_catalog_unlock (&outcatalog); 125 dvo_catalog_free (&outcatalog); 133 dvo_catalog_unlock (&incatalog); 134 dvo_catalog_free (&incatalog); 126 135 } 127 136 … … 153 162 // load the image table 154 163 if (inDB.dbstate == LCK_EMPTY) { 155 Shutdown ("can't find input image catalog %s", inDB.filename); 164 // Shutdown ("can't find input image catalog %s", inDB.filename); 165 IDmap->Nmap = 0; 166 return TRUE; 156 167 } 157 168 if (!dvo_image_load (&inDB, VERBOSE, TRUE)) { -
trunk/Ohana/src/dvomerge/src/dvoverify.c
r28268 r29001 154 154 // convert the raw image table to Image type (byteswap if needed) 155 155 images = gfits_table_get_Image (&inDB.ftable, &Nimages, &inDB.swapped); 156 if (!images) { 157 fprintf (stderr, "ERROR: failed to read images\n"); 158 exit (2); 159 } 156 160 157 161 // update additional metadata -
trunk/Ohana/src/dvomerge/src/help.c
r27583 r29001 4 4 fprintf (stderr, "USAGE: dvomerge (input1) and (input2) to (output)\n"); 5 5 fprintf (stderr, " OR: dvomerge (input) into (output)\n"); 6 fprintf (stderr, " [-region Rmin Rmax Dmin Dmax]\n"); 6 7 exit (2); 7 8 } … … 10 11 11 12 fprintf (stderr, "USAGE: dvoconvert (input) to (output)\n"); 13 14 exit (2); 15 } 16 17 void dvosecfilt_usage(void) { 18 19 fprintf (stderr, "USAGE: dvosecfilt (input) -photcodes (photcodes.txt)\n"); 12 20 13 21 exit (2); … … 57 65 } 58 66 67 void dvosecfilt_help (int argc, char **argv) { 68 69 /* check for help request */ 70 if (get_argument (argc, argv, "-help")) goto show_help; 71 if (get_argument (argc, argv, "-h")) goto show_help; 72 return; 73 74 show_help: 75 76 fprintf (stderr, "USAGE\n"); 77 fprintf (stderr, " dvosecfilt (input) (Nsecfilt)\n\n"); 78 79 fprintf (stderr, " change number of secfilt entries in photcode table (updates secfilt tables only)\n"); 80 81 fprintf (stderr, " optional flags:\n"); 82 fprintf (stderr, " -v : verbose mode\n"); 83 fprintf (stderr, " -help : this list\n"); 84 fprintf (stderr, " -h : this list\n\n"); 85 exit (2); 86 } 87 -
trunk/Ohana/src/gastro2/src/rfits.c
r27435 r29001 15 15 16 16 stars = gfits_table_get_SMPData (&table, &Nstars, NULL); 17 if (!stars) { 18 fprintf (stderr, "ERROR: failed to read stars\n"); 19 exit (2); 20 } 17 21 18 22 ALLOCATE (stardata, StarData, Nstars); -
trunk/Ohana/src/getstar/src/dvoImageExtract.c
r27435 r29001 32 32 // convert database table to internal structure 33 33 images = gfits_table_get_Image (&db.ftable, &Nimages, &db.swapped); 34 if (!images) { 35 fprintf (stderr, "ERROR: failed to read images\n"); 36 exit (2); 37 } 34 38 35 39 matches = SelectImages (argv[1], images, Nimages, &Nmatches); -
trunk/Ohana/src/getstar/src/dvoImageOverlaps.c
r27435 r29001 35 35 // convert database table to internal structure 36 36 dbImages = gfits_table_get_Image (&db.ftable, &NdbImages, &db.swapped); 37 if (!dbImages) { 38 fprintf (stderr, "ERROR: failed to read images\n"); 39 exit (2); 40 } 37 41 38 42 // for (i = 1; i < 2; i++) { -
trunk/Ohana/src/getstar/src/dvoImagesAtCoords.c
r27435 r29001 55 55 // convert database table to internal structure 56 56 dbImages = gfits_table_get_Image (&db.ftable, &NdbImages, &db.swapped); 57 if (!dbImages) { 58 fprintf (stderr, "ERROR: failed to read images\n"); 59 exit (2); 60 } 57 61 } 58 62 -
trunk/Ohana/src/imregister/src/detsearch.c
r27435 r29001 36 36 if (!output.Modify && !output.Delete && !output.Altpath) gfits_db_close (&db); 37 37 detrend = gfits_table_get_DetReg (&db.ftable, &Ndetrend, &db.swapped); 38 if (!detrend) { 39 fprintf (stderr, "ERROR: failed to read detrend info\n"); 40 exit (2); 41 } 38 42 39 43 match = MatchCriteria (detrend, Ndetrend, &Nmatch); /* match basic criteria */ -
trunk/Ohana/src/imregister/src/imphotsearch.c
r27435 r29001 33 33 34 34 image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped); 35 if (!image) { 36 fprintf (stderr, "ERROR: failed to read images\n"); 37 exit (2); 38 } 35 39 36 40 match = subset (image, Nimage, &Nmatch); -
trunk/Ohana/src/imregister/src/imregtable.c
r27435 r29001 34 34 35 35 image = gfits_table_get_RegImage (&ftable, &Nimage, NULL); 36 if (!image) { 37 fprintf (stderr, "ERROR: failed to read images\n"); 38 exit (2); 39 } 36 40 37 41 /* load database table */ -
trunk/Ohana/src/imregister/src/imsearch.c
r27435 r29001 30 30 31 31 image = gfits_table_get_RegImage (&db.ftable, &Nimage, &db.swapped); 32 if (!image) { 33 fprintf (stderr, "ERROR: failed to read images\n"); 34 exit (2); 35 } 32 36 33 37 match = match_criteria (image, Nimage, &Nmatch); -
trunk/Ohana/src/imregister/src/imstatreg.c
r27611 r29001 67 67 } 68 68 subset = gfits_table_get_RegImage (&temp_db.ftable, &Nsubset, &temp_db.swapped); 69 if (!subset) { 70 fprintf (stderr, "ERROR: failed to read images\n"); 71 exit (2); 72 } 69 73 fprintf (stderr, "temporary database read\n"); 70 74 … … 93 97 } 94 98 image = gfits_table_get_RegImage (&image_db.ftable, &Nimage, &image_db.swapped); 99 if (!image) { 100 fprintf (stderr, "ERROR: failed to read images\n"); 101 exit (2); 102 } 95 103 fprintf (stderr, "main database read\n"); 96 104 -
trunk/Ohana/src/imregister/src/photsearch.c
r27435 r29001 42 42 if (output.convert) { 43 43 photpars_old = gfits_table_get_PhotParsOld (&db.ftable, &Nphotpars, &db.swapped); 44 if (!photpars_old) { 45 fprintf (stderr, "ERROR: failed to read photometry parameters\n"); 46 exit (2); 47 } 44 48 photpars = PhotParsOld_to_PhotPars (photpars_old, Nphotpars); 45 49 } else { 46 50 photpars = gfits_table_get_PhotPars (&db.ftable, &Nphotpars, &db.swapped); 51 if (!photpars) { 52 fprintf (stderr, "ERROR: failed to read photometry parameters\n"); 53 exit (2); 54 } 47 55 } 48 56 -
trunk/Ohana/src/imregister/src/spsearch.c
r27435 r29001 30 30 31 31 spectrum = gfits_table_get_Spectrum (&db.ftable, &Nspectrum, &db.swapped); 32 if (!spectrum) { 33 fprintf (stderr, "ERROR: failed to read spectrum\n"); 34 exit (2); 35 } 32 36 33 37 match = match_criteria (spectrum, Nspectrum, &Nmatch); -
trunk/Ohana/src/libautocode/def/autocode.c
r28277 r29001 66 66 if (Ncols != $SIZE) { 67 67 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, $SIZE); 68 exit (1);68 return NULL; 69 69 } 70 70 -
trunk/Ohana/src/libdvo/include/dvo.h
r28855 r29001 85 85 # define PHOT_MAG 0x06 /* generic magnitude; never stored */ 86 86 87 /* Image.code values. these are codes to note bad images */ 88 # define ID_IMAGE_NEW 0x0000 /* no nrphot attempted */ 89 # define ID_IMAGE_NOCAL 0x0001 /* used within nrphot to mean "don't apply fit" */ 90 # define ID_IMAGE_POOR 0x0002 /* relphot says image is bad */ 91 # define ID_IMAGE_SKIP 0x0004 /* external information image is bad */ 92 # define ID_IMAGE_FEW 0x0008 /* currently too few measurements for good value */ 87 /* Image.code values -- these values are 32 bit (as of PS1_V1) */ 88 typedef enum { 89 ID_IMAGE_NEW = 0x00000000, /* no calibrations yet attempted */ 90 ID_IMAGE_PHOTOM_NOCAL = 0x00000001, /* user-set value used within relphot: ignore */ 91 ID_IMAGE_PHOTOM_POOR = 0x00000002, /* relphot says image is bad (dMcal > limit) */ 92 ID_IMAGE_PHOTOM_SKIP = 0x00000004, /* user-set value: assert that this image has bad photometry */ 93 ID_IMAGE_PHOTOM_FEW = 0x00000008, /* currently too few measurements for photometry */ 94 ID_IMAGE_ASTROM_NOCAL = 0x00000010, /* user-set value used within relastro: ignore */ 95 ID_IMAGE_ASTROM_POOR = 0x00000020, /* relastro says image is bad (dR,dD > limit) */ 96 ID_IMAGE_ASTROM_FAIL = 0x00000040, /* relastro fit diverged, fit not applied */ 97 ID_IMAGE_ASTROM_SKIP = 0x00000080, /* user-set value: assert that this image has bad astrometry */ 98 ID_IMAGE_ASTROM_FEW = 0x00000100, /* currently too few measurements for astrometry */ 99 } DVOImageFlags; 93 100 94 101 /* Measure.flags values -- these values are 32 bit (as of PS1_V1) */ 95 102 typedef enum { 96 ID_MEAS_NOCAL = 0x000 1, // detection ignored for this analysis (photcode, time range) -- internal only97 ID_MEAS_POOR_PHOTOM = 0x000 2, // detection is photometry outlier98 ID_MEAS_SKIP_PHOTOM = 0x000 4, // detection was ignored for photometry measurement99 ID_MEAS_AREA = 0x000 8, // detection near image edge100 ID_MEAS_POOR_ASTROM = 0x00 10, // detection is astrometry outlier101 ID_MEAS_SKIP_ASTROM = 0x00 20, // detection was ignored for astrometry measurement102 ID_MEAS_USED_OBJ = 0x00 40, // detection was used during opdate objects103 ID_MEAS_USED_CHIP = 0x00 80, // detection was used during update chips104 ID_MEAS_BLEND_MEAS = 0x0 100, // detection is within radius of multiple objects105 ID_MEAS_BLEND_OBJ = 0x0 200, // multiple detections within radius of object106 ID_MEAS_UNDEF_3 = 0x0 400, // unused107 ID_MEAS_UNDEF_4 = 0x0 800, // unused108 ID_MEAS_BLEND_MEAS_X = 0x 1000, // detection is within radius of multiple objects across catalogs109 ID_MEAS_ARTIFACT = 0x 2000, // detection is thought to be non-astronomical110 ID_MEAS_UNDEF_5 = 0x 4000, // unused111 ID_MEAS_UNDEF_6 = 0x 8000, // unused103 ID_MEAS_NOCAL = 0x00000001, // detection ignored for this analysis (photcode, time range) -- internal only 104 ID_MEAS_POOR_PHOTOM = 0x00000002, // detection is photometry outlier 105 ID_MEAS_SKIP_PHOTOM = 0x00000004, // detection was ignored for photometry measurement 106 ID_MEAS_AREA = 0x00000008, // detection near image edge 107 ID_MEAS_POOR_ASTROM = 0x00000010, // detection is astrometry outlier 108 ID_MEAS_SKIP_ASTROM = 0x00000020, // detection was ignored for astrometry measurement 109 ID_MEAS_USED_OBJ = 0x00000040, // detection was used during opdate objects 110 ID_MEAS_USED_CHIP = 0x00000080, // detection was used during update chips 111 ID_MEAS_BLEND_MEAS = 0x00000100, // detection is within radius of multiple objects 112 ID_MEAS_BLEND_OBJ = 0x00000200, // multiple detections within radius of object 113 ID_MEAS_UNDEF_3 = 0x00000400, // unused 114 ID_MEAS_UNDEF_4 = 0x00000800, // unused 115 ID_MEAS_BLEND_MEAS_X = 0x00001000, // detection is within radius of multiple objects across catalogs 116 ID_MEAS_ARTIFACT = 0x00002000, // detection is thought to be non-astronomical 117 ID_MEAS_UNDEF_5 = 0x00004000, // unused 118 ID_MEAS_UNDEF_6 = 0x00008000, // unused 112 119 } DVOMeasureFlags; 113 120 … … 147 154 ID_STAR_USE_PM = 0x00100000, // proper motion used (not AVE or PAR) 148 155 ID_STAR_USE_PAR = 0x00200000, // parallax used (not AVE or PM) 156 ID_OBJ_EXT = 0x01000000, // extended in our data (eg, PS) 157 ID_OBJ_EXT_ALT = 0x02000000, // extended in external data (eg, 2MASS) 158 ID_OBJ_GOOD = 0x04000000, // good-quality measurement in our data (eg, PS) 159 ID_OBJ_GOOD_ALT = 0x08000000, // good-quality measurement in external data (eg, 2MASS) 149 160 } DVOAverageFlags; 150 161 -
trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
r27580 r29001 43 43 if (!strcmp (extname, "DVO_PHOTCODE")) { 44 44 PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped); 45 if (!photcode_elixir) { 46 fprintf (stderr, "ERROR: failed to read photcodes\n"); 47 exit (2); 48 } 45 49 photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode); 46 50 free (photcode_elixir); … … 49 53 if (!strcmp (extname, "DVO_PHOTCODE_ELIXIR")) { 50 54 PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped); 55 if (!photcode_elixir) { 56 fprintf (stderr, "ERROR: failed to read photcodes\n"); 57 exit (2); 58 } 51 59 photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode); 52 60 free (photcode_elixir); … … 55 63 if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_1")) { 56 64 PhotCode_PS1_DEV_1 *photcode_ps1_dev_1 = gfits_table_get_PhotCode_PS1_DEV_1 (&db.ftable, &Ncode, &db.swapped); 65 if (!photcode_ps1_dev_1) { 66 fprintf (stderr, "ERROR: failed to read photcodes\n"); 67 exit (2); 68 } 57 69 photcode = PhotCode_PS1_DEV_1_To_Internal (photcode_ps1_dev_1, Ncode); 58 70 free (photcode_ps1_dev_1); … … 61 73 if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_2")) { 62 74 PhotCode_PS1_DEV_2 *photcode_ps1_dev_2 = gfits_table_get_PhotCode_PS1_DEV_2 (&db.ftable, &Ncode, &db.swapped); 75 if (!photcode_ps1_dev_2) { 76 fprintf (stderr, "ERROR: failed to read photcodes\n"); 77 exit (2); 78 } 63 79 photcode = PhotCode_PS1_DEV_2_To_Internal (photcode_ps1_dev_2, Ncode); 64 80 free (photcode_ps1_dev_2); … … 67 83 if (!strcmp (extname, "DVO_PHOTCODE_PS1_DEV_3")) { 68 84 PhotCode_PS1_DEV_3 *photcode_ps1_dev_3 = gfits_table_get_PhotCode_PS1_DEV_3 (&db.ftable, &Ncode, &db.swapped); 85 if (!photcode_ps1_dev_3) { 86 fprintf (stderr, "ERROR: failed to read photcodes\n"); 87 exit (2); 88 } 69 89 photcode = PhotCode_PS1_DEV_3_To_Internal (photcode_ps1_dev_3, Ncode); 70 90 free (photcode_ps1_dev_3); … … 73 93 if (!strcmp (extname, "DVO_PHOTCODE_PS1_V1")) { 74 94 PhotCode_PS1_V1 *photcode_ps1_v1 = gfits_table_get_PhotCode_PS1_V1 (&db.ftable, &Ncode, &db.swapped); 95 if (!photcode_ps1_v1) { 96 fprintf (stderr, "ERROR: failed to read photcodes\n"); 97 exit (2); 98 } 75 99 photcode = PhotCode_PS1_V1_To_Internal (photcode_ps1_v1, Ncode); 76 100 free (photcode_ps1_v1); … … 79 103 if (!strcmp (extname, "DVO_PHOTCODE_PS1_V2")) { 80 104 PhotCode_PS1_V2 *photcode_ps1_v2 = gfits_table_get_PhotCode_PS1_V2 (&db.ftable, &Ncode, &db.swapped); 105 if (!photcode_ps1_v2) { 106 fprintf (stderr, "ERROR: failed to read photcodes\n"); 107 exit (2); 108 } 81 109 photcode = PhotCode_PS1_V2_To_Internal (photcode_ps1_v2, Ncode); 82 110 free (photcode_ps1_v2); … … 85 113 if (!strcmp (extname, "DVO_PHOTCODE_PS1_REF")) { 86 114 PhotCode_PS1_REF *photcode_ps1_ref = gfits_table_get_PhotCode_PS1_REF (&db.ftable, &Ncode, &db.swapped); 115 if (!photcode_ps1_ref) { 116 fprintf (stderr, "ERROR: failed to read photcodes\n"); 117 exit (2); 118 } 87 119 photcode = PhotCode_PS1_REF_To_Internal (photcode_ps1_ref, Ncode); 88 120 free (photcode_ps1_ref); -
trunk/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c
r28241 r29001 14 14 if (ftable[0].header[0].Naxis[0] != 136) { 15 15 fprintf (stderr, "ERROR: wrong format for CMF_PS1_V1_Alt: "OFF_T_FMT" vs %d\n", ftable[0].header[0].Naxis[0], 136); 16 exit (2);16 return (NULL); 17 17 } 18 18 -
trunk/Ohana/src/libdvo/src/coordops.c
r28837 r29001 20 20 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords) { 21 21 22 OhanaProjection proj; 23 OhanaProjectionMode mode; 22 24 double X, Y, X2, XY, Y2, X3, Y3; 25 26 proj = GetProjection (coords[0].ctype); 27 mode = GetProjectionMode (proj); 23 28 24 29 /** convert pixel coordinates to cartesian system **/ … … 45 50 } 46 51 52 if (mode == PROJ_MODE_CARTESIAN) { 53 *L += coords[0].crval1; 54 *M += coords[0].crval2; 55 } 56 47 57 return (TRUE); 48 58 } … … 64 74 /** Locally Cartesian Projections **/ 65 75 if (mode == PROJ_MODE_CARTESIAN) { 66 *ra = L + coords[0].crval1;67 *dec = M + coords[0].crval2;68 69 76 /* mosaic astrometry : WRP is chip astrometry; apply mosaic (DIS) term */ 70 77 if (proj == PROJ_WRP) { 71 78 if (!gotMosaic) return (FALSE); 72 XY_to_RD (ra, dec, *ra, *dec, &mosaic);79 XY_to_RD (ra, dec, L, M, &mosaic); 73 80 } 74 81 return (TRUE); … … 183 190 184 191 double phi, theta; 185 double Lo, Mo;186 192 double sphi, cphi, stht, ctht; 187 193 double salp, calp, sdel, cdel, sdp, cdp; … … 201 207 if (proj == PROJ_WRP) { 202 208 if (!gotMosaic) return (FALSE); 203 RD_to_XY (&Lo, &Mo, ra, dec, &mosaic); 204 *L = (Lo - coords[0].crval1); 205 *M = (Mo - coords[0].crval2); 209 RD_to_XY (L, M, ra, dec, &mosaic); 206 210 return (TRUE); 207 211 } 208 *L = (ra - coords[0].crval1);209 *M = (dec - coords[0].crval2);212 *L = ra; 213 *M = dec; 210 214 return (TRUE); 211 215 } … … 310 314 double dX, dY, Lo, Mo, dL, dM; 311 315 double dLdX, dLdY, dMdX, dMdY, Do; 316 OhanaProjection proj; 317 OhanaProjectionMode mode; 318 319 proj = GetProjection (coords[0].ctype); 320 mode = GetProjectionMode (proj); 312 321 313 322 *x = 0; 314 323 *y = 0; 324 325 if (mode == PROJ_MODE_CARTESIAN) { 326 L -= coords[0].crval1; 327 M -= coords[0].crval2; 328 } 315 329 316 330 /* start with linear solution for X,Y */ … … 422 436 } 423 437 438 enum {COORD_TYPE_NONE, COORD_TYPE_PC, COORD_TYPE_ROT, COORD_TYPE_CD, COORD_TYPE_LIN}; 439 424 440 int GetCoords (Coords *coords, Header *header) { 425 441 … … 428 444 double equinox; 429 445 char *ctype; 446 int mode; 430 447 431 448 rotate = 0.0; … … 437 454 strcpy (coords[0].ctype, "NONE"); 438 455 439 status = FALSE; 440 if (gfits_scan (header, "CTYPE2", "%s", 1, coords[0].ctype)) { 441 status = gfits_scan (header, "CRVAL1", "%lf", 1, &coords[0].crval1); 442 status &= gfits_scan (header, "CRPIX1", "%f", 1, &coords[0].crpix1); 443 status &= gfits_scan (header, "CRVAL2", "%lf", 1, &coords[0].crval2); 444 status &= gfits_scan (header, "CRPIX2", "%f", 1, &coords[0].crpix2); 445 446 if (gfits_scan (header, "CDELT1", "%f", 1, &coords[0].cdelt1)) { 447 status &= gfits_scan (header, "CDELT2", "%f", 1, &coords[0].cdelt2); 448 if (gfits_scan (header, "CROTA2", "%lf", 1, &rotate)) { 449 Lambda = coords[0].cdelt2 / coords[0].cdelt1; 450 coords[0].pc1_1 = cos(rotate*RAD_DEG); 451 coords[0].pc1_2 = -sin(rotate*RAD_DEG) * Lambda; 452 coords[0].pc2_1 = sin(rotate*RAD_DEG) / Lambda; 453 coords[0].pc2_2 = cos(rotate*RAD_DEG); 454 } 455 if (gfits_scan (header, "PC001001", "%f", 1, &coords[0].pc1_1)) { 456 status &= gfits_scan (header, "PC001002", "%f", 1, &coords[0].pc1_2); 457 status &= gfits_scan (header, "PC002001", "%f", 1, &coords[0].pc2_1); 458 status &= gfits_scan (header, "PC002002", "%f", 1, &coords[0].pc2_2); 459 } 456 mode = COORD_TYPE_NONE; 457 { 458 int haveCTYPE, haveCDELT, haveCROTA, haveCDij, havePCij, haveRAo; 459 float tmp; 460 char stmp[80]; 461 462 // there are a few different representations for scale and rotation. choose an appropriate 463 // set: (CDELTi + CROTAi), (CDELTi + PCij), (CDij), 464 465 haveCTYPE = gfits_scan (header, "CTYPE2", "%s", 1, stmp); 466 haveCDELT = gfits_scan (header, "CDELT1", "%f", 1, &tmp); 467 haveCROTA = gfits_scan (header, "CROTA1", "%f", 1, &tmp); 468 haveCDij = gfits_scan (header, "CD1_1", "%f", 1, &tmp); 469 havePCij = gfits_scan (header, "PC001001", "%f", 1, &tmp); 470 haveRAo = gfits_scan (header, "RA_O", "%f", 1, &tmp); 471 472 if (haveCTYPE && havePCij && haveCDELT) { mode = COORD_TYPE_PC; goto gotit; } 473 if (haveCTYPE && haveCROTA && haveCDELT) { mode = COORD_TYPE_ROT; goto gotit; } 474 if (haveCTYPE && haveCDij) { mode = COORD_TYPE_CD; goto gotit; } 475 if (haveRAo) { mode = COORD_TYPE_LIN; goto gotit; } 476 // fprintf (stderr, "no valid WCS keywords\n"); 477 return (FALSE); 478 } 479 480 gotit: 481 482 status = TRUE; 483 switch (mode) { 484 case COORD_TYPE_PC: 485 status &= gfits_scan (header, "CTYPE2", "%s", 1, coords[0].ctype); 486 status &= gfits_scan (header, "CRVAL1", "%lf", 1, &coords[0].crval1); 487 status &= gfits_scan (header, "CRPIX1", "%f", 1, &coords[0].crpix1); 488 status &= gfits_scan (header, "CRVAL2", "%lf", 1, &coords[0].crval2); 489 status &= gfits_scan (header, "CRPIX2", "%f", 1, &coords[0].crpix2); 490 491 status &= gfits_scan (header, "CDELT1", "%f", 1, &coords[0].cdelt1); 492 status &= gfits_scan (header, "CDELT2", "%f", 1, &coords[0].cdelt2); 493 status &= gfits_scan (header, "PC001001", "%f", 1, &coords[0].pc1_1); 494 status &= gfits_scan (header, "PC001002", "%f", 1, &coords[0].pc1_2); 495 status &= gfits_scan (header, "PC002001", "%f", 1, &coords[0].pc2_1); 496 status &= gfits_scan (header, "PC002002", "%f", 1, &coords[0].pc2_2); 460 497 461 498 /* set NPLYTERM based on header. if NPLYTERM is missing, it should have a … … 491 528 break; 492 529 } 493 } else { 494 if (gfits_scan (header, "CD1_1", "%f", 1, &coords[0].pc1_1)) { 495 status &= gfits_scan (header, "CD1_2", "%f", 1, &coords[0].pc1_2); 496 status &= gfits_scan (header, "CD2_1", "%f", 1, &coords[0].pc2_1); 497 status &= gfits_scan (header, "CD2_2", "%f", 1, &coords[0].pc2_2); 498 /* renormalize */ 499 scale = hypot (coords[0].pc1_1, coords[0].pc1_2); 500 coords[0].cdelt1 = coords[0].cdelt2 = scale; 501 coords[0].pc1_1 /= scale; 502 coords[0].pc1_2 /= scale; 503 coords[0].pc2_1 /= scale; 504 coords[0].pc2_2 /= scale; 505 } else { 506 status = FALSE; 507 } 508 } 509 } else { 510 /* some of my thesis data uses this simple linear model - convert on read? */ 511 if (gfits_scan (header, "RA_O", "%lf", 1, &coords[0].crval1)) { 512 status = gfits_scan (header, "RA_X", "%f", 1, &coords[0].pc1_1); 530 break; 531 532 case COORD_TYPE_ROT: 533 status &= gfits_scan (header, "CTYPE2", "%s", 1, coords[0].ctype); 534 status &= gfits_scan (header, "CRVAL1", "%lf", 1, &coords[0].crval1); 535 status &= gfits_scan (header, "CRPIX1", "%f", 1, &coords[0].crpix1); 536 status &= gfits_scan (header, "CRVAL2", "%lf", 1, &coords[0].crval2); 537 status &= gfits_scan (header, "CRPIX2", "%f", 1, &coords[0].crpix2); 538 539 status &= gfits_scan (header, "CDELT1", "%f", 1, &coords[0].cdelt1); 540 status &= gfits_scan (header, "CDELT2", "%f", 1, &coords[0].cdelt2); 541 542 status &= gfits_scan (header, "CROTA2", "%lf", 1, &rotate); 543 Lambda = coords[0].cdelt2 / coords[0].cdelt1; 544 coords[0].pc1_1 = cos(rotate*RAD_DEG); 545 coords[0].pc1_2 = -sin(rotate*RAD_DEG) * Lambda; 546 coords[0].pc2_1 = sin(rotate*RAD_DEG) / Lambda; 547 coords[0].pc2_2 = cos(rotate*RAD_DEG); 548 break; 549 550 case COORD_TYPE_CD: 551 status &= gfits_scan (header, "CTYPE2", "%s", 1, coords[0].ctype); 552 status &= gfits_scan (header, "CRVAL1", "%lf", 1, &coords[0].crval1); 553 status &= gfits_scan (header, "CRPIX1", "%f", 1, &coords[0].crpix1); 554 status &= gfits_scan (header, "CRVAL2", "%lf", 1, &coords[0].crval2); 555 status &= gfits_scan (header, "CRPIX2", "%f", 1, &coords[0].crpix2); 556 557 status &= gfits_scan (header, "CD1_1", "%f", 1, &coords[0].pc1_1); 558 status &= gfits_scan (header, "CD1_2", "%f", 1, &coords[0].pc1_2); 559 status &= gfits_scan (header, "CD2_1", "%f", 1, &coords[0].pc2_1); 560 status &= gfits_scan (header, "CD2_2", "%f", 1, &coords[0].pc2_2); 561 /* renormalize */ 562 scale = hypot (coords[0].pc1_1, coords[0].pc1_2); 563 coords[0].cdelt1 = coords[0].cdelt2 = scale; 564 coords[0].pc1_1 /= scale; 565 coords[0].pc1_2 /= scale; 566 coords[0].pc2_1 /= scale; 567 coords[0].pc2_2 /= scale; 568 break; 569 570 case COORD_TYPE_LIN: 571 /* some of my thesis data uses this simple linear model - convert on read? */ 572 status &= gfits_scan (header, "RA_O", "%lf", 1, &coords[0].crval1); 573 status &= gfits_scan (header, "RA_X", "%f", 1, &coords[0].pc1_1); 513 574 status &= gfits_scan (header, "RA_Y", "%f", 1, &coords[0].pc1_2); 514 575 status &= gfits_scan (header, "DEC_O", "%lf", 1, &coords[0].crval2); … … 518 579 coords[0].cdelt1 = coords[0].cdelt2 = 1.0; 519 580 strcpy (coords[0].ctype, "GENE"); 520 } 521 } 581 break; 582 } 583 522 584 if (status) { 523 585 if (!gfits_scan (header, "EQUINOX", "%lf", 1, &equinox)) { … … 530 592 } 531 593 } 594 532 595 if (!status) { 533 fprintf (stderr, "error getting all elements for coordinate mode %s\n", coords[0].ctype);596 // fprintf (stderr, "error getting all elements for coordinate mode %s\n", coords[0].ctype); 534 597 coords[0].crval1 = coords[0].crpix1 = coords[0].cdelt1 = 0.0; 535 598 coords[0].crval2 = coords[0].crpix2 = coords[0].cdelt2 = 0.0; -
trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c
r28241 r29001 125 125 /* no conversions currently defined */ 126 126 catalog[0].missing = gfits_table_get_Missing (&ftable, &catalog[0].Nmissing, NULL); 127 if (!catalog[0].missing) { 128 fprintf (stderr, "ERROR: failed to read missing\n"); 129 exit (2); 130 } 127 131 if (Nmissing != catalog[0].Nmiss_disk) { 128 132 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nmissing, catalog[0].Nmiss_disk); -
trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
r28241 r29001 285 285 /* no conversions currently defined : this just does the byte swap */ 286 286 catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL); 287 if (!catalog[0].missing) { 288 fprintf (stderr, "ERROR: failed to read missing\n"); 289 exit (2); 290 } 287 291 if (Nmissing != catalog[0].Nmiss_disk) { 288 292 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nmissing, catalog[0].Nmiss_disk); … … 473 477 /* no conversions currently defined : this just does the byte swap */ 474 478 catalog[0].missing = gfits_table_get_Missing (&ftable, &Nmissing, NULL); 479 if (!catalog[0].missing) { 480 fprintf (stderr, "ERROR: failed to read missing\n"); 481 exit (2); 482 } 475 483 if (Nmissing != Nrows) { 476 484 fprintf (stderr, "Warning: mismatch between Nmissing in PHU and Table headers ("OFF_T_FMT" vs "OFF_T_FMT")\n", Nmissing, Nrows); -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r28241 r29001 32 32 Average_##TYPE *tmpAverage; \ 33 33 tmpAverage = gfits_table_get_Average_##TYPE (ftable, Naverage, NULL); \ 34 if (!tmpAverage) { \ 35 fprintf (stderr, "ERROR: failed to read averages\n"); \ 36 exit (2); \ 37 } \ 34 38 average = Average_##TYPE##_ToInternal (tmpAverage, *Naverage, primary); \ 35 39 free (tmpAverage); \ … … 39 43 if (!strcmp (extname, "DVO_AVERAGE")) { 40 44 average = gfits_table_get_Average (ftable, Naverage, NULL); 45 if (!average) { 46 fprintf (stderr, "ERROR: failed to read averages\n"); 47 exit (2); 48 } 41 49 *format = DVO_FORMAT_INTERNAL; 42 50 return (average); … … 111 119 Measure_##TYPE *tmpMeasure; \ 112 120 tmpMeasure = gfits_table_get_Measure_##TYPE (ftable, Nmeasure, NULL); \ 121 if (!tmpMeasure) { \ 122 fprintf (stderr, "ERROR: failed to read measures\n"); \ 123 exit (2); \ 124 } \ 113 125 measure = Measure_##TYPE##_ToInternal (tmpMeasure, *Nmeasure); \ 114 126 free (tmpMeasure); \ … … 118 130 if (!strcmp (extname, "DVO_MEASURE")) { 119 131 measure = gfits_table_get_Measure (ftable, Nmeasure, NULL); 132 if (!measure) { 133 fprintf (stderr, "ERROR: failed to read measures\n"); 134 exit (2); 135 } 120 136 *format = DVO_FORMAT_INTERNAL; 121 137 return (measure); … … 190 206 SecFilt_##TYPE *tmpSecFilt; \ 191 207 tmpSecFilt = gfits_table_get_SecFilt_##TYPE (ftable, Nsecfilt, NULL); \ 208 if (!tmpSecFilt) { \ 209 fprintf (stderr, "ERROR: failed to read secfilts\n"); \ 210 exit (2); \ 211 } \ 192 212 secfilt = SecFilt_##TYPE##_ToInternal (tmpSecFilt, *Nsecfilt); \ 193 213 free (tmpSecFilt); \ … … 197 217 if (!strcmp (extname, "DVO_SECFILT")) { 198 218 secfilt = gfits_table_get_SecFilt (ftable, Nsecfilt, NULL); 219 if (!secfilt) { 220 fprintf (stderr, "ERROR: failed to read secfilts\n"); 221 exit (2); 222 } 199 223 *format = DVO_FORMAT_INTERNAL; 200 224 return (secfilt); … … 263 287 Image_Elixir *tmpimage; 264 288 tmpimage = gfits_table_get_Image_Elixir (ftable, &Nimage, NULL); 289 if (!tmpimage) { 290 fprintf (stderr, "ERROR: failed to read images\n"); 291 exit (2); 292 } 265 293 ftable[0].buffer = (char *) Image_Elixir_ToInternal (tmpimage, Nimage); 266 294 free (tmpimage); … … 284 312 *format = DVO_FORMAT_##FORMAT; \ 285 313 tmpimage = gfits_table_get_Image_##TYPE (ftable, &Nimage, NULL); \ 314 if (!tmpimage) { \ 315 fprintf (stderr, "ERROR: failed to read images\n"); \ 316 exit (2); \ 317 } \ 286 318 ftable[0].buffer = (char *) Image_##TYPE##_ToInternal (tmpimage, Nimage); \ 287 319 free (tmpimage); \ … … 296 328 Image *image; 297 329 image = gfits_table_get_Image (ftable, &Nimage, NULL); 330 if (!image) { 331 fprintf (stderr, "ERROR: failed to read images\n"); 332 exit (2); 333 } 298 334 *format = DVO_FORMAT_INTERNAL; 299 335 return (TRUE); -
trunk/Ohana/src/libdvo/src/skyregion_io.c
r27435 r29001 40 40 ALLOCATE (skytable, SkyTable, 1); 41 41 skytable[0].regions = gfits_table_get_SkyRegion (&ftable, &skytable[0].Nregions, NULL); 42 if (!skytable[0].regions) { 43 fprintf (stderr, "ERROR: failed to read sky regions\n"); 44 exit (2); 45 } 46 42 47 ALLOCATE (skytable[0].filename, char *, skytable[0].Nregions); 43 48 for (i = 0; i < skytable[0].Nregions; i++) { -
trunk/Ohana/src/markstar/src/find_images.c
r7080 r29001 26 26 27 27 timage = gfits_table_get_Image (&db[0].ftable, &Ntimage, &db[0].swapped); 28 if (!timage) { 29 fprintf (stderr, "ERROR: failed to read images\n"); 30 exit (2); 31 } 28 32 29 33 /* set up buffers for images, temporary storage */ -
trunk/Ohana/src/mosastro/src/rfits.c
r27435 r29001 32 32 off_t Nstars; 33 33 stars = gfits_table_get_SMPData (&table, &Nstars, NULL); 34 if (!stars) { 35 fprintf (stderr, "ERROR: failed to read stars\n"); 36 exit (2); 37 } 38 34 39 mychip[0].Nstars = Nstars; 35 40 gfits_scan (table.header, "NAXIS1", "%d", 1, &Nx); -
trunk/Ohana/src/opihi/cmd.astro/cgrid.c
r26258 r29001 153 153 SetVector (&Yvec, OPIHI_FLT, NELEMENTS); 154 154 155 { // sanity check 156 float Nelem; 157 Nelem = 180.0 / minorRA; 158 if (!isfinite(Nelem) || (fabs(Nelem) > 10000)) { fprintf (stderr, "absurd cgrid spacing %f\n", minorRA); return FALSE; } 159 Nelem = 180.0 / minorDEC; 160 if (!isfinite(Nelem) || (fabs(Nelem) > 10000)) { fprintf (stderr, "absurd cgrid spacing %f\n", minorDEC); return FALSE; } 161 } 162 155 163 /*** do consecutive RA lines, first increasing **/ 156 164 OnPic = TRUE; -
trunk/Ohana/src/opihi/cmd.data/Makefile
r27817 r29001 19 19 $(SRC)/init.$(ARCH).o \ 20 20 $(SRC)/accum.$(ARCH).o \ 21 $(SRC)/applyfit1d.$(ARCH).o \ 21 22 $(SRC)/applyfit2d.$(ARCH).o \ 22 $(SRC)/applyfit 1d.$(ARCH).o \23 $(SRC)/applyfit3d.$(ARCH).o \ 23 24 $(SRC)/box.$(ARCH).o \ 24 25 $(SRC)/book.$(ARCH).o \ … … 46 47 $(SRC)/fit1d.$(ARCH).o \ 47 48 $(SRC)/fit2d.$(ARCH).o \ 49 $(SRC)/fit3d.$(ARCH).o \ 48 50 $(SRC)/gaussj.$(ARCH).o \ 49 51 $(SRC)/gaussdeviate.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/applyfit2d.c
r20936 r29001 10 10 11 11 if (argc != 4) { 12 gprint (GP_ERR, "USAGE: applyfit x y z\n");12 gprint (GP_ERR, "USAGE: applyfit2d x y z\n"); 13 13 return (FALSE); 14 14 } -
trunk/Ohana/src/opihi/cmd.data/fit2d.c
r27817 r29001 168 168 } 169 169 170 /** test print **/ 171 if (VERBOSE) { 172 for (i = 0; i < wterm; i++) { 173 for (j = 0; j < wterm; j++) { 174 gprint (GP_ERR, "%g ", c[i][j]); 175 } 176 gprint (GP_ERR, "\n"); 177 } 178 gprint (GP_ERR, "-----\n"); 179 } 180 170 181 dgaussjordan (c, b, wterm, 1); 171 182 … … 176 187 gprint (GP_ERR, "x^%d y^%d: %g\n", nx, ny, b[i][0]); 177 188 } 189 } 190 } 191 192 /** test print **/ 193 if (VERBOSE) { 194 for (i = 0; i < wterm; i++) { 195 for (j = 0; j < wterm; j++) { 196 gprint (GP_ERR, "%g ", c[i][j]); 197 } 198 gprint (GP_ERR, "\n"); 178 199 } 179 200 } -
trunk/Ohana/src/opihi/cmd.data/init.c
r27817 r29001 5 5 int applyfit1d PROTO((int, char **)); 6 6 int applyfit2d PROTO((int, char **)); 7 int applyfit3d PROTO((int, char **)); 7 8 int box PROTO((int, char **)); 8 9 int book_command PROTO((int, char **)); … … 34 35 int fit1d PROTO((int, char **)); 35 36 int fit2d PROTO((int, char **)); 37 int fit3d PROTO((int, char **)); 36 38 int gaussjordan PROTO((int, char **)); 37 39 int gaussdeviate PROTO((int, char **)); … … 138 140 {1, "applyfit1d", applyfit1d, "apply 1-d fit to new vector"}, 139 141 {1, "applyfit2d", applyfit2d, "apply 2-d fit to new vector"}, 142 {1, "applyfit3d", applyfit3d, "apply 3-d fit to new vector"}, 140 143 {1, "book", book_command, "commands to manipulate book/page/word data"}, 141 144 {1, "box", box, "draw a box on the plot"}, … … 168 171 {1, "fit1d", fit1d, "fit polynomial to vector pair"}, 169 172 {1, "fit2d", fit2d, "fit 2-d polynomial to vector triplet"}, 173 {1, "fit3d", fit3d, "fit 3-d polynomial to vector quad"}, 170 174 {1, "gaussdev", gaussdeviate, "generate a gaussian deviate vector"}, 171 175 {1, "gaussint", gaussintegral, "return the integrated gaussian vector"}, -
trunk/Ohana/src/opihi/cmd.data/vgauss.c
r20936 r29001 42 42 if ((ovec = SelectVector (argv[4], ANYVECTOR, TRUE)) == NULL) return (FALSE); 43 43 44 REQUIRE_VECTOR_FLT (xvec, FALSE);45 REQUIRE_VECTOR_FLT (yvec, FALSE);46 REQUIRE_VECTOR_FLT (svec, FALSE);44 CastVector (xvec, OPIHI_FLT); 45 CastVector (yvec, OPIHI_FLT); 46 CastVector (svec, OPIHI_FLT); 47 47 48 48 Npts = xvec[0].Nelements; -
trunk/Ohana/src/opihi/dvo/LoadImages.c
r28958 r29001 65 65 66 66 image = gfits_table_get_Image (&db.ftable, Nimage, &db.swapped); 67 if (!image) { 68 fprintf (stderr, "ERROR: failed to read images\n"); 69 return (NULL); 70 } 67 71 if (dvoUseImageCache && image) { 68 72 cacheNimage = *Nimage; … … 71 75 lastModified = getLastModified(filename); 72 76 } 73 74 77 return (image); 75 78 } -
trunk/Ohana/src/opihi/dvo/cmpReadFile.c
r27435 r29001 20 20 21 21 smpdata = gfits_table_get_SMPData (&table, &Nstars, NULL); 22 if (!smpdata) { 23 fprintf (stderr, "ERROR: failed to read stars\n"); 24 exit (2); 25 } 22 26 23 27 ALLOCATE (stars, CMPstars, Nstars); -
trunk/Ohana/src/photdbc/src/copy_images.c
r28331 r29001 46 46 47 47 image = gfits_table_get_Image (&in.ftable, &Nimage, &in.swapped); 48 if (!image) { 49 fprintf (stderr, "ERROR: failed to read images\n"); 50 exit (2); 51 } 48 52 dvo_image_addrows (&out, image, Nimage); 49 53 -
trunk/Ohana/src/photdbc/src/find_images.c
r12332 r29001 28 28 29 29 timage = gfits_table_get_Image (&db[0].ftable, &Ntimage, &db[0].swapped); 30 if (!timage) { 31 fprintf (stderr, "ERROR: failed to read images\n"); 32 exit (2); 33 } 30 34 31 35 nimage = 0; … … 97 101 if (found) { 98 102 image[nimage] = timage[i]; 99 if (image[nimage].code == ID_IMAGE_ NOCAL) {100 image[nimage].code &= ~ID_IMAGE_ NOCAL;103 if (image[nimage].code == ID_IMAGE_PHOTOM_NOCAL) { 104 image[nimage].code &= ~ID_IMAGE_PHOTOM_NOCAL; 101 105 } 102 106 line_number[nimage] = i; -
trunk/Ohana/src/photdbc/src/flag_measures.c
r12332 r29001 16 16 17 17 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 18 if (!image) { 19 fprintf (stderr, "ERROR: failed to read images\n"); 20 exit (2); 21 } 18 22 19 23 PhotNsec = GetPhotcodeNsecfilt (); -
trunk/Ohana/src/relastro/Makefile
r28184 r29001 58 58 $(SRC)/CoordOps.$(ARCH).o \ 59 59 $(SRC)/FixProblemImages.$(ARCH).o \ 60 $(SRC)/StarMaps.$(ARCH).o \ 60 61 $(SRC)/high_speed_catalogs.$(ARCH).o \ 61 62 $(SRC)/high_speed_objects.$(ARCH).o \ -
trunk/Ohana/src/relastro/doc/notes.txt
r27435 r29001 1 2 2010.07.15 3 4 Some issues: 5 6 * when I apply the fitted image parameters (UpdateObjectOffsets), I 7 currently check for good/bad fits and warn if the image is bad. 8 But the correction requires multiple re-loads of the catalog 9 tables. 10 11 * I would like to check for bad fits by defining a grid of test 12 points and seeing how much they move. However, for some chips, 13 the region of valid data is much smaller than the regino with any 14 data. 15 16 * I would like to define a grid (say, Nx * Ny with Nx >> polynomial 17 order) and only use those grid regions in testing the solution 18 19 * This means knowing which detections belong on a specific image. 20 I'm not sure if there is a good way to do this. at the moment, it 21 is easy to do detection -> image, but not so easy to do 22 image->detection. 23 24 * That might argue for generating the grid for each image, then 25 running through all detections and, as detections are examined, 26 populate the grid elements for their own image. 1 27 2 28 2010.03.24 -
trunk/Ohana/src/relastro/include/relastro.h
r28184 r29001 3 3 # include <kapa.h> 4 4 # include <signal.h> 5 # include <assert.h> 5 6 6 7 typedef enum { … … 76 77 int Nmeas; 77 78 } StatType; 79 80 # define MARKTIME(MSG,...) { \ 81 float dtime; \ 82 gettimeofday (&stop, (void *) NULL); \ 83 dtime = DTIME (stop, start); \ 84 fprintf (stderr, MSG, __VA_ARGS__); } 78 85 79 86 /* global variables set in parameter file */ … … 145 152 int DoUpdateChips; 146 153 int DoUpdateMosaics; 154 155 // StarMap parameters: 156 int NX_MAP; 157 int NY_MAP; 158 double DPOS_MAX; 159 double ADDSTAR_RADIUS; 147 160 148 161 /*** relphot prototypes ***/ … … 207 220 void create_image_db (FITS_DB *db); 208 221 void save_catalogs (Catalog *catalog, int Ncatalog); 222 223 int reload_images (FITS_DB *db); 209 224 210 225 int main PROTO((int argc, char **argv)); … … 267 282 double **poly2d_copy (double **poly, int Nx, int Ny); 268 283 double poly2d_eval (double **poly, int Nx, int Ny, double x, double y); 269 int fit_apply_coords (CoordFit *fit, Coords *coords );284 int fit_apply_coords (CoordFit *fit, Coords *coords, int keepRef); 270 285 int CoordsGetCenter (CoordFit *fit, double tol, double *xo, double *yo); 271 286 CoordFit *CoordsSetCenter (CoordFit *input, double Xo, double Yo); 272 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords);287 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image); 273 288 void FitMosaic (StarData *raw, StarData *ref, int Nmatch, Coords *coords); 274 289 void FitSimple (StarData *raw, StarData *ref, int Nmatch, Coords *coords); … … 293 308 StarData *getImageRef (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode); 294 309 StarData *getImageRaw (Catalog *catalog, int Ncatalog, off_t im, off_t *Nstars, CoordMode mode); 310 off_t getImageByID (off_t ID); 295 311 296 312 Mosaic *getmosaics (off_t *N); … … 331 347 int high_speed_objects (SkyRegion *region, Catalog *catalog); 332 348 int MeasMatchesPhotcode(Measure *measure, PhotCode **photcodeSet, int Nset); 349 350 int initStarMaps (); 351 int updateStarMaps(Catalog *catalog); 352 int createStarMapPoints(); 353 int checkStarMap(int N); -
trunk/Ohana/src/relastro/src/ConfigInit.c
r25757 r29001 32 32 GetConfig (config, "PM_TOOFEW", "%d", 0, &PM_TOOFEW); 33 33 GetConfig (config, "POS_TOOFEW", "%d", 0, &POS_TOOFEW); 34 35 GetConfig (config, "RELASTRO_MAP_NX", "%d", 0, &NX_MAP); 36 GetConfig (config, "RELASTRO_MAP_NY", "%d", 0, &NY_MAP); 37 GetConfig (config, "RELASTRO_DPOS_MAX", "%lf", 0, &DPOS_MAX); 38 GetConfig (config, "ADDSTAR_RADIUS", "%lf", 0, &ADDSTAR_RADIUS); 34 39 35 40 GetConfig (config, "GSCFILE", "%s", 0, GSCFILE); -
trunk/Ohana/src/relastro/src/FitChip.c
r27581 r29001 3 3 4 4 // XXX make these user parameters 5 # define FIT_CHIP_MAX_ERROR 0.056 5 # define FIT_CHIP_NITER 3 7 6 # define FIT_CHIP_NSIGMA 3.0 8 9 10 // XXX we should test if the fit is sufficiently constrained across the chip, or if the11 // new positions deviate too much from the old positions12 13 // XXX add visualization tools: per chip residual plots14 7 15 8 // XXX save the fit[0].Npts value in the image table? … … 17 10 // XXX save measurements of the fit quality (scatter, chisq) in the image table 18 11 19 int FitChip (StarData *raw, StarData *ref, int Nmatch, Coords *coords) {12 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) { 20 13 21 14 int i, Nscatter, Niter, skip; … … 29 22 for (i = Nscatter = 0; i < Nmatch; i++) { 30 23 if (raw[i].mask) continue; 31 if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) continue;24 if (isnan(raw[i].dMag) || raw[i].dMag > SIGMA_LIM) continue; 32 25 33 26 dL = raw[i].L - ref[i].L; … … 39 32 } 40 33 41 // for a 2D Gaussian, 40% of the points are within 1 sigma; dRmax is ~ 3 sigma 42 dsort (values, Nscatter); 43 dRmax = FIT_CHIP_NSIGMA*values[(int)(0.40*Nscatter)]; 44 relastroVisualPlotScatter(values, dRmax, Nscatter); 45 relastroVisualPlotRawRef(raw, ref, dRmax, Nmatch); 34 if (Nscatter > 5) { 35 // for a 2D Gaussian, 40% of the points are within 1 sigma; dRmax is ~ 3 sigma 36 // XXX this test is not sensible for Nscatter < XXX (5?) 37 dsort (values, Nscatter); 38 dRmax = FIT_CHIP_NSIGMA*values[(int)(0.40*Nscatter)]; 39 relastroVisualPlotScatter(values, dRmax, Nscatter); 40 relastroVisualPlotRawRef(raw, ref, dRmax, Nmatch); 41 } else { 42 dRmax = 0; 43 } 46 44 47 45 // fit the requested order polynomial 48 46 if (CHIPORDER > 0) { 49 coords[0].Npolyterms = CHIPORDER;47 image[0].coords.Npolyterms = CHIPORDER; 50 48 } 51 fit = fit_init ( coords[0].Npolyterms);49 fit = fit_init (image[0].coords.Npolyterms); 52 50 53 51 // generate the fit matches … … 56 54 continue; 57 55 } 58 if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) {56 if (isnan(raw[i].dMag) || raw[i].dMag > SIGMA_LIM) { 59 57 continue; 60 58 } … … 64 62 dM = raw[i].M - ref[i].M; 65 63 dR = hypot (dL, dM); 66 if (dR > dRmax) continue; 64 65 // fprintf (stderr, "fit %f %f -> %f %f : %f %f (%f vs %f) wt: %f\n", raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].L, raw[i].M, dR, dRmax, raw[i].dPos); 66 67 if ((dRmax > 0.0) && (dR > dRmax)) continue; 67 68 68 69 fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos); … … 71 72 // check if the fit has enough data points for the polynomial order 72 73 skip = FALSE; 73 switch ( coords[0].Npolyterms) {74 switch (image[0].coords.Npolyterms) { 74 75 case 0: 75 76 case 1: … … 83 84 break; 84 85 default: 85 fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms);86 fprintf (stderr, "invalid chip order %d\n", image[0].coords.Npolyterms); 86 87 skip = TRUE; 87 88 } 88 89 if (skip) { 89 fprintf (stderr, "insufficient measurements (%d) for requested order (%d)\n", fit[0].Npts, coords[0].Npolyterms);90 if (VERBOSE) fprintf (stderr, "insufficient measurements (%d) for requested order (%d)\n", fit[0].Npts, image[0].coords.Npolyterms); 90 91 fit_free (fit); 91 92 free (values); 93 image[0].flags |= ID_IMAGE_ASTROM_FEW; 92 94 return FALSE; 93 95 } … … 98 100 if (!fit_eval (fit)) { 99 101 fprintf (stderr, "failed to fit new model\n"); 102 image[0].flags |= ID_IMAGE_ASTROM_FAIL; 100 103 return FALSE; 101 104 } 102 105 103 if (!fit_apply_coords (fit, coords)) {106 if (!fit_apply_coords (fit, &image[0].coords, FALSE)) { 104 107 fprintf (stderr, "failed to fit new model\n"); 108 image[0].flags |= ID_IMAGE_ASTROM_FAIL; 105 109 return FALSE; 106 110 } … … 109 113 110 114 for (i = 0; i < Nmatch; i++) { 111 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, coords);115 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[0].coords); 112 116 } 113 117 -
trunk/Ohana/src/relastro/src/FitMosaic.c
r16810 r29001 26 26 } 27 27 fit_eval (fit); 28 fit_apply_coords (fit, coords );28 fit_apply_coords (fit, coords, TRUE); 29 29 fit_free (fit); 30 30 -
trunk/Ohana/src/relastro/src/FitSimple.c
r27435 r29001 26 26 } 27 27 fit_eval (fit); 28 fit_apply_coords (fit, coords );28 fit_apply_coords (fit, coords, TRUE); 29 29 fit_free (fit); 30 30 -
trunk/Ohana/src/relastro/src/ImageOps.c
r28241 r29001 319 319 } 320 320 321 void dump_measures(Average *average, Measure *measure) { 322 323 off_t j, off; 324 325 for (j = 0; j < average[0].Nmeasure; j++) { 326 off = average[0].measureOffset + j; 327 fprintf (stderr, "%f, %f\n", measure[off].dR, measure[off].dD); 328 } 329 return; 330 } 331 321 332 // return StarData values for detections in the specified image, converting coordinates from the 322 333 // chip positions: X,Y -> L,M -> P,Q -> R,D … … 325 336 off_t i, m, c, n, nPos; 326 337 double X, Y, L, M, P, Q, R, D, dR, dD; 327 double dPos ;338 double dPos, DPOS_MAX_ASEC; 328 339 329 340 Mosaic *mosaic; … … 341 352 } 342 353 imcoords = &image[im].coords; 354 355 if (moscoords) { 356 DPOS_MAX_ASEC = 3600.0*DPOS_MAX*hypot(moscoords[0].cdelt1, moscoords[0].cdelt2); 357 } else { 358 DPOS_MAX_ASEC = 3600.0*DPOS_MAX*hypot(imcoords[0].cdelt1, imcoords[0].cdelt2); 359 } 343 360 344 361 // accumulate the rms position offsets. if this value, or any specific entry, is too … … 372 389 373 390 // complain if the new location is far from the average location 374 if (fabs(dR) > 2.0) { 375 fprintf (stderr, "!"); 376 setBadCoords (im); // report a failure for this image 377 return; 378 } 379 if (fabs(dD) > 2.0) { 380 fprintf (stderr, "*"); 381 setBadCoords (im); // report a failure for this image 382 return; 391 // NOTE: This should never happen, or our StarMap tests are not working 392 if (fabs(dR) > 1.5*ADDSTAR_RADIUS) { 393 fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD); 394 dump_measures (&catalog[c].average[n], catalog[c].measure); 395 // abort (); 396 } 397 if (fabs(dD) > 1.5*ADDSTAR_RADIUS) { 398 fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD); 399 dump_measures (&catalog[c].average[n], catalog[c].measure); 400 // abort (); 383 401 } 384 402 385 403 // complain if the new location is far from the old location 386 if (fabs(catalog[c].measure[m].dR - dR) > 2.0) {387 fprintf (stderr, " @");388 setBadCoords (im); // report a failure for this image389 return;390 } 391 if (fabs(catalog[c].measure[m].dD - dD) > 2.0) {392 fprintf (stderr, " #");393 setBadCoords (im); // report a failure for this image394 return;404 if (fabs(catalog[c].measure[m].dR - dR) > DPOS_MAX_ASEC) { 405 fprintf (stderr, "measurement is far from original location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD); 406 dump_measures (&catalog[c].average[n], catalog[c].measure); 407 // abort(); 408 } 409 if (fabs(catalog[c].measure[m].dD - dD) > DPOS_MAX_ASEC) { 410 fprintf (stderr, "measurement is far from original location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD); 411 dump_measures (&catalog[c].average[n], catalog[c].measure); 412 // abort(); 395 413 } 396 414 … … 414 432 415 433 saveOffsets (dPos, nPos, im); 434 435 // XXX this function should probably update the average positions as well. 416 436 417 437 return; -
trunk/Ohana/src/relastro/src/UpdateChips.c
r28241 r29001 31 31 // FitChip does iterative, clipped fitting 32 32 // fprintf (stderr, "image "OFF_T_FMT" : Nstars: "OFF_T_FMT"\n", i, Nraw); 33 if (!FitChip (raw, ref, Nraw, &image[i] .coords)) {34 fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name, i, Nraw);33 if (!FitChip (raw, ref, Nraw, &image[i])) { 34 if (VERBOSE) fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name, i, Nraw); 35 35 oldCoords = getCoords (i); 36 36 memcpy (&image[i].coords, oldCoords, sizeof(Coords)); 37 free (raw); 38 free (ref); 39 continue; 40 } 41 42 if (!checkStarMap (i)) { 43 if (VERBOSE) fprintf (stderr, "fit diverges too much for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name, i, Nraw); 44 oldCoords = getCoords (i); 45 memcpy (&image[i].coords, oldCoords, sizeof(Coords)); 46 image[i].flags |= ID_IMAGE_ASTROM_POOR; 37 47 } 38 48 -
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r27435 r29001 5 5 off_t i, Nimage; 6 6 Image *image; 7 8 int badImage = 9 ID_IMAGE_ASTROM_NOCAL | 10 ID_IMAGE_ASTROM_POOR | 11 ID_IMAGE_ASTROM_FAIL | 12 ID_IMAGE_ASTROM_SKIP | 13 ID_IMAGE_ASTROM_FEW; 7 14 8 15 image = getimages (&Nimage); … … 13 20 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue; 14 21 22 // skip images that have failed solutions (divergent or otherwise) 23 if (image[i].flags & badImage) continue; 24 15 25 /* convert measure coordinates to raw entries */ 16 26 fixImageRaw (catalog, Ncatalog, i); -
trunk/Ohana/src/relastro/src/bcatalog.c
r28241 r29001 45 45 offset = catalog[0].average[i].measureOffset + j; 46 46 47 // filter objects based on user supplied criteria47 // filter objects based on user supplied criteria 48 48 if (!MeasFilterTest(&catalog[0].measure[offset])) { 49 49 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; … … 51 51 } 52 52 53 // filter out outliers53 // filter out outliers 54 54 if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) { 55 55 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; -
trunk/Ohana/src/relastro/src/fitpoly.c
r27581 r29001 110 110 if (fit[0].Npts == 0) { 111 111 fprintf (stderr, "warning: no valid pts\n"); 112 return (FALSE); 112 113 } 113 114 … … 140 141 } 141 142 142 for (i = 0; i < fit[0].Nelems; i++) {143 for (i = 0; FALSE && (i < fit[0].Nelems); i++) { 143 144 ix = i % fit[0].Nterms; 144 145 iy = i / fit[0].Nterms; 145 //fprintf (stderr, "x2 : x^%dy^%d: %10.4g y2 : x^%dy^%d: %10.4g \n",146 //ix, iy, vector[i][0], ix, iy, vector[i][1]);146 fprintf (stderr, "x2 : x^%dy^%d: %10.4g y2 : x^%dy^%d: %10.4g \n", 147 ix, iy, vector[i][0], ix, iy, vector[i][1]); 147 148 } 148 149 … … 151 152 } 152 153 153 for (i = 0; i < fit[0].Nelems; i++) {154 for (i = 0; FALSE && i < fit[0].Nelems; i++) { 154 155 ix = i % fit[0].Nterms; 155 156 iy = i / fit[0].Nterms; 156 //fprintf (stderr, "x2 : x^%dy^%d: %10.4g y2 : x^%dy^%d: %10.4g \n",157 //ix, iy, vector[i][0], ix, iy, vector[i][1]);157 fprintf (stderr, "x2 : x^%dy^%d: %10.4g y2 : x^%dy^%d: %10.4g \n", 158 ix, iy, vector[i][0], ix, iy, vector[i][1]); 158 159 } 159 160 … … 274 275 /* this should only apply to the polynomial, not the projection terms */ 275 276 /* compare with psastro supporting code */ 276 int fit_apply_coords (CoordFit *fit, Coords *coords ) {277 int fit_apply_coords (CoordFit *fit, Coords *coords, int keepRef) { 277 278 278 279 double Xo, Yo, R1, R2; 279 280 CoordFit *modfit; 280 281 281 /* I have L,M = fit(X,Y). set corresponding terms for coords */ 282 283 // L = a[0][0] + a[1][0]x^1 y^0 + a[0][1] x^0 y^1 + ... 284 // L = pc1_1*cd1*(x - cp1) + pc1_2*cd2*(y - cp2) + ... 285 286 if (!CoordsGetCenter (fit, 0.001, &Xo, &Yo)) { 287 fprintf (stderr, "failed to modify model\n"); 288 return (FALSE); 289 } 290 coords[0].crpix1 = Xo; 291 coords[0].crpix2 = Yo; 292 293 // resulting fit should have zero constant terms 294 modfit = CoordsSetCenter (fit, Xo, Yo); 295 296 /* we do not modify crval1,2: these are kept at the default values */ 282 if (keepRef) { 283 // adjust crpix1,2 as needed: 284 // L = a[0][0] + a[1][0]x^1 y^0 + a[0][1] x^0 y^1 + ... 285 // L = pc1_1*cd1*(x - cp1) + pc1_2*cd2*(y - cp2) + ... 286 287 if (!CoordsGetCenter (fit, 0.001, &Xo, &Yo)) { 288 fprintf (stderr, "failed to modify model\n"); 289 return (FALSE); 290 } 291 coords[0].crpix1 = Xo; 292 coords[0].crpix2 = Yo; 293 /* we do not modify crval1,2: these are kept at the default values */ 294 295 // resulting fit should have zero constant terms 296 modfit = CoordsSetCenter (fit, Xo, Yo); 297 } else { 298 // L = a[0][0] + a[1][0]x^1 y^0 + a[0][1] x^0 y^1 + ... 299 // P = cd1*x, Q = cd2*y 300 // L = pc1_1*P + pc1_2*Q + ... 301 302 /* modify crval1,2: these are kept at the default values */ 303 304 coords[0].crpix1 = 0.0; 305 coords[0].crpix2 = 0.0; 306 modfit = fit; 307 } 297 308 298 309 // set cdelt1, cdelt2 … … 331 342 coords[0].polyterms[6][1] = modfit[0].yfit[0][3]*R2*R2*R2; 332 343 } 333 334 fit_free (modfit); 344 345 if (keepRef) { 346 fit_free (modfit); 347 } else { 348 fit_apply (fit, &coords[0].crval1, &coords[0].crval2, coords[0].crpix1, coords[0].crpix2); 349 } 335 350 /* keep the order and type from initial values */ 336 351 -
trunk/Ohana/src/relastro/src/initialize.c
r28184 r29001 100 100 initstats (STATMODE); 101 101 102 // IMAGE_BAD = ID_IMAGE_ POOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;102 // IMAGE_BAD = ID_IMAGE_ASTROM_POOR | ID_IMAGE_ASTROM_FEW | ID_IMAGE_ASTROM_SKIP; 103 103 // STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 104 104 // MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR_ASTROM | ID_MEAS_SKIP_ASTROM | ID_MEAS_AREA; -
trunk/Ohana/src/relastro/src/load_catalogs.c
r24308 r29001 9 9 10 10 ALLOCATE (catalog, Catalog, skylist[0].Nregions); 11 12 initStarMaps(); 11 13 12 14 // load data from each region file, only use bright stars … … 34 36 FlagOutliers(&tcatalog); 35 37 } 38 39 updateStarMaps (&tcatalog); 36 40 37 41 // select only the brighter stars -
trunk/Ohana/src/relastro/src/load_images.c
r27581 r29001 33 33 // convert database table to internal structure 34 34 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 35 if (!image) { 36 fprintf (stderr, "ERROR: failed to read images\n"); 37 exit (2); 38 } 39 35 40 MARKTIME(" convert image table: %f sec\n", dtime); 36 41 … … 52 57 return (skylist); 53 58 } 59 60 int reload_images (FITS_DB *db) { 61 62 Image *image; 63 off_t Nimage, Nx, i; 64 VTable *vtable; 65 66 image = getimages (&Nimage); 67 68 vtable = &db[0].vtable; 69 70 gfits_scan (vtable[0].header, "NAXIS1", OFF_T_FMT, 1, &Nx); 71 for (i = 0; i < Nimage; i++) { 72 memcpy (vtable[0].buffer[i], &image[i], Nx); 73 } 74 return (TRUE); 75 } -
trunk/Ohana/src/relastro/src/mkpolyterm.c
r27581 r29001 66 66 Xo -= beta[0][0]; 67 67 Yo -= beta[1][0]; 68 68 69 dPos = hypot(beta[0][0], beta[1][0]); 69 70 if (i == 0) { -
trunk/Ohana/src/relastro/src/relastro.c
r28184 r29001 1 1 # include "relastro.h" 2 3 # define MARKTIME(MSG,...) { \4 float dtime; \5 gettimeofday (&stop, (void *) NULL); \6 dtime = DTIME (stop, start); \7 fprintf (stderr, MSG, __VA_ARGS__); }8 2 9 3 int main (int argc, char **argv) { … … 49 43 50 44 /* load catalog data from region files : subselect high-quality measurements */ 45 // XXX pass in the image table 46 // XXX who carries the image grid? 51 47 catalog = load_catalogs (skylist, &Ncatalog, TRUE); 52 48 MARKTIME("load catalog data: %f sec\n", dtime); … … 63 59 // plot_mosaic_fields (catalog); 64 60 } 61 62 // set test points based on the starmap 63 createStarMapPoints(); 65 64 66 65 /* major modes */ … … 98 97 freeImageBins (1); 99 98 99 reload_images (&db); 100 100 101 // iterate over catalogs to make detection coordinates consistant 101 102 UpdateObjectOffsets (skylist); 102 103 103 104 // iterate over catalogs to make detection coordinates consistant 104 FixProblemImages (skylist);105 // FixProblemImages (skylist); 105 106 106 107 // save the updated image parameters -
trunk/Ohana/src/relastro/src/select_images.c
r28241 r29001 28 28 double *RmaxSky; 29 29 off_t *index; 30 31 int badImage = 32 ID_IMAGE_ASTROM_POOR | 33 ID_IMAGE_ASTROM_FAIL | 34 ID_IMAGE_ASTROM_FEW; 30 35 31 36 if (skylist[0].Nregions < 1) { … … 171 176 image[nimage] = timage[i]; 172 177 /* always allow 'few' images to succeed, if possible */ 173 if (image[nimage].flags & ID_IMAGE_ FEW) {174 image[nimage].flags &= ~ (ID_IMAGE_FEW | ID_IMAGE_POOR);178 if (image[nimage].flags & ID_IMAGE_ASTROM_FEW) { 179 image[nimage].flags &= ~ID_IMAGE_ASTROM_FEW; 175 180 } 176 181 if (RESET) { … … 178 183 assignMcal (&image[nimage], (double *) NULL, -1); 179 184 image[nimage].dMcal = NAN; 180 image[nimage].flags &= ~ ID_IMAGE_POOR;185 image[nimage].flags &= ~badImage; 181 186 } 182 187 line_number[nimage] = i; -
trunk/Ohana/src/relphot/src/ImageOps.c
r28241 r29001 323 323 /* on PoorImages run, skip good images */ 324 324 if (PoorImages) { 325 bad = image[i].flags & (ID_IMAGE_ FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);325 bad = image[i].flags & (ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_POOR | ID_IMAGE_PHOTOM_SKIP); 326 326 if (!bad) continue; 327 327 } … … 369 369 mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*Nlist[i]); 370 370 if (mark) { 371 image[i].flags |= ID_IMAGE_ FEW;371 image[i].flags |= ID_IMAGE_PHOTOM_FEW; 372 372 Nfew ++; 373 373 } else { 374 image[i].flags &= ~ID_IMAGE_ FEW;374 image[i].flags &= ~ID_IMAGE_PHOTOM_FEW; 375 375 } 376 376 } … … 387 387 388 388 if (PoorImages) { 389 IMAGE_BAD = ID_IMAGE_P OOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;389 IMAGE_BAD = ID_IMAGE_PHOTOM_POOR | ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_SKIP; 390 390 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 391 391 MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR_PHOTOM | ID_MEAS_SKIP_PHOTOM | ID_MEAS_AREA; … … 429 429 for (i = 0; i < Nimage; i++) { 430 430 mark = FALSE; 431 image[i].flags &= ~ID_IMAGE_P OOR;431 image[i].flags &= ~ID_IMAGE_PHOTOM_POOR; 432 432 mark = (image[i].dMcal > MaxScatter) || (fabs(image[i].Mcal - MedOffset) > MaxOffset); 433 433 if (mark) { 434 434 Nmark ++; 435 image[i].flags |= ID_IMAGE_P OOR;435 image[i].flags |= ID_IMAGE_PHOTOM_POOR; 436 436 } else { 437 image[i].flags &= ~ID_IMAGE_P OOR;437 image[i].flags &= ~ID_IMAGE_PHOTOM_POOR; 438 438 } 439 439 } -
trunk/Ohana/src/relphot/src/MosaicOps.c
r28241 r29001 189 189 image[im].dMcal = mosaic[i].dMcal; 190 190 image[im].Xm = mosaic[i].Xm; 191 image[im].flags |= (mosaic[i].flags & ID_IMAGE_ FEW);192 image[im].flags |= (mosaic[i].flags & ID_IMAGE_P OOR);191 image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_FEW); 192 image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_POOR); 193 193 } 194 194 } … … 351 351 /* on PoorImages run, skip good images */ 352 352 if (PoorImages) { 353 bad = mosaic[i].flags & (ID_IMAGE_ FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);353 bad = mosaic[i].flags & (ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_POOR | ID_IMAGE_PHOTOM_SKIP); 354 354 if (!bad) continue; 355 355 } … … 401 401 if (mark) { 402 402 fprintf (stderr, "marked mosaic %s ("OFF_T_FMT"), ("OFF_T_FMT" < %d) || ("OFF_T_FMT" < %f*"OFF_T_FMT")\n", image[imlist[i][0]].name, i, N, IMAGE_TOOFEW, N, IMAGE_GOOD_FRACTION, Nlist[i]); 403 mosaic[i].flags |= ID_IMAGE_ FEW;403 mosaic[i].flags |= ID_IMAGE_PHOTOM_FEW; 404 404 Nfew ++; 405 405 } else { 406 mosaic[i].flags &= ~ID_IMAGE_ FEW;406 mosaic[i].flags &= ~ID_IMAGE_PHOTOM_FEW; 407 407 } 408 408 } … … 421 421 422 422 if (PoorImages) { 423 IMAGE_BAD = ID_IMAGE_P OOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;423 IMAGE_BAD = ID_IMAGE_PHOTOM_POOR | ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_SKIP; 424 424 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 425 425 MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR_PHOTOM | ID_MEAS_SKIP_PHOTOM | ID_MEAS_AREA; … … 593 593 if (mark) { 594 594 Nmark ++; 595 mosaic[i].flags |= ID_IMAGE_P OOR;595 mosaic[i].flags |= ID_IMAGE_PHOTOM_POOR; 596 596 } else { 597 mosaic[i].flags &= ~ID_IMAGE_P OOR;597 mosaic[i].flags &= ~ID_IMAGE_PHOTOM_POOR; 598 598 } 599 599 } -
trunk/Ohana/src/relphot/src/StarOps.c
r28241 r29001 188 188 StatType stats; 189 189 PhotCode *code; 190 DVOAverageFlags flagBits; 191 192 flagBits = ID_OBJ_EXT | ID_OBJ_EXT_ALT | ID_OBJ_GOOD | ID_OBJ_GOOD_ALT; 190 193 191 194 // pre-allocate a list for stats purposes … … 281 284 } 282 285 286 // we attempt to set a few flags here; reset those bits before trying: 287 catalog[i].average[j].flags &= ~flagBits; 288 283 289 if (nEXT && (nEXT > nPSF)) { 284 catalog[i].average[j].flags |= 0x00010000;290 catalog[i].average[j].flags |= ID_OBJ_EXT; 285 291 } 286 292 if (goodPS1) { 287 catalog[i].average[j].flags |= 0x00020000;293 catalog[i].average[j].flags |= ID_OBJ_GOOD; 288 294 } 289 295 if (Galaxy2MASS) { 290 catalog[i].average[j].flags |= 0x00040000;296 catalog[i].average[j].flags |= ID_OBJ_EXT_ALT; 291 297 } 292 298 if (good2MASS) { 293 catalog[i].average[j].flags |= 0x00080000;299 catalog[i].average[j].flags |= ID_OBJ_GOOD_ALT; 294 300 } 295 301 } … … 302 308 } 303 309 304 /* set measure.Mcal for all measures except ID_MEAS_NOCAL and ID_IMAGE_ NOCAL */310 /* set measure.Mcal for all measures except ID_MEAS_NOCAL and ID_IMAGE_PHOTOM_NOCAL */ 305 311 int setMcalOutput (Catalog *catalog, int Ncatalog) { 306 312 … … 310 316 311 317 MEAS_BAD = ID_MEAS_NOCAL; 312 IMAGE_BAD = ID_IMAGE_ NOCAL;318 IMAGE_BAD = ID_IMAGE_PHOTOM_NOCAL; 313 319 314 320 for (i = 0; i < Ncatalog; i++) { … … 470 476 /* apply to list of all relevant measurements, including IMAGE_POOR & IMAGE_FEW */ 471 477 image_bad = IMAGE_BAD; 472 IMAGE_BAD = ID_IMAGE_ NOCAL;478 IMAGE_BAD = ID_IMAGE_PHOTOM_NOCAL; 473 479 m = catalog[i].average[j].measureOffset; 474 480 N = 0; -
trunk/Ohana/src/relphot/src/initialize.c
r17242 r29001 27 27 initstats (STATMODE); 28 28 29 IMAGE_BAD = ID_IMAGE_P OOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;29 IMAGE_BAD = ID_IMAGE_PHOTOM_POOR | ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_SKIP; 30 30 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 31 31 MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR_PHOTOM | ID_MEAS_SKIP_PHOTOM | ID_MEAS_AREA; -
trunk/Ohana/src/relphot/src/load_images.c
r28241 r29001 25 25 // convert database table to internal structure 26 26 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 27 if (!image) { 28 fprintf (stderr, "ERROR: failed to read images\n"); 29 exit (2); 30 } 27 31 28 32 // select the images which overlap the selected sky regions -
trunk/Ohana/src/relphot/src/select_images.c
r28241 r29001 157 157 image[nimage] = timage[i]; 158 158 /* always allow 'few' images to succeed, if possible */ 159 if (image[nimage].flags & ID_IMAGE_ FEW) {160 image[nimage].flags &= ~(ID_IMAGE_ FEW | ID_IMAGE_POOR);159 if (image[nimage].flags & ID_IMAGE_PHOTOM_FEW) { 160 image[nimage].flags &= ~(ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_POOR); 161 161 } 162 162 if (RESET) { 163 163 assignMcal (&image[nimage], (double *) NULL, -1); 164 164 image[nimage].dMcal = NAN; 165 image[nimage].flags &= ~ID_IMAGE_P OOR;165 image[nimage].flags &= ~ID_IMAGE_PHOTOM_POOR; 166 166 } 167 167 line_number[nimage] = i; -
trunk/Ohana/src/relphot/src/setMrelFinal.c
r28241 r29001 75 75 76 76 /* allow measures from images marked POOR and FEW */ 77 if (pass >= 3) IMAGE_BAD = ID_IMAGE_ NOCAL;77 if (pass >= 3) IMAGE_BAD = ID_IMAGE_PHOTOM_NOCAL; 78 78 79 79 /* allow measures marked as outliers (POOR) and off image region (AREA) */ -
trunk/Ohana/src/uniphot/src/find_image_sgroups.c
r27435 r29001 13 13 imlink = *Imlink; 14 14 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 15 if (!image) { 16 fprintf (stderr, "ERROR: failed to read images\n"); 17 exit (2); 18 } 15 19 16 20 coords.crpix1 = coords.crpix2 = 0.0; … … 28 32 for (i = 0; i < Nimage; i++) { 29 33 if (imlink[i].sgroup != NULL) continue; 30 if (image[i].flags & ID_IMAGE_ NOCAL) continue;34 if (image[i].flags & ID_IMAGE_PHOTOM_NOCAL) continue; 31 35 32 36 /* new sgroup, set ref coords */ … … 53 57 54 58 for (j = 0; j < Nimage; j++) { 55 if (image[j].flags & ID_IMAGE_ NOCAL) continue;59 if (image[j].flags & ID_IMAGE_PHOTOM_NOCAL) continue; 56 60 if (imlink[j].sgroup != NULL) continue; 57 61 -
trunk/Ohana/src/uniphot/src/find_image_tgroups.c
r27435 r29001 12 12 13 13 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 14 if (!image) { 15 fprintf (stderr, "ERROR: failed to read images\n"); 16 exit (2); 17 } 18 14 19 ALLOCATE (imlink, ImageLink, Nimage); 15 20 … … 64 69 if (image[j].tzero < tmin[i]) continue; 65 70 if (image[j].tzero > tmax[i]) continue; 66 if (image[j].flags & ID_IMAGE_ NOCAL) continue;71 if (image[j].flags & ID_IMAGE_PHOTOM_NOCAL) continue; 67 72 68 73 group[i].image[Nentry] = &image[j]; -
trunk/Ohana/src/uniphot/src/initialize.c
r27790 r29001 16 16 } 17 17 18 IMAGE_BAD = ID_IMAGE_ NOCAL | ID_IMAGE_POOR | ID_IMAGE_SKIP | ID_IMAGE_FEW;18 IMAGE_BAD = ID_IMAGE_PHOTOM_NOCAL | ID_IMAGE_PHOTOM_POOR | ID_IMAGE_PHOTOM_SKIP | ID_IMAGE_PHOTOM_FEW; 19 19 20 20 initstats (STATMODE); -
trunk/Ohana/src/uniphot/src/load_images.c
r28241 r29001 22 22 /* use a vtable to keep the images to be calibrated */ 23 23 image = gfits_table_get_Image (&db[0].ftable, Nimage, &db[0].swapped); 24 if (!image) { 25 fprintf (stderr, "ERROR: failed to read images\n"); 26 exit (2); 27 } 24 28 25 29 fprintf (stderr, "loaded "OFF_T_FMT" images\n", *Nimage); -
trunk/Ohana/src/uniphot/src/match_zpts_to_images.c
r28717 r29001 71 71 image[Ni].Mcal = SCALE*code[0].C - zpts[Nz].zpt; 72 72 image[Ni].dMcal = zpts[Nz].zpt_err; 73 image[Ni].flags &= ~ID_IMAGE_ NOCAL; // clear the NOCAL flag73 image[Ni].flags &= ~ID_IMAGE_PHOTOM_NOCAL; // clear the NOCAL flag 74 74 zpts[Nz].found = TRUE; 75 75 NImatch ++; -
trunk/Ohana/src/uniphot/src/subset_images.c
r27435 r29001 9 9 /* use a vtable to keep the images to be calibrated */ 10 10 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 11 if (!image) { 12 fprintf (stderr, "ERROR: failed to read images\n"); 13 exit (2); 14 } 11 15 12 16 Nkeep = 0; … … 16 20 for (i = 0; i < Nimage; i++) { 17 21 18 image[i].flags |= ID_IMAGE_ NOCAL;22 image[i].flags |= ID_IMAGE_PHOTOM_NOCAL; 19 23 20 24 /* select images by photcode */ … … 27 31 if (image[i].tzero > TSTOP) continue; 28 32 } 29 image[i].flags &= ~ID_IMAGE_ NOCAL;33 image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; 30 34 keep[Nkeep] = i; 31 35 Nkeep ++; -
trunk/Ohana/src/uniphot/src/update.c
r27435 r29001 14 14 15 15 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 16 if (!image) { 17 fprintf (stderr, "ERROR: failed to read images\n"); 18 exit (2); 19 } 16 20 17 21 /* clear the NOCAL flags */ 18 22 for (i = 0; i < Nimage; i++) { 19 image[i].flags &= ~ID_IMAGE_ NOCAL;23 image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; 20 24 } 21 25
Note:
See TracChangeset
for help on using the changeset viewer.
