Changeset 16698
- Timestamp:
- Feb 27, 2008, 5:16:06 PM (18 years ago)
- Location:
- branches/eam_branch_20080223/Ohana/src/addstar
- Files:
-
- 9 added
- 20 edited
-
Makefile (modified) (6 diffs)
-
doc/2mass.txt (added)
-
doc/sdss-tsObj.txt (added)
-
doc/sdss.txt (modified) (1 diff)
-
include/2mass.h (modified) (1 diff)
-
include/addstar.h (modified) (4 diffs)
-
src/FilterStars.c (modified) (1 diff)
-
src/GetFileMode.c (modified) (1 diff)
-
src/ImageOptions.c (modified) (4 diffs)
-
src/LoadData.c (added)
-
src/LoadDataSDSS.c (added)
-
src/LoadHeaders.c (added)
-
src/LoadStars.c (modified) (4 diffs)
-
src/MatchHeaders.c (added)
-
src/ReadImageHeader.c (modified) (1 diff)
-
src/ReadSDSSHeader.c (added)
-
src/ReadStarsFITS.c (modified) (5 diffs)
-
src/ReadStarsSDSS.c (added)
-
src/ReadStarsTEXT.c (modified) (1 diff)
-
src/SEDfit.c (modified) (1 diff)
-
src/UpdateImageIDs.c (modified) (4 diffs)
-
src/addstarc.c (modified) (1 diff)
-
src/fakeimage.c (modified) (2 diffs)
-
src/find_matches.c (modified) (5 diffs)
-
src/find_matches_closest.c (modified) (5 diffs)
-
src/find_matches_refstars.c (modified) (5 diffs)
-
src/get2mass_full.c (added)
-
src/load2mass_as_rawdata.c (modified) (1 diff)
-
src/load2mass_catalog.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080223/Ohana/src/addstar/Makefile
r16040 r16698 13 13 14 14 # programs may add their own internal requirements here 15 FULL_CFLAGS = $(BASE_CFLAGS) 15 FULL_CFLAGS = $(BASE_CFLAGS) -Wall -Werror 16 16 FULL_CPPFLAGS = $(BASE_CPPFLAGS) 17 17 FULL_LDFLAGS = -lkapa -ldvo -lFITS -lohana $(BASE_LDFLAGS) … … 59 59 $(SRC)/grefstars.$(ARCH).o \ 60 60 $(SRC)/LoadStars.$(ARCH).o \ 61 $(SRC)/LoadHeaders.$(ARCH).o \ 62 $(SRC)/MatchHeaders.$(ARCH).o \ 63 $(SRC)/LoadData.$(ARCH).o \ 64 $(SRC)/LoadDataSDSS.$(ARCH).o \ 61 65 $(SRC)/in_image.$(ARCH).o \ 62 66 $(SRC)/load_subpix.$(ARCH).o \ … … 67 71 $(SRC)/ReadStarsFITS.$(ARCH).o \ 68 72 $(SRC)/ReadStarsTEXT.$(ARCH).o \ 73 $(SRC)/ReadStarsSDSS.$(ARCH).o \ 69 74 $(SRC)/FilterStars.$(ARCH).o \ 70 75 $(SRC)/ImageOptions.$(ARCH).o \ 71 76 $(SRC)/GetFileMode.$(ARCH).o \ 72 77 $(SRC)/ReadImageHeader.$(ARCH).o \ 78 $(SRC)/UpdateImageIDs.$(ARCH).o \ 73 79 $(SRC)/update_coords.$(ARCH).o 74 80 … … 165 171 $(SRC)/ConfigInit.$(ARCH).o \ 166 172 $(SRC)/LoadStars.$(ARCH).o \ 173 $(SRC)/LoadHeaders.$(ARCH).o \ 174 $(SRC)/MatchHeaders.$(ARCH).o \ 175 $(SRC)/LoadData.$(ARCH).o \ 176 $(SRC)/LoadDataSDSS.$(ARCH).o \ 167 177 $(SRC)/grefstars.$(ARCH).o \ 168 178 $(SRC)/load_subpix.$(ARCH).o \ … … 172 182 $(SRC)/ReadImageHeader.$(ARCH).o \ 173 183 $(SRC)/ReadStarsTEXT.$(ARCH).o \ 184 $(SRC)/ReadStarsSDSS.$(ARCH).o \ 185 $(SRC)/UpdateImageIDs.$(ARCH).o \ 174 186 $(SRC)/FilterStars.$(ARCH).o \ 175 187 $(SRC)/Shutdown.$(ARCH).o \ … … 189 201 $(SRC)/load2mass_catalog.$(ARCH).o \ 190 202 $(SRC)/get2mass_ops.$(ARCH).o \ 203 $(SRC)/get2mass_full.$(ARCH).o \ 191 204 $(SRC)/find_matches_refstars.$(ARCH).o \ 192 205 $(SRC)/args_load2mass.$(ARCH).o \ -
branches/eam_branch_20080223/Ohana/src/addstar/doc/sdss.txt
r16657 r16698 9 9 * some re-org might be needed for LoadStars 10 10 11 12 ** fields to keep: 13 14 name sdss 15 X 'objc_colc' (or colc) 16 Y 'objc_rowc' (or rowc) 17 dX 'objc_colcErr' (or colcErr) 18 dY 'objc_rowcErr' (or rowcErr) 19 R ra + offset Ra (get cos des right) 20 D dec + offset Dec 21 dR (calculate from dX * plate scale?) 22 dD (calculate from dX * plate scale?) 23 uR (from 'propermotion' and 'propermotionangle') 24 uD (from 'propermotion' and 'propermotionangle') 25 duR ? 26 duD ? 27 P X 28 dP X 29 M psfCounts (is already a mag?) 30 dM psfCountsErr (is already a mag?) 31 sky sky (convert to flux?) 32 dsky skyErr (convert to flux?) 33 fx ? 34 fy ? 35 df ? 36 Mgal X 37 Map X 38 Mpeak X 39 detID X 40 found -1 41 t MJD_U + Y*rate 42 dt fixed? NY*rate 43 psfChisq 44 crNsigma 45 extNsigma 46 psfQual 47 Mcal 48 airmass 49 az 50 code 51 nFrames 52 flags 53 dophot 54 dummy 55 56 we can use these header fields to get the exp times, and I suppose alt, az, airmass, etc: 57 NODE = XXX.XXXXXX / Ascending node of great circle scanned (deg) 58 INCL = XXX.XXXXXX / Inclincation of great circle scanned (deg) 59 C_OBS = XXXXX.XXX / CCD clock rate (usec/unbinned-row) 60 TRACKING= XXXXX.XXX / Tracking rate (arcsec/TAI-sec) -
branches/eam_branch_20080223/Ohana/src/addstar/include/2mass.h
r8361 r16698 42 42 int get2mass_star (Stars *star, char *line, int Nmax); 43 43 int get2mass_3star (Stars *star, char *line, int Nmax); 44 45 int get2mass_3star_full (Stars *star, char *line, int Nmax); 46 char *next2MASSfield (char *line); 47 int set2MASS_ph_qual (Stars *star, char qual); 48 int set2MASS_rd_flag (Stars *star, char qual); 49 int set2MASS_cc_flag (Stars *star, char qual); 50 int set2MASS_bl_flag (Stars *star, char qual); 51 int set2MASS_gal_flag (Stars *star, char qual); 52 int set2MASS_mp_flag (Stars *star, char qual); 53 int set2MASS_dup_flag (Stars *star, char qual); 54 int set2MASS_use_flag (Stars *star, char qual); -
branches/eam_branch_20080223/Ohana/src/addstar/include/addstar.h
r15210 r16698 51 51 52 52 enum {M_IMAGE, M_REFLIST, M_REFCAT, M_FAKEIMAGE, M_RESORT}; 53 enum {NONE, SIMPLE_CMP, SIMPLE_CMF, SIMPLE_MEF, MOSAIC_CMP, MOSAIC_CMF, MOSAIC_MEF, MOSAIC_PHU };53 enum {NONE, SIMPLE_CMP, SIMPLE_CMF, SIMPLE_MEF, MOSAIC_CMP, MOSAIC_CMF, MOSAIC_MEF, MOSAIC_PHU, SDSS_OBJ}; 54 54 /* note: MEF implies CMF */ 55 55 … … 163 163 Stars *grefstars PROTO((char *file, int photcode, int *Nstars)); 164 164 165 Stars *LoadStars PROTO((char *file, int *Nstars, Image **images, int *Nimages, int photcode));165 Stars *LoadStars PROTO((char *file, int *Nstars, Image **images, int *Nimages, AddstarClientOptions *options)); 166 166 Header **LoadHeaders PROTO((FILE *f, int *mode, int *Nheader)); 167 167 HeaderSet *MatchHeaders PROTO((int **extsize, int *nimage, int mode, Header **headers, int Nheaders)); … … 185 185 Stars *ReadStarsFITS PROTO((FILE *f, Header *header, Header *in_theader, unsigned int *nstars)); 186 186 Stars *ReadStarsTEXT PROTO((FILE *f, unsigned int *nstars)); 187 Stars *ReadStarsSDSS PROTO((FILE *f, char *name, Header *header, Header *in_theader, Image *images, int *nimages, unsigned int *nstars)); 187 188 int ReadImageHeader PROTO((Header *header, Image *image, int photcode)); 188 Stars *FilterStars PROTO((Stars *instars, Image *image ));189 Stars *FilterStars PROTO((Stars *instars, Image *image, unsigned int imageID)); 189 190 Stars *MergeStars PROTO((Stars *stars, int *Nstars, Stars *instars, int Ninstars)); 190 191 void save_pt_catalog PROTO((Catalog *catalog)); /*** choose new name ***/ … … 245 246 int args_skycells (int argc, char **argv); 246 247 int ConfigInit_skycells (int *argc, char **argv); 248 int UpdateImageIDs (Stars *stars, int Nstars, Image *images, int Nimages); 249 int LoadDataSDSS (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages); 250 int altaz (double *alt, double *az, double ha, double dec, double latitude); 247 251 248 252 // this is a gnu extension?? caution! -
branches/eam_branch_20080223/Ohana/src/addstar/src/FilterStars.c
r16648 r16698 65 65 stars[N].M += MTIME - dMs; 66 66 } 67 if (!isnan(stars[N].Mgal)) {68 stars[N].Mgal += MTIME - dMs;69 }70 67 if (!isnan(stars[N].Map)) { 71 68 stars[N].Map += MTIME - dMs; -
branches/eam_branch_20080223/Ohana/src/addstar/src/GetFileMode.c
r10937 r16698 16 16 gfits_scan (header, "EXTEND", "%t", 1, &extend); 17 17 18 { 19 int tmp, haveCAMCOL, haveSTRIPE; 20 21 // SDSS tsObj files have CAMCOL & STRIP keywords present in the header 22 haveCAMCOL = gfits_scan (header, "CAMCOL", "%d", 1, &tmp); 23 haveSTRIPE = gfits_scan (header, "STRIPE", "%d", 1, &tmp); 24 if (haveCAMCOL && haveSTRIPE) return SDSS_OBJ; 25 } 26 18 27 if ((Naxis == 2) || TEXTMODE || !simple) { 19 28 if (!strcmp (&ctype[4], "-WRP")) { -
branches/eam_branch_20080223/Ohana/src/addstar/src/ImageOptions.c
r15038 r16698 4 4 int ImageOptions (AddstarClientOptions *options, Image *images, int Nimages) { 5 5 6 int i, equivPhotcode ;6 int i, equivPhotcode, consistent; 7 7 float maxError; 8 8 PhotCode *photcode; … … 18 18 19 19 // check that all images have the same equiv photcode and save it 20 // XXX this is only used to allow use to calculate an average mag 21 // if we have mis-matched photcodes, leave this as 0; 22 options[0].photcode = 0; 20 23 equivPhotcode = 0; 24 consistent = TRUE; 21 25 22 26 for (i = 0; i < Nimages; i++) { … … 28 32 if (equivPhotcode) { 29 33 if (equivPhotcode != photcode[0].equiv) { 30 fprintf (stderr, "ERROR: mismatch in equiv photcode values\n");31 exit (2);34 consistent = FALSE; 35 break; 32 36 } 33 37 } else { … … 35 39 } 36 40 } 37 options[0].photcode = equivPhotcode; 41 if (consistent) { 42 options[0].photcode = equivPhotcode; 43 } 38 44 39 45 options[0].imageID = 0; -
branches/eam_branch_20080223/Ohana/src/addstar/src/LoadStars.c
r16654 r16698 23 23 for (i = 0; (fscanf (f, "%s", line) != EOF); i++) { 24 24 // filename limited to 1024 chars 25 fprintf (stderr, "file: %s\n", line); 25 26 file[i] = strcreate (line); 27 if (i == NFILE - 1) { 28 NFILE += 10; 29 REALLOCATE (file, char *, NFILE); 30 } 26 31 } 27 32 Nfile = i; … … 76 81 } 77 82 83 if (!strcmp (headerSets[0].exttype, "SDSS_OBJ")) { 84 LoadDataSDSS (f, file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets); 85 continue; 86 } 87 78 88 LoadData (f, file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets); 79 89 80 90 // XXX add a function to (optionally) load the extended source measurements 91 # if (0) 81 92 if (extSources) { 82 93 // not sure how to link the measurements here to the psf measurements above (though there is an ID in the det list) … … 86 97 LoadDataXFIT (f, file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets); 87 98 } 99 # endif 88 100 89 101 } … … 100 112 } 101 113 102 // load all of the headers, jump in file to skip data segments103 Header **LoadHeaders (FILE *f, int *mode, int *Nheaders) {104 105 int i, status, Nskip, NHEADERS;106 Header **headers;107 108 /* we need to examine the extensions to determine the headers and the data */109 NHEADERS = 10;110 ALLOCATE (headers, Header *, NHEADERS);111 112 // load all headers into memory113 for (i = 0;; i++) {114 ALLOCATE (headers[i], Header, 1);115 status = gfits_fread_header (f, headers[i]);116 if (!status) {117 *Nheaders = i;118 return (headers);119 }120 121 // check the mode for this file122 if (i == 0) {123 *mode = GetFileMode (headers[0]);124 if ((*mode == SIMPLE_CMP) || (*mode == MOSAIC_CMP)) {125 *Nheaders = i;126 return (headers);127 }128 }129 130 // advance to the next header131 Nskip = gfits_data_size (headers[i]);132 fseek (f, Nskip, SEEK_CUR);133 if (i == NHEADERS - 1) {134 NHEADERS += 10;135 REALLOCATE (headers, Header *, NHEADERS);136 }137 }138 }139 140 HeaderSet *MatchHeaders (int **extsize, int *nimage, int mode, Header **headers, int Nheaders) {141 142 int i, j, Nimage, NIMAGE;143 char extname[80], exttype[80], exthead[80];144 HeaderSet *headerSets;145 146 ALLOCATE (extsize[0], int, Nheaders);147 148 Nimage = 0;149 NIMAGE = 10;150 ALLOCATE (headerSets, HeaderSet, NIMAGE);151 152 // what is the mode of the first header (ie, do we have a PHU DIS image?)153 mode = GetFileMode (headers[0]);154 155 if (mode == MOSAIC_MEF) {156 headerSets[Nimage].exthead = strcreate ("PHU");157 headerSets[Nimage].extdata = strcreate ("NONE");158 headerSets[Nimage].extnum_data = -1;159 headerSets[Nimage].extnum_head = 0;160 Nimage ++;161 }162 163 // now examine the headers, count the table entries, find corresponding headers164 for (i = 0; i < Nheaders; i++) {165 if (mode == SIMPLE_CMP) {166 extsize[0][i] = headers[i][0].size;167 } else {168 extsize[0][i] = headers[i][0].size + gfits_data_size (headers[i]);169 }170 gfits_scan (headers[i], "EXTTYPE", "%s", 1, exttype);171 172 if (!strcmp (exttype, "SMPDATA")) goto keep;173 if (!strcmp (exttype, "PS1_DEV_0")) goto keep;174 if (!strcmp (exttype, "PS1_DEV_1")) goto keep;175 continue;176 177 keep:178 headerSets[Nimage].exttype = strcreate (exttype);179 180 gfits_scan (headers[i], ExtnameKeyword, "%s", 1, extname);181 gfits_scan (headers[i], "EXTHEAD", "%s", 1, exthead);182 183 headerSets[Nimage].extdata = strcreate (extname);184 headerSets[Nimage].exthead = strcreate (exthead);185 headerSets[Nimage].extnum_data = i;186 headerSets[Nimage].extnum_head = -1;187 188 // find the matching exthead entry189 for (j = 0; j < Nheaders; j++) {190 if (!gfits_scan (headers[j], ExtnameKeyword, "%s", 1, extname)) continue;191 if (strcmp (extname, headerSets[Nimage].exthead)) continue;192 headerSets[Nimage].extnum_head = j;193 break;194 }195 196 // skip or crash on table with missing matching header?197 if (headerSets[Nimage].extnum_head == -1) {198 return NULL;199 }200 Nimage ++;201 if (Nimage == NIMAGE) {202 NIMAGE += 10;203 REALLOCATE (headerSets, HeaderSet, NIMAGE);204 }205 }206 207 // some old format files did not write EXTTYPE. they have a single table in the first208 // extension matched to the header in the PHU209 if (Nimage == 0) {210 extsize[0][0] = headers[0][0].size + gfits_data_size (headers[0]);211 extsize[0][1] = headers[1][0].size + gfits_data_size (headers[1]);212 gfits_scan (headers[1], ExtnameKeyword, "%s", 1, extname);213 if (!strcmp (extname, "SMPFILE")) {214 headerSets[Nimage].extdata = strcreate (extname);215 headerSets[Nimage].exttype = strcreate ("SMPDATA");216 headerSets[Nimage].exthead = strcreate ("PHU");217 headerSets[Nimage].extnum_head = 0;218 headerSets[Nimage].extnum_data = 1;219 Nimage = 1;220 }221 }222 223 *nimage = Nimage;224 return (headerSets);225 }226 227 // XXX this function is somewhat specific to the elixir format output files228 // it is capable of distinguishing several format versions defined for elixir/psphot229 230 // examine the header sets and set the Image entries for the the valid images231 int LoadData (FILE *f, char *file, Image **images, int *nvalid, Stars **stars, int *Nstars, Header **headers, int *extsize, HeaderSet *headerSets, int Nimages) {232 233 char *name;234 int i, j, Nvalid, Nhead, Ndata, Nskip;235 Stars *inStars;236 237 if (images[0] == NULL) {238 Nvalid = 0;239 NVALID = 10;240 ALLOCATE (images[0], Image, NVALID);241 } else {242 Nvalid = *nvalid;243 NVALID = Nvalid + 10;244 REALLOCATE (images[0], Image, NVALID);245 }246 247 // find image rootname248 name = filebasename (file);249 250 // now run through the images, interpret the headers and read the stars251 for (i = 0; i < Nimages; i++) {252 Nhead = headerSets[i].extnum_head;253 254 if (VERBOSE) fprintf (stderr, "reading header for %s (%s)\n", headerSets[i].exthead, headerSets[i].extdata);255 if (!ReadImageHeader (headers[Nhead], &images[0][Nvalid], 0)) {256 fprintf (stderr, "skipping %s\n", headerSets[i].exthead);257 continue;258 }259 images[0][Nvalid].imageID = Nvalid;260 images[0][Nvalid].externID = 0;261 images[0][Nvalid].sourceID = 0;262 263 // XXX EAM : I seemed to have dropped the ability to support TEXT (old-style cmp format files).264 // I need to detect them here and load them with ReadStarsTEXT instead of calling the code265 // below.266 267 // XXX use something to set the chip name? EXTNAME?268 if (!strcmp(headerSets[i].exthead, "PHU") && (Nimages == 1)) {269 snprintf (images[0][Nvalid].name, 64, "%s", name);270 } else {271 snprintf (images[0][Nvalid].name, 64, "%s[%s]", name, headerSets[i].exthead);272 }273 274 // skip the table if there is no data segment (eg, mosaic WRP image)275 if (!strcmp(headerSets[i].extdata, "NONE")) {276 Nvalid++;277 if (Nvalid == NVALID) {278 NVALID += 10;279 REALLOCATE (images[0], Image, NVALID);280 }281 continue;282 }283 284 // advance the pointer to the start of the corresponding table block285 Ndata = headerSets[i].extnum_data;286 Nskip = 0;287 for (j = 0; j < Ndata; j++) {288 Nskip += extsize[j];289 }290 fseek (f, Nskip, SEEK_SET);291 292 inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar);293 inStars = FilterStars (inStars, &images[0][Nvalid], Nvalid);294 *stars = MergeStars (*stars, Nstars, inStars, images[0][Nvalid].nstar);295 Nvalid++;296 }297 free (name);298 *nvalid = Nvalid;299 return (TRUE);300 }301 -
branches/eam_branch_20080223/Ohana/src/addstar/src/ReadImageHeader.c
r15514 r16698 156 156 image[0].Xm = NAN_S_SHORT; 157 157 image[0].code = 0; 158 memset (image[0].dummy, 0, sizeof(image[0].dummy));159 158 160 159 /* find expected number of stars */ -
branches/eam_branch_20080223/Ohana/src/addstar/src/ReadStarsFITS.c
r15514 r16698 72 72 if ((smpdata[i].M >= ZeroPt) || isnan(smpdata[i].M)) { 73 73 stars[i].M = NAN; 74 stars[i].Mgal = NAN;75 74 stars[i].Map = NAN; 76 75 } else { 77 76 stars[i].M = smpdata[i].M; 78 stars[i].Mgal = smpdata[i].M;79 77 stars[i].Map = smpdata[i].M; 80 78 } … … 122 120 stars[i].df = ps1data[i].df; 123 121 124 stars[i].psf Prob = ps1data[i].psfProb;125 stars[i].psfQual = ps1data[i].psfQual;122 stars[i].psfChisq = ps1data[i].psfChisq; 123 stars[i].psfQual = ps1data[i].psfQual; 126 124 127 125 stars[i].detID = ps1data[i].detID; … … 150 148 /* these are not used */ 151 149 stars[i].Map = NAN; 152 stars[i].Mgal = NAN;153 150 stars[i].dophot = 0; 154 151 } … … 190 187 stars[i].df = ps1data[i].df; 191 188 192 stars[i].psf Prob = ps1data[i].psfProb;189 stars[i].psfChisq = ps1data[i].psfChisq; 193 190 stars[i].psfQual = ps1data[i].psfQual; 194 191 stars[i].crNsigma = ps1data[i].crNsigma; … … 225 222 /* these are not used */ 226 223 stars[i].Map = NAN; 227 stars[i].Mgal = NAN;228 224 stars[i].dophot = 0; 229 225 } -
branches/eam_branch_20080223/Ohana/src/addstar/src/ReadStarsTEXT.c
r15509 r16698 80 80 stars[N].dophot = tmp; 81 81 82 dparse (&stars[N].Mgal, 7, &buffer[j*BYTES_STAR]); 82 // XXX I've removed the Mgal field from the measure.d table, and am using Map 83 // instead. DVO has not to date been used to track and study objects which are 84 // extended, but it is about to. Related to this, I have created the concept of two 85 // extended source attribute tables, to carry the information being measured by the 86 // IPP. 87 88 // dparse (&stars[N].Mgal, 7, &buffer[j*BYTES_STAR]); 83 89 dparse (&stars[N].Map, 8, &buffer[j*BYTES_STAR]); 84 90 dparse (&stars[N].fx, 9, &buffer[j*BYTES_STAR]); -
branches/eam_branch_20080223/Ohana/src/addstar/src/SEDfit.c
r16633 r16698 193 193 outcat[0].measure[Nmeas].dt = 0xffff; 194 194 195 outcat[0].measure[Nmeas].Mgal = NAN;196 195 outcat[0].measure[Nmeas].airmass = 0; 197 196 outcat[0].measure[Nmeas].FWx = NAN_S_SHORT; -
branches/eam_branch_20080223/Ohana/src/addstar/src/UpdateImageIDs.c
r16649 r16698 2 2 3 3 int UpdateImageIDs (Stars *stars, int Nstars, Image *images, int Nimages) { 4 5 int i, status, isEmpty; 6 unsigned int imageID; 7 FITS_DB db; 4 8 5 9 /*** update the image table ***/ … … 14 18 if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat); 15 19 dvo_image_create (&db, GetZeroPoint()); 20 isEmpty = TRUE; 16 21 } else { 17 22 /* position to start of file */ … … 20 25 Shutdown ("can't read image table phu %s", db.filename); 21 26 } 27 isEmpty = FALSE; 22 28 } 23 29 24 status = gfits_scan (&db.header, "IMAGEID", "%d", 1, &imageID); 30 // note that imageID is unsigned int 31 status = gfits_scan (&db.header, "IMAGEID", "%u", 1, &imageID); 25 32 if (!status) { 26 status = gfits_scan (&db.header, "NIMAGES", "% d", 1, &imageID);33 status = gfits_scan (&db.header, "NIMAGES", "%u", 1, &imageID); 27 34 } 28 35 … … 40 47 41 48 imageID += Nimages; 42 status = gfits_modify (&db.header, "IMAGEID", "%d", 1, imageID); 43 44 // write PHU 45 // position to start of file 46 Fseek (db.f, 0, SEEK_SET); 47 SetProtect (TRUE); 48 if (!gfits_fwrite_header (db.f, &db.header)) { 49 Shutdown ("can't write image table phu %s", db.filename); 49 status = gfits_modify (&db.header, "IMAGEID", "%u", 1, imageID); 50 51 52 if (isEmpty) { 53 dvo_image_addrows (&db, NULL, 0); 54 SetProtect (TRUE); 55 dvo_image_update (&db, VERBOSE); 56 SetProtect (FALSE); 57 } else { 58 // write just the PHU 59 // position to start of file 60 Fseek (db.f, 0, SEEK_SET); 61 SetProtect (TRUE); 62 if (!gfits_fwrite_header (db.f, &db.header)) { 63 Shutdown ("can't write image table phu %s", db.filename); 64 } 65 SetProtect (FALSE); 50 66 } 51 SetProtect (FALSE);52 67 53 68 dvo_image_unlock (&db); 54 69 55 return 70 return TRUE; 56 71 } -
branches/eam_branch_20080223/Ohana/src/addstar/src/addstarc.c
r15036 r16698 21 21 case M_IMAGE: 22 22 /* load data */ 23 stars = LoadStars (argv[1], &Nstars, &images, &Nimages, options.photcode); 23 stars = LoadStars (argv[1], &Nstars, &images, &Nimages, &options); 24 25 // set and update the imageID sequence 26 UpdateImageIDs (stars, Nstars, images, Nimages); 24 27 25 28 /* send data to server */ -
branches/eam_branch_20080223/Ohana/src/addstar/src/fakeimage.c
r16648 r16698 130 130 image[i+1].Xm = NAN_S_SHORT; 131 131 image[i+1].code = 0; 132 memset (image[i+1].dummy, 0, sizeof(image[i+1].dummy));133 132 134 133 image[i+1].nstar = 0; … … 189 188 image[0].Xm = NAN_S_SHORT; 190 189 image[0].code = 0; 191 memset (image[0].dummy, 0, sizeof(image[0].dummy));192 190 image[0].nstar = 0; 193 191 image[0].Myyyy = 0; -
branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches.c
r16648 r16698 10 10 int Nave, NAVE, Nmeas, NMEAS, Nmatch; 11 11 int Nsecfilt, Nsec; 12 unsigned int objID, catID; 12 13 Coords tcoords; 13 14 … … 183 184 catalog[0].measure[Nmeas].photFlags = stars[N].flags; 184 185 catalog[0].measure[Nmeas].qPSF = stars[N].psfQual; 185 catalog[0].measure[Nmeas].psf Prob = stars[N].psfProb;186 catalog[0].measure[Nmeas].psfChisq = stars[N].psfChisq; 186 187 catalog[0].measure[Nmeas].crNsigma = stars[N].crNsigma; 187 188 catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma; … … 197 198 catalog[0].measure[Nmeas].dYccd = stars[N].dY; 198 199 199 catalog[0].measure[Nmeas].M gal = stars[N].Mgal;200 catalog[0].measure[Nmeas].Map = stars[N].Map; 200 201 catalog[0].measure[Nmeas].FWx = 100*stars[N].fx; 201 202 catalog[0].measure[Nmeas].FWy = 100*stars[N].fy; … … 313 314 catalog[0].measure[Nmeas].photFlags = stars[N].flags; 314 315 catalog[0].measure[Nmeas].qPSF = stars[N].psfQual; 315 catalog[0].measure[Nmeas].psf Prob = stars[N].psfProb;316 catalog[0].measure[Nmeas].psfChisq = stars[N].psfChisq; 316 317 catalog[0].measure[Nmeas].crNsigma = stars[N].crNsigma; 317 318 catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma; … … 327 328 catalog[0].measure[Nmeas].dYccd = stars[N].dY; 328 329 329 catalog[0].measure[Nmeas].M gal = stars[N].Mgal;330 catalog[0].measure[Nmeas].Map = stars[N].Map; 330 331 catalog[0].measure[Nmeas].FWx = 100*stars[N].fx; 331 332 catalog[0].measure[Nmeas].FWy = 100*stars[N].fy; -
branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches_closest.c
r16648 r16698 9 9 int *N1, *N2, *next_meas, *next_miss; 10 10 int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch; 11 int Nsecfilt, Nsec; 12 unsigned int objID, catID; 11 13 Coords tcoords; 12 int Nsecfilt, Nsec;13 14 14 15 /* photcode data - must by of type DEP; options.photcode is equiv photcode for all input … … 203 204 catalog[0].measure[Nmeas].photFlags = stars[N].flags; 204 205 catalog[0].measure[Nmeas].qPSF = stars[N].psfQual; 205 catalog[0].measure[Nmeas].psf Prob = stars[N].psfProb;206 catalog[0].measure[Nmeas].psfChisq = stars[N].psfChisq; 206 207 catalog[0].measure[Nmeas].crNsigma = stars[N].crNsigma; 207 208 catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma; … … 217 218 catalog[0].measure[Nmeas].dYccd = stars[N].dY; 218 219 219 catalog[0].measure[Nmeas].M gal = stars[N].Mgal;220 catalog[0].measure[Nmeas].Map = stars[N].Map; 220 221 221 222 // XXX saturate range for FWx, FWy, theta … … 315 316 catalog[0].measure[Nmeas].photFlags = stars[N].flags; 316 317 catalog[0].measure[Nmeas].qPSF = stars[N].psfQual; 317 catalog[0].measure[Nmeas].psf Prob = stars[N].psfProb;318 catalog[0].measure[Nmeas].psfChisq = stars[N].psfChisq; 318 319 catalog[0].measure[Nmeas].crNsigma = stars[N].crNsigma; 319 320 catalog[0].measure[Nmeas].extNsigma = stars[N].extNsigma; … … 329 330 catalog[0].measure[Nmeas].dYccd = stars[N].dY; 330 331 331 catalog[0].measure[Nmeas].M gal = stars[N].Mgal;332 catalog[0].measure[Nmeas].Map = stars[N].Map; 332 333 catalog[0].measure[Nmeas].FWx = 100*stars[N].fx; 333 334 catalog[0].measure[Nmeas].FWy = 100*stars[N].fy; -
branches/eam_branch_20080223/Ohana/src/addstar/src/find_matches_refstars.c
r16648 r16698 9 9 int *N1, *N2, *next, *next_miss, last, last_miss; 10 10 int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch; 11 unsigned int objID, catID; 11 12 Measure *tmpmeasure; 12 13 Missing *tmpmissing; … … 147 148 catalog[0].measure[Nmeas].dt = 0xffff; 148 149 149 catalog[0].measure[Nmeas].M gal= NAN;150 catalog[0].measure[Nmeas].Map = NAN; 150 151 catalog[0].measure[Nmeas].airmass = 0; 151 152 catalog[0].measure[Nmeas].FWx = NAN_S_SHORT; … … 155 156 catalog[0].measure[Nmeas].photFlags = 0; 156 157 catalog[0].measure[Nmeas].qPSF = 0; 157 catalog[0].measure[Nmeas].psf Prob= 0;158 catalog[0].measure[Nmeas].psfChisq = 0; 158 159 catalog[0].measure[Nmeas].crNsigma = 0; 159 160 catalog[0].measure[Nmeas].extNsigma = 0; … … 281 282 catalog[0].measure[Nmeas].photFlags = 0; 282 283 catalog[0].measure[Nmeas].qPSF = 0; 283 catalog[0].measure[Nmeas].psf Prob= 0;284 catalog[0].measure[Nmeas].psfChisq = 0; 284 285 catalog[0].measure[Nmeas].crNsigma = 0; 285 286 catalog[0].measure[Nmeas].extNsigma = 0; … … 299 300 300 301 catalog[0].measure[Nmeas].airmass = 0; 301 catalog[0].measure[Nmeas].M gal= NAN;302 catalog[0].measure[Nmeas].Map = NAN; 302 303 catalog[0].measure[Nmeas].FWx = NAN_S_SHORT; 303 304 catalog[0].measure[Nmeas].FWy = NAN_S_SHORT; -
branches/eam_branch_20080223/Ohana/src/addstar/src/load2mass_as_rawdata.c
r14401 r16698 135 135 stars[Nstars+2].R = tstars[j].R; 136 136 stars[Nstars+2].D = tstars[j].D; 137 get2mass_3star (&stars[Nstars], &buffer[offset], Nbyte - offset);137 get2mass_3star_full (&stars[Nstars], &buffer[offset], Nbyte - offset); 138 138 // get2mass_star (&stars[Nstars], &buffer[offset], Nbyte - offset); 139 139 -
branches/eam_branch_20080223/Ohana/src/addstar/src/load2mass_catalog.c
r16633 r16698 47 47 // we now have the min chisq row. use this to supply the other filter values.... 48 48 for (j = 0; j < 3; j++) { 49 catalog[0].measure[Nmeas].dR = 0.0; 50 catalog[0].measure[Nmeas].dD = 0.0; 51 catalog[0].measure[Nmeas].M = stars[i+j].M; 52 catalog[0].measure[Nmeas].dM = stars[i+j].dM; 53 catalog[0].measure[Nmeas].Mcal = 0; 54 catalog[0].measure[Nmeas].t = stars[i+j].t; 55 catalog[0].measure[Nmeas].averef = Nave; 56 catalog[0].measure[Nmeas].photcode = stars[i+j].code; 57 catalog[0].measure[Nmeas].dophot = 0; 58 catalog[0].measure[Nmeas].dbFlags = 0; 59 catalog[0].measure[Nmeas].dt = 0xffff; 60 61 catalog[0].measure[Nmeas].Mgal = NAN; 62 catalog[0].measure[Nmeas].airmass = 0; 63 catalog[0].measure[Nmeas].FWx = NAN_S_SHORT; 64 catalog[0].measure[Nmeas].FWy = NAN_S_SHORT; 65 catalog[0].measure[Nmeas].theta = NAN_S_SHORT; 49 catalog[0].measure[Nmeas].dR = 0.0; 50 catalog[0].measure[Nmeas].dD = 0.0; 51 catalog[0].measure[Nmeas].Xccd = stars[i+j].X; 52 catalog[0].measure[Nmeas].Yccd = stars[i+j].Y; 53 catalog[0].measure[Nmeas].dXccd = 0.0; 54 catalog[0].measure[Nmeas].dYccd = 0.0; 55 catalog[0].measure[Nmeas].M = stars[i+j].M; 56 catalog[0].measure[Nmeas].dM = stars[i+j].dM; 57 catalog[0].measure[Nmeas].Mcal = 0; 58 catalog[0].measure[Nmeas].dMcal = stars[i+j].dMcal; 59 catalog[0].measure[Nmeas].t = stars[i+j].t; 60 catalog[0].measure[Nmeas].averef = Nave; 61 catalog[0].measure[Nmeas].photcode = stars[i+j].code; 62 catalog[0].measure[Nmeas].dophot = 0; 63 catalog[0].measure[Nmeas].photFlags = stars[i+j].flags; 64 catalog[0].measure[Nmeas].dbFlags = 0; 65 catalog[0].measure[Nmeas].dt = 0xffff; 66 67 catalog[0].measure[Nmeas].airmass = 0; 68 catalog[0].measure[Nmeas].FWx = stars[i+j].fx; 69 catalog[0].measure[Nmeas].FWy = stars[i+j].fy; 70 catalog[0].measure[Nmeas].theta = stars[i+j].df; 66 71 67 72 catalog[0].average[Nave].Nmeasure++;
Note:
See TracChangeset
for help on using the changeset viewer.
