Changeset 38986 for trunk/Ohana/src/addstar/src/grefstars.c
- Timestamp:
- Oct 27, 2015, 4:49:06 PM (11 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/addstar/src/grefstars.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
Property svn:mergeinfo
set to
/branches/eam_branches/ipp-20150625/Ohana merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana/src/addstar/src/grefstars.c
r38467 r38986 2 2 3 3 /* read ASCII file with ref star data */ 4 Stars *grefstars (char *file, int photcode, unsigned int *Nstars) {4 Catalog *grefstars (char *file, int photcode) { 5 5 6 6 FILE *f; 7 int N, NSTARS; 8 Stars *stars; 7 int NSTARS; 9 8 char line[256]; 10 9 … … 13 12 if (f == NULL) Shutdown ("can't read data from %s", file); 14 13 15 NSTARS = 100; 16 ALLOCATE (stars, Stars, NSTARS); 14 NSTARS = 1000; 15 16 Catalog *catalog = NULL; 17 ALLOCATE (catalog, Catalog, 1); 18 dvo_catalog_init (catalog, TRUE); 19 ALLOCATE (catalog->average, Average, NSTARS); 20 ALLOCATE (catalog->measure, Measure, NSTARS); 17 21 18 22 /* read in stars line-by-line */ 19 for (N = 0; scan_line (f, line) != EOF; N++) { 23 int N = 0; 24 while (scan_line (f, line) != EOF) { 20 25 stripwhite (line); 21 26 if (line[0] == 0) continue; 22 27 if (line[0] == '#') continue; 23 28 24 InitStar (&stars[N]); 29 dvo_average_init (&catalog->average[N]); 30 dvo_measure_init (&catalog->measure[N]); 25 31 26 32 int status = sscanf (line, "%lf %lf %f %f %x", 27 &stars[N].average.R, &stars[N].average.D, 28 &stars[N].measure.M, &stars[N].measure.dM, 29 &stars[N].measure.photFlags); 33 &catalog->average[N].R, &catalog->average[N].D, 34 &catalog->measure[N].M, &catalog->measure[N].dM, 35 &catalog->measure[N].photFlags); 36 30 37 if ((status != 4) && (status != 5)) { 31 38 fprintf (stderr, "error reading line: %s\n", line); 32 N --;33 39 continue; 34 40 } 35 stars[N].average.R = ohana_normalize_angle (stars[N].average.R);41 catalog->average[N].R = ohana_normalize_angle (catalog->average[N].R); 36 42 37 stars[N].measure.R = stars[N].average.R;38 stars[N].measure.D = stars[N].average.D;43 catalog->measure[N].R = catalog->average[N].R; 44 catalog->measure[N].D = catalog->average[N].D; 39 45 40 stars[N].measure.photcode = photcode;46 catalog->measure[N].photcode = photcode; 41 47 42 CHECK_REALLOCATE (stars, Stars, NSTARS, N+1, 100); 48 catalog->average[N].Nmeasure = 1; 49 catalog->average[N].measureOffset = N; 50 51 N++; 52 CHECK_REALLOCATE (catalog->average, Average, NSTARS, N, 1000); 53 CHECK_REALLOCATE (catalog->measure, Measure, NSTARS, N, 1000); 43 54 } 44 *Nstars = N; 45 return (stars); 55 catalog->Naverage = N; 56 catalog->Nmeasure = N; 57 return (catalog); 46 58 }
Note:
See TracChangeset
for help on using the changeset viewer.
