Changeset 40833
- Timestamp:
- Jul 12, 2019, 10:42:03 AM (7 years ago)
- Location:
- branches/eam_branches/ohana.20190329/src/addstar
- Files:
-
- 3 edited
-
Makefile (modified) (5 diffs)
-
include/ukirt_uhs.h (modified) (1 diff)
-
src/loadukirt_uhs_readstars.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20190329/src/addstar/Makefile
r40543 r40833 27 27 loadgaia : $(BIN)/loadgaia.$(ARCH) 28 28 loadgaia_dr2 : $(BIN)/loadgaia_dr2.$(ARCH) 29 loadukirt_uhs : $(BIN)/loadukirt_uhs.$(ARCH) 29 30 loadstarpar : $(BIN)/loadstarpar.$(ARCH) 30 31 loadstarpar_client : $(BIN)/loadstarpar_client.$(ARCH) … … 44 45 # programs in 'SERVER' use the client-server concept and are out of date 45 46 46 INSTALL = addstar addstar_client sedstar loadgalphot loadgaia loadgaia_dr2 load starpar loadstarpar_client setobjflags setobjflags_client loadICRF loadICRF_client skycells mkcmf dumpskycells findskycell load2mass loadwise loadtycho loadbsc loadsupercos47 INSTALL = addstar addstar_client sedstar loadgalphot loadgaia loadgaia_dr2 loadukirt_uhs loadstarpar loadstarpar_client setobjflags setobjflags_client loadICRF loadICRF_client skycells mkcmf dumpskycells findskycell load2mass loadwise loadtycho loadbsc loadsupercos 47 48 SERVER = addstarc addstard addstart 48 49 … … 305 306 $(SRC)/psps_ids.$(ARCH).o 306 307 308 LOAD-UKIRT_UHS = \ 309 $(SRC)/loadukirt_uhs.$(ARCH).o \ 310 $(SRC)/ConfigInit.$(ARCH).o \ 311 $(SRC)/SetSignals.$(ARCH).o \ 312 $(SRC)/Shutdown.$(ARCH).o \ 313 $(SRC)/args_loadukirt_uhs.$(ARCH).o \ 314 $(SRC)/find_matches_ukirt_uhs.$(ARCH).o \ 315 $(SRC)/loadukirt_uhs_catalog.$(ARCH).o \ 316 $(SRC)/loadukirt_uhs_make_subset.$(ARCH).o \ 317 $(SRC)/loadukirt_uhs_readstars.$(ARCH).o \ 318 $(SRC)/loadukirt_uhs_table.$(ARCH).o \ 319 $(SRC)/parse_csv.$(ARCH).o \ 320 $(SRC)/resort_catalog.$(ARCH).o \ 321 $(SRC)/build_links.$(ARCH).o \ 322 $(SRC)/strhash.$(ARCH).o \ 323 $(SRC)/sortIDs.$(ARCH).o \ 324 $(SRC)/psps_ids.$(ARCH).o 325 307 326 LOAD-STARPAR = \ 308 327 $(SRC)/loadstarpar.$(ARCH).o \ … … 528 547 $(LOAD-GAIA) : $(INC)/addstar.h $(INC)/gaia.h 529 548 $(LOAD-GAIA_DR2) : $(INC)/addstar.h $(INC)/gaia_dr2.h 549 $(LOAD-UKIRT_UHS) : $(INC)/addstar.h $(INC)/ukirt_uhs.h 530 550 $(LOAD-STARPAR) : $(INC)/addstar.h $(INC)/loadstarpar.h 531 551 $(LOAD-STARPAR-CLIENT) : $(INC)/addstar.h $(INC)/loadstarpar.h … … 551 571 $(BIN)/loadgaia.$(ARCH) : $(LOAD-GAIA) 552 572 $(BIN)/loadgaia_dr2.$(ARCH) : $(LOAD-GAIA_DR2) 573 $(BIN)/loadukirt_uhs.$(ARCH) : $(LOAD-UKIRT_UHS) 553 574 $(BIN)/loadstarpar.$(ARCH) : $(LOAD-STARPAR) 554 575 $(BIN)/loadstarpar_client.$(ARCH) : $(LOAD-STARPAR-CLIENT) -
branches/eam_branches/ohana.20190329/src/addstar/include/ukirt_uhs.h
r40832 r40833 1 1 2 // measure[ 0] = g, measure[1] = b, measure[2] = r,2 // measure[1] = J 3 3 4 4 typedef struct { 5 5 Average average; 6 Measure measure[ 3];6 Measure measure[1]; 7 7 int flag; // in a subset? 8 8 int found; // assigned to an object? -
branches/eam_branches/ohana.20190329/src/addstar/src/loadukirt_uhs_readstars.c
r40832 r40833 78 78 79 79 // XXX I need a UKIRT UHS Mean Epoch 80 time_t UKIRT_UHS_EPOCH = ohana_date_to_sec ("2016/01/01,00:00:00");81 fprintf (stderr, "WARNING: using an invalid UKIRT_UHS_EPOCH (see loadukirt_uhs_readstars.c:60)\n");80 // time_t UKIRT_UHS_EPOCH = ohana_date_to_sec ("2016/01/01,00:00:00"); 81 // fprintf (stderr, "WARNING: using an invalid UKIRT_UHS_EPOCH (see loadukirt_uhs_readstars.c:60)\n"); 82 82 83 83 // read in the full FITS files … … 90 90 int NELEM = 10000; // currently-allocated number of output rows 91 91 92 // for initial testing, a minimal subset: 93 ALLOCATE_PTR (sourceID, uint64_t, NELEM); 94 ALLOCATE_PTR (Rg, double, NELEM); 95 ALLOCATE_PTR (Dg, double, NELEM); 96 ALLOCATE_PTR (chiSq, double, NELEM); 97 ALLOCATE_PTR (drg, double, NELEM); 98 99 ALLOCATE_PTR (sourceID, , NELEM); 100 ALLOCATE_PTR (frameSetID, , NELEM); 101 ALLOCATE_PTR (ra, , NELEM); 102 ALLOCATE_PTR (dec, , NELEM); 103 ALLOCATE_PTR (pStar, , NELEM); 104 ALLOCATE_PTR (pGalaxy, , NELEM); 105 ALLOCATE_PTR (jHallMag, , NELEM); 106 ALLOCATE_PTR (jHallMagErr, , NELEM); 107 ALLOCATE_PTR (jAperMag3, , NELEM); 108 ALLOCATE_PTR (jAperMag3Err, , NELEM); 109 ALLOCATE_PTR (jAperMag4, , NELEM); 110 ALLOCATE_PTR (jAperMag4Err, , NELEM); 111 ALLOCATE_PTR (jPA, , NELEM); 112 ALLOCATE_PTR (jClass, , NELEM); 113 ALLOCATE_PTR (jppErrBits, , NELEM); 114 ALLOCATE_PTR (photFlags2, , NELEM); 115 ALLOCATE_PTR (jSeqNum, , NELEM); 92 // vectors to hold the data loaded from the csv file (names are UKIRT native names) 93 ALLOCATE_PTR (sourceID, uint64_t, NELEM); 94 ALLOCATE_PTR (frameSetID, uint64_t, NELEM); // XXX doc says 8-bytes for this value! 95 ALLOCATE_PTR (ra, double, NELEM); 96 ALLOCATE_PTR (dec, double, NELEM); 97 ALLOCATE_PTR (priOrSec, uint64_t, NELEM); 98 ALLOCATE_PTR (mergedClass, int, NELEM); // XXX doc says 2-bytes (could use a short) 99 ALLOCATE_PTR (pStar, double, NELEM); 100 ALLOCATE_PTR (pGalaxy, double, NELEM); 101 ALLOCATE_PTR (jHallMag, double, NELEM); 102 ALLOCATE_PTR (jHallMagErr, double, NELEM); 103 ALLOCATE_PTR (jAperMag3, double, NELEM); 104 ALLOCATE_PTR (jAperMag3Err, double, NELEM); 105 ALLOCATE_PTR (jAperMag4, double, NELEM); 106 ALLOCATE_PTR (jAperMag4Err, double, NELEM); 107 ALLOCATE_PTR (jPA, double, NELEM); 108 ALLOCATE_PTR (jClass, int, NELEM); 109 ALLOCATE_PTR (jppErrBits, int, NELEM); 110 ALLOCATE_PTR (jSeqNum, int, NELEM); 116 111 117 112 // we allocate one extra byte into which we never read so there will always be a NULL terminating the string … … 178 173 if (*c0 == '!') { if (!EndOfFile) { c0 = c1 + 1; } continue; } 179 174 180 // XXX for Gaia, we know which columns we want in advance175 // for UKIRT UHS, we know which columns we want in advance 181 176 182 177 int lineStatus = TRUE; … … 189 184 cA = c0; 190 185 191 // Tref == 2015.5 for DR2186 // Tref : TBD for UHS 192 187 193 188 // the start of the line is the 1st element (fields are 1-counting) … … 207 202 dPARSE (30, 29, jAperMag4Err, "jAperMag4Err"); 208 203 dPARSE (35, 30, jPA, "jPA"); 209 dPARSE (38, 35, jClass, "jClass");204 iPARSE (38, 35, jClass, "jClass"); 210 205 iPARSE (40, 38, jppErrBits, "jppErrBits"); 211 206 iPARSE (41, 40, jSeqNum, "jSeqNum"); … … 223 218 NELEM += 1000; 224 219 225 REALLOCATE (sourceID, uint64_t, NELEM); 226 REALLOCATE (ra, double, NELEM); 227 REALLOCATE (dec, double, NELEM); 228 REALLOCATE (priOrSec, uint64_t, NELEM); 229 REALLOCATE (mergedClass, int, NELEM); 230 REALLOCATE (pStar, double, NELEM); 231 REALLOCATE (pGalaxy, double, NELEM); 232 REALLOCATE (jHallMag, double, NELEM); 233 REALLOCATE (jHallMagErr, double, NELEM); 234 REALLOCATE (jAperMag3, double, NELEM); 235 REALLOCATE (jAperMag3Err, double, NELEM); 236 REALLOCATE (jAperMag4, double, NELEM); 237 REALLOCATE (jAperMag4Err, double, NELEM); 238 REALLOCATE (jPA, double, NELEM); 239 REALLOCATE (jClass, double, NELEM); 240 REALLOCATE (jppErrBits, int, NELEM); 241 REALLOCATE (jSeqNum, int, NELEM); 220 REALLOCATE (sourceID, uint64_t, NELEM); 221 REALLOCATE (frameSetID, uint64_t, NELEM); 222 REALLOCATE (ra, double, NELEM); 223 REALLOCATE (dec, double, NELEM); 224 REALLOCATE (priOrSec, uint64_t, NELEM); 225 REALLOCATE (mergedClass, int, NELEM); 226 REALLOCATE (pStar, double, NELEM); 227 REALLOCATE (pGalaxy, double, NELEM); 228 REALLOCATE (jHallMag, double, NELEM); 229 REALLOCATE (jHallMagErr, double, NELEM); 230 REALLOCATE (jAperMag3, double, NELEM); 231 REALLOCATE (jAperMag3Err, double, NELEM); 232 REALLOCATE (jAperMag4, double, NELEM); 233 REALLOCATE (jAperMag4Err, double, NELEM); 234 REALLOCATE (jPA, double, NELEM); 235 REALLOCATE (jClass, int, NELEM); 236 REALLOCATE (jppErrBits, int, NELEM); 237 REALLOCATE (jSeqNum, int, NELEM); 242 238 } 243 239 if (!EndOfFile) { … … 267 263 for (int i = 0; i < NstarsIn; i++) { 268 264 269 Rmin = MIN (Rmin, Rg[i]); 270 Rmax = MAX (Rmax, Rg[i]); 271 Dmin = MIN (Dmin, Dg[i]); 272 Dmax = MAX (Dmax, Dg[i]); 273 274 // each Gaia DR2 source corresponds to 3 measurements: Gg, Gr, Gb: 275 265 Rmin = MIN (Rmin, ra[i]); 266 Rmax = MAX (Rmax, ra[i]); 267 Dmin = MIN (Dmin, dec[i]); 268 Dmax = MAX (Dmax, dec[i]); 269 270 // we have one UKIRT UHS (J-band) measurement per object 276 271 dvo_average_init (&stars[Nstars].average); 277 dvo_measure_init (&stars[Nstars].measure );272 dvo_measure_init (&stars[Nstars].measure[0]); 278 273 279 274 stars[Nstars].average.R = ra[i]; … … 286 281 287 282 int isPrimary = (!priOrSec[i] || (priOrSec[i] == frameSetID[i])) ? ID_MEAS_STACK_PRIMARY : 0x00; 288 int isGalaxy = (mergedClass[i] == 1) ? 0x01 : 0x00; 289 int isNoise = (mergedClass[i] == 0) ? 0x02 : 0x00; 290 int isStar = (mergedClass[i] == -1) ? 0x04 : 0x00; 291 int maybeStar = (mergedClass[i] == -2) ? 0x08 : 0x00; 292 int maybeGalaxy = (mergedClass[i] == -3) ? 0x10 : 0x00; 293 int isSaturated = (mergedClass[i] == -9) ? 0x20 : 0x00; 294 295 int photFlags2 = isGalaxy | isNoise | isStar | maybeStar | maybeGalaxy | isSaturated | isPrimary; 296 297 stars[Nstars].measure[0].extID = sourceID[i]; 298 stars[Nstars].measure[0].imageID = frameSetID[i]; 299 stars[Nstars].measure[0].R = ra[i]; 300 stars[Nstars].measure[0].D = dec[i]; 301 stars[Nstars].measure[0].psfChisq = pStar[i]; 302 stars[Nstars].measure[0].extNsigma = pGalaxy[i]; 303 stars[Nstars].measure[0].M = jHallMag[i]; 304 stars[Nstars].measure[0].dM = jHallMagErr[i]; 305 stars[Nstars].measure[0].Map = jAperMag3[i]; 306 stars[Nstars].measure[0].dMap = jAperMag3Err[i]; 307 stars[Nstars].measure[0].Mkron = jAperMag4[i]; 308 stars[Nstars].measure[0].dMkron = jAperMag4Err[i]; 309 stars[Nstars].measure[0].posangle = jPA[i]; // XXX units 310 stars[Nstars].measure[0].psfQF = jClass[i]; 311 283 int photFlags2 = isPrimary; 284 switch (mergedClass[i]) { 285 case 1: photFlags2 |= 0x01; break; // Galaxy 286 case 0: photFlags2 |= 0x02; break; // Noise 287 case -1: photFlags2 |= 0x04; break; // Star 288 case -2: photFlags2 |= 0x08; break; // probably star 289 case -3: photFlags2 |= 0x10; break; // probably galaxy 290 case -9: photFlags2 |= 0x20; break; // saturated 291 default: break; 292 } 293 294 stars[Nstars].measure[0].extID = sourceID[i]; 295 stars[Nstars].measure[0].imageID = frameSetID[i]; // XXX check for frameSetID > 31-bit int 296 stars[Nstars].measure[0].R = ra[i]; 297 stars[Nstars].measure[0].D = dec[i]; 298 stars[Nstars].measure[0].psfChisq = pStar[i]; 299 stars[Nstars].measure[0].extNsigma = pGalaxy[i]; 300 stars[Nstars].measure[0].M = jHallMag[i]; 301 stars[Nstars].measure[0].dM = jHallMagErr[i]; 302 stars[Nstars].measure[0].Map = jAperMag3[i]; 303 stars[Nstars].measure[0].dMap = jAperMag3Err[i]; 304 stars[Nstars].measure[0].Mkron = jAperMag4[i]; 305 stars[Nstars].measure[0].dMkron = jAperMag4Err[i]; 306 stars[Nstars].measure[0].posangle = jPA[i]; // XXX units 307 stars[Nstars].measure[0].psfQF = jClass[i]; 312 308 stars[Nstars].measure[0].photFlags = jppErrBits[i]; 313 stars[Nstars].measure[0].photFlags2 = photFlags2 [i];309 stars[Nstars].measure[0].photFlags2 = photFlags2; 314 310 stars[Nstars].measure[0].detID = jSeqNum[i]; 315 316 stars[Nstars].measure[0].photcode = codeJ; 311 stars[Nstars].measure[0].photcode = codeJ; 317 312 318 313 stars[Nstars].average.Nmeasure = 1; … … 322 317 } 323 318 324 free (srcID); 325 free (Rg); 326 free (dRg); 327 free (Dg); 328 free (dDg); 329 free (plx); 330 free (dplx); 331 free (uR); 332 free (duR); 333 free (uD); 334 free (duD); 335 free (nObs); 336 free (nGood); 337 free (goFit); 338 free (chiSq); 339 free (exNoise); 340 free (exNoiseSig); 341 free (nPeriods); 342 free (dupSource); 343 free (gg); 344 free (dgg); 345 free (bg); 346 free (dbg); 347 free (rg); 348 free (drg); 349 free (procMode); 319 FREE (sourceID); 320 FREE (frameSetID); 321 FREE (ra); 322 FREE (dec); 323 FREE (priOrSec); 324 FREE (mergedClass); 325 FREE (pStar); 326 FREE (pGalaxy); 327 FREE (jHallMag); 328 FREE (jHallMagErr); 329 FREE (jAperMag3); 330 FREE (jAperMag3Err); 331 FREE (jAperMag4); 332 FREE (jAperMag4Err); 333 FREE (jPA); 334 FREE (jClass); 335 FREE (jppErrBits); 336 FREE (jSeqNum); 350 337 351 338 free (buffer);
Note:
See TracChangeset
for help on using the changeset viewer.
