Changeset 3347
- Timestamp:
- Mar 1, 2005, 7:15:45 AM (21 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 1 added
- 17 edited
-
include/addstar.h (modified) (1 diff)
-
src/RegionOps.c (modified) (2 diffs)
-
src/addstar.c (modified) (2 diffs)
-
src/args.c (modified) (4 diffs)
-
src/calibrate.c (modified) (1 diff)
-
src/find_matches.c (modified) (3 diffs)
-
src/find_matches_refstars.c (modified) (1 diff)
-
src/get2mass.c (modified) (1 diff)
-
src/getgsc.c (modified) (1 diff)
-
src/getusno.c (modified) (4 diffs)
-
src/greference.c (modified) (2 diffs)
-
src/grefstars.c (modified) (3 diffs)
-
src/gregion_image.c (modified) (2 diffs)
-
src/gregion_match.c (modified) (1 diff)
-
src/gregion_match_glob.c (added)
-
src/gregion_patch.c (modified) (1 diff)
-
src/gregion_star.c (modified) (2 diffs)
-
src/gstars.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/include/addstar.h
r3339 r3347 15 15 int found; 16 16 } Stars; 17 18 enum {M_IMAGE, M_REFLIST, M_REFCAT}; 17 19 18 20 /* global variables set in parameter file */ -
trunk/Ohana/src/addstar/src/RegionOps.c
r3339 r3347 100 100 } 101 101 102 FindRegionByPoint (double ra, double dec, GSCRegion *gsc, int Ngsc) {102 int FindRegionByPoint (GSCRegion *regions, double ra, double dec, GSCRegion *gsc, int Ngsc) { 103 103 104 104 Ns = FindRegionDecBandStart (gsc, Ngsc, dec); … … 109 109 if (gsc[i].DEC[0] >= dec) continue; 110 110 if (gsc[i].DEC[1] < dec) continue; 111 return (value); 112 } 113 114 error: 115 return (-1); 111 region[0] = gsc[i]; 112 return (TRUE); 113 } 114 return (FALSE); 116 115 } 117 116 -
trunk/Ohana/src/addstar/src/addstar.c
r3339 r3347 14 14 args (argc, argv); 15 15 16 if (SKYPROBE) load_subpix (); 17 16 18 lock_image_db (); 17 19 18 20 switch (mode) { 19 case IMAGE:21 case M_IMAGE: 20 22 stars = gstars (argv[1], &Nstars, &image); 21 23 region = gregion_image (&image, &Nregions); 22 image_db = gimages (&image, &Nimage_db);24 overlap = gimages (&image, &Noverlap); 23 25 break; 24 case REFLIST:26 case M_REFLIST: 25 27 stars = grefstars (argv[1], &Nstars); 26 28 region = gregion_stars (stars, &Nregion); 27 29 break; 28 case PATCH:30 case M_REFCAT: 29 31 regions = gregion_patch (patch, &Nregions); 30 break;31 case MATCH:32 regions = gregion_match (&Nregions);32 if (ONLY_MATCH) { 33 regions = gregion_match (regions, &Nregions); 34 } 33 35 break; 34 36 } … … 38 40 39 41 switch (mode) { 40 case IMAGE:41 find_matches (®ion[i], stars, Nstars, &catalog, &image, pimage, Nimage);42 case M_IMAGE: 43 find_matches (®ion[i], stars, Nstars, &catalog, &image, overlap, Noverlap); 42 44 break; 43 case PATCH: 44 case MATCH: 45 stars = grefcat (region, &Nstars); 46 case REFLIST: 45 case M_REFCAT: 46 stars = grefcat (argv[1], region, &Nstars); 47 case M_REFLIST: 47 48 subset = find_subset (®ion, stars, Nstars, &subref, &Nsubset); 48 49 find_matches_refstars (®ion, subset, Nsubset, &catalog); -
trunk/Ohana/src/addstar/src/args.c
r3339 r3347 23 23 } 24 24 25 /* check for command line options */ 26 VERBOSE = FALSE; 27 if ((N = get_argument (argc, argv, "-v"))) { 28 VERBOSE = TRUE; 25 /*** check for command line options ***/ 26 27 /* basic mode: image, list, refcat */ 28 mode = M_IMAGE; 29 if ((N = get_argument (argc, argv, "-ref"))) { 30 mode = M_REFLIST; 29 31 remove_argument (N, &argc, argv); 30 32 } 31 ACCEPT_ASTROM = FALSE; 32 if ((N = get_argument (argc, argv, "-accept"))) { 33 ACCEPT_ASTROM = TRUE; 33 if ((N = get_argument (argc, argv, "-cat"))) { 34 mode = M_REFCAT; 34 35 remove_argument (N, &argc, argv); 35 36 } 36 thiscode = NULL; 37 if ((N = get_argument (argc, argv, "-p"))) { 37 38 /* restrict to a portion of the sky? (REFCAT only) */ 39 patch.RA[0] = 0; 40 patch.RA[1] = 360; 41 patch.DEC[0] = -90; 42 patch.DEC[1] = +90; 43 if ((N = get_argument (argc, argv, "-region"))) { 38 44 remove_argument (N, &argc, argv); 39 thiscode = GetPhotcodebyName (argv[N]); 45 patch.RA[0] = atof (argv[N]); 46 patch.RA[1] = atof (argv[N]); 47 patch.DEC[0] = atof (argv[N]); 48 patch.DEC[1] = atof (argv[N]); 49 } 50 51 /* only add to existing objects (REFCAT only) */ 52 ONLY_MATCH = FALSE; 53 if ((i = get_argument (argc, argv, "-only-match"))) { 54 ONLY_MATCH = TRUE; 55 remove_argument (i, &argc, argv); 56 } 57 /* don't add missed pts to Missed table */ 58 SKIP_MISSED = FALSE; 59 if ((N = get_argument (argc, argv, "-missed"))) { 60 SKIP_MISSED = TRUE; 40 61 remove_argument (N, &argc, argv); 41 62 } 63 /* replace measurement, don't duplicate */ 64 REPLACE = FALSE; 65 if ((i = get_argument (argc, argv, "-replace"))) { 66 REPLACE = TRUE; 67 remove_argument (i, &argc, argv); 68 } 69 /* only add image potion to image table */ 42 70 ONLY_IMAGES = FALSE; 43 71 if ((N = get_argument (argc, argv, "-image"))) { … … 45 73 remove_argument (N, &argc, argv); 46 74 } 47 DUMP_MATCHES = FALSE; 48 if ((N = get_argument (argc, argv, "-dump"))) { 49 DUMP_MATCHES = TRUE; 50 remove_argument (N, &argc, argv); 51 } 52 FORCE_READ = FALSE; 53 if ((N = get_argument (argc, argv, "-force"))) { 54 FORCE_READ = TRUE; 55 remove_argument (N, &argc, argv); 56 } 57 SKIP_MISSED = FALSE; 58 if ((N = get_argument (argc, argv, "-missed"))) { 59 SKIP_MISSED = TRUE; 60 remove_argument (N, &argc, argv); 61 } 62 SKYPROBE = FALSE; 63 if ((N = get_argument (argc, argv, "-skyprobe"))) { 64 SKYPROBE = TRUE; 65 remove_argument (N, &argc, argv); 66 } 67 ADDREFS = FALSE; 68 if ((N = get_argument (argc, argv, "-addrefs"))) { 69 ADDREFS = TRUE; 70 remove_argument (N, &argc, argv); 71 } 72 REPLACE = FALSE; 73 if ((i = get_argument (argc, argv, "-replace"))) { 74 REPLACE = TRUE; 75 remove_argument (i, &argc, argv); 76 } 77 TIMEREF = 0; 78 if ((i = get_argument (argc, argv, "-time"))) { 79 remove_argument (i, &argc, argv); 80 if (!str_to_time (argv[i], &TIMEREF)) { 81 fprintf (stderr, "syntax error in time\n"); 82 exit (1); 83 } 84 remove_argument (i, &argc, argv); 85 } 86 ONLY_MATCH = FALSE; 87 if ((i = get_argument (argc, argv, "-only-match"))) { 88 ONLY_MATCH = TRUE; 89 remove_argument (i, &argc, argv); 90 } 75 /* apply average zpt offset calibration */ 91 76 CALIBRATE = FALSE; 92 77 if ((N = get_argument (argc, argv, "-cal"))) { … … 106 91 remove_argument (N, &argc, argv); 107 92 } 93 94 /* treat data specially for skyprobe (calibration, subpix) */ 95 SKYPROBE = FALSE; 96 if ((N = get_argument (argc, argv, "-skyprobe"))) { 97 SKYPROBE = TRUE; 98 remove_argument (N, &argc, argv); 99 } 100 ACCEPT_ASTROM = FALSE; 101 if ((N = get_argument (argc, argv, "-accept"))) { 102 ACCEPT_ASTROM = TRUE; 103 remove_argument (N, &argc, argv); 104 } 105 DUMP_MATCHES = FALSE; 106 if ((N = get_argument (argc, argv, "-dump"))) { 107 DUMP_MATCHES = TRUE; 108 remove_argument (N, &argc, argv); 109 } 110 FORCE_READ = FALSE; 111 if ((N = get_argument (argc, argv, "-force"))) { 112 FORCE_READ = TRUE; 113 remove_argument (N, &argc, argv); 114 } 115 116 VERBOSE = FALSE; 117 if ((N = get_argument (argc, argv, "-v"))) { 118 VERBOSE = TRUE; 119 remove_argument (N, &argc, argv); 120 } 121 thiscode = NULL; 122 if ((N = get_argument (argc, argv, "-p"))) { 123 remove_argument (N, &argc, argv); 124 thiscode = GetPhotcodebyName (argv[N]); 125 remove_argument (N, &argc, argv); 126 } 127 TIMEREF = 0; 128 if ((i = get_argument (argc, argv, "-time"))) { 129 remove_argument (i, &argc, argv); 130 if (!str_to_time (argv[i], &TIMEREF)) { 131 fprintf (stderr, "syntax error in time\n"); 132 exit (1); 133 } 134 remove_argument (i, &argc, argv); 135 } 108 136 if (DUMP_MATCHES && !CALIBRATE) { 109 137 fprintf (stderr, "-dump only valid -with -cal\n"); 110 138 exit (1); 111 139 } 112 113 if (SKYPROBE) load_subpix ();114 140 115 141 if (argc != 2) { … … 132 158 ASCII - RA,DEC,M,dM in a table 133 159 160 addstar 161 134 162 **/ 135 163 -
trunk/Ohana/src/addstar/src/calibrate.c
r3339 r3347 75 75 } 76 76 /* create a hash array from Nstar[] entries */ 77 ALLOCATE (Nlist, int, M AX (1, MaxN + 1));77 ALLOCATE (Nlist, int, MaxN + 1); 78 78 bzero (Nlist, MAX (0, MaxN*sizeof(int))); 79 79 for (i = 0; i < Ncal; i++) { -
trunk/Ohana/src/addstar/src/find_matches.c
r3339 r3347 5 5 ((R) >= region[0].RA[0]) && ((R) < region[0].RA[1])) 6 6 7 void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image * pimage, int Nimage) {7 void find_matches (GSCRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap) { 8 8 9 9 double secz; … … 360 360 361 361 /** now add references from all previous non-detection observations of this spot on the sky */ 362 for (j = 0; (j < N image) && !SKIP_MISSED; j++) {363 if (in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, & pimage[j])) {362 for (j = 0; (j < Noverlap) && !SKIP_MISSED; j++) { 363 if (in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j])) { 364 364 if (catalog[0].average[Nave].Nn < 1) { 365 365 catalog[0].average[Nave].missing = Nmiss; … … 369 369 last_miss = Nmiss; 370 370 /* this can now be done exactly */ 371 RD_to_XY (&X, &Y, catalog[0].average[Nave].R, catalog[0].average[Nave].D, & pimage[j].coords);372 catalog[0].missing[Nmiss].t = pimage[j].tzero + 1e-4*Y*pimage[j].trate; /* rough guess at time */371 RD_to_XY (&X, &Y, catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j].coords); 372 catalog[0].missing[Nmiss].t = overlap[j].tzero + 1e-4*Y*overlap[j].trate; /* rough guess at time */ 373 373 catalog[0].average[Nave].Nn ++; 374 374 Nmiss ++; -
trunk/Ohana/src/addstar/src/find_matches_refstars.c
r3339 r3347 18 18 int Nsecfilt, Nsec; 19 19 20 /* photcode data */20 /* photcode data -- should not have to modify secfilt / average */ 21 21 Nsecfilt = GetPhotcodeNsecfilt (); 22 22 Nsec = GetPhotcodeNsec (thiscode[0].code); -
trunk/Ohana/src/addstar/src/get2mass.c
r3339 r3347 21 21 Nstars += Ngsc; 22 22 23 REALLOCATE (stars, StarData, MAX (1, Nstars));23 REALLOCATE (stars, StarData, Nstars); 24 24 for (k = Ns, j = 0; j < Ngsc; k++, j++) { 25 25 stars[k].R = gsc[j].R; -
trunk/Ohana/src/addstar/src/getgsc.c
r3339 r3347 21 21 Nstars += Ngsc; 22 22 23 REALLOCATE (stars, StarData, MAX (1, Nstars));23 REALLOCATE (stars, StarData, Nstars); 24 24 for (k = Ns, j = 0; j < Ngsc; k++, j++) { 25 25 stars[k].R = gsc[j].R; -
trunk/Ohana/src/addstar/src/getusno.c
r3339 r3347 9 9 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10}; 10 10 11 Star Data*getusno (CatStats *catstats, int *Nstars) {11 Stars *getusno (CatStats *catstats, int *Nstars) { 12 12 13 13 long int offset; … … 21 21 int spd, spd_start, spd_end, disk; 22 22 int NUSNO, Nusno; 23 Star Data*stars;23 Stars *stars; 24 24 25 25 /** USNO-specific things **/ … … 57 57 Nusno = 0; 58 58 NUSNO = 5000; 59 ALLOCATE (stars, Star Data, NUSNO);59 ALLOCATE (stars, Stars, NUSNO); 60 60 61 61 for (spd = spd_start; spd < spd_end; spd += 75) { … … 125 125 if ((buf[0] > iRA0) && (buf[0] < iRA1) && 126 126 (buf[1] > iDEC0) && (buf[1] < iDEC1)) { 127 bzero (&stars[Nusno], sizeof(Star Data));127 bzero (&stars[Nusno], sizeof(Stars)); 128 128 stars[Nusno].R = buf[0]/360000.0; 129 129 stars[Nusno].D = buf[1]/360000.0 - 90.0; 130 130 stars[Nusno].Mag = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000)))); 131 /* b = 0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000); */ 131 stars[Nusno].code = USNO_RED; 132 /* r data */ 132 133 Nusno ++; 133 if (Nusno == NUSNO) { 134 NUSNO += 5000; 135 REALLOCATE (stars, StarData, NUSNO); 136 } 134 stars[Nusno].R = buf[0]/360000.0; 135 stars[Nusno].D = buf[1]/360000.0 - 90.0; 136 stars[Nusno].Mag = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000)); 137 stars[Nusno].code = USNO_BLUE; 138 /* b data */ 139 Nusno ++; 140 CHECK_REALLOCATE (stars, Stars, NUSNO, Nusno-1, 5000); 137 141 } 138 142 } -
trunk/Ohana/src/addstar/src/greference.c
r3339 r3347 1 1 # include "addstar.h" 2 2 3 Stars *grefcat ( CatStats *catstats, int *Nrefcat) {3 Stars *grefcat (char *Refcat, CatStats *catstats, int *Nrefcat) { 4 4 5 5 int Nstars; 6 6 Stars *stars; 7 7 8 if (VERBOSE) fprintf (stderr, "loading astrometric reference data from %s\n", REFCAT);8 if (VERBOSE) fprintf (stderr, "loading reference catalog data from %s\n", Refcat); 9 9 10 10 Nstars = 0; … … 12 12 13 13 /* get stars from USNO for the given region */ 14 if (!strcmp (R EFCAT, "USNO")) {14 if (!strcmp (Refcat, "USNO")) { 15 15 stars = getusno (catstats, &Nstars); 16 16 } 17 17 18 18 /* get stars from HST GSC for the given region */ 19 if (!strcmp (R EFCAT, "GSC")) {19 if (!strcmp (Refcat, "GSC")) { 20 20 stars = getgsc (catstats, &Nstars); 21 21 } 22 22 23 23 /* get stars from 2MASS for the given region */ 24 if (!strcmp (R EFCAT, "2MASS")) {24 if (!strcmp (Refcat, "2MASS")) { 25 25 stars = get2mass (catstats, &Nstars); 26 26 } 27 27 28 28 if (Nstars == 0) { 29 fprintf (stderr, "no ref objs: %s\n", R EFCAT);29 fprintf (stderr, "no ref objs: %s\n", Refcat); 30 30 exit (1); 31 31 } -
trunk/Ohana/src/addstar/src/grefstars.c
r3339 r3347 21 21 ALLOCATE (stars, Stars, NSTARS); 22 22 23 /* require photcode */ 24 if (thiscode == NULL) { 25 fprintf (stderr, "error: photcode not specified\n"); 26 exit (2); 27 } 28 23 29 /* read in stars line-by-line */ 24 30 for (N = 0; scan_line (f, line) != EOF; N++) { … … 34 40 stars[N].dophot = 0; 35 41 stars[N].found = -1; 36 if (N == NSTARS - 1) { 37 NSTARS += 100; 38 REALLOCATE (stars, Stars, NSTARS); 39 } 42 stars[N].code = thiscode[0].code;; 43 CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100); 40 44 } 41 45 *Nstars = N; … … 43 47 } 44 48 49 /* add the photcode here */ -
trunk/Ohana/src/addstar/src/gregion_image.c
r3339 r3347 17 17 18 18 /* find regions at image corners */ 19 NREGION = 10 ;19 NREGION = 100; 20 20 ALLOCATE (region, GSCRegion, NREGION); 21 21 nregion = 0; … … 35 35 } 36 36 nregion ++; 37 if (nregion == NREGION) { 38 NREGION += 10; 39 REALLOCATE (region, GSCRegion, NREGION); 40 } 37 CHECK_REALLOCATE (region, GSCRegion, NREGION, nregion, 100); 41 38 } 42 39 } -
trunk/Ohana/src/addstar/src/gregion_match.c
r3339 r3347 1 1 # include "addstar.h" 2 # include <glob.h>3 2 4 GSCRegion *gregion_match ( int *nregions) {3 GSCRegion *gregion_match (GSCRegion *regions, int *nregions) { 5 4 6 5 int i; 7 int Ngsc, Nregions; 8 glob_t pglob; 6 int Nsubset; 7 GSCRegion *subset; 8 struct stat filestats; 9 10 Nregions = *nregions; 9 11 10 GSCRegion *gsc, *regions; 11 12 gsc = LoadRegions (&Ngsc); 13 14 sprintf (globline, "%s/[nsNS]????/*.cpt", CATDIR); 15 pglob.gl_offs = 0; 16 glob (globline, 0, NULL, &pglob); 17 18 Nregions = 0; 19 ALLOCATE (regions, GSCRegions, MAX (1, pglob.gl_pathc)); 12 Nsubset = 0; 13 NSUBSET = 100; 14 ALLOCATE (subset, GSCRegions, NSUBSET); 20 15 21 16 /* match the basename against the GSCRegion file names */ 22 for (i = 0; i < pglob.gl_pathc; i++) { 23 found = FALSE; 24 for (j = 0; !found && (j < Ngsc); j++) { 25 if (strcasecmp (pglob.gl_pathv, gsc[j].filename)) continue; 26 regions[Nregions] = gsc[j]; 27 found = TRUE; 28 } 17 for (i = 0; i < Nregions; i++) { 18 status = stat (regions[i].filename, &filestats); 19 if ((status == -1) && (errno == ENOENT)) continue; 20 /* give an error for other conditions? */ 21 22 subset[Nsubset] = regions[i]; 23 Nsubset ++; 24 CHECK_ALLOCATE (subset, GSCRegion, NSUBSET, Nsubset, 100); 29 25 } 30 *nregions = Nregions;31 return (regions); 32 33 /* should free things up here */26 free (regions); 27 28 *nregions = Nsubset; 29 return (subset); 34 30 } 35 36 /* given a ra,dec bounded region, find all region files which overlap it37 38 - split region into two if overlapping 0,360 boundary39 40 */41 42 /* the goal here is to return a list of the existing region files43 this means either:44 45 grabbing all files that are on disk and converting46 them to GSCRegion files47 48 trying all GSCRegion files to see if they exist49 (and are populated?)50 51 */ -
trunk/Ohana/src/addstar/src/gregion_patch.c
r3339 r3347 14 14 15 15 Nregions = 0; 16 ALLOCATE (regions, GSCRegions, MAX (1, (Ne - Ns)));16 ALLOCATE (regions, GSCRegions, (Ne - Ns)); 17 17 18 18 /* find all regions in range within ra range */ -
trunk/Ohana/src/addstar/src/gregion_star.c
r3339 r3347 4 4 5 5 int i; 6 int Ngsc ;7 GSCRegion *gsc ;6 int Ngsc, Nregions, NREGIONS; 7 GSCRegion *gsc, regions; 8 8 9 9 gsc = LoadRegions (&Ngsc); 10 11 Nregions = 0; 12 NREGIONS = 100; 13 ALLOCATE (region, GSCRegion, NREGIONS); 10 14 11 15 sort_stars (stars, Nstars); 12 16 for (i = 0; i < Nstars; i++) { 13 17 if (stars[0].found) continue; 14 region = FindRegionByPoint (star[0].R, star[0].D, gsc, Ngsc);18 FindRegionByPoint (®ions[Nregions], star[0].R, star[0].D, gsc, Ngsc); 15 19 stars[0].found = TRUE; 16 20 /* search forward for all contained stars */ 17 21 for (j = i; j < Nstars; j++) { 18 if (stars[j].R >= region .RA[1]) break;19 if (stars[j].D < region .DEC[0]) continue;20 if (stars[j].D >= region .DEC[1]) continue;22 if (stars[j].R >= regions.RA[1]) break; 23 if (stars[j].D < regions.DEC[0]) continue; 24 if (stars[j].D >= regions.DEC[1]) continue; 21 25 stars[j].found = TRUE; 22 26 } 27 Nregions ++; 28 CHECK_REALLOCATE (regions, GSCRegion, Nregions, NREGIONS, 100); 23 29 } 24 30 25 31 } 26 27 32 28 33 /* given a list of stars, find all region files which contain them … … 40 45 41 46 */ 42 43 -
trunk/Ohana/src/addstar/src/gstars.c
r3339 r3347 244 244 return (stars); 245 245 } 246 247 # if (0)248 /* left over fraction of a block */249 nbytes = Fread (buffer, 1, (Nbytes % (BLOCK*BYTES_STAR)), f, "char");250 if (nbytes != (Nbytes % (BLOCK*BYTES_STAR))) {251 fprintf (stderr, "ERROR: failed to read in stars (2)\n");252 exit (1);253 }254 /* check line-by-line integrity */255 Nnew = 0;256 c = buffer;257 done = FALSE;258 while ((c < buffer + nbytes) && (!done)) {259 for (c2 = c; *c2 == '\n'; c2++);260 if (c2 > c) { /* extra return chars */261 memmove (c, c2, (int)(buffer + nbytes - c2));262 Nnew += c2 - c;263 fprintf (stderr, "deleting %d extra return chars\n", (int)(c2-c));264 }265 c2 = strchr (c, '\n');266 if (c2 == (char *) NULL) {267 if (Nnew > 0) {268 nnew = Fread (&buffer[nbytes-Nnew], 1, Nnew, f, "char");269 if (nnew != Nnew) {270 fprintf (stderr, "ERROR: failed to read in stars (1)\n");271 exit (1);272 }273 } else {274 done = TRUE;275 }276 continue;277 }278 c2++;279 if ((c2 - c) != BYTES_STAR) {280 /* this is a bad line, delete it, adjust data in buffer,281 and be ready to read the rest of the last line */282 memmove (c, c2, (int)(buffer + nbytes - c2));283 Nnew += c2 - c;284 fprintf (stderr, "deleting bad line with %d chars\n", (int)(c2-c));285 } else {286 c = c2;287 }288 }289 for (j = 0; j < nbytes / BYTES_STAR; j++, nstar++, N++) {290 dparse (&stars[N].X, 1, &buffer[j*BYTES_STAR]);291 dparse (&stars[N].Y, 2, &buffer[j*BYTES_STAR]);292 dparse (&stars[N].M, 3, &buffer[j*BYTES_STAR]);293 dparse (&stars[N].dM, 4, &buffer[j*BYTES_STAR]);294 XY_to_RD (&stars[N].R, &stars[N].D, stars[N].X, stars[N].Y, &image[0].coords);295 while (stars[N].R < 0.0) stars[N].R += 360.0;296 while (stars[N].R >= 360.0) stars[N].R -= 360.0;297 dparse (&tmp, 5, &buffer[j*BYTES_STAR]);298 stars[N].dophot = tmp;299 stars[N].found = -1;300 }301 302 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
