Changeset 3389 for trunk/Ohana/src/addstar
- Timestamp:
- Mar 7, 2005, 6:15:46 PM (22 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 7 edited
-
Makefile (modified) (2 diffs)
-
include/addstar.h (modified) (1 diff)
-
src/args.c (modified) (5 diffs)
-
src/find_matches.c (modified) (5 diffs)
-
src/gimages.c (modified) (6 diffs)
-
src/gregion_image.c (modified) (1 diff)
-
src/gstars.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r3376 r3389 1 #install: 2 # @echo "addstar under re-construction" 1 3 default: addstar 2 4 help: … … 110 112 # utilities ################################################# 111 113 112 install:114 # install: 113 115 for i in $(INSTALL); do make $$i.install; done 114 116 -
trunk/Ohana/src/addstar/include/addstar.h
r3376 r3389 62 62 PhotCode *thiscode; 63 63 GSCRegion UserPatch; 64 Coords *MOSAIC; 64 65 65 66 char DateKeyword[64]; -
trunk/Ohana/src/addstar/src/args.c
r3376 r3389 14 14 int args (int argc, char **argv) { 15 15 16 int i,N;16 int N; 17 17 18 18 /* check for help request */ … … 61 61 /* provide a time for dataset */ 62 62 TIMEREF = 0; 63 if (( i= get_argument (argc, argv, "-time"))) {64 remove_argument ( i, &argc, argv);65 if (!str_to_time (argv[ i], &TIMEREF)) {63 if ((N = get_argument (argc, argv, "-time"))) { 64 remove_argument (N, &argc, argv); 65 if (!str_to_time (argv[N], &TIMEREF)) { 66 66 fprintf (stderr, "syntax error in time\n"); 67 67 exit (1); 68 68 } 69 remove_argument (i, &argc, argv); 69 remove_argument (N, &argc, argv); 70 } 71 /* provide a mosaic for distortion */ 72 MOSAIC = NULL; 73 if ((N = get_argument (argc, argv, "-mosaic"))) { 74 Header header; 75 ALLOCATE (MOSAIC, Coords, 1); 76 77 remove_argument (N, &argc, argv); 78 if (!fits_read_header (argv[N], &header)) { 79 fprintf (stderr, "ERROR: can't read header for mosaic %s\n", argv[N]); 80 exit (1); 81 } 82 if (!GetCoords (MOSAIC, &header)) { 83 fprintf (stderr, "ERROR: no astrometric solution in header\n"); 84 exit (1); 85 } 86 if (strcmp(&MOSAIC[0].ctype[4], "-DIS")) { 87 fprintf (stderr, "ERROR: not a mosaic distortion header\n"); 88 exit (1); 89 } 90 remove_argument (N, &argc, argv); 91 fits_free_header (&header); 70 92 } 71 93 … … 73 95 /* only add to existing objects */ 74 96 ONLY_MATCH = FALSE; 75 if (( i= get_argument (argc, argv, "-only-match"))) {97 if ((N = get_argument (argc, argv, "-only-match"))) { 76 98 ONLY_MATCH = TRUE; 77 remove_argument ( i, &argc, argv);99 remove_argument (N, &argc, argv); 78 100 } 79 101 /* don't add missed pts to Missed table (image only) */ … … 85 107 /* replace measurement, don't duplicate (ref/cat only) */ 86 108 REPLACE = FALSE; 87 if (( i= get_argument (argc, argv, "-replace"))) {109 if ((N = get_argument (argc, argv, "-replace"))) { 88 110 REPLACE = TRUE; 89 remove_argument ( i, &argc, argv);111 remove_argument (N, &argc, argv); 90 112 } 91 113 /* only add image potion to image table */ … … 133 155 fprintf (stderr, "USAGE: addstar -ref (filename)\n"); 134 156 fprintf (stderr, " cur: %s ", argv[0]); 135 for ( i = 0; i < argc; i++) { fprintf (stderr, "%s ", argv[i]); }157 for (N = 0; N < argc; N++) { fprintf (stderr, "%s ", argv[N]); } 136 158 fprintf (stderr, "\n"); 137 159 exit (2); -
trunk/Ohana/src/addstar/src/find_matches.c
r3376 r3389 49 49 REALLOCATE (catalog[0].missing, Missing, NMISS); 50 50 51 /* project onto rectilinear grid with 1 arcsec pixels, sort by X */ 52 /* reference for coords is this image */ 53 tcoords = image[0].coords; 54 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 55 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; 56 tcoords.pc1_2 = tcoords.pc2_1 = 0.0; 57 strcpy (tcoords.ctype, "RA---TAN"); 58 51 /* project onto rectilinear grid with 1 arcsec pixels */ 52 /* we keep the original crpix1,2 and crref1,2 */ 53 /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */ 54 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 55 tcoords = MOSAIC[0]; 56 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 57 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; 58 tcoords.pc1_2 = tcoords.pc2_1 = 0.0; 59 tcoords.Npolyterms = 1; 60 strcpy (tcoords.ctype, "RA---TAN"); 61 } else { 62 tcoords = image[0].coords; 63 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 64 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; 65 tcoords.pc1_2 = tcoords.pc2_1 = 0.0; 66 strcpy (tcoords.ctype, "RA---TAN"); 67 } 68 59 69 for (i = 0; i < Nstars; i++) { 60 70 fRD_to_XY (&X1[i], &Y1[i], stars[i].R, stars[i].D, &tcoords); … … 134 144 /* calculate accurate per-star airmass */ 135 145 secz = airmass (image[0].secz, stars[N].R, stars[N].D, SiderealTime, Latitude); 136 137 146 138 147 /** add measurements for this star **/ … … 162 171 if (*Mval == NO_MAG) *Mval = Mrel; 163 172 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. **/ 164 175 if (CALIBRATE) { 165 /** this is a little tricky: the new measures are not in the measure sequence166 this call can run into the next star if we have had two measures found at this location. **/167 176 AddToCalibration (&catalog[0].average[n], &catalog[0].measure[m], &catalog[0].measure[Nmeas], N); 168 177 } … … 202 211 203 212 /* add reference for undetected catalog stars */ 213 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (MOSAIC); 204 214 for (j = 0; (j < Nave) && !SKIP_MISSED; j++) { 205 215 n = N2[j]; … … 287 297 /** now add references from all previous non-detection observations of this spot on the sky */ 288 298 for (j = 0; (j < Noverlap) && !SKIP_MISSED; j++) { 299 if (!FindMosaicForImage (overlap, Noverlap, j)) continue; 289 300 if (!in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j])) continue; 290 301 if (catalog[0].average[Nave].Nn < 1) { -
trunk/Ohana/src/addstar/src/gimages.c
r3376 r3389 38 38 /* project onto rectilinear grid with 1 arcsec pixels */ 39 39 /* we keep the original crpix1,2 and crref1,2 */ 40 tcoords = image[0].coords; 41 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 42 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; 43 tcoords.pc1_2 = tcoords.pc2_1 = 0.0; 44 strcpy (tcoords.ctype, "RA---TAN"); 40 /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */ 41 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 42 tcoords = MOSAIC[0]; 43 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 44 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; 45 tcoords.pc1_2 = tcoords.pc2_1 = 0.0; 46 tcoords.Npolyterms = 1; 47 strcpy (tcoords.ctype, "RA---TAN"); 48 RegisterMosaic (MOSAIC); 49 /* register so image->sky conversions below have correct mosaic */ 50 } else { 51 tcoords = image[0].coords; 52 tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0; 53 tcoords.pc1_1 = tcoords.pc2_2 = 1.0; 54 tcoords.pc1_2 = tcoords.pc2_1 = 0.0; 55 strcpy (tcoords.ctype, "RA---TAN"); 56 } 45 57 46 58 /* define original corners */ … … 51 63 Xo[4] = 0; Yo[4] = 0; /* so we can make a loop easily */ 52 64 for (j = 0; j < 5; j++) { 65 /* XY-to_RD is two-level if ctype == WRP */ 53 66 XY_to_RD (&r, &d, Xo[j], Yo[j], &image[0].coords); 54 67 RD_to_XY (&Xo[j], &Yo[j], r, d, &tcoords); … … 77 90 } 78 91 79 NTIMAGE = 100; 92 /* kind of dangerous, see note below */ 93 NTIMAGE = MAX (MIN (Nimage, 1000), 1); 80 94 ALLOCATE (timage, Image, NTIMAGE); 81 95 … … 87 101 for (Ntimage = 0; Ntimage < Nimage; Ntimage += ntimage) { 88 102 ntimage = Fread (timage, sizeof(Image), NTIMAGE, f, "image"); 103 if (ntimage == 0) Shutdown ("expected %d images, only found %d", Nimage, Ntimage); 104 BuildChipMatch (timage, ntimage); 105 89 106 for (i = 0; i < ntimage; i++) { 107 108 /* if any of these images are WRP images, need to find matching DIS */ 109 if (!FindMosaicForImage (timage, ntimage, i)) { 110 fprintf (stderr, "!"); 111 continue; 112 } 113 90 114 addtolist = FALSE; 91 115 /* define image corners */ … … 116 140 } 117 141 } 142 } 118 143 119 if (ntimage == 0) { 120 Shutdown ("expected %d images, only found %d", Nimage, Ntimage); 121 } 122 } 144 BuildChipMatch (pimage, npimage); 123 145 124 146 if (VERBOSE) fprintf (stderr, "found %d overlapping images\n", npimage); … … 129 151 } 130 152 153 /* this function tries to find overlapping images with the current image. 154 it loads the image table in blocks (up to 1000 at a time) and looks 155 for overlaps within the set. the search is not very robust. in 156 addition, it needs to look for mosaic DIS images matching any WRP images. 157 if the WRP image is loaded near the beginning of a block, then the corresponding DIS 158 may be in the previous block, and thus missed 159 */ -
trunk/Ohana/src/addstar/src/gregion_image.c
r3376 r3389 12 12 impatch.DEC[0] = +90; 13 13 impatch.DEC[1] = -90; 14 15 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 16 if (MOSAIC == NULL) Shutdown ("no mosaic for WRP image (use -mosaic)"); 17 RegisterMosaic (MOSAIC); 18 } 14 19 15 20 for (x = 0; x <= 1; x++) { -
trunk/Ohana/src/addstar/src/gstars.c
r3361 r3389 52 52 exit (1); 53 53 } 54 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 55 if (MOSAIC == NULL) { 56 fprintf (stderr, "ERROR: no mosaic for WRP image (use -mosaic)\n"); 57 exit (1); 58 } 59 RegisterMosaic (MOSAIC); 60 } 54 61 55 62 /* get ST (used for airmass calculation) */
Note:
See TracChangeset
for help on using the changeset viewer.
