Changeset 5229
- Timestamp:
- Oct 6, 2005, 6:11:02 AM (21 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 2 added
- 13 edited
-
Makefile (modified) (2 diffs)
-
doc/Changes.txt (modified) (2 diffs)
-
doc/notes.txt (modified) (1 diff)
-
include/addstar.h (modified) (4 diffs)
-
src/ConfigInit.c (modified) (1 diff)
-
src/addstar.c (modified) (1 diff)
-
src/args.c (modified) (2 diffs)
-
src/build_links.c (added)
-
src/calibrate.c (modified) (3 diffs)
-
src/find_matches.c (modified) (18 diffs)
-
src/find_matches_closest.c (added)
-
src/gcatalog.c (modified) (2 diffs)
-
src/image-db.c (modified) (2 diffs)
-
src/mkcatalog.c (modified) (5 diffs)
-
src/wcatalog.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r4864 r5229 25 25 $(SRC)/airmass.$(ARCH).o \ 26 26 $(SRC)/args.$(ARCH).o \ 27 $(SRC)/build_links.$(ARCH).o \ 27 28 $(SRC)/calibrate.$(ARCH).o \ 28 29 $(SRC)/check_permissions.$(ARCH).o \ … … 31 32 $(SRC)/edge_check.$(ARCH).o \ 32 33 $(SRC)/find_matches.$(ARCH).o \ 34 $(SRC)/find_matches_closest.$(ARCH).o \ 33 35 $(SRC)/find_matches_refstars.$(ARCH).o \ 34 36 $(SRC)/find_subset.$(ARCH).o \ -
trunk/Ohana/src/addstar/doc/Changes.txt
r4826 r5229 1 1 2 2005.02.24 : I am adding the mosaic two-level astrometry information to the Image table. 2 2005.10.04 3 - moved measure/missing list manipulation to separate functions 4 - added concept of sorted / unsorted measure catalog 5 - defined build_meas_links and reorder_measure,missing 6 - some cleanup of both find_matches.c and find_matches_closest.c 7 8 2005.10.03: 9 - dropping GSCRegion *region entry from find_matches (unused!) 10 - adding function find_matches_closest (alternate matches) 11 12 2005.08.19: 13 changed load_photcode to handle CATMODE and CATFORMAT variations 14 - addstar.h: added CATMODE and CATFORMAT globals 15 - ConfigInit: read CATMODE and CATFORMAT from config 16 - gcatalog: set catalog.catmode from CATMODE 17 - mkcatalog: set CATFORMAT and CATMODE for new catalog 18 - wcatalog: set CATFORMAT for new catalog 19 20 using full photometry conversions in find_matches 21 added SetZeroPoint to gstars to enable phot conversions 22 23 2005.08.15: 24 cleanup of the minor Wall,Werror messages 3 25 4 26 2005.07.06 : current release is addstar-1.1 … … 21 43 need to know about the mysql backend interface. 22 44 23 2005.08.15: 24 cleanup of the minor Wall,Werror messages 45 2005.02.24 : I am adding the mosaic two-level astrometry information to the Image table. 25 46 26 2005.08.19:27 changed load_photcode to handle CATMODE and CATFORMAT variations28 - addstar.h: added CATMODE and CATFORMAT globals29 - ConfigInit: read CATMODE and CATFORMAT from config30 - gcatalog: set catalog.catmode from CATMODE31 - mkcatalog: set CATFORMAT and CATMODE for new catalog32 - wcatalog: set CATFORMAT for new catalog33 34 using full photometry conversions in find_matches35 added SetZeroPoint to gstars to enable phot conversions36 -
trunk/Ohana/src/addstar/doc/notes.txt
r3392 r5229 1 2 - measure <-> average matches and reordering 3 4 next[i] = i + 1 5 6 7 8 1 9 2 10 2005.03.07 : notes related to new version of addstar -
trunk/Ohana/src/addstar/include/addstar.h
r5144 r5229 102 102 int REPLACE; 103 103 int ONLY_MATCH; 104 int CLOSEST; 105 int REORDER; 104 106 105 107 int MODE; … … 110 112 111 113 /*** addstar prototypes ***/ 112 void AddToCalibration PROTO((Average *average, Measure *measure, Measure *new, int Nstar));114 void AddToCalibration PROTO((Average *average, Measure *measure, Measure *new, int *next, int Nstar)); 113 115 void ConfigInit PROTO((int *argc, char **argv)); 114 116 void FindCalibration PROTO((Image *image)); … … 132 134 int edge_check PROTO((double *x1, double *y1, double *x2, double *y2)); 133 135 void find_matches PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap)); 136 void find_matches_closest PROTO((GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap)); 134 137 void find_matches_refstars PROTO((GSCRegion *region, Stars **stars, int Nstars, Catalog *catalog)); 135 138 Stars **find_subset PROTO((GSCRegion *region, Stars *stars, int Nstars, int *NSTARS)); … … 182 185 void fsort2 PROTO((float *X, float *Y, int N)); 183 186 187 int *init_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure); 188 int *init_missing_links (Average *average, int Naverage, Missing *missing, int Nmissing); 189 int add_meas_link (Average *average, int *next, int Nmeasure); 190 int add_miss_link (Average *average, int *next, int Nmissing); 191 int *build_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure); 192 Measure *reorder_measure (Average *average, int Naverage, Measure *measure, int Nmeasure, int *next); 193 Missing *reorder_missing (Average *average, int Naverage, Missing *missing, int Nmissing, int *next_miss); 194 184 195 /** 185 196 there is an inconsistency to be resolved: fixed structures (like Image) -
trunk/Ohana/src/addstar/src/ConfigInit.c
r5144 r5229 62 62 } 63 63 64 /* default mode, format, if not specified */ 64 65 if (*CATMODE == 0) strcpy (CATMODE, "RAW"); 65 66 if (*CATFORMAT == 0) strcpy (CATFORMAT, "ELIXIR"); -
trunk/Ohana/src/addstar/src/addstar.c
r4864 r5229 61 61 case M_IMAGE: 62 62 Nsubset = Nstars; 63 find_matches (®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap); 63 if (CLOSEST) { 64 find_matches_closest (®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap); 65 } else { 66 find_matches (®ions[i], stars, Nstars, &catalog, &image, overlap, Noverlap); 67 } 64 68 break; 65 69 case M_REFCAT: -
trunk/Ohana/src/addstar/src/args.c
r5144 r5229 22 22 fprintf (stderr, " -missed : skipped 'missed' entries\n"); 23 23 fprintf (stderr, " -replace : replace time/photcode measurements (no duplication)\n"); 24 fprintf (stderr, " -closest : use closest-star algorith\n"); 24 25 fprintf (stderr, " -image : only insert image data\n"); 25 26 fprintf (stderr, " -cal : perform zero-point calibration\n"); … … 144 145 remove_argument (N, &argc, argv); 145 146 } 147 /* use 'closest star' matching, rather than traditional method */ 148 CLOSEST = FALSE; 149 if ((N = get_argument (argc, argv, "-closest"))) { 150 CLOSEST = TRUE; 151 remove_argument (N, &argc, argv); 152 } 153 /* only add new rows (-update) or re-write complete measure table */ 154 REORDER = TRUE; 155 if ((N = get_argument (argc, argv, "-update"))) { 156 REORDER = FALSE; 157 remove_argument (N, &argc, argv); 158 } 146 159 /* only add image potion to image table */ 147 160 ONLY_IMAGES = FALSE; -
trunk/Ohana/src/addstar/src/calibrate.c
r5014 r5229 41 41 } 42 42 43 /* this does not use the linked list to navigate the measure structure 44 this is OK for old measures, but will break for entries which have 45 already added a new measure to the list. */ 46 void AddToCalibration (Average *average, Measure *measure, Measure *new, int Nstar) { 43 /* use the linked list to navigate the measures; safe for unsorted measures */ 44 void AddToCalibration (Average *average, Measure *measure, Measure *new, int *next, int Nstar) { 47 45 48 int i, found0, found1, found2;46 int i, m, found0, found1, found2; 49 47 float CalM0, CalM1, CalM2, dCalM; 50 48 short CalC0, CalC1, CalC2; … … 57 55 CalC2 = thiscode[0].c2; 58 56 57 m = average[0].offset; 59 58 for (i = 0; i < average[0].Nm; i++) { 60 if (measure[ 0].source == CalC0) {59 if (measure[m].source == CalC0) { 61 60 found0 = TRUE; 62 CalM0 = measure[ i].M_PS;63 dCalM = measure[ i].dM_PS;61 CalM0 = measure[m].M_PS; 62 dCalM = measure[m].dM_PS; 64 63 } 65 if (measure[ i].source == CalC1) {64 if (measure[m].source == CalC1) { 66 65 found1 = TRUE; 67 CalM1 = measure[ i].M_PS;66 CalM1 = measure[m].M_PS; 68 67 } 69 if (measure[ i].source == CalC2) {68 if (measure[m].source == CalC2) { 70 69 found2 = TRUE; 71 CalM2 = measure[ i].M_PS;70 CalM2 = measure[m].M_PS; 72 71 } 73 72 if (found0 && found1 && found2) { … … 75 74 return; 76 75 } 77 /* n = next[n]; - if we use this, we need to pass in measure[0] above */76 m = next[m]; 78 77 } 79 78 return; -
trunk/Ohana/src/addstar/src/find_matches.c
r5014 r5229 3 3 void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap) { 4 4 5 int i, j, k, n, m, N, J;5 int i, j, n, N, J; 6 6 double X, Y, RADIUS, RADIUS2, secz; 7 7 float *X1, *Y1, *X2, *Y2; 8 8 float dX, dY, dR; 9 int *N1, *N2, *next , *next_miss, last, last_miss;9 int *N1, *N2, *next_meas, *next_miss; 10 10 int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch; 11 Measure *tmpmeasure;12 Missing *tmpmissing;13 11 Coords tcoords; 14 12 int Nsecfilt, Nsec; 15 13 float Mcat, *Mval, MTIME; 14 double dtime; 15 struct timeval start, stop; 16 17 gettimeofday (&start, NULL); 16 18 17 19 /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */ … … 28 30 29 31 /** allocate local arrays (catalog) **/ 30 Nave = catalog[0].Naverage; 31 NAVE = Nave + 1000; 32 NAVE = Nave = catalog[0].Naverage; 32 33 ALLOCATE (X2, float, NAVE); 33 34 ALLOCATE (Y2, float, NAVE); 34 35 ALLOCATE (N2, int, NAVE); 35 36 ALLOCATE (catalog[0].found, int, NAVE); 36 REALLOCATE (catalog[0].average, Average, NAVE);37 REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*catalog[0].Nsecfilt);38 37 /* for secfilt j and star i, secfilt[i*Nsecfilt+j] */ 39 38 39 /* internal counters */ 40 40 Nmatch = 0; 41 Nmeas = catalog[0].Nmeasure; 42 NMEAS = Nmeas + 1000; 43 ALLOCATE (next, int, NMEAS); 44 REALLOCATE (catalog[0].measure, Measure, NMEAS); 45 46 Nmiss = catalog[0].Nmissing; 47 NMISS = Nmiss + 1000; 48 ALLOCATE (next_miss, int, NMISS); 49 REALLOCATE (catalog[0].missing, Missing, NMISS); 41 NMEAS = Nmeas = catalog[0].Nmeasure; 42 NMISS = Nmiss = catalog[0].Nmissing; 50 43 51 44 /* project onto rectilinear grid with 1 arcsec pixels */ … … 67 60 } 68 61 62 /* build spatial index (RA sort) */ 69 63 for (i = 0; i < Nstars; i++) { 70 64 fRD_to_XY (&X1[i], &Y1[i], stars[i].R, stars[i].D, &tcoords); … … 73 67 if (Nstars > 1) sort_lists (X1, Y1, N1, Nstars); 74 68 69 /* build spatial index (RA sort) */ 75 70 for (i = 0; i < Nave; i++) { 76 71 fRD_to_XY (&X2[i], &Y2[i], catalog[0].average[i].R_PS, catalog[0].average[i].D_PS, &tcoords); … … 80 75 if (Nave > 1) sort_lists (X2, Y2, N2, Nave); 81 76 82 /* set up pointers for linked list of measurements */ 83 for (i = 0; i < Nmeas - 1; i++) { 84 next[i] = i+1; 85 } 86 next[i] = -1; 87 last = i; 88 89 for (i = 0; i < Nmiss - 1; i++) { 90 next_miss[i] = i+1; 91 } 92 next_miss[i] = -1; 93 last_miss = i; 77 /* set up pointers for linked list of measure, missing */ 78 if (catalog[0].ordered) { 79 next_meas = init_measure_links (catalog[0].average, Nave, catalog[0].measure, Nmeas); 80 } else { 81 next_meas = build_measure_links (catalog[0].average, Nave, catalog[0].measure, Nmeas); 82 } 83 next_miss = init_missing_links (catalog[0].average, Nave, catalog[0].missing, Nmiss); 84 /* missing MUST be written ordered, or not at all */ 94 85 95 86 /* choose a radius for matches */ … … 102 93 103 94 /* correct instrumental mags for exposure time */ 104 if (image[0].exptime > 0) { 105 MTIME = 2.500*log10(image[0].exptime); 106 } else { 107 MTIME = 0; 108 } 95 MTIME = (image[0].exptime > 0) ? 2.500*log10(image[0].exptime) : 0.0; 109 96 110 97 /** find matched stars **/ 111 98 for (i = j = 0; (i < Nstars) && (j < Nave); ) { 112 99 100 /* negative dX: j is too large */ 113 101 dX = X1[i] - X2[j]; 114 102 if (dX <= -2*RADIUS) { … … 116 104 continue; 117 105 } 106 /* positive dX, i is too large */ 118 107 if (dX >= 2*RADIUS) { 119 108 j++; … … 121 110 } 122 111 123 /* negative dX: j is too large, positive dX, i is too large*/112 /* within match range; look for matches */ 124 113 for (J = j; (dX > -2*RADIUS) && (J < Nave); J++) { 125 114 dX = X1[i] - X2[J]; … … 128 117 if (dR > RADIUS2) continue; 129 118 119 /* make sure there is space for next entry */ 120 if (Nmeas >= NMEAS) { 121 NMEAS = Nmeas + 1000; 122 REALLOCATE (next_meas, int, NMEAS); 123 REALLOCATE (catalog[0].measure, Measure, NMEAS); 124 } 125 130 126 Nmatch ++; 131 127 n = N2[J]; 132 128 N = N1[i]; 133 m = catalog[0].average[n].offset; 134 135 /** insert star in measurement list */ 136 /* find last measurement of this star */ 137 for (k = 0; k < catalog[0].average[n].Nm - 1; k++) m = next[m]; 138 /* set up references */ 139 next[Nmeas] = next[m]; 140 next[m] = Nmeas; 141 /* last just was moved */ 142 if (next[Nmeas] == -1) last = Nmeas; 143 129 130 /* add to end of measurement list */ 131 add_meas_link (&catalog[0].average[n], next_meas, Nmeas); 132 144 133 /* calculate accurate per-star airmass */ 145 134 secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, SiderealTime, Latitude); … … 171 160 if (*Mval == NO_MAG) *Mval = Mcat; 172 161 173 /** this is a little tricky: the new measures are not in the measure sequence 174 this call can run into the next star if we have had two measures found at this location. **/ 162 /* adds the measurement to the calibration if appropriate color terms are found */ 175 163 if (CALIBRATE) { 176 AddToCalibration (&catalog[0].average[n], &catalog[0].measure[m], &catalog[0].measure[Nmeas], N);164 AddToCalibration (&catalog[0].average[n], catalog[0].measure, &catalog[0].measure[Nmeas], next_meas, N); 177 165 } 178 166 … … 196 184 catalog[0].found[n] = Nmeas; 197 185 } 198 199 186 catalog[0].average[n].Nm ++; 200 187 Nmeas ++; 201 if (Nmeas == NMEAS) { 202 NMEAS = Nmeas + 1000; 203 REALLOCATE (next, int, NMEAS); 204 REALLOCATE (catalog[0].measure, Measure, NMEAS); 205 } 206 207 update_coords (&catalog[0].average[n], &catalog[0].measure[0], next); 188 189 update_coords (&catalog[0].average[n], &catalog[0].measure[0], next_meas); 208 190 } 209 191 i++; … … 215 197 n = N2[j]; 216 198 if (catalog[0].found[n] < 0) { 199 /* make sure there is space for next entry */ 200 if (Nmiss >= NMISS) { 201 NMISS = Nmiss + 1000; 202 REALLOCATE (next_miss, int, NMISS); 203 REALLOCATE (catalog[0].missing, Missing, NMISS); 204 } 205 217 206 /* should the catalog star be on this image? project into image coords */ 218 207 if (!in_image (catalog[0].average[n].R_PS, catalog[0].average[n].D_PS, image)) continue; 219 /* find last missing meas */ 220 if (catalog[0].average[n].Nn < 1) { /* no previous missing obs */ 221 catalog[0].average[n].missing = Nmiss; 222 next_miss[last_miss] = Nmiss; 223 next_miss[Nmiss] = -1; 224 last_miss = Nmiss; 225 } else { 226 m = catalog[0].average[n].missing; 227 for (k = 0; k < catalog[0].average[n].Nn - 1; k++) 228 m = next_miss[m]; 229 next_miss[Nmiss] = next_miss[m]; 230 next_miss[m] = Nmiss; 231 if (next_miss[Nmiss] == -1) { /* last just was moved */ 232 last_miss = Nmiss; 233 } 234 } 208 add_miss_link (&catalog[0].average[n], next_miss, Nmiss); 209 235 210 /* calculate time of exposure for this coordinate in the image */ 236 211 RD_to_XY (&X, &Y, catalog[0].average[n].R_PS, catalog[0].average[n].D_PS, &image[0].coords); … … 238 213 catalog[0].average[n].Nn ++; 239 214 Nmiss ++; 240 if (Nmiss == NMISS) {241 NMISS = Nmiss + 1000;242 REALLOCATE (next_miss, int, NMISS);243 REALLOCATE (catalog[0].missing, Missing, NMISS);244 }245 215 } 246 216 } … … 248 218 /* incorporate unmatched image stars, if this star is in field of this catalog */ 249 219 for (i = 0; (i < Nstars) && !ONLY_MATCH; i++) { 220 /* make sure there is space for next entry */ 221 if (Nmeas >= NMEAS) { 222 NMEAS = Nmeas + 1000; 223 REALLOCATE (next_meas, int, NMEAS); 224 REALLOCATE (catalog[0].measure, Measure, NMEAS); 225 } 226 if (Nave >= NAVE) { 227 NAVE = Nave + 1000; 228 REALLOCATE (catalog[0].average, Average, NAVE); 229 REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*catalog[0].Nsecfilt); 230 } 231 250 232 N = N1[i]; 251 233 if (stars[N].found >= 0) continue; … … 297 279 /** now add references from all previous non-detection observations of this spot on the sky */ 298 280 for (j = 0; (j < Noverlap) && !SKIP_MISSED; j++) { 281 /* make sure there is space for next entry */ 282 if (Nmiss >= NMISS) { 283 NMISS = Nmiss + 1000; 284 REALLOCATE (next_miss, int, NMISS); 285 REALLOCATE (catalog[0].missing, Missing, NMISS); 286 } 299 287 if (!FindMosaicForImage (overlap, Noverlap, j)) continue; 300 288 if (!in_image (catalog[0].average[Nave].R_PS, catalog[0].average[Nave].D_PS, &overlap[j])) continue; 301 if (catalog[0].average[Nave].Nn < 1) { 302 catalog[0].average[Nave].missing = Nmiss; 303 } 304 next_miss[last_miss] = Nmiss; 305 next_miss[Nmiss] = -1; 306 last_miss = Nmiss; 289 add_miss_link (&catalog[0].average[Nave], next_miss, Nmiss); 290 307 291 /* get time of exposure of this portion of the image */ 308 292 RD_to_XY (&X, &Y, catalog[0].average[Nave].R_PS, catalog[0].average[Nave].D_PS, &overlap[j].coords); … … 310 294 catalog[0].average[Nave].Nn ++; 311 295 Nmiss ++; 312 if (Nmiss == NMISS) {313 NMISS = Nmiss + 1000;314 REALLOCATE (next_miss, int, NMISS);315 REALLOCATE (catalog[0].missing, Missing, NMISS);316 }317 296 } 318 297 319 298 stars[N].found = Nmeas; 320 next[last] = Nmeas; 321 next[Nmeas] = -1; 322 last = Nmeas; 299 next_meas[Nmeas] = -1; 323 300 Nmeas ++; 324 if (Nmeas == NMEAS) {325 NMEAS = Nmeas + 1000;326 REALLOCATE (next, int, NMEAS);327 REALLOCATE (catalog[0].measure, Measure, NMEAS);328 }329 301 Nave ++; 330 if (Nave == NAVE) {331 NAVE = Nave + 1000;332 REALLOCATE (catalog[0].average, Average, NAVE);333 REALLOCATE (catalog[0].secfilt, SecFilt, NAVE*catalog[0].Nsecfilt);334 }335 302 } 336 303 … … 338 305 REALLOCATE (catalog[0].average, Average, Nave); 339 306 REALLOCATE (catalog[0].measure, Measure, Nmeas); 307 REALLOCATE (catalog[0].missing, Missing, Nmiss); 340 308 341 /* fix order of Measure (memory intensive, but fast) */ 342 N = 0; 343 ALLOCATE (tmpmeasure, Measure, Nmeas); 344 for (i = 0; i < Nave; i++) { 345 n = catalog[0].average[i].offset; 346 catalog[0].average[i].offset = N; 347 for (k = 0; k < catalog[0].average[i].Nm; k++, N++) { 348 tmpmeasure[N] = catalog[0].measure[n]; 349 tmpmeasure[N].averef = i; 350 n = next[n]; 351 } 352 } 353 free (catalog[0].measure); 354 catalog[0].measure = tmpmeasure; 355 356 /* fix order of Missing (memory intensive, but fast) */ 357 N = 0; 358 ALLOCATE (tmpmissing, Missing, Nmiss); 359 for (i = 0; i < Nave; i++) { 360 if (catalog[0].average[i].Nn > 0) { 361 n = catalog[0].average[i].missing; 362 catalog[0].average[i].missing = N; 363 for (k = 0; k < catalog[0].average[i].Nn; k++, N++) { 364 tmpmissing[N] = catalog[0].missing[n]; 365 n = next_miss[n]; 366 } 367 } 368 } 369 free (catalog[0].missing); 370 catalog[0].missing = tmpmissing; 309 /* XXX EAM - temporary examination of next_meas 310 for (i = 0; i < 5; i++) { 311 m = catalog[0].average[i].offset; 312 for (j = 0; j < catalog[0].average[i].Nm; j++) { 313 fprintf (stderr, "this: %d (%f), next: %d\n", m, catalog[0].measure[m].M_PS, next_meas[m]); 314 m = next_meas[m]; 315 } 316 } */ 317 318 if (REORDER) { 319 catalog[0].measure = reorder_measure (catalog[0].average, Nave, catalog[0].measure, Nmeas, next_meas); 320 catalog[0].ordered = TRUE; 321 } else { 322 catalog[0].ordered = FALSE; 323 } 324 catalog[0].missing = reorder_missing (catalog[0].average, Nave, catalog[0].missing, Nmiss, next_miss); 325 /* missing is REQUIRED to be sorted */ 371 326 372 327 /* note stars which have been found in this catalog */ … … 384 339 catalog[0].Nmissing = Nmiss; 385 340 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nmiss: %d %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmiss, Nmatch); 341 342 gettimeofday (&stop, NULL); 343 dtime = DTIME (stop, start); 344 fprintf (stderr, " match time %8.3f sec for %5d stars, %6d average\n", dtime, Nstars, Nave); 345 346 return; 386 347 } 387 348 -
trunk/Ohana/src/addstar/src/gcatalog.c
r5014 r5229 3 3 int gcatalog (Catalog *catalog) { 4 4 5 int Nsecfilt ;5 int Nsecfilt, status; 6 6 char mode; 7 7 … … 14 14 exit (1); 15 15 } 16 17 /* should this be moved into save_catalog?? */ 18 status = fits_scan (&catalog[0].header, "ORDERED", "%t", 1, &catalog[0].ordered); 19 if (!status) catalog[0].ordered = TRUE; 20 /* XXX EAM - is this a good choice? should the default be 'FALSE'? */ 16 21 17 22 /* check Nsecfile value, update if needed */ -
trunk/Ohana/src/addstar/src/image-db.c
r5014 r5229 40 40 41 41 /* set the recommended mode */ 42 if (!strcmp (CATMODE, "RAW")) { 42 db[0].mode = DVO_MODE_UNDEF; 43 if (!strcasecmp (CATMODE, "RAW")) { 43 44 /* make header a fake image */ 44 45 db[0].header.bitpix = 16; … … 49 50 db[0].mode = DVO_MODE_RAW; 50 51 } 51 52 if (!strcmp (CATMODE, "MEF") || !strcmp (CATMODE, "SPLIT")) { 52 if (!strcasecmp (CATMODE, "MEF") || !strcasecmp (CATMODE, "SPLIT")) { 53 53 db[0].header.extend = TRUE; 54 54 fits_create_header (&db[0].header); 55 55 db[0].mode = DVO_MODE_MEF; 56 56 } 57 if (db[0].mode == DVO_MODE_UNDEF) { 58 fprintf (stderr, "invalid output catalog mode\n"); 59 exit (1); 60 } 57 61 58 62 /* set the recommended format */ 59 63 db[0].format = DVO_FORMAT_UNDEF; 60 if (!strc mp (CATFORMAT, "INTERNAL")) db[0].format = DVO_FORMAT_INTERNAL;61 if (!strc mp (CATFORMAT, "LONEOS")) db[0].format = DVO_FORMAT_LONEOS;62 if (!strc mp (CATFORMAT, "ELIXIR")) db[0].format = DVO_FORMAT_ELIXIR;63 if (!strc mp (CATFORMAT, "PANSTARRS")) db[0].format = DVO_FORMAT_PANSTARRS;64 if (!strcasecmp (CATFORMAT, "INTERNAL")) db[0].format = DVO_FORMAT_INTERNAL; 65 if (!strcasecmp (CATFORMAT, "LONEOS")) db[0].format = DVO_FORMAT_LONEOS; 66 if (!strcasecmp (CATFORMAT, "ELIXIR")) db[0].format = DVO_FORMAT_ELIXIR; 67 if (!strcasecmp (CATFORMAT, "PANSTARRS")) db[0].format = DVO_FORMAT_PANSTARRS; 64 68 if (db[0].format == DVO_FORMAT_UNDEF) { 65 69 fprintf (stderr, "invalid output catalog format\n"); -
trunk/Ohana/src/addstar/src/mkcatalog.c
r5014 r5229 3 3 void mkcatalog (GSCRegion *region, Catalog *catalog) { 4 4 5 char *line; 5 int length, status; 6 char *path, *root, *file, *line; 6 7 time_t now; 7 8 … … 10 11 /* set the recommended CATFORMAT */ 11 12 catalog[0].catformat = DVO_FORMAT_UNDEF; 12 if (!strc mp (CATFORMAT, "INTERNAL")) catalog[0].catformat = DVO_FORMAT_INTERNAL;13 if (!strc mp (CATFORMAT, "LONEOS")) catalog[0].catformat = DVO_FORMAT_LONEOS;14 if (!strc mp (CATFORMAT, "ELIXIR")) catalog[0].catformat = DVO_FORMAT_ELIXIR;15 if (!strc mp (CATFORMAT, "PANSTARRS")) catalog[0].catformat = DVO_FORMAT_PANSTARRS;13 if (!strcasecmp (CATFORMAT, "INTERNAL")) catalog[0].catformat = DVO_FORMAT_INTERNAL; 14 if (!strcasecmp (CATFORMAT, "LONEOS")) catalog[0].catformat = DVO_FORMAT_LONEOS; 15 if (!strcasecmp (CATFORMAT, "ELIXIR")) catalog[0].catformat = DVO_FORMAT_ELIXIR; 16 if (!strcasecmp (CATFORMAT, "PANSTARRS")) catalog[0].catformat = DVO_FORMAT_PANSTARRS; 16 17 if (catalog[0].catformat == DVO_FORMAT_UNDEF) { 17 18 fprintf (stderr, "invalid output catalog format\n"); … … 20 21 21 22 /* set the recommended CATMODE */ 22 catalog[0].catmode = DVO_MODE_RAW; 23 if (!strcmp (CATMODE, "RAW")) catalog[0].catmode = DVO_MODE_RAW; 24 if (!strcmp (CATMODE, "MEF")) catalog[0].catmode = DVO_MODE_MEF; 23 catalog[0].catmode = DVO_MODE_UNDEF; 24 if (!strcasecmp (CATMODE, "RAW")) catalog[0].catmode = DVO_MODE_RAW; 25 if (!strcasecmp (CATMODE, "MEF")) catalog[0].catmode = DVO_MODE_MEF; 26 if (!strcasecmp (CATMODE, "SPLIT")) catalog[0].catmode = DVO_MODE_SPLIT; 27 if (catalog[0].catmode == DVO_MODE_UNDEF) { 28 fprintf (stderr, "invalid output catalog mode\n"); 29 exit (1); 30 } 25 31 26 32 fits_init_header (&catalog[0].header); … … 36 42 fits_create_header (&catalog[0].header); 37 43 44 if (catalog[0].catmode == DVO_MODE_SPLIT) { 45 path = pathname (catalog[0].filename); 46 root = filerootname (catalog[0].filename); 47 length = strlen(path) + strlen(root) + 6; 48 49 /* define measure catalog file */ 50 ALLOCATE (catalog[0].measure_catalog, Catalog, 1); 51 fits_init_header (&catalog[0].measure_catalog[0].header); 52 fits_create_header (&catalog[0].measure_catalog[0].header); 53 ALLOCATE (catalog[0].measure_catalog[0].filename, char, length); 54 sprintf (catalog[0].measure_catalog[0].filename, "%s/%s.cpm", path, root); 55 status = lock_catalog (catalog[0].measure_catalog, catalog[0].lockmode); 56 if (status != 2) { 57 fprintf (stderr, "error with file lock\n"); 58 exit (2); 59 } 60 file = filebasename (catalog[0].measure_catalog[0].filename); 61 fits_modify (&catalog[0].header, "MEASURE", "%s", 1, file); 62 free (file); 63 64 /* define missing catalog file */ 65 ALLOCATE (catalog[0].missing_catalog, Catalog, 1); 66 fits_init_header (&catalog[0].missing_catalog[0].header); 67 fits_create_header (&catalog[0].missing_catalog[0].header); 68 ALLOCATE (catalog[0].missing_catalog[0].filename, char, length); 69 sprintf (catalog[0].missing_catalog[0].filename, "%s/%s.cpn", path, root); 70 if (lock_catalog (catalog[0].missing_catalog, catalog[0].lockmode) != 2) { 71 fprintf (stderr, "error with file lock\n"); 72 exit (2); 73 } 74 file = filebasename (catalog[0].missing_catalog[0].filename); 75 fits_modify (&catalog[0].header, "MISSING", "%s", 1, file); 76 free (file); 77 78 /* define secfilt catalog file */ 79 ALLOCATE (catalog[0].secfilt_catalog, Catalog, 1); 80 fits_init_header (&catalog[0].secfilt_catalog[0].header); 81 fits_create_header (&catalog[0].secfilt_catalog[0].header); 82 ALLOCATE (catalog[0].secfilt_catalog[0].filename, char, length); 83 sprintf (catalog[0].secfilt_catalog[0].filename, "%s/%s.cps", path, root); 84 if (lock_catalog (catalog[0].secfilt_catalog, catalog[0].lockmode) != 2) { 85 fprintf (stderr, "error with file lock\n"); 86 exit (2); 87 } 88 file = filebasename (catalog[0].secfilt_catalog[0].filename); 89 fits_modify (&catalog[0].header, "SECFILT", "%s", 1, file); 90 free (file); 91 free (path); 92 free (root); 93 } 94 38 95 /* write RA,DEC range in header */ 39 96 fits_modify (&catalog[0].header, "RA0", "%lf", 1, region[0].RA[0]); … … 48 105 free (line); 49 106 107 /* dummy allocation so realloc will succeed */ 50 108 ALLOCATE (catalog[0].average, Average, 1); 51 109 ALLOCATE (catalog[0].measure, Measure, 1); 52 110 ALLOCATE (catalog[0].missing, Missing, 1); 111 ALLOCATE (catalog[0].secfilt, SecFilt, 1); 53 112 catalog[0].Naverage = catalog[0].Nmeasure = catalog[0].Nmissing = 0; 113 catalog[0].Nsecfilt = GetPhotcodeNsecfilt (); 54 114 55 115 /* setup secondary filters to match photcodes: 56 * Nsecfilt is number of filters. Number of entries in array is57 * Nsecfilt * Naverage. At this point, N entries == 0116 * Nsecfilt is number of filters. Number of entries in array is 117 * Nsecfilt * Naverage. At this point, N entries == 0 58 118 */ 59 ALLOCATE (catalog[0].secfilt, SecFilt, 1);60 catalog[0].Nsecfilt = GetPhotcodeNsecfilt ();61 119 } -
trunk/Ohana/src/addstar/src/wcatalog.c
r5014 r5229 5 5 /* output CATMODE and CATFORMAT are set by mkcatalog 6 6 or by mode and format of existing data */ 7 8 /* should this be moved into save_catalog?? */ 9 fits_modify (&catalog[0].header, "ORDERED", "%t", 1, catalog[0].ordered); 7 10 8 11 if (!save_catalog (catalog, VERBOSE)) {
Note:
See TracChangeset
for help on using the changeset viewer.
