Changeset 15036
- Timestamp:
- Sep 26, 2007, 1:30:05 PM (19 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 4 deleted
- 17 edited
-
Makefile (modified) (5 diffs)
-
include/addstar.h (modified) (4 diffs)
-
src/ConfigInit.c (modified) (2 diffs)
-
src/LoadStars.c (modified) (1 diff)
-
src/ReadImageHeader.c (modified) (3 diffs)
-
src/ReadStarsFITS.c (modified) (5 diffs)
-
src/ReadStarsTEXT.c (modified) (2 diffs)
-
src/SkyTableFromTychoIndex.c (modified) (4 diffs)
-
src/SocketOps.c (modified) (3 diffs)
-
src/UpdateDatabase_Image.c (modified) (1 diff)
-
src/addstar.c (modified) (2 diffs)
-
src/addstarc.c (modified) (1 diff)
-
src/calibrate.c (modified) (3 diffs)
-
src/fakeimage.c (modified) (2 diffs)
-
src/find_proper.c (modified) (1 diff)
-
src/getusno.c (modified) (1 diff)
-
src/getusnob.c (modified) (1 diff)
-
src/gimages.c (deleted)
-
src/gstars.c (deleted)
-
src/rfits.c (deleted)
-
src/rtext.c (deleted)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r13106 r15036 58 58 $(SRC)/greference.$(ARCH).o \ 59 59 $(SRC)/grefstars.$(ARCH).o \ 60 $(SRC)/ gstars.$(ARCH).o \60 $(SRC)/LoadStars.$(ARCH).o \ 61 61 $(SRC)/in_image.$(ARCH).o \ 62 62 $(SRC)/load_subpix.$(ARCH).o \ … … 73 73 $(SRC)/ReadImageHeader.$(ARCH).o \ 74 74 $(SRC)/update_coords.$(ARCH).o 75 76 # $(SRC)/gimages.$(ARCH).o \77 75 78 76 ADDSTARD = \ … … 111 109 $(SRC)/getusnob.$(ARCH).o \ 112 110 $(SRC)/ImageOptions.$(ARCH).o \ 113 $(SRC)/gimages.$(ARCH).o \114 111 $(SRC)/greference.$(ARCH).o \ 115 112 $(SRC)/in_image.$(ARCH).o \ … … 148 145 $(SRC)/gettycho.$(ARCH).o \ 149 146 $(SRC)/greference.$(ARCH).o \ 150 $(SRC)/gimages.$(ARCH).o \151 147 $(SRC)/in_image.$(ARCH).o \ 152 148 $(SRC)/load_subpix.$(ARCH).o \ … … 171 167 $(SRC)/SocketOps.$(ARCH).o \ 172 168 $(SRC)/ConfigInit.$(ARCH).o \ 173 $(SRC)/ gstars.$(ARCH).o \169 $(SRC)/LoadStars.$(ARCH).o \ 174 170 $(SRC)/grefstars.$(ARCH).o \ 175 171 $(SRC)/load_subpix.$(ARCH).o \ -
trunk/Ohana/src/addstar/include/addstar.h
r13142 r15036 102 102 103 103 /* these globals are used separately by both client and server (KEEP) */ 104 double ZeroPt; // double check for consistency105 104 double CAL_INSTMAG_MAX; 106 105 double CAL_INSTMAG_MIN; … … 155 154 Stars *grefcat PROTO((char *Refcat, SkyRegion *catstats, int photcode, int *nstars)); 156 155 Stars *grefstars PROTO((char *file, int photcode, int *Nstars)); 157 Stars * gstarsPROTO((char *file, int *Nstars, Image **images, int *Nimages, int photcode));156 Stars *LoadStars PROTO((char *file, int *Nstars, Image **images, int *Nimages, int photcode)); 158 157 int in_image PROTO((double r, double d, Image *image)); 159 158 int load_pt_catalog PROTO((Catalog *catalog, SkyRegion *region)); /*** choose new name ***/ … … 199 198 Measure *sort_measure PROTO((Average *average, int Naverage, Measure *measure, int Nmeasure, int *next)); 200 199 Missing *sort_missing PROTO((Average *average, int Naverage, Missing *missing, int Nmissing, int *next_miss)); 201 Stars *ConvertSMPDATA PROTO((FTable *table, int *nstars));202 Stars *ConvertPS1_DEV_0 PROTO((FTable *table, int *nstars));203 200 int ImageOptions PROTO((AddstarClientOptions *options, Image *images, int Nimages)); 204 201 int GetFileMode PROTO((Header *header)); … … 229 226 int NewReflist_Thread PROTO((int BindSocket)); 230 227 228 Stars *Convert_SMPDATA PROTO((FTable *table, int *nstars)); 229 Stars *Convert_PS1_DEV_0 PROTO((FTable *table, int *nstars)); 230 Stars *Convert_PS1_DEV_1 PROTO((FTable *table, int *nstars)); 231 231 232 int args_skycells (int argc, char **argv); 232 233 int ConfigInit_skycells (int *argc, char **argv); -
trunk/Ohana/src/addstar/src/ConfigInit.c
r13140 r15036 5 5 AddstarClientOptions ConfigInit (int *argc, char **argv) { 6 6 7 double ZERO_POINT; 7 8 char *config, *file; 8 9 char RadiusWord[80]; … … 95 96 SKY_TABLE[0] = 0; 96 97 } 98 GetConfig (config, "ZERO_PT", "%lf", 0, &ZERO_POINT); 99 SetZeroPoint (ZERO_POINT); 97 100 98 101 if (!ScanConfig (config, "IMAGE_TABLE", "%s", 0, ImageCat)) { -
trunk/Ohana/src/addstar/src/LoadStars.c
r14590 r15036 1 2 /* read an image header corresponding to a CMF / CMP data block */ 3 Image *ReadImageHeader (Header *header) { 4 1 # include "addstar.h" 2 3 Stars *LoadStars (char *filename, int *Nstars, Image **images, int *Nimages, int photcode) { 4 5 int i, j, N, Nfile, Nheader, NHEADER, Nimage, NIMAGE; 6 int Nskip, Nhead, Ndata, done, status, mode, NinStars; 7 char **file, *name; 8 FILE *f; 9 glob_t globList; 10 char **exthead, **extdata, **exttype, tmpword[80]; 11 int *extnum_head, *extnum_data, *extsize; 12 Header *header, **headers; 5 13 Image *image; 6 7 ALLOCATE (image, Image, 1); 8 9 /* get astrometry information */ 10 if (!GetCoords (&image[0].coords, &header)) { 11 fprintf (stderr, "ERROR: no astrometric solution in header\n"); 14 Stars *inStars, *stars; 15 16 // parse the filename as a glob 17 globList.gl_offs = 0; 18 glob (filename, 0, NULL, &globList); 19 20 // if the glob does not match, save the literal word: 21 // otherwise save all glob matches 22 if (globList.gl_pathc == 0) { 23 Nfile = 1; 24 ALLOCATE (file, char *, Nfile); 25 file[0] = strcreate (filename); 26 } else { 27 Nfile = globList.gl_pathc; 28 ALLOCATE (file, char *, Nfile); 29 for (i = 0; i < Nfile; i++) { 30 file[i] = strcreate (globList.gl_pathv[i]); 31 } 32 } 33 34 // open the first file, read the PHU header 35 f = fopen (file[0], "r"); 36 if (f == NULL) { 37 fprintf (stderr, "ERROR: can't read header for %s\n", file[0]); 12 38 exit (1); 13 39 } 14 itmp = 0; 15 gfits_scan (&header, "NASTRO", "%d", 1, &itmp); 16 if ((itmp == 0) && !ACCEPT_ASTROM) { 17 fprintf (stderr, "ERROR: bad astrometric solution in header\n"); 40 ALLOCATE (header, Header, 1); 41 gfits_fread_header (f, header); 42 43 mode = GetFileMode (header); 44 45 stars = NULL; 46 *Nstars = 0; 47 48 /*** load data from a single PHU or a collection of PHU files ***/ 49 if ((mode != SIMPLE_MEF) && (mode != MOSAIC_MEF)) { 50 Nimage = Nfile; 51 ALLOCATE (image, Image, Nimage); 52 for (i = N = 0; i < Nfile; i++) { 53 // XXX we should not drop all input images if one fails 54 if (i > 0) { 55 f = fopen (file[i], "r"); 56 if (f == NULL) { 57 fprintf (stderr, "can't read header for %s, skipping\n", file[i]); 58 continue; 59 } 60 gfits_fread_header (f, header); 61 } 62 63 if (!ReadImageHeader (header, &image[N], photcode)) { 64 fprintf (stderr, "skipping %s\n", file[i]); 65 continue; 66 } 67 68 /* find image rootname */ 69 name = filebasename (file[i]); 70 snprintf (image[N].name, 64, name); 71 free (name); 72 73 switch (mode) { 74 case SIMPLE_CMP: 75 case MOSAIC_CMP: 76 inStars = ReadStarsTEXT (f, &image[N].nstar); 77 inStars = FilterStars (inStars, &image[N]); 78 stars = MergeStars (stars, Nstars, inStars, image[N].nstar); 79 break; 80 81 case SIMPLE_CMF: 82 case MOSAIC_CMF: 83 inStars = ReadStarsFITS (f, header, NULL, &image[N].nstar); 84 inStars = FilterStars (inStars, &image[N]); 85 stars = MergeStars (stars, Nstars, inStars, image[N].nstar); 86 break; 87 88 case MOSAIC_PHU: 89 inStars = NULL; 90 NinStars = 0; 91 break; 92 } 93 fclose (f); 94 gfits_free_header (header); 95 N++; 96 } 97 *Nimages = N; 98 *images = image; 99 100 if (N == 0) { 101 // XXX how do we track this error? 102 fprintf (stderr, "no valid image data in %s, giving up\n", filename); 103 exit (0); 104 } 105 106 return stars; 107 } 108 109 /* we have a multi-chip image */ 110 111 /* supplied photcode is incompatible with multi-chip images */ 112 if (photcode) { 113 fprintf (stderr, "ERROR: photcode cannot be supplied to multi-chip images -- manually adjust the headers\n"); 18 114 exit (1); 19 115 } 20 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) { 21 if (MOSAIC == NULL) { 22 fprintf (stderr, "ERROR: no mosaic for WRP image (use -mosaic)\n"); 23 exit (1); 24 } 25 RegisterMosaic (MOSAIC); 26 } else { 27 /* force image to lie in 0-360 range */ 28 while (image[0].coords.crval1 < 0) image[0].coords.crval1 += 360.0; 29 while (image[0].coords.crval1 > 360.0) image[0].coords.crval1 -= 360.0; 30 } 31 32 /* CERROR in data file is in arcsec */ 33 if (!gfits_scan (&header, "CERROR", "%lf", 1, &tmp)) tmp = 1.0; 34 image[0].cerror = tmp * 50.0; 35 gfits_scan (&header, "NAXIS1", "%hd", 1, &image[0].NX); 36 gfits_scan (&header, "NAXIS2", "%hd", 1, &image[0].NY); 37 38 /* get photcode from header */ 39 if (photcode == 0) { 40 if (!gfits_scan (&header, "PHOTCODE", "%s", 1, photname)) { 41 fprintf (stderr, "ERROR: photcode not supplied in header\n"); 42 exit (1); 43 } 44 photcode = GetPhotcodeCodebyName (photname); 45 if (photcode == 0) { 46 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", photname); 47 exit (1); 48 } 49 } 50 if (photcode == 0) { 51 fprintf (stderr, "ERROR: no valid photcode is supplied\n"); 52 exit (1); 53 } 54 image[0].photcode = photcode; 55 56 image[0].NX -= XOVERSCAN; 57 image[0].NY -= YOVERSCAN; 58 gfits_scan (&header, ExptimeKeyword, "%lf", 1, &tmp); 59 image[0].exptime = tmp; 60 61 /*** why are we no longer using APMIFIT?? ***/ 62 tmp = 0; 63 /* gfits_scan (&header, "APMIFIT", "%lf", 1, &tmp); */ 64 image[0].apmifit = tmp; 65 66 tmp = 0; 67 /* gfits_scan (&header, "dAPMIFIT", "%lf", 1, &tmp); */ 68 image[0].dapmifit = tmp; 69 70 tmp = 0; 71 gfits_scan (&header, "FLIMIT", "%lf", 1, &tmp); 72 image[0].detection_limit = tmp * 10.0; 73 74 tmp = 0; 75 gfits_scan (&header, "FSATUR", "%lf", 1, &tmp); 76 image[0].saturation_limit = tmp * 10.0; 77 78 tmp = 0; 79 gfits_scan (&header, "FWHM_X", "%lf", 1, &tmp); 80 image[0].fwhm_x = tmp * 25.0 * image[0].coords.cdelt1 * 3600.0; 81 82 tmp = 0; 83 gfits_scan (&header, "FWHM_Y", "%lf", 1, &tmp); 84 image[0].fwhm_y = tmp * 25.0 * image[0].coords.cdelt1 * 3600.0; 85 86 if (!gfits_scan (&header, "TZERO", "%d", 1, &image[0].tzero)) { 87 image[0].tzero = parse_time (&header); 88 } 89 90 if (STKeyword[0]) { 91 /* get ST (used for airmass calculation) */ 92 gfits_scan (&header, STKeyword, "%s", 1, line); 93 /* remove ':' characters */ 94 for (c = strchr (line, ':'); c != (char *) NULL; c = strchr (line, ':')) { *c = ' '; } 95 sscanf (line, "%d %d %lf", &hour, &min, &sec); 96 image[0].sidtime = hour + min/60.0 + sec/3600.0; 97 } else { 98 double jd; 99 jd = ohana_sec_to_jd (image[0].tzero); 100 image[0].sidtime = ohana_lst (jd, Longitude); 101 } 102 image[0].latitude = Latitude; 103 104 tmp = 0; 105 gfits_scan (&header, "TRATE", "%lf", 1, &tmp); 106 image[0].trate = 10000 * tmp; 107 108 tmp = 0; 109 gfits_scan (&header, AirmassKeyword, "%lf", 1, &tmp); 110 image[0].secz = MIN (NO_MAG, tmp); 111 112 if (!gfits_scan (&header, CCDNumKeyword, "%d", 1, &itmp)) { 113 image[0].ccdnum = 0xff; 114 } else { 115 image[0].ccdnum = itmp; 116 } 117 118 gfits_scan (&header, "ZERO_PT", "%lf", 1, &ZeroPt); 119 SetZeroPoint (ZeroPt); 120 121 /* secz is in units milli-airmass */ 122 image[0].Mcal = 0.0; 123 image[0].Xm = NO_MAG; 124 image[0].code = 0; 125 bzero (image[0].dummy, sizeof(image[0].dummy)); 126 127 /* find expected number of stars */ 128 if (!gfits_scan (&header, "NSTARS", "%d", 1, &image[0].nstar)) { 129 fprintf (stderr, "ERROR: can't get NSTARS from header\n"); 130 exit (1); 131 } 132 116 117 /* we need to examine the extensions to determine the headers and the data */ 118 NHEADER = 10; 119 ALLOCATE (headers, Header *, NHEADER); 120 121 // the first header is already loaded 122 headers[0] = header; 123 Nskip = gfits_matrix_size (header); 124 fseek (f, Nskip, SEEK_CUR); 125 126 // load all headers into memory 127 done = FALSE; 128 for (i = 1; !done; i++) { 129 ALLOCATE (headers[i], Header, 1); 130 status = gfits_fread_header (f, headers[i]); 131 if (!status) { 132 done = TRUE; 133 } else { 134 Nskip = gfits_matrix_size (headers[i]); 135 fseek (f, Nskip, SEEK_CUR); 136 } 137 if (i == NHEADER - 1) { 138 NHEADER += 10; 139 REALLOCATE (headers, Header *, NHEADER); 140 } 141 } 142 Nheader = i - 1; /* we failed on the last loop */ 143 144 // space to store the images, indexes to the matching headers 145 Nimage = 0; 146 NIMAGE = Nheader; 147 ALLOCATE (image, Image, NIMAGE); 148 ALLOCATE (exthead, char *, NIMAGE); 149 ALLOCATE (extdata, char *, NIMAGE); 150 ALLOCATE (exttype, char *, NIMAGE); 151 ALLOCATE (extnum_head, int, NIMAGE); 152 ALLOCATE (extnum_data, int, NIMAGE); 153 ALLOCATE (extsize, int, Nheader); 154 155 if (mode == MOSAIC_MEF) { 156 exthead[Nimage] = strcreate ("PHU"); 157 extdata[Nimage] = strcreate ("NONE"); 158 extnum_data[Nimage] = -1; 159 extnum_head[Nimage] = 0; 160 Nimage ++; 161 } 162 163 // now examine the headers, count the table entries, find corresponding headers 164 for (i = 0; i < Nheader; i++) { 165 extsize[i] = headers[i][0].size + gfits_matrix_size (headers[i]); 166 gfits_scan (headers[i], "EXTTYPE", "%s", 1, tmpword); 167 168 if (!strcmp (tmpword, "SMPDATA") || 169 !strcmp (tmpword, "PS1_DEV_0") || 170 !strcmp (tmpword, "PS1_DEV_1")) { 171 172 exttype[Nimage] = strcreate (tmpword); 173 gfits_scan (headers[i], ExtnameKeyword, "%s", 1, tmpword); 174 extdata[Nimage] = strcreate (tmpword); 175 gfits_scan (headers[i], "EXTHEAD", "%s", 1, tmpword); 176 exthead[Nimage] = strcreate (tmpword); 177 extnum_data[Nimage] = i; 178 extnum_head[Nimage] = -1; 179 // find the matching exthead entry 180 for (j = 0; j < Nheader; j++) { 181 if (gfits_scan (headers[j], ExtnameKeyword, "%s", 1, tmpword)) { 182 if (!strcmp (tmpword, exthead[Nimage])) { 183 extnum_head[Nimage] = j; 184 } 185 } 186 } 187 // skip or crash on table with missing matching header? 188 if (extnum_head[Nimage] == -1) { 189 fprintf (stderr, "ERROR: can't read header for %s\n", file[0]); 190 exit (1); 191 } 192 Nimage ++; 193 } 194 } 195 // some old format files did not write EXTTYPE. they have a single table in the first 196 // extension matched to the header in the PHU 197 if (Nimage == 0) { 198 extsize[0] = headers[0][0].size + gfits_matrix_size (headers[0]); 199 extsize[1] = headers[1][0].size + gfits_matrix_size (headers[1]); 200 gfits_scan (headers[1], ExtnameKeyword, "%s", 1, tmpword); 201 if (!strcmp (tmpword, "SMPFILE")) { 202 extdata[Nimage] = strcreate (tmpword); 203 exttype[Nimage] = strcreate ("SMPDATA"); 204 exthead[Nimage] = strcreate ("PHU"); 205 extnum_head[Nimage] = 0; 206 extnum_data[Nimage] = 1; 207 Nimage = 1; 208 } 209 } 210 if (Nimage == 0) Shutdown ("no object data in file"); 211 212 if (VERBOSE) fprintf (stderr, "file %s has %d headers, including %d images\n", file[0], Nheader, Nimage); 213 214 /* find image rootname */ 215 name = filebasename (file[0]); 216 217 // now run through the images, interpret the headers and read the stars 218 for (i = N = 0; i < Nimage; i++) { 219 Nhead = extnum_head[i]; 220 221 if (VERBOSE) fprintf (stderr, "reading header for %s (%s)\n", exthead[i], extdata[i]); 222 if (!ReadImageHeader (headers[Nhead], &image[N], 0)) { 223 fprintf (stderr, "skipping %s\n", exthead[i]); 224 continue; 225 } 226 227 // XXX use something to set the chip name? EXTNAME? 228 if (!strcmp(exthead[i], "PHU") && (Nimage == 1)) { 229 snprintf (image[N].name, 64, "%s", name); 230 } else { 231 snprintf (image[N].name, 64, "%s[%s]", name, exthead[i]); 232 } 233 234 // skip the table if there is not data segment (eg, mosaic WRP image) 235 if (!strcmp(extdata[i], "NONE")) { 236 N++; 237 continue; 238 } 239 240 // advance the pointer to the start of the corresponding table block 241 Ndata = extnum_data[i]; 242 Nskip = 0; 243 for (j = 0; j < Ndata; j++) { 244 Nskip += extsize[j]; 245 } 246 fseek (f, Nskip, SEEK_SET); 247 248 inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &image[N].nstar); 249 inStars = FilterStars (inStars, &image[N]); 250 stars = MergeStars (stars, Nstars, inStars, image[N].nstar); 251 N++; 252 } 253 free (name); 254 *Nimages = N; 255 *images = image; 256 257 if (N == 0) { 258 fprintf (stderr, "no valid image data in %s, giving up\n", filename); 259 exit (0); 260 } 261 262 return stars; 263 } -
trunk/Ohana/src/addstar/src/ReadImageHeader.c
r14590 r15036 6 6 7 7 int Nastro, ccdnum, hour, min, Nx, Ny; 8 double tmp, sec, Cerror ;8 double tmp, sec, Cerror, ZeroPt; 9 9 char *c, photname[64], line[80]; 10 10 … … 146 146 147 147 gfits_scan (header, "ZERO_PT", "%lf", 1, &ZeroPt); 148 SetZeroPoint (ZeroPt); 148 if (ZeroPt != GetZeroPoint()) { 149 fprintf (stderr, "inconsistent zero point values: image: %f, config: %f\n", ZeroPt, GetZeroPoint()); 150 return (FALSE); 151 } 149 152 150 153 /* secz is in units milli-airmass */ … … 152 155 image[0].Xm = NO_MAG; 153 156 image[0].code = 0; 154 bzero (image[0].dummy, sizeof(image[0].dummy));157 memset (image[0].dummy, 0, sizeof(image[0].dummy)); 155 158 156 159 /* find expected number of stars */ -
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r12732 r15036 32 32 stars = NULL; 33 33 if (!strcmp (type, "SMPDATA")) { 34 stars = Convert SMPDATA (&table, &Nstars);34 stars = Convert_SMPDATA (&table, &Nstars); 35 35 } 36 36 if (!strcmp (type, "PS1_DEV_0")) { 37 stars = ConvertPS1_DEV_0 (&table, &Nstars); 37 stars = Convert_PS1_DEV_0 (&table, &Nstars); 38 } 39 if (!strcmp (type, "PS1_DEV_1")) { 40 stars = Convert_PS1_DEV_1 (&table, &Nstars); 38 41 } 39 42 if (stars == NULL) { … … 48 51 } 49 52 50 Stars *Convert SMPDATA (FTable *table, int *nstars) {53 Stars *Convert_SMPDATA (FTable *table, int *nstars) { 51 54 52 55 int i, Nstars, swapped; … … 77 80 } 78 81 79 // XXX I need to make the IPP I/O functions and these functions 80 // consistent wrt ZERO_POINT.... 81 Stars *ConvertPS1_DEV_0 (FTable *table, int *nstars) { 82 Stars *Convert_PS1_DEV_0 (FTable *table, int *nstars) { 82 83 83 84 int i, Nstars; 85 double ZeroPt; 84 86 Stars *stars; 85 87 PS1_DEV_0 *ps1data; 86 88 87 89 ps1data = gfits_table_get_PS1_DEV_0 (table, &Nstars, NULL); 90 ZeroPt = GetZeroPoint(); 88 91 89 92 ALLOCATE (stars, Stars, Nstars); … … 93 96 stars[i].dX = ps1data[i].dX; 94 97 stars[i].dY = ps1data[i].dY; 95 stars[i].M = ps1data[i].M + 25.0;98 stars[i].M = ps1data[i].M + ZeroPt; 96 99 stars[i].dM = ps1data[i].dM; 97 100 stars[i].Mpeak = ps1data[i].Mpeak; … … 138 141 return (stars); 139 142 } 143 144 // XXX I need to make the IPP I/O functions and these functions 145 // consistent wrt ZERO_POINT.... 146 Stars *Convert_PS1_DEV_1 (FTable *table, int *nstars) { 147 148 int i, Nstars; 149 double ZeroPt; 150 Stars *stars; 151 PS1_DEV_1 *ps1data; 152 153 ps1data = gfits_table_get_PS1_DEV_1 (table, &Nstars, NULL); 154 ZeroPt = GetZeroPoint(); 155 156 ALLOCATE (stars, Stars, Nstars); 157 for (i = 0; i < Nstars; i++) { 158 stars[i].X = ps1data[i].X; 159 stars[i].Y = ps1data[i].Y; 160 stars[i].dX = ps1data[i].dX; 161 stars[i].dY = ps1data[i].dY; 162 stars[i].M = ps1data[i].M + ZeroPt; 163 stars[i].dM = ps1data[i].dM; 164 stars[i].Mpeak = ps1data[i].Mpeak; 165 166 stars[i].sky = ps1data[i].sky; 167 stars[i].dsky = ps1data[i].dSky; 168 169 stars[i].fx = ps1data[i].fx; 170 stars[i].fy = ps1data[i].fy; 171 stars[i].df = ps1data[i].df; 172 173 stars[i].psfProb = ps1data[i].psfProb; 174 stars[i].psfQual = ps1data[i].psfQual; 175 stars[i].crNsigma = ps1data[i].crNsigma; 176 stars[i].extNsigma = ps1data[i].extNsigma; 177 178 stars[i].detID = ps1data[i].detID; 179 180 /* these are set elsewhere */ 181 stars[i].R = 0.0; 182 stars[i].D = 0.0; 183 stars[i].dR = 0.0; 184 stars[i].dD = 0.0; 185 186 stars[i].uR = 0.0; 187 stars[i].uD = 0.0; 188 stars[i].duR = 0.0; 189 stars[i].duD = 0.0; 190 191 stars[i].P = 0.0; 192 stars[i].dP = 0.0; 193 194 stars[i].Mcal = 0; 195 stars[i].t = 0; 196 stars[i].dt = 0; 197 stars[i].airmass = 0; 198 stars[i].code = 0; 199 stars[i].found = 0; 200 201 /* these are not used */ 202 stars[i].Map = NO_MAG; 203 stars[i].Mgal = NO_MAG; 204 stars[i].dophot = 0; 205 } 206 *nstars = Nstars; 207 return (stars); 208 } -
trunk/Ohana/src/addstar/src/ReadStarsTEXT.c
r10897 r15036 39 39 Nskip = c2 - c; 40 40 nbytes -= Nskip; 41 bzero (buffer + nbytes, Nskip);41 memset (buffer + nbytes, 0, Nskip); 42 42 if (VERBOSE) fprintf (stderr, "deleted %d extra return chars\n", Nskip); 43 43 } … … 52 52 Nskip = c2 - c; 53 53 nbytes -= Nskip; 54 bzero (buffer + nbytes, Nskip);54 memset (buffer + nbytes, 0, Nskip); 55 55 if (VERBOSE) fprintf (stderr, "deleted line, %d extra chars\n", Nskip); 56 56 } else { -
trunk/Ohana/src/addstar/src/SkyTableFromTychoIndex.c
r7974 r15036 34 34 tycho[i].Dmax = atof (&line[36]); 35 35 36 bzero (tycho[i].name, 21);36 memset (tycho[i].name, 0, 21); 37 37 strncpy (tycho[i].name, line, 7); 38 38 tycho[i].name[7] = 0; … … 56 56 regions[Nr].child = TRUE; 57 57 regions[Nr].table = FALSE; 58 bzero (regions[Nr].name, 21);58 memset (regions[Nr].name, 0, 21); 59 59 strcpy (regions[Nr].name, "fullsky"); 60 60 … … 75 75 regions[Nr].child = TRUE; 76 76 regions[Nr].table = FALSE; 77 bzero (regions[Nr].name, 21);77 memset (regions[Nr].name, 0, 21); 78 78 strcpy (regions[Nr].name, DecNames[i]); 79 79 } … … 89 89 regions[Nr].child = TRUE; 90 90 regions[Nr].table = FALSE; 91 bzero (regions[Nr].name, 21);91 memset (regions[Nr].name, 0, 21); 92 92 strcpy (regions[Nr].name, DecNames[i+13]); 93 93 } -
trunk/Ohana/src/addstar/src/SocketOps.c
r12332 r15036 13 13 14 14 host = gethostbyname (hostname); 15 bzero (hostip, 80);15 memset (hostip, 0, 80); 16 16 for (i = 0; i < host[0].h_length; i++) { 17 17 sprintf (tmpline, "%u", (0xff & host[0].h_addr[i])); … … 125 125 126 126 host = gethostbyname (hostname); 127 bzero (hostip, 80);127 memset (hostip, 0, 80); 128 128 for (i = 0; i < host[0].h_length; i++) { 129 129 sprintf (tmpline, "%u", (0xff & host[0].h_addr[i])); … … 170 170 171 171 host = gethostbyname (hostname); 172 bzero (hostip, 80);172 memset (hostip, 0, 80); 173 173 for (i = 0; i < host[0].h_length; i++) { 174 174 sprintf (tmpline, "%u", (0xff & host[0].h_addr[i])); -
trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c
r14401 r15036 96 96 if (db.dbstate == LCK_EMPTY) { 97 97 if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat); 98 dvo_image_create (&db, ZeroPt);98 dvo_image_create (&db, GetZeroPoint()); 99 99 } else { 100 100 if (!dvo_image_load (&db, VERBOSE, FORCE_READ)) { -
trunk/Ohana/src/addstar/src/addstar.c
r14401 r15036 37 37 switch (options.mode) { 38 38 case M_IMAGE: 39 stars = gstars (argv[1], &Nstars, &images, &Nimages, options.photcode);39 stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode); 40 40 if ((DUMP != NULL) && !strcmp (DUMP, "rawstars")) dump_rawstars (stars, Nstars); 41 41 for (i = 0; i < Nimages; i++) { … … 163 163 /* load or create the image table */ 164 164 if (db.dbstate == LCK_EMPTY) { 165 double ZeroPt; 165 166 if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat); 166 dvo_image_create (&db, ZeroPt);167 dvo_image_create (&db, GetZeroPoint()); 167 168 } else { 168 169 if (!dvo_image_load (&db, VERBOSE, FORCE_READ)) { -
trunk/Ohana/src/addstar/src/addstarc.c
r10939 r15036 21 21 case M_IMAGE: 22 22 /* load data */ 23 stars = gstars (argv[1], &Nstars, &images, &Nimages, options.photcode);23 stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode); 24 24 25 25 /* send data to server */ -
trunk/Ohana/src/addstar/src/calibrate.c
r14590 r15036 113 113 } 114 114 if (found0 && found1 && found2) { 115 Mcal = new[0].M + 0.001*mycode[0].C + mycode[0].K*(new[0].airmass - 1.0) - ZeroPt;115 Mcal = new[0].M + 0.001*mycode[0].C + mycode[0].K*(new[0].airmass - 1.0) - GetZeroPoint(); 116 116 color = CalM1 - CalM2 - 0.001*mycode[0].dX; 117 117 factor = color; … … 124 124 } 125 125 // if we want to apply a Mcal -> Mref color correction, we need the additional color term 126 Minst = new[0].M - ZeroPt- new[0].dt;126 Minst = new[0].M - GetZeroPoint() - new[0].dt; 127 127 SaveCalibration (Mcal, new[0].dM, CalM0, dCalM, Minst, Nstar); 128 128 if ((DUMP != NULL) && !strcmp (DUMP, "cal")) { … … 156 156 /* create a hash array from Nstar[] entries */ 157 157 ALLOCATE (Nlist, int, MaxN + 1); 158 bzero (Nlist, MAX (0, MaxN*sizeof(int)));158 memset (Nlist, 0, MAX (0, MaxN*sizeof(int))); 159 159 for (i = 0; i < Ncal; i++) { 160 160 Nlist[Nstar[i]] ++; -
trunk/Ohana/src/addstar/src/fakeimage.c
r12332 r15036 130 130 image[i+1].Xm = NO_MAG; 131 131 image[i+1].code = 0; 132 bzero (image[i+1].dummy, sizeof(image[i+1].dummy));132 memset (image[i+1].dummy, 0, sizeof(image[i+1].dummy)); 133 133 134 134 image[i+1].nstar = 0; … … 189 189 image[0].Xm = NO_MAG; 190 190 image[0].code = 0; 191 bzero (image[0].dummy, sizeof(image[0].dummy));191 memset (image[0].dummy, 0, sizeof(image[0].dummy)); 192 192 image[0].nstar = 0; 193 193 image[0].Myyyy = 0; -
trunk/Ohana/src/addstar/src/find_proper.c
r12332 r15036 27 27 /* no need to do this twice!! */ 28 28 ALLOCATE (usnodist, float, Nave); 29 bzero (usnodist, Nave*sizeof(float));29 memset (usnodist, 0, Nave*sizeof(float)); 30 30 31 31 X2 = usnostats[0].X; -
trunk/Ohana/src/addstar/src/getusno.c
r6675 r15036 110 110 if (buf[1] > iDEC1) continue; 111 111 112 bzero (&stars[Nusno], sizeof(Stars));112 memset (&stars[Nusno], 0, sizeof(Stars)); 113 113 stars[Nusno].R = buf[0]/360000.0; 114 114 stars[Nusno].D = buf[1]/360000.0 - 90.0; -
trunk/Ohana/src/addstar/src/getusnob.c
r14590 r15036 120 120 /* USNO coords are reported for J2000 / epoch 2000.0 */ 121 121 /* extract the basic stellar data */ 122 bzero (&stars[Nusno], sizeof(Stars));122 memset (&stars[Nusno], 0, sizeof(Stars)); 123 123 stars[Nusno].R = buf[0]/360000.0; 124 124 stars[Nusno].D = buf[1]/360000.0 - 90.0;
Note:
See TracChangeset
for help on using the changeset viewer.
