Changeset 38986 for trunk/Ohana/src/addstar/src/getusno.c
- Timestamp:
- Oct 27, 2015, 4:49:06 PM (11 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/addstar/src/getusno.c (modified) (5 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/getusno.c
r38467 r38986 4 4 # define NELEM 3 5 5 6 Stars *getusno (SkyRegion *catstats, int photcode, unsigned int *nstars) {6 Catalog *getusno (SkyRegion *catstats) { 7 7 8 8 off_t offset; … … 15 15 double dec; 16 16 int spd, spd_start, spd_end; 17 int NUSNO, Nusno;18 Stars *stars;19 17 short int USNO_RED, USNO_BLUE; 20 18 … … 22 20 NAMED_PHOTCODE (USNO_RED, "USNO_RED"); 23 21 NAMED_PHOTCODE (USNO_BLUE, "USNO_BLUE"); 24 if (photcode == USNO_RED) goto good_code;25 if (photcode == USNO_BLUE) goto good_code;26 Shutdown ("USNO photcode not specified");27 good_code:28 22 29 23 /* identify ra & dec range of interest */ … … 43 37 } 44 38 45 Nusno = 0; 46 NUSNO = 5000; 47 ALLOCATE (stars, Stars, NUSNO); 39 int Nave = 0; 40 int Nmeas = 0; 41 int NAVE = 1000; 42 int NMEAS = 1000; 43 44 Catalog *catalog = NULL; 45 ALLOCATE (catalog, Catalog, 1); 46 dvo_catalog_init (catalog, TRUE); 47 ALLOCATE (catalog->average, Average, NAVE); 48 ALLOCATE (catalog->measure, Measure, NMEAS); 48 49 49 50 for (spd = spd_start; spd < spd_end; spd += 75) { … … 110 111 if (buf[1] > iDEC1) continue; 111 112 112 InitStar (&stars[Nusno]); 113 dvo_average_init (&catalog->average[Nave]); 114 dvo_measure_init (&catalog->measure[Nmeas+0]); 115 dvo_measure_init (&catalog->measure[Nmeas+1]); 113 116 114 stars[Nusno].average.R = buf[0]/360000.0; 115 stars[Nusno].average.D = buf[1]/360000.0 - 90.0; 116 stars[Nusno].measure.R = stars[Nusno].average.R; 117 stars[Nusno].measure.D = stars[Nusno].average.D; 118 stars[Nusno].measure.dM = NAN; 117 catalog->average[Nave].R = buf[0]/360000.0; 118 catalog->average[Nave].D = buf[1]/360000.0 - 90.0; 119 119 120 /* one pass of addstar does either r or b */ 121 if (photcode == USNO_RED) { 122 stars[Nusno].measure.photcode = USNO_RED; 123 stars[Nusno].measure.M = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000)))); 124 } 125 if (photcode == USNO_BLUE) { 126 stars[Nusno].measure.photcode = USNO_BLUE; 127 stars[Nusno].measure.M = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000)); 128 } 129 Nusno ++; 130 CHECK_REALLOCATE (stars, Stars, NUSNO, Nusno, 5000); 120 catalog->measure[Nmeas+0].R = catalog->average[Nave].R; 121 catalog->measure[Nmeas+0].D = catalog->average[Nave].D; 122 catalog->measure[Nmeas+0].dM = NAN; 123 catalog->measure[Nmeas+1].R = catalog->average[Nave].R; 124 catalog->measure[Nmeas+1].D = catalog->average[Nave].D; 125 catalog->measure[Nmeas+1].dM = NAN; 126 127 catalog->measure[Nmeas+0].photcode = USNO_RED; 128 catalog->measure[Nmeas+0].M = fabs (0.1*(buf[2] - 1000*((int)(buf[2]/1000)))); 129 catalog->measure[Nmeas+1].photcode = USNO_BLUE; 130 catalog->measure[Nmeas+1].M = fabs (0.1*((int)(buf[2] - 1000000*((int)(buf[2]/1000000))) / 1000)); 131 132 catalog->average[Nave].Nmeasure = 2; 133 catalog->average[Nave].measureOffset = Nmeas; 134 135 Nave ++; 136 Nmeas += 2; 137 138 CHECK_REALLOCATE (catalog->average, Average, NAVE, Nave, 1000); 139 CHECK_REALLOCATE (catalog->measure, Measure, NMEAS, Nmeas, 1000); 131 140 } 132 141 free (buffer); 133 142 fclose (f); 134 143 } 135 REALLOCATE (stars, Stars, Nusno); 144 catalog->Naverage = Nave; 145 catalog->Nmeasure = Nmeas; 136 146 137 *nstars = Nusno; 138 if (VERBOSE) fprintf (stderr, "%d stars from USNO 1.0\n", Nusno); 139 return (stars); 147 if (VERBOSE) fprintf (stderr, "%d stars from USNO 1.0\n", Nave); 148 return (catalog); 140 149 } 141 150
Note:
See TracChangeset
for help on using the changeset viewer.
