Changeset 10889
- Timestamp:
- Jan 3, 2007, 8:50:43 AM (19 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 1 added
- 4 edited
-
include/addstar.h (modified) (1 diff)
-
src/LoadStars.c (added)
-
src/addstar.c (modified) (5 diffs)
-
src/find_matches.c (modified) (1 diff)
-
src/gstars.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/include/addstar.h
r8640 r10889 8 8 # include <netdb.h> 9 9 # include <arpa/inet.h> 10 # include <glob.h> 10 11 11 12 /* used in find_matches, find_matches_refstars */ -
trunk/Ohana/src/addstar/src/addstar.c
r8641 r10889 4 4 5 5 int Nmatch, status; 6 int i, Nstars, Nimage , Noverlap, Nsubset;6 int i, Nstars, Nimages, Noverlap, Nsubset; 7 7 unsigned long long Naverage, Nmeasure; 8 8 Stars *stars, **subset; 9 Image image, *imageSet, *overlap;9 Image *images, *overlap; 10 10 Catalog catalog; 11 11 FITS_DB db; … … 14 14 SkyTable *sky = NULL; 15 15 SkyList *skylist = NULL; 16 SkyList *newlist = NULL; 16 17 17 18 double dtime; … … 39 40 switch (options.mode) { 40 41 case M_IMAGE: 41 stars = gstars (argv[1], &Nstars, options.photcode, &image );42 stars = gstars (argv[1], &Nstars, options.photcode, &images, &Nimages); 42 43 if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars); 43 44 RegisterMosaic (MOSAIC); 44 skylist = SkyListByImage (sky, -1, &image); 45 for (i = 0; i < Nimages; i++) { 46 newlist = SkyListByImage (sky, -1, &image); 47 SkyListMergeLists (&skylist, &newlist); 48 } 45 49 overlap = gimages (&db, &image, MOSAIC, &Noverlap); 46 50 break; … … 54 58 break; 55 59 case M_FAKEIMAGE: 56 image Set = fakeimage (argv[1], &Nimage, options.photcode);60 images = fakeimage (argv[1], &Nimages, options.photcode); 57 61 RegisterMosaic (MOSAIC); 58 62 … … 65 69 } 66 70 67 dvo_image_addrows (&db, imageSet, Nimage );71 dvo_image_addrows (&db, imageSet, Nimages); 68 72 SetProtect (TRUE); 69 73 dvo_image_update (&db, VERBOSE); -
trunk/Ohana/src/addstar/src/find_matches.c
r8652 r10889 14 14 Coords tcoords; 15 15 16 /* changes needed to handle mosaic MEF images: 17 - options should not carry photcode: this is set per star in gstars 18 - validate that all images have the same equiv code value (same Nsec) 19 - add dt to Stars.d and set in gstars, not here 20 - add airmass to Stars.d and set in gstars, not here 21 - set stars.t in gstars 22 - disallow mosaic and missed? otherwise, need to loop over all images 23 for each missed source to see if it should have been found 24 - Mcal_PS is supplied by image, but is not correctly set: it is 25 calculated *after* find_matches in addstar 26 */ 27 16 28 /* XXX EAM : options.photcode overridden by image.source.... */ 29 /* XXX this function could be modified to handle multiple photcodes as long 30 as they match the same equiv code value, resulting in the same value of Nsec */ 17 31 code = GetPhotcodebyCode (image[0].source); 18 32 -
trunk/Ohana/src/addstar/src/gstars.c
r8643 r10889 1 1 # include "addstar.h" 2 2 3 Stars *gstars (char *file, int *NSTARS, int photcode, Image *image) { 3 /* break into sections, loop over images and load stars one at a time */ 4 5 Stars *gstars (char *file, int *NSTARS, int photcode, Image **imageList, int Nimages) { 4 6 5 7 FILE *f; 6 int j, N, Nbytes, naxis;8 int i, j, N, Nbytes, naxis; 7 9 int itmp, hour, min, simple; 8 10 char *name, *c, photname[64], line[80]; … … 10 12 Stars *stars, *rdstars; 11 13 Header header; 14 Image *images; 12 15 13 16 /* XXX which of these values are required, which are just interesting? */ 17 18 # if (0) 19 /* file may be a glob, in which case it should represent multiple chip files 20 from a single mosaic image */ 21 22 // parse the word as a glob 23 glob_t globList; 24 globList.gl_offs = 0; 25 glob (file, 0, NULL, &globList); 26 27 // if the glob does not match, save the literal word: 28 // otherwise save all glob matches 29 if (globList.gl_pathc == 0) { 30 if (!gfits_read_header (file, &header)) { 31 fprintf (stderr, "ERROR: can't read header for %s\n", file); 32 exit (1); 33 } 34 } else { 35 for (i = 0; i < globList.gl_pathc; i++) { 36 if (!gfits_read_header (globList.gl_pathv[i], &header)) { 37 fprintf (stderr, "ERROR: can't read header for %s\n", globList.gl_pathv[i]); 38 exit (1); 39 } 40 } 41 } 42 # endif 14 43 15 44 if (!gfits_read_header (file, &header)) { … … 19 48 20 49 /* find image rootname */ 50 /* if we are reading a MEF mosaic image, attached [extname] to the name of the image */ 21 51 name = filebasename (file); 22 52 strcpy (image[0].name, name); 23 53 free (name); 24 25 /* get astrometry information */26 if (!GetCoords (&image[0].coords, &header)) {27 fprintf (stderr, "ERROR: no astrometric solution in header\n");28 exit (1);29 }30 itmp = 0;31 gfits_scan (&header, "NASTRO", "%d", 1, &itmp);32 if ((itmp == 0) && !ACCEPT_ASTROM) {33 fprintf (stderr, "ERROR: bad astrometric solution in header\n");34 exit (1);35 }36 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {37 if (MOSAIC == NULL) {38 fprintf (stderr, "ERROR: no mosaic for WRP image (use -mosaic)\n");39 exit (1);40 }41 RegisterMosaic (MOSAIC);42 } else {43 /* force image to lie in 0-360 range */44 while (image[0].coords.crval1 < 0) image[0].coords.crval1 += 360.0;45 while (image[0].coords.crval1 > 360.0) image[0].coords.crval1 -= 360.0;46 }47 48 /* CERROR in data file is in arcsec */49 if (!gfits_scan (&header, "CERROR", "%lf", 1, &tmp)) tmp = 1.0;50 image[0].cerror = tmp * 50.0;51 gfits_scan (&header, "NAXIS1", "%hd", 1, &image[0].NX);52 gfits_scan (&header, "NAXIS2", "%hd", 1, &image[0].NY);53 54 /* get photcode from header */55 if (photcode == 0) {56 if (!gfits_scan (&header, "PHOTCODE", "%s", 1, photname)) {57 fprintf (stderr, "ERROR: photcode not supplied in header\n");58 exit (1);59 }60 photcode = GetPhotcodeCodebyName (photname);61 if (photcode == 0) {62 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", photname);63 exit (1);64 }65 }66 if (photcode == 0) {67 fprintf (stderr, "ERROR: no valid photcode is supplied\n");68 exit (1);69 }70 image[0].source = photcode;71 72 image[0].NX -= XOVERSCAN;73 image[0].NY -= YOVERSCAN;74 gfits_scan (&header, ExptimeKeyword, "%lf", 1, &tmp);75 image[0].exptime = tmp;76 77 /*** why are we no longer using APMIFIT?? ***/78 tmp = 0;79 /* gfits_scan (&header, "APMIFIT", "%lf", 1, &tmp); */80 image[0].apmifit_PS = tmp;81 82 tmp = 0;83 /* gfits_scan (&header, "dAPMIFIT", "%lf", 1, &tmp); */84 image[0].dapmifit_PS = tmp;85 86 tmp = 0;87 gfits_scan (&header, "FLIMIT", "%lf", 1, &tmp);88 image[0].detection_limit = tmp * 10.0;89 90 tmp = 0;91 gfits_scan (&header, "FSATUR", "%lf", 1, &tmp);92 image[0].saturation_limit = tmp * 10.0;93 94 tmp = 0;95 gfits_scan (&header, "FWHM_X", "%lf", 1, &tmp);96 image[0].fwhm_x = tmp * 25.0 * image[0].coords.cdelt1 * 3600.0;97 98 tmp = 0;99 gfits_scan (&header, "FWHM_Y", "%lf", 1, &tmp);100 image[0].fwhm_y = tmp * 25.0 * image[0].coords.cdelt1 * 3600.0;101 102 if (!gfits_scan (&header, "TZERO", "%d", 1, &image[0].tzero)) {103 image[0].tzero = parse_time (&header);104 }105 106 if (STKeyword[0]) {107 /* get ST (used for airmass calculation) */108 gfits_scan (&header, STKeyword, "%s", 1, line);109 /* remove ':' characters */110 for (c = strchr (line, ':'); c != (char *) NULL; c = strchr (line, ':')) { *c = ' '; }111 sscanf (line, "%d %d %lf", &hour, &min, &sec);112 image[0].sidtime = hour + min/60.0 + sec/3600.0;113 } else {114 double jd;115 jd = sec_to_jd (image[0].tzero);116 image[0].sidtime = ohana_lst (jd, Longitude);117 }118 image[0].latitude = Latitude;119 120 tmp = 0;121 gfits_scan (&header, "TRATE", "%lf", 1, &tmp);122 image[0].trate = 10000 * tmp;123 124 tmp = 0;125 gfits_scan (&header, AirmassKeyword, "%lf", 1, &tmp);126 image[0].secz_PS = MIN (NO_MAG, tmp);127 128 if (!gfits_scan (&header, CCDNumKeyword, "%d", 1, &itmp)) {129 image[0].ccdnum = 0xff;130 } else {131 image[0].ccdnum = itmp;132 }133 134 gfits_scan (&header, "ZERO_PT", "%lf", 1, &ZeroPt);135 SetZeroPoint (ZeroPt);136 137 /* secz is in units milli-airmass */138 image[0].Mcal_PS = 0.0;139 image[0].Xm = NO_MAG;140 image[0].code = 0;141 bzero (image[0].dummy, sizeof(image[0].dummy));142 143 /* find expected number of stars */144 if (!gfits_scan (&header, "NSTARS", "%d", 1, &image[0].nstar)) {145 fprintf (stderr, "ERROR: can't get NSTARS from header\n");146 exit (1);147 }148 54 149 55 /* this is really lame. get sky background from Flips data */
Note:
See TracChangeset
for help on using the changeset viewer.
