Changeset 16648
- Timestamp:
- Feb 24, 2008, 3:28:36 PM (18 years ago)
- Location:
- branches/eam_branch_20080223/Ohana/src/addstar/src
- Files:
-
- 15 edited
-
FilterStars.c (modified) (2 diffs)
-
LoadStars.c (modified) (5 diffs)
-
addstar.c (modified) (1 diff)
-
args.c (modified) (1 diff)
-
fakeimage.c (modified) (1 diff)
-
find_matches.c (modified) (4 diffs)
-
find_matches_closest.c (modified) (3 diffs)
-
find_matches_refstars.c (modified) (3 diffs)
-
get2mass_dr2.c (modified) (1 diff)
-
get2mass_ops.c (modified) (4 diffs)
-
getgsc.c (modified) (1 diff)
-
gettycho.c (modified) (1 diff)
-
getusno.c (modified) (1 diff)
-
getusnob.c (modified) (1 diff)
-
grefstars.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080223/Ohana/src/addstar/src/FilterStars.c
r15514 r16648 1 1 # include "addstar.h" 2 2 3 Stars *FilterStars (Stars *instars, Image *image ) {3 Stars *FilterStars (Stars *instars, Image *image, unsigned int imageID) { 4 4 5 5 int j, N; … … 72 72 } 73 73 74 // XXX currently, this ID is internal only; 75 // should we use the psphot / other external ID, if available? 76 stars[N].detID = N; // sequence number within image 77 stars[N].imageID = imageID; // does this need to be updated? 78 74 79 N ++; 75 80 } -
branches/eam_branch_20080223/Ohana/src/addstar/src/LoadStars.c
r15487 r16648 1 1 # include "addstar.h" 2 2 3 Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, int photcode) {4 5 int i, Nfile, N headers, NheaderSets, mode, *extsize;6 char **file ;3 Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options) { 4 5 int i, Nfile, NFILE, Nheaders, NheaderSets, mode, *extsize; 6 char **file, line[1024]; 7 7 FILE *f; 8 8 glob_t globList; … … 11 11 HeaderSet *headerSets; 12 12 13 // parse the filename as a glob 14 globList.gl_offs = 0; 15 glob (filename, 0, NULL, &globList); 16 17 // if the glob does not match, save the literal word: 18 // otherwise save all glob matches 19 if (globList.gl_pathc == 0) { 20 Nfile = 1; 21 ALLOCATE (file, char *, Nfile); 22 file[0] = strcreate (filename); 13 if (options[0].filelist) { 14 // read the list of input files from the supplied file 15 f = fopen (filename, "r"); 16 if (f == NULL) { 17 fprintf (stderr, "can't read input list %s, giving up\n", filename); 18 exit (1); 19 } 20 21 NFILE = 10; 22 ALLOCATE (file, char *, NFILE); 23 for (i = 0; (fscanf (f, "%s", line) != EOF); i++) { 24 // filename limited to 1024 chars 25 file[i] = strcreate (line); 26 } 27 Nfile = i; 23 28 } else { 24 Nfile = globList.gl_pathc; 25 ALLOCATE (file, char *, Nfile); 26 for (i = 0; i < Nfile; i++) { 27 file[i] = strcreate (globList.gl_pathv[i]); 29 // parse the filename as a glob 30 globList.gl_offs = 0; 31 glob (filename, 0, NULL, &globList); 32 33 // if the glob does not match, save the literal word: 34 // otherwise save all glob matches 35 if (globList.gl_pathc == 0) { 36 Nfile = 1; 37 ALLOCATE (file, char *, Nfile); 38 file[0] = strcreate (filename); 39 } else { 40 Nfile = globList.gl_pathc; 41 ALLOCATE (file, char *, Nfile); 42 for (i = 0; i < Nfile; i++) { 43 file[i] = strcreate (globList.gl_pathv[i]); 44 } 28 45 } 29 46 } … … 54 71 55 72 /* supplied photcode is incompatible with multi-chip images */ 56 if ((NheaderSets > 1) && photcode) {73 if ((NheaderSets > 1) && options[0].photcode) { 57 74 fprintf (stderr, "ERROR: photcode cannot be supplied to multi-chip images -- manually adjust the headers\n"); 58 75 exit (1); … … 227 244 continue; 228 245 } 246 images[0][Nvalid].imageID = Nvalid; 247 images[0][Nvalid].externID = 0; 248 images[0][Nvalid].sourceID = 0; 229 249 230 250 // XXX use something to set the chip name? EXTNAME? … … 254 274 255 275 inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar); 256 inStars = FilterStars (inStars, &images[0][Nvalid] );276 inStars = FilterStars (inStars, &images[0][Nvalid], Nvalid); 257 277 *stars = MergeStars (*stars, Nstars, inStars, images[0][Nvalid].nstar); 258 278 Nvalid++; -
branches/eam_branch_20080223/Ohana/src/addstar/src/addstar.c
r15743 r16648 37 37 switch (options.mode) { 38 38 case M_IMAGE: 39 stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode); 39 stars = LoadStars (argv[1], &Nstars, &images, &Nimages, &options); 40 41 // set and update the imageID sequence 42 UpdateImageIDs (stars, Nstars, images, Nimages); 43 40 44 if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars); 41 45 for (i = 0; i < Nimages; i++) { -
branches/eam_branch_20080223/Ohana/src/addstar/src/args.c
r14590 r16648 37 37 if ((N = get_argument (argc, argv, "-resort"))) { 38 38 options.mode = M_RESORT; 39 remove_argument (N, &argc, argv); 40 } 41 42 options.filelist = FALSE; 43 if ((N = get_argument (argc, argv, "-list"))) { 44 options.filelist = TRUE; 39 45 remove_argument (N, &argc, argv); 40 46 } -
branches/eam_branch_20080223/Ohana/src/addstar/src/fakeimage.c
r15509 r16648 193 193 image[0].Myyyy = 0; 194 194 195 // XXX need to set the imageID here 196 195 197 *Nimage = Nchips + 1; 196 198 return (image); -
branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches.c
r16633 r16648 37 37 NMEAS = Nmeas = catalog[0].Nmeasure; 38 38 39 // current max obj ID for this catalog 40 objID = catalog[0].objID; 41 catID = catalog[0].catID; 42 39 43 /* project onto rectilinear grid with 1 arcsec pixels. the choice of ZEA projection has the 40 44 * advantage that every point in R,D has a mapping to a unique X,Y. However, note that not all … … 280 284 catalog[0].average[Nave].P = 0; 281 285 catalog[0].average[Nave].dP = 0; 286 287 catalog[0].average[Nave].objID = objID; 288 catalog[0].average[Nave].catID = catID; 289 objID ++; 282 290 283 291 for (j = 0; j < Nsecfilt; j++) { … … 314 322 315 323 catalog[0].measure[Nmeas].detID = stars[N].detID; 316 catalog[0].measure[Nmeas].imageID = options.imageID;324 catalog[0].measure[Nmeas].imageID = stars[N].imageID; 317 325 318 326 catalog[0].measure[Nmeas].dXccd = stars[N].dX; … … 359 367 360 368 /* check if the catalog has changed? if no change, no need to write */ 369 catalog[0].objID = objID; // new max value, save on catalog close 361 370 catalog[0].Naverage = Nave; 362 371 catalog[0].Nmeasure = Nmeas; -
branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches_closest.c
r16633 r16648 37 37 NMEAS = Nmeas = catalog[0].Nmeasure; 38 38 NMISS = Nmiss = catalog[0].Nmissing; 39 40 // current max obj ID for this catalog 41 objID = catalog[0].objID; 42 catID = catalog[0].catID; 39 43 40 44 /* project onto rectilinear grid with 1 arcsec pixels. the choice of ZEA projection has the … … 283 287 catalog[0].average[Nave].dP = 0; 284 288 289 catalog[0].average[Nave].objID = objID; 290 catalog[0].average[Nave].catID = catID; 291 objID ++; 292 285 293 for (j = 0; j < Nsecfilt; j++) { 286 294 catalog[0].secfilt[Nave*Nsecfilt+j].M = NAN; … … 360 368 361 369 /* check if the catalog has changed? if no change, no need to write */ 370 catalog[0].objID = objID; // new max value, save on catalog close 362 371 catalog[0].Naverage = Nave; 363 372 catalog[0].Nmeasure = Nmeas; -
branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches_refstars.c
r16633 r16648 47 47 REALLOCATE (catalog[0].missing, Missing, NMISS); 48 48 49 // current max obj ID for this catalog 50 objID = catalog[0].objID; 51 catID = catalog[0].catID; 52 49 53 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ 50 54 /* reference for coords is catalog center */ … … 253 257 } 254 258 259 catalog[0].average[Nave].objID = objID; 260 catalog[0].average[Nave].catID = catID; 261 objID ++; 262 255 263 for (j = 0; j < Nsecfilt; j++) { 256 264 catalog[0].secfilt[Nave*Nsecfilt+j].M = NAN; … … 369 377 free (next_miss); 370 378 379 catalog[0].objID = objID; // new max value, save on catalog close 371 380 catalog[0].Naverage = Nave; 372 381 catalog[0].Nmeasure = Nmeas; -
branches/eam_branch_20080223/Ohana/src/addstar/src/get2mass_dr2.c
r7394 r16648 62 62 stars[Nstars].t = short_date_to_sec (&buffer[NBYTE*i + 164]); 63 63 stars[Nstars].found = -1; 64 stars[Nstars].detID = 0; 65 stars[Nstars].imageID = 0; 64 66 65 67 if (photcode == TM_J) { -
branches/eam_branch_20080223/Ohana/src/addstar/src/get2mass_ops.c
r14590 r16648 57 57 } 58 58 59 star[0].M = M; 60 star[0].dM = dM; 61 star[0].code = Photcode; 62 star[0].t = time; 63 star[0].found = -1; 59 star[0].M = M; 60 star[0].dM = dM; 61 star[0].code = Photcode; 62 star[0].t = time; 63 star[0].found = -1; 64 star[0].detID = 0; 65 star[0].imageID = 0; 64 66 65 67 return TRUE; … … 108 110 star[0].t = time; 109 111 star[0].found = -1; 112 star[0].detID = 0; 113 star[0].imageID = 0; 110 114 111 115 star[1].M = H; … … 114 118 star[1].t = time; 115 119 star[1].found = -1; 120 star[1].detID = 0; 121 star[1].imageID = 0; 116 122 117 123 star[2].M = K; … … 120 126 star[2].t = time; 121 127 star[2].found = -1; 128 star[2].detID = 0; 129 star[2].imageID = 0; 122 130 123 131 return TRUE; -
branches/eam_branch_20080223/Ohana/src/addstar/src/getgsc.c
r15514 r16648 75 75 stars[Nstars].code = GSC_M; 76 76 stars[Nstars].found = -1; 77 78 stars[Nstars].detID = 0; 79 stars[Nstars].imageID = 0; 80 77 81 Nstars ++; 78 82 CHECK_REALLOCATE (stars, Stars, NSTARS, Nstars, 1000); -
branches/eam_branch_20080223/Ohana/src/addstar/src/gettycho.c
r14590 r16648 96 96 stars[Ntycho].dP = 0; 97 97 98 stars[Ntycho].detID = 0; 99 stars[Ntycho].imageID = 0; 100 98 101 /* Tycho uses J2000 equinox and 1991.25 epoch for coordinates */ 99 102 /* the magnitudes have no temporal information */ -
branches/eam_branch_20080223/Ohana/src/addstar/src/getusno.c
r15514 r16648 117 117 stars[Nusno].found = -1; 118 118 119 stars[Nusno].detID = 0; 120 stars[Nusno].imageID = 0; 121 119 122 /* one pass of addstar does either r or b */ 120 123 if (photcode == USNO_RED) { -
branches/eam_branch_20080223/Ohana/src/addstar/src/getusnob.c
r15036 r16648 141 141 stars[Nusno].found = -1; 142 142 143 stars[Nusno].detID = 0; 144 stars[Nusno].imageID = 0; 145 143 146 /* USNO-B uses J2000 equinox and 2000.0 epoch for coordinates */ 144 147 /* the magnitudes have no temporal information */ -
branches/eam_branch_20080223/Ohana/src/addstar/src/grefstars.c
r8361 r16648 30 30 stars[N].code = photcode; 31 31 stars[N].found = FALSE; 32 stars[N].detID = 0; 33 stars[N].imageID = 0; 32 34 CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100); 33 35 }
Note:
See TracChangeset
for help on using the changeset viewer.
