Changeset 38594
- Timestamp:
- Jul 16, 2015, 8:21:43 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150625/Ohana/src/addstar
- Files:
-
- 10 edited
-
Makefile (modified) (4 diffs)
-
include/WISE.h (modified) (1 diff)
-
include/supercos.h (modified) (1 diff)
-
src/load2mass_as_rawdata.c (modified) (3 diffs)
-
src/loadsupercos.c (modified) (3 diffs)
-
src/loadsupercos_ops.c (modified) (1 diff)
-
src/loadsupercos_rawdata.c (modified) (9 diffs)
-
src/loadtycho_rawdata.c (modified) (5 diffs)
-
src/loadwise_rawdata.c (modified) (6 diffs)
-
src/loadwise_star_full.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150625/Ohana/src/addstar/Makefile
r38593 r38594 37 37 mkcmf : $(BIN)/mkcmf.$(ARCH) 38 38 39 # programs in 'OTHERS' have not been updated since moving from Stars to Catalog as an internal carrier40 39 # programs in 'SERVER' use the client-server concept and are out of date 41 40 42 INSTALL = addstar sedstar loadstarpar loadstarpar_client loadICRF loadICRF_client load2mass skycells mkcmf dumpskycells findskycell 43 OTHERS = loadwise loadtycho loadsupercos 41 INSTALL = addstar sedstar loadstarpar loadstarpar_client loadICRF loadICRF_client load2mass loadwise loadtycho loadsupercos skycells mkcmf dumpskycells findskycell 44 42 SERVER = addstar_client addstarc addstard addstart 45 43 46 old: $(OTHERS)47 44 all: $(INSTALL) 48 45 … … 355 352 $(SRC)/ConfigInit.$(ARCH).o \ 356 353 $(SRC)/Shutdown.$(ARCH).o \ 357 $(SRC)/StarOps.$(ARCH).o \358 354 $(SRC)/find_matches_refstars.$(ARCH).o \ 359 355 $(SRC)/build_links.$(ARCH).o \ … … 372 368 $(SRC)/Shutdown.$(ARCH).o \ 373 369 $(SRC)/find_matches_closest_refstars.$(ARCH).o \ 370 $(SRC)/replace_match.$(ARCH).o \ 374 371 $(SRC)/build_links.$(ARCH).o \ 375 372 $(SRC)/SetSignals.$(ARCH).o \ … … 387 384 $(SRC)/ConfigInit.$(ARCH).o \ 388 385 $(SRC)/Shutdown.$(ARCH).o \ 389 $(SRC)/S tarOps.$(ARCH).o \386 $(SRC)/SkyListForStars.$(ARCH).o \ 390 387 $(SRC)/find_matches_refstars.$(ARCH).o \ 391 388 $(SRC)/build_links.$(ARCH).o \ -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/include/WISE.h
r38062 r38594 35 35 int getWISE_sortStars (WISE_Stars *tstars, int Ntstars); 36 36 37 int loadwise_star_prelim (Stars **star, char *line, int Nmax);38 int loadwise_star_allsky (Stars **star, char *line, int Nmax);39 int loadwise_star_allwise ( Stars **star, char *line, int Nmax);37 int loadwise_star_prelim (Measure *measure, char *line, int Nmax); 38 int loadwise_star_allsky (Measure *measure, char *line, int Nmax); 39 int loadwise_star_allwise (Measure *measure, char *line, int Nmax); 40 40 41 41 42 42 char *nextWISEfield (char *line); 43 int setWISE_cc_flag (Stars *star, char qual);44 int setWISE_ph_qual (Stars *star, char qual);45 int setWISE_rd_flag (Stars *star, char qual);46 int setWISE_bl_flag (Stars *star, char qual);47 int setWISE_gal_flag ( Stars *star, char qual);48 int setWISE_mp_flag (Stars *star, char qual);49 int setWISE_dup_flag ( Stars *star, char qual);50 int setWISE_use_flag ( Stars *star, char qual);43 int setWISE_cc_flag (Measure *measure, char qual); 44 int setWISE_ph_qual (Measure *measure, char qual); 45 int setWISE_rd_flag (Measure *measure, char qual); 46 int setWISE_bl_flag (Measure *measure, char qual); 47 int setWISE_gal_flag (Measure *measure, char qual); 48 int setWISE_mp_flag (Measure *measure, char qual); 49 int setWISE_dup_flag (Measure *measure, char qual); 50 int setWISE_use_flag (Measure *measure, char qual); 51 51 52 52 char *skipNbounds (char *line, char bound, int Nbound, int Nbyte); -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/include/supercos.h
r33653 r38594 80 80 Image *loadsupercos_plates (Survey *survey, int Nsurvey, char *filename, int *nimage); 81 81 int loadsupercos_getFilterInfo (char *line, char *emulsion, char *filterID); 82 int loadsupercos_rawdata (Image *image, int *imlist, int Nimage, SkyList *skytable, char *filename, AddstarClientOptions options); 83 int loadsupercos_sortStars (Stars *tstars, int Ntstars); 82 int loadsupercos_rawdata (Image *image, int *imlist, int Nimage, SkyTable *skytable, char *filename, AddstarClientOptions options); 84 83 int *loadsupercos_image_index (Image *image, int Nimage); 85 84 int loadsupercos_getST (char *line, double *st); -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/load2mass_as_rawdata.c
r38593 r38594 12 12 int load2mass_as_rawdata (SkyList *skytable, char *filename, AddstarClientOptions options) { 13 13 14 int i, j, verbose;14 int i, j, k, verbose; 15 15 int Ntstars, NTSTARS; 16 16 int Nbyte, Nextra, offset; … … 146 146 147 147 dvo_average_init (&newcat->average[Nave]); 148 dvo_measure_init (&newcat->measure[Nmeas+0]);149 dvo_measure_init (&newcat->measure[Nmeas+1]);150 dvo_measure_init (&newcat->measure[Nmeas+2]);148 for (k = 0; k < 4; k++) { 149 dvo_measure_init (&newcat->measure[Nmeas+k]); 150 } 151 151 152 152 newcat->average[Nave].R = tstars[j].R; … … 174 174 } 175 175 176 if (DEBUG) fprintf (stderr, "selected %d stars (%10.6f - %10.6f, %10.6f - %10.6f)\n", (int) newcat->Naverage, 176 if (DEBUG) fprintf (stderr, "selected %d stars (%10.6f - %10.6f, %10.6f - %10.6f)\n", 177 (int) newcat->Naverage, 177 178 region[0].Rmin, region[0].Rmax, region[0].Dmin, region[0].Dmax); 178 179 -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadsupercos.c
r38441 r38594 15 15 int i, status; 16 16 SkyTable *sky; 17 SkyList *skylist = NULL;18 17 AddstarClientOptions options; 19 18 FITS_DB db; … … 27 26 SkyTableSetFilenames (sky, CATDIR, "cpt"); 28 27 29 // generate the subset matching the user-selected region30 skylist = SkyListByPatch (sky, -1, &UserPatch);31 32 // if we only match to existing (already populated) regions, limit the select to those regions:33 if (options.existing_regions) {34 SkyList *tmp;35 tmp = SkyListExistingSubset (skylist, CATDIR);36 SkyListFree (skylist);37 skylist = tmp;38 }39 40 28 // load the images table (needed regardless) 41 29 int Nsurvey = 0; … … 68 56 for (i = 3; i < argc; i++) { 69 57 fprintf (stderr, "loading %s\n", argv[i]); 70 loadsupercos_rawdata (image, imlist, Nimage, sky list, argv[i], options);58 loadsupercos_rawdata (image, imlist, Nimage, sky, argv[i], options); 71 59 } 72 60 exit (0); -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadsupercos_ops.c
r37036 r38594 79 79 } 80 80 81 int loadsupercos_sortStars (Stars *tstars, int Ntstars) {82 83 # define SWAPFUNC(A,B){ Stars temp = tstars[A]; tstars[A] = tstars[B]; tstars[B] = temp; }84 # define COMPARE(A,B)(tstars[A].average.R < tstars[B].average.R)85 86 OHANA_SORT (Ntstars, COMPARE, SWAPFUNC);87 88 # undef SWAPFUNC89 # undef COMPARE90 91 return TRUE;92 }93 94 81 int *loadsupercos_image_index (Image *image, int Nimage) { 95 82 -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadsupercos_rawdata.c
r38471 r38594 6 6 # define DEBUG 0 7 7 8 int loadsupercos_rawdata (Image *image, int *imlist, int Nimage, Sky List*skytable, char *filename, AddstarClientOptions options) {8 int loadsupercos_rawdata (Image *image, int *imlist, int Nimage, SkyTable *skytable, char *filename, AddstarClientOptions options) { 9 9 10 int i , j, verbose;11 int N stars, NSTARS, Nrecords;10 int i; 11 int Nrecords; 12 12 13 13 FILE *f; … … 15 15 16 16 Detection *sstars; 17 Stars **stars, *tstars;18 SkyList *skylist;19 SkyRegion *region;20 17 Catalog catalog; 21 18 … … 26 23 if (f == NULL) Shutdown ("can't read the Supercosmos data file: %s", filename); 27 24 28 ALLOCATE (tstars, Stars, NRECORDS);29 25 ALLOCATE (sstars, Detection, NRECORDS); 30 26 … … 33 29 double Dmin = +90.0; 34 30 double Dmax = -90.0; 31 32 Catalog *newcat = NULL; 33 ALLOCATE (newcat, Catalog, 1); 34 dvo_catalog_init (newcat, TRUE); 35 ALLOCATE (newcat->average, Average, NRECORDS); 36 ALLOCATE (newcat->measure, Measure, NRECORDS); 35 37 36 38 while ((Nrecords = fread (buffer, NBYTE, NRECORDS, f)) != 0) { … … 62 64 // convert to the Stars format 63 65 for (i = 0; i < Nrecords; i++) { 64 InitStar (&tstars[i]);65 tstars[i].measure.Xccd = sstars[i].xCen;66 tstars[i].measure.Yccd = sstars[i].yCen;67 66 68 tstars[i].measure.M = sstars[i].sMag; 69 tstars[i].measure.Map = sstars[i].gMag; 70 tstars[i].measure.photFlags = sstars[i].class; 67 dvo_average_init (&newcat->average[i]); 68 dvo_measure_init (&newcat->measure[i]); 71 69 72 tstars[i].average.R = sstars[i].ra;73 tstars[i].average.D = sstars[i].dec;70 newcat->measure[i].Xccd = sstars[i].xCen; 71 newcat->measure[i].Yccd = sstars[i].yCen; 74 72 75 tstars[i].measure.R = sstars[i].ra; 76 tstars[i].measure.D = sstars[i].dec; 73 newcat->measure[i].M = sstars[i].sMag; 74 newcat->measure[i].Map = sstars[i].gMag; 75 newcat->measure[i].photFlags = sstars[i].class; 76 77 newcat->average[i].R = sstars[i].ra; 78 newcat->average[i].D = sstars[i].dec; 79 80 newcat->measure[i].R = sstars[i].ra; 81 newcat->measure[i].D = sstars[i].dec; 77 82 78 83 int Ni = imlist[sstars[i].plateID]; … … 80 85 81 86 // XXX fix these 82 tstars[i].measure.Mcal = 0.0;83 tstars[i].measure.dt = image[Ni].exptime;87 newcat->measure[i].Mcal = 0.0; 88 newcat->measure[i].dt = image[Ni].exptime; 84 89 85 90 double sidtime = image[Ni].sidtime; … … 87 92 88 93 double alt, az; 89 altaz (&alt, &az, 15.0*sidtime - tstars[i].average.R, tstars[i].average.D, latitude);94 altaz (&alt, &az, 15.0*sidtime - newcat->average[i].R, newcat->average[i].D, latitude); 90 95 91 tstars[i].measure.airmass = 1.0 / cos(RAD_DEG*alt);92 tstars[i].measure.az = az;93 tstars[i].measure.t = image[Ni].tzero;94 tstars[i].measure.imageID = image[Ni].imageID;95 tstars[i].measure.photcode = image[Ni].photcode;96 newcat->measure[i].airmass = 1.0 / cos(RAD_DEG*alt); 97 newcat->measure[i].az = az; 98 newcat->measure[i].t = image[Ni].tzero; 99 newcat->measure[i].imageID = image[Ni].imageID; 100 newcat->measure[i].photcode = image[Ni].photcode; 96 101 97 tstars[i].measure.FWx = ToShortPixels(sstars[i].aU);98 tstars[i].measure.FWy = ToShortPixels(sstars[i].bU);99 tstars[i].measure.theta = ToShortDegrees(sstars[i].thetaU);102 newcat->measure[i].FWx = ToShortPixels(sstars[i].aU); 103 newcat->measure[i].FWy = ToShortPixels(sstars[i].bU); 104 newcat->measure[i].theta = ToShortDegrees(sstars[i].thetaU); 100 105 101 Rmin = MIN (Rmin, tstars[i].average.R);102 Rmax = MAX (Rmax, tstars[i].average.R);103 Dmin = MIN (Dmin, tstars[i].average.D);104 Dmax = MAX (Dmax, tstars[i].average.D);106 Rmin = MIN (Rmin, newcat->average[i].R); 107 Rmax = MAX (Rmax, newcat->average[i].R); 108 Dmin = MIN (Dmin, newcat->average[i].D); 109 Dmax = MAX (Dmax, newcat->average[i].D); 105 110 } 106 111 107 112 if (VERBOSE) fprintf (stderr, "scan %d stars (%10.6f - %10.6f, %10.6f - %10.6f) .. ", Nrecords, Rmin, Rmax, Dmin, Dmax); 108 113 109 // sort the tstars by RA 110 loadsupercos_sortStars (tstars, Nrecords); 114 SkyList *skylist = SkyListForStars (skytable, -1, newcat); 111 115 112 // scan through the stars, loading the containing catalogs 113 // skip through table for unsaved stars 114 for (i = 0; i < Nrecords; i++) { 115 if (tstars[i].found != -1) continue; 116 for (i = 0; i < skylist[0].Nregions; i++) { 117 // now we have all of the loaded stars in this catalog 118 dvo_catalog_init (&catalog, TRUE); 119 catalog.filename = skylist[0].filename[0]; 120 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 121 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 122 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT; 123 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 116 124 117 // scan forward until we reach the UserPatch (stars sorted by RA) 118 if (tstars[i].average.R < UserPatch.Rmin) continue; 119 if (tstars[i].average.R > UserPatch.Rmax) break; 120 if (tstars[i].average.D < UserPatch.Dmin) continue; 121 if (tstars[i].average.D > UserPatch.Dmax) continue; 122 123 // identify the relevant catalog 124 skylist = SkyRegionByPoint_List (skytable, -1, tstars[i].average.R, tstars[i].average.D); 125 if (skylist[0].Nregions == 0) { 126 SkyListFree (skylist); 127 continue; 128 } 129 region = skylist[0].regions[0]; 130 if (DEBUG) fprintf (stderr, "writing to %s\n", skylist[0].filename[0]); 131 132 int this_image_id = tstars[i].measure.imageID; 133 134 // loop over stars in this WISE region that are also in this output region 135 Nstars = 0; 136 NSTARS = 1000; 137 ALLOCATE (stars, Stars *, NSTARS); 138 139 for (j = i; j < Nrecords; j++) { 140 if (tstars[j].found != -1) continue; 141 142 if (tstars[j].measure.imageID != this_image_id) continue; 143 144 // check if in skyregion 145 if (tstars[j].average.R < region[0].Rmin) continue; 146 if (tstars[j].average.R > region[0].Rmax) break; 147 if (tstars[j].average.D < region[0].Dmin) continue; 148 if (tstars[j].average.D > region[0].Dmax) continue; 149 150 // check if in UserPatch 151 if (tstars[j].average.R < UserPatch.Rmin) continue; 152 if (tstars[j].average.R > UserPatch.Rmax) break; 153 if (tstars[j].average.D < UserPatch.Dmin) continue; 154 if (tstars[j].average.D > UserPatch.Dmax) continue; 155 156 stars[Nstars] = &tstars[j]; 157 Nstars ++; 158 159 CHECK_REALLOCATE (stars, Stars *, NSTARS, Nstars, 1000); 160 } 161 162 if (DEBUG) fprintf (stderr, "selected %d stars (%10.6f - %10.6f, %10.6f - %10.6f)\n", Nstars, 163 region[0].Rmin, region[0].Rmax, region[0].Dmin, region[0].Dmax); 164 165 if (1) { 166 verbose = VERBOSE; 167 VERBOSE = FALSE; 168 169 // now we have all of the loaded stars in this catalog 170 dvo_catalog_init (&catalog, TRUE); 171 catalog.filename = skylist[0].filename[0]; 172 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 173 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 174 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT; 175 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 176 177 // an error exit status here is a significant error 178 if (!dvo_catalog_open (&catalog, skylist[0].regions[0], VERBOSE, "w")) { 179 fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename); 180 exit (2); 181 } 182 183 // assume no input star matches an existing star 184 // simply add to the existing table 185 // loadWISE_catalog (&catalog, stars, Nstars); 186 find_matches_refstars (skylist[0].regions[0], stars, Nstars, &catalog, options); 187 // loadWISE_catalog (&catalog, stars, Nstars); 188 189 dvo_catalog_save (&catalog, VERBOSE); 190 dvo_catalog_unlock (&catalog); 191 dvo_catalog_free (&catalog); 192 // free (catalog.filename); 193 // XXX don't free this! it points to an element of the skytable 125 // an error exit status here is a significant error 126 if (!dvo_catalog_open (&catalog, skylist[0].regions[0], VERBOSE, "w")) { 127 fprintf (stderr, "ERROR: failure to open/create catalog file %s\n", catalog.filename); 128 exit (2); 194 129 } 195 130 196 SkyListFree (skylist); 131 // assume no input star matches an existing star 132 // simply add to the existing table 133 find_matches_refstars (skylist[0].regions[0], newcat, &catalog, options); 197 134 198 free (stars); 199 VERBOSE = verbose; 135 dvo_catalog_save (&catalog, VERBOSE); 136 dvo_catalog_unlock (&catalog); 137 dvo_catalog_free (&catalog); 200 138 } 139 140 SkyListFree (skylist); 141 dvo_catalog_free (newcat); 142 free (newcat); 143 201 144 if (VERBOSE) fprintf (stderr, "done\n"); 202 145 } … … 204 147 if (VERBOSE) fprintf (stderr, "\n"); 205 148 206 free (tstars);207 149 free (sstars); 208 150 … … 225 167 */ 226 168 169 170 171 172 173 174 175 176 177 178 179 180 181 -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadtycho_rawdata.c
r38471 r38594 22 22 23 23 Tycho_Stars *tstars; 24 Stars *stars, **starrefs; // this is an array of pointers to be consistent with input to find_match_refstars25 24 SkyList *skylist; 26 25 SkyRegion *region; … … 87 86 if (DEBUG) fprintf (stderr, "writing to %s\n", skylist[0].filename[0]); 88 87 89 // collect array of (Stars *) stars in a new output catalog 90 int Nstars = 0; 91 int NSTARS = (NGROUP*1000); 92 ALLOCATE (stars, Stars, NSTARS); 88 int Nave = 0; 89 int Nmeas = 0; 90 int NAVE = 1000; 91 int NMEAS = 4000; 92 93 Catalog *newcat = NULL; 94 ALLOCATE (newcat, Catalog, 1); 95 dvo_catalog_init (newcat, TRUE); 96 ALLOCATE (newcat->average, Average, NAVE); 97 ALLOCATE (newcat->measure, Measure, NMEAS); 93 98 94 99 // loop over stars in this WISE region that are also in this output region … … 108 113 if (tstars[j].average.D > UserPatch.Dmax) continue; 109 114 110 for (k = 0; k < NGROUP; k++) { 111 stars[Nstars+k].average = tstars[j].average; 112 stars[Nstars+k].measure = tstars[j].measure[k]; 113 stars[Nstars+k].found = -1; 114 } 115 dvo_average_init (&newcat->average[Nave]); 116 newcat->average[Nave] = tstars[j].average; 117 for (k = 0; k < NGROUP; k++) { 118 dvo_measure_init (&newcat->measure[Nmeas + k]); 119 newcat->measure[Nmeas + k] = tstars[j].measure[k]; 120 } 115 121 tstars[j].flag = TRUE; 116 122 117 Nstars += NGROUP; 118 if (Nstars >= NSTARS - NGROUP) { 119 NSTARS += (NGROUP*1000); 120 REALLOCATE (stars, Stars, NSTARS); 121 } 123 newcat->average[Nave].Nmeasure = NGROUP; 124 newcat->average[Nave].measureOffset = Nmeas; 125 126 Nave ++; 127 Nmeas += NGROUP; 128 129 CHECK_REALLOCATE (newcat->average, Average, NAVE, Nave, 1000); 130 CHECK_REALLOCATE (newcat->measure, Measure, NMEAS, Nmeas + NGROUP, 4000); 122 131 } 132 newcat->Naverage = Nave; 133 newcat->Nmeasure = Nmeas; 123 134 124 ALLOCATE (starrefs, Stars *, NSTARS); 125 for (j = 0; j < Nstars; j++) { 126 starrefs[j] = &stars[j]; 135 if (!newcat->Naverage) { 136 dvo_catalog_free (newcat); 137 free (newcat); 138 continue; 127 139 } 128 140 … … 145 157 // assume no input star matches an existing star 146 158 // simply add to the existing table 147 find_matches_closest_refstars(region, starrefs, Nstars, &catalog, options);159 find_matches_closest_refstars(region, newcat, &catalog, options); 148 160 149 161 dvo_catalog_save (&catalog, verbose); … … 152 164 153 165 SkyListFree (skylist); 154 free (stars);155 free ( starrefs);166 dvo_catalog_free (newcat); 167 free (newcat); 156 168 } 157 169 free (tstars); -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadwise_rawdata.c
r38471 r38594 13 13 14 14 int i, j, k, verbose; 15 int N stars, NSTARS, Ntstars, NTSTARS;15 int Ntstars, NTSTARS; 16 16 int Nbyte, Nextra, offset; 17 17 … … 21 21 char *buffer, *p, *q; 22 22 23 Stars **stars; // this is an array of pointers to be consistent with input to find_match_refstars24 23 WISE_Stars *tstars; 25 24 SkyList *skylist; … … 117 116 if (DEBUG) fprintf (stderr, "writing to %s\n", skylist[0].filename[0]); 118 117 119 // collect array of (Stars *) stars in a new output catalog 120 Nstars = 0; 121 NSTARS = 3000; 122 ALLOCATE (stars, Stars *, NSTARS); 118 int Nave = 0; 119 int Nmeas = 0; 120 int NAVE = 1000; 121 int NMEAS = 4000; 122 123 Catalog *newcat = NULL; 124 ALLOCATE (newcat, Catalog, 1); 125 dvo_catalog_init (newcat, TRUE); 126 ALLOCATE (newcat->average, Average, NAVE); 127 ALLOCATE (newcat->measure, Measure, NMEAS); 123 128 124 129 // loop over stars in this WISE region that are also in this output region … … 140 145 offset = tstars[j].offset; 141 146 147 dvo_average_init (&newcat->average[Nave]); 142 148 for (k = 0; k < 4; k++) { 143 ALLOCATE (stars[Nstars + k], Stars, 1); 144 InitStar (stars[Nstars + k]); 145 stars[Nstars+k][0].average.R = tstars[j].R; 146 stars[Nstars+k][0].average.D = tstars[j].D; 147 stars[Nstars+k][0].measure.R = tstars[j].R; 148 stars[Nstars+k][0].measure.D = tstars[j].D; 149 } 149 dvo_measure_init (&newcat->measure[Nmeas+k]); 150 } 150 151 152 newcat->average[Nave].R = tstars[j].R; 153 newcat->average[Nave].D = tstars[j].D; 154 151 155 switch (MODE) { 152 156 case MODE_PRELIM: 153 loadwise_star_prelim (& stars[Nstars], &buffer[offset], Nbyte - offset);157 loadwise_star_prelim (&newcat->measure[Nmeas], &buffer[offset], Nbyte - offset); 154 158 break; 155 159 case MODE_ALLSKY: 156 loadwise_star_allsky (& stars[Nstars], &buffer[offset], Nbyte - offset);160 loadwise_star_allsky (&newcat->measure[Nmeas], &buffer[offset], Nbyte - offset); 157 161 break; 158 162 case MODE_ALLWISE: 159 loadwise_star_allwise (& stars[Nstars], &buffer[offset], Nbyte - offset);163 loadwise_star_allwise (&newcat->measure[Nmeas], &buffer[offset], Nbyte - offset); 160 164 break; 161 165 default: … … 165 169 tstars[j].flag = TRUE; 166 170 167 Nstars += 4; 168 if (Nstars >= NSTARS - 4) { 169 NSTARS += 4000; 170 REALLOCATE (stars, Stars *, NSTARS); 171 } 172 } 173 174 if (!Nstars) { 175 free (stars); 171 newcat->average[Nave].Nmeasure = 4; 172 newcat->average[Nave].measureOffset = Nmeas; 173 174 Nave ++; 175 Nmeas += 4; 176 177 CHECK_REALLOCATE (newcat->average, Average, NAVE, Nave, 1000); 178 CHECK_REALLOCATE (newcat->measure, Measure, NMEAS, Nmeas, 4000); 179 } 180 newcat->Naverage = Nave; 181 newcat->Nmeasure = Nmeas; 182 183 if (!newcat->Naverage) { 184 dvo_catalog_free (newcat); 185 free (newcat); 176 186 continue; 177 187 } 178 188 179 if (DEBUG) fprintf (stderr, "selected %d stars (%10.6f - %10.6f, %10.6f - %10.6f)\n", Nstars, 189 if (DEBUG) fprintf (stderr, "selected %d stars (%10.6f - %10.6f, %10.6f - %10.6f)\n", 190 (int) newcat->Naverage, 180 191 region[0].Rmin, region[0].Rmax, region[0].Dmin, region[0].Dmax); 181 192 … … 200 211 // assume no input star matches an existing star 201 212 // simply add to the existing table 202 // loadWISE_catalog (&catalog, stars, Nstars); 203 find_matches_refstars (skylist[0].regions[0], stars, Nstars, &catalog, options); 204 // loadWISE_catalog (&catalog, stars, Nstars); 213 find_matches_refstars (skylist[0].regions[0], newcat, &catalog, options); 205 214 206 215 dvo_catalog_save (&catalog, VERBOSE); 207 216 dvo_catalog_unlock (&catalog); 208 217 dvo_catalog_free (&catalog); 209 // free (catalog.filename);210 // XXX don't free this! it points to an element of the skytable211 218 } 212 219 213 220 SkyListFree (skylist); 214 for (j = 0; j < Nstars; j++) free (stars[j]);215 free ( stars);221 dvo_catalog_free (newcat); 222 free (newcat); 216 223 VERBOSE = verbose; 217 224 } -
branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadwise_star_full.c
r38593 r38594 242 242 243 243 for (i = 0; i < 4; i++) { 244 setWISE_ph_qual ( star[i], ptr[i]); // ph_qual244 setWISE_ph_qual (&measure[i], ptr[i]); // ph_qual 245 245 } 246 246 … … 343 343 344 344 // set blend flags for all 4 measures 345 setWISE_blend_flag ( star, ptr); // nb & na both used here345 setWISE_blend_flag (measure, ptr); // nb & na both used here 346 346 ptr = skipNbounds (ptr, '|', 2, Nmax); // skip: nb, na 347 347 348 348 for (i = 0; i < 4; i++) { 349 setWISE_sat_flag ( star[i], ptr); // w1sat349 setWISE_sat_flag (&measure[i], ptr); // w1sat 350 350 ptr = nextWISEfield (ptr); 351 351 } … … 353 353 354 354 for (i = 0; i < 4; i++) { 355 setWISE_cc_flag ( star[i], ptr[i]); // cc_flg355 setWISE_cc_flag (&measure[i], ptr[i]); // cc_flg 356 356 } 357 357 ptr = nextWISEfield (ptr); // skip cc_flags 358 358 359 359 // set ext flags for all 4 measures 360 setWISE_ext_flag_prelim ( star, *ptr); // ext_flg360 setWISE_ext_flag_prelim (measure, *ptr); // ext_flg 361 361 ptr = nextWISEfield (ptr); // skip ext_flags 362 362 363 363 for (i = 0; i < 4; i++) { 364 setWISE_var_flag_prelim ( star[i], ptr[i]); // var_flg364 setWISE_var_flag_prelim (&measure[i], ptr[i]); // var_flg 365 365 } 366 366 ptr = nextWISEfield (ptr); // skip var_flags 367 367 368 368 for (i = 0; i < 4; i++) { 369 setWISE_ph_qual ( star[i], ptr[i]); // ph_qual369 setWISE_ph_qual (&measure[i], ptr[i]); // ph_qual 370 370 } 371 371
Note:
See TracChangeset
for help on using the changeset viewer.
