Changeset 33374
- Timestamp:
- Feb 26, 2012, 4:19:37 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src
- Files:
-
- 6 edited
-
libdvo/include/dvo.h (modified) (2 diffs)
-
relphot/include/relphot.h (modified) (2 diffs)
-
relphot/src/ImageOps.c (modified) (4 diffs)
-
relphot/src/StarOps.c (modified) (13 diffs)
-
relphot/src/select_images.c (modified) (1 diff)
-
relphot/src/setMrelFinal.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h
r33303 r33374 142 142 */ 143 143 144 /* Average. codevalues -- these values are 32 bit (as of PS1_V1) */144 /* Average.flags values -- these values are 32 bit (as of PS1_V1) */ 145 145 typedef enum { 146 146 ID_STAR_FEW = 0x00000001, // used within relphot: skip star … … 169 169 } DVOAverageFlags; 170 170 171 /* Secfilt.flags values -- these values are 32 bit (as of PS1_V1) */ 172 typedef enum { 173 ID_SECF_STAR_FEW = 0x00000001, // used within relphot: skip star 174 ID_SECF_STAR_POOR = 0x00000002, // used within relphot: skip star 175 ID_PHOTOM_PASS_0 = 0x00000100, // average magnitude calculated in 0th pass 176 ID_PHOTOM_PASS_1 = 0x00000200, // average magnitude calculated in 1th pass 177 ID_PHOTOM_PASS_2 = 0x00000400, // average magnitude calculated in 2th pass 178 ID_PHOTOM_PASS_3 = 0x00000800, // average magnitude calculated in 3th pass 179 ID_PHOTOM_PASS_4 = 0x00001000, // average magnitude calculated in 4th pass 180 } DVOSecfiltFlags; 181 171 182 /*** general dvo structures (internal use only / not IO) ***/ 172 183 -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/include/relphot.h
r33364 r33374 216 216 float getMmos PROTO((off_t meas, int cat)); 217 217 float getMrel PROTO((Catalog *catalog, off_t meas, int cat)); 218 short getUbercalDist PROTO((off_t meas, int cat)); 218 219 Image *getimage PROTO((off_t N)); 219 220 Image *getimages PROTO((off_t *N, off_t **LineNumber)); … … 265 266 int setMrel PROTO((Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr)); 266 267 void setMrelFinal PROTO((Catalog *catalog, FlatCorrectionTable *flatcorr)); 267 int setMrelOutput PROTO((Catalog *catalog, int Ncatalog, int mark, FlatCorrectionTable *flatcorr));268 int setMrelOutput PROTO((Catalog *catalog, int Ncatalog, int pass, FlatCorrectionTable *flatcorr)); 268 269 int setMave PROTO((Catalog *catalog, int Ncatalog)); 269 270 void set_ZP PROTO((double ZERO)); -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/ImageOps.c
r33254 r33374 328 328 } 329 329 330 // returns image.Mcal - ff(x,y) 331 short getUbercalDist (off_t meas, int cat) { 332 333 off_t i; 334 short distance; 335 336 i = MeasureToImage[cat][meas]; 337 if (i == -1) return (1000); 338 339 if (image[i].flags & IMAGE_BAD) return (1000); 340 distance = image[i].dummy3; // XXX dummy3 == ubercalDist 341 return (distance); 342 } 343 330 344 float getMflat (off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog) { 331 345 … … 393 407 } 394 408 395 /* we optionally do not recalibrate images with UBERCAL zero points */ 396 if (KEEP_UBERCAL && (image[i].flags & ID_IMAGE_PHOTOM_UBERCAL)) continue; 409 // UBERCAL image: if this is an ubercal image, set minUbercalDist to 0: 410 // we optionally do not recalibrate images with UBERCAL zero points 411 if (image[i].flags & ID_IMAGE_PHOTOM_UBERCAL) { 412 image[i].dummy3 = 0; // dummy3 = ubercalDist 413 if (KEEP_UBERCAL) continue; 414 } 415 416 int minUbercalDist = 1000; 397 417 398 418 N = 0; … … 436 456 } 437 457 458 minUbercalDist = MIN (catalog[c].secfilt[n*Nsecfilt].M_80, minUbercalDist); // M_80 == ubercalDist 459 438 460 // fprintf (stderr, "%1d, %3d : %3d, %3d : %10.6f %10.6f : %6.3f %6.3f %6.3f %6.3f %6.3f\n", (int) i, (int) j, (int) c, (int) m, catalog[c].averageT[n].R, catalog[c].averageT[n].D, Msys, Mrel, Mmos, Mgrid, Mflat); 439 461 … … 473 495 image[i].Mcal = 0.0; 474 496 } 497 498 image[i].dummy3 = minUbercalDist; 475 499 } 476 500 free (list); -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/StarOps.c
r33373 r33374 61 61 62 62 // XXX accumulate all secfilt values in a single pass? 63 64 int minUbercalDist = 1000; 63 65 64 66 int Ns; … … 102 104 list[N] = Msys - Mcal - Mmos - Mgrid; 103 105 106 int myUbercalDist = getUbercalDist(m,i); 107 minUbercalDist = MIN(minUbercalDist, myUbercalDist); 108 104 109 // dlist gives the error, which is used as the weight in WT_MEAN. 105 110 // we can modify the resulting weight in a few ways: … … 137 142 138 143 liststats (list, dlist, N, &stats); 139 144 140 145 catalog[i].secfilt[Nsecfilt*j+Nsec].M = stats.mean; 141 146 catalog[i].secfilt[Nsecfilt*j+Nsec].dM = stats.sigma; 142 147 catalog[i].secfilt[Nsecfilt*j+Nsec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq + 1e-4) : NAN_S_SHORT; 148 149 catalog[i].secfilt[Nsecfilt*j+Nsec].M_80 = minUbercalDist; // M_80 == ubercalDist 143 150 } 144 151 } … … 159 166 // * setMave updates 2MASS average flags 160 167 // * setMave updates average EXT flags (PS1 and 2MASS) 161 int setMrelOutput (Catalog *catalog, int Ncatalog, int mark, FlatCorrectionTable *flatcorr) {168 int setMrelOutput (Catalog *catalog, int Ncatalog, int pass, FlatCorrectionTable *flatcorr) { 162 169 163 170 int i, N; … … 192 199 if (catalog[i].found[Nsecfilt*j+Nsec]) continue; 193 200 201 int Ncode = 0; 202 194 203 N = 0; 195 204 m = catalog[i].averageT[j].measureOffset; … … 200 209 if (!code) continue; 201 210 if (code->equiv != thisCode) { continue; } 211 Ncode ++; 202 212 203 213 if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue; 204 214 205 // XXX allow REF stars (no Image Entry) to be included in the calculation this206 // should be optionally set, and should allow for REF stars to be downweighted by207 // more than their reported errors. how such info is carried is unclear...208 215 if (getImageEntry (m, i) < 0) { 209 216 Mcal = Mmos = Mgrid = 0; … … 247 254 if (N < 1) continue; 248 255 256 // force WT_MEAN or MEAN here? 257 249 258 liststats (list, dlist, N, &stats); 250 if (mark) catalog[i].found[Nsecfilt*j+Nsec] = TRUE; 259 catalog[i].found[Nsecfilt*j+Nsec] = TRUE; 260 switch (pass) { 261 case 0: 262 catalog[i].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_0; 263 break; 264 case 1: 265 catalog[i].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_1; 266 break; 267 case 2: 268 catalog[i].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_2; 269 break; 270 case 3: 271 catalog[i].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_3; 272 break; 273 case 4: 274 catalog[i].secfilt[Nsecfilt*j+Nsec].flags |= ID_PHOTOM_PASS_4; 275 break; 276 } 251 277 252 278 /* use sigma or error in dM for output? */ … … 254 280 catalog[i].secfilt[Nsecfilt*j+Nsec].dM = MAX (stats.error, stats.sigma); 255 281 catalog[i].secfilt[Nsecfilt*j+Nsec].Xm = (stats.Nmeas > 1) ? 100.0*log10(stats.chisq) : NAN_S_SHORT; 282 catalog[i].secfilt[Nsecfilt*j+Nsec].Ncode = Ncode; 283 catalog[i].secfilt[Nsecfilt*j+Nsec].Nused = stats.Nmeas; 256 284 } 257 285 } … … 540 568 for (Ns = 0; Ns < Nphotcodes; Ns++) { 541 569 542 /* on final processing, skip stars already measured */543 if (final && catalog[i].found[j]) continue;544 545 570 int thisCode = photcodes[Ns][0].code; 546 571 int Nsec = GetPhotcodeNsec(thisCode); 547 572 573 /* on final processing, skip stars already measured */ 574 if (final && catalog[i].found[Nsecfilt*j + Nsec]) continue; 575 548 576 /* skip bad stars to prevent them from becoming good (on inner sample) */ 549 577 if (catalog[i].secfilt[Nsecfilt*j+Nsec].flags & STAR_BAD) continue; … … 557 585 if (ecode != thisCode) { continue; } 558 586 559 // why am I skipping this?? 560 /* if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue; */ 587 // NOTE: we do not skip MEAS_BAD because this measurement is just an internal assessment of the outliers 561 588 Mcal = getMcal (m, i, flatcorr, catalog); 562 589 if (isnan(Mcal)) { Ncal ++; continue; } … … 602 629 if (ecode != thisCode) { continue; } 603 630 604 / * if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue; */631 // NOTE: we do not skip MEAS_BAD because this measurement is just an internal assessment of the outliers 605 632 Mcal = getMcal (m, i, flatcorr, catalog); 606 633 if (isnan(Mcal)) continue; … … 725 752 list[n] = pow (10.0, 0.01*Xm); 726 753 dlist[n] = 1; 727 if (list[n] > 100000) {728 fprintf (stderr, "!");729 }730 754 n++; 731 755 } … … 765 789 dM = catalog[i].secfilt[Nsecfilt*j+Nsec].dM; 766 790 if (isnan(dM)) continue; 767 if (dM > 100) {768 fprintf (stderr, ".");769 }770 791 list[n] = dM; 771 792 dlist[n] = 1; -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/select_images.c
r31450 r33374 239 239 } 240 240 if (RESET) { 241 // XXX assignMcal (&image[nimage], (double *) NULL, -1);242 241 // XXX this needs to be thought through a bit more 243 image[nimage].Mcal = 0.0; 244 image[nimage].dMcal = NAN; 242 if (!KEEP_UBERCAL) { 243 image[nimage].Mcal = 0.0; 244 image[nimage].dMcal = NAN; 245 } 245 246 image[nimage].flags &= ~ID_IMAGE_PHOTOM_POOR; 247 image[nimage].dummy3 = 1000; // dummy3 == ubercalDist 246 248 } 247 249 line_number[nimage] = i; -
branches/eam_branches/ipp-20111122/Ohana/src/relphot/src/setMrelFinal.c
r33373 r33374 21 21 ID_MEAS_AREA; // detetion was outside acceptable area of device 22 22 23 // flags used by the photometry analysis (excluding UBERCAL) 24 unsigned int PHOTOM_PASSES = 25 ID_PHOTOM_PASS_0 | // average measured at pass 0 26 ID_PHOTOM_PASS_1 | // average measured at pass 1 27 ID_PHOTOM_PASS_2 | // average measured at pass 2 28 ID_PHOTOM_PASS_3 | // average measured at pass 3 29 ID_PHOTOM_PASS_4; // average measured at pass 4 30 23 31 int Ns; 24 32 for (Ns = 0; Ns < Nphotcodes; Ns++) { … … 31 39 catalog[0].secfilt[Nsecfilt*i+Nsec].dM = NAN; 32 40 catalog[0].secfilt[Nsecfilt*i+Nsec].Xm = NAN_S_SHORT; 41 catalog[0].secfilt[Nsecfilt*j+Nsec].Ncode = 0; 42 catalog[0].secfilt[Nsecfilt*j+Nsec].Nused = 0; 43 44 catalog[0].secfilt[Nsecfilt*i+Nsec].flags &= ~PHOTOM_PASSES; 33 45 34 46 m = catalog[0].average[i].measureOffset; … … 64 76 } 65 77 78 clean_measures (catalog, 1, TRUE, flatcorr); /* mark outliers ID_MEAS_POOR_PHOTOM */ 66 79 for (i = 0; i < 5; i++) { 67 80 skip_measurements (catalog, i, flatcorr); /* set ID_MEAS_SKIP for measures to be skipped */ 68 setMrelOutput (catalog, 1, FALSE, flatcorr); /* set Mrel using all measures not skipped */ 69 clean_measures (catalog, 1, TRUE, flatcorr); /* mark outliers ID_MEAS_POOR_PHOTOM */ 70 setMrelOutput (catalog, 1, TRUE, flatcorr); /* set Mrel using remaining measures */ 81 setMrelOutput (catalog, 1, i, flatcorr); /* set Mrel using remaining measures */ 71 82 } 72 83 setMcalOutput (catalog, 1, flatcorr); 73 74 int Nsecfilt = GetPhotcodeNsecfilt ();75 84 76 85 /* clear ID_STAR_POOR, ID_STAR_FEW values before writing ??? */ 77 86 /* ID_MEAS_NOCAL is an internal bit, so it should be cleared */ 87 // XXX eventually: move these internal flags to an internal-only catalog->FOO element (like found) 78 88 for (i = 0; i < catalog[0].Naverage; i++) { 79 89 catalog[0].average[i].flags &= ~ID_STAR_FEW; … … 95 105 // acceptance on each pass. The rejections at the different passes are: 96 106 97 // 0 : only use measurements thought to be not extended and dM < SIGMA_LIM (REMOVED) 98 // 1 : use extended and low-sig detections (REMOVED) 99 // 3 : accept the measurements marked as outliers; accept images marked as outliers 107 // 0 : only use measurements thought to be GOOD (photflags not POOR or BAD) 108 // 1 : accept measurements thought to be POOR based on photflags 109 // 2 : accept the measurements marked as outliers; accept images marked as outliers 110 // 3 : accept measurements thought to be BAD based on photflags 100 111 // 4 : accept the measurements outside of the instrumental magnitude limits (eg, SAT) 101 112 … … 106 117 107 118 off_t i, k, m; 108 int ecode, found, Ns;109 119 off_t Ntot, Ntry, Nkeep, Nskip; 110 120 float mag; 111 121 122 int Nsecfilt = GetPhotcodeNsecfilt (); 123 112 124 Ntot = Ntry = Nskip = Nkeep = 0; 113 125 114 126 /* allow measures from images marked POOR and FEW */ 115 if (pass >= 3) IMAGE_BAD = ID_IMAGE_PHOTOM_NOCAL;127 if (pass >= 2) IMAGE_BAD = ID_IMAGE_PHOTOM_NOCAL; 116 128 117 129 /* allow measures marked as outliers (POOR) and off image region (AREA) */ 118 if (pass >= 3) MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_SKIP_PHOTOM;119 120 /* mark measures which should be ignored on secondpass */130 if (pass >= 2) MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_SKIP_PHOTOM; 131 132 /* mark measures which should be ignored on this pass */ 121 133 for (i = 0; i < catalog[0].Naverage; i++) { 122 134 Ntot += catalog[0].average[i].Nmeasure; 123 135 124 // this function does not check secfilt entries separately, but there is no harm in 125 // twiddling the so skip a star here only we can only 126 // have we gotten 127 128 if (catalog[0].found[i]) continue; 129 XXX : this should be done by secfilt. think about this... 130 131 m = catalog[0].average[i].measureOffset; 132 for (k = 0; k < catalog[0].average[i].Nmeasure; k++, m++) { 133 Ntry++; 134 135 /* clear SKIP for all measures at first */ 136 catalog[0].measureT[m].dbFlags &= ~ID_MEAS_SKIP_PHOTOM; 137 138 /** never use these measurements (wrong photcode, bad time range) */ 139 /* skipped via NOCAL, don't mark as skipped */ 140 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[m].photcode); 141 found = FALSE; 142 for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) { 143 if (ecode == photcodes[Ns][0].code) found = TRUE; 136 // mark measurements for each secfilt separately 137 int Ns; 138 for (Ns = 0; Ns < Nphotcodes; Ns++) { 139 140 int thisCode = photcodes[Ns][0].code; 141 int Nsec = GetPhotcodeNsec(thisCode); 142 143 /* star/photcodes already calibrated */ 144 if (catalog[0].found[Nsecfilt*i+Nsec]) continue; 145 146 m = catalog[0].average[i].measureOffset; 147 for (k = 0; k < catalog[0].average[i].Nmeasure; k++, m++) { 148 Ntry++; 149 150 // skip measurements not related to this photcode 151 PhotCode *code = GetPhotcodebyCode (catalog[0].measure[m].photcode); 152 if (!code) continue; 153 if (code->equiv != thisCode) continue; 154 155 // skip measurements by time range (mark as skipped for this secfilt) 156 // XXX note that this is a bit dangerous : some objects may never get calibrated 157 if (TimeSelect) { 158 if (catalog[0].measure[m].t < TSTART) goto skip; 159 if (catalog[0].measure[m].t > TSTOP) goto skip; 160 } 161 162 // we now have a measurement relavant to this photcode (and time range) 163 164 // clear SKIP for all measures at first 165 catalog[0].measureT[m].dbFlags &= ~ID_MEAS_SKIP_PHOTOM; 166 167 // skip measurements from BAD images and mosaics 168 // do NOT skip measurements without a matching image 169 if (isnan(getMcal (m, 0, flatcorr, catalog))) goto skip; 170 if (isnan(getMmos (m, 0))) goto skip; 171 172 // PASS 4 : skip measurements by inst mag limit 173 if ((pass < 4) && ImagSelect) { 174 mag = PhotInst (&catalog[0].measure[m]); 175 if (mag < ImagMin) goto skip; 176 if (mag > ImagMax) goto skip; 177 } 178 179 // PASS 3 : accept bad measurements (eg, SAT, CR) 180 if (pass < 3) { 181 if (catalog[0].measure[m].photFlags & code->photomBadMask) goto skip; 182 if ((catalog[i].measure[m].photcode > 10000) && (catalog[i].measure[m].photcode < 10500)) { 183 if (catalog[i].measure[m].psfQual < 0.85) goto skip; 184 } 185 } 186 187 // PASS 2 : internal outliers accepted 188 189 // PASS 1 : accept poor measurements as well (eg, POOR FIT, etc) 190 if ((pass < 1) && (catalog[0].measure[m].photFlags & code->photomPoorMask)) goto skip; 191 192 // PASS 0 : skip poor, outlier, bad measurements as well (eg, POOR FIT, etc) 193 194 Nkeep ++; 195 196 continue; 197 198 skip: 199 catalog[0].measure [m].dbFlags |= ID_MEAS_SKIP_PHOTOM; 200 catalog[0].measureT[m].dbFlags |= ID_MEAS_SKIP_PHOTOM; 201 Nskip ++; 144 202 } 145 if (!found) continue;146 147 /* skip measurements by time range */148 if (TimeSelect) {149 if (catalog[0].measure[m].t < TSTART) goto skip;150 if (catalog[0].measure[m].t > TSTOP) goto skip;151 }152 153 /* skip measurements with sat. dophot values */154 // XXX we need to fix this: use the photFlags to ID saturation...155 // if ((pass < 4) && (catalog[0].measure[m].dophot == 10)) goto skip;156 157 /* skip measurements from BAD images and mosaics */158 /* do NOT skip measurements without a matching image */159 if (isnan(getMcal (m, 0, flatcorr, catalog))) goto skip;160 if (isnan(getMmos (m, 0))) goto skip;161 162 /* skip measurements by inst mag limit */163 if ((pass < 4) && ImagSelect) {164 mag = PhotInst (&catalog[0].measure[m]);165 if (mag < ImagMin) goto skip;166 if (mag > ImagMax) goto skip;167 }168 169 // d1 = (catalog[0].measure[m].dophot == 1);170 // d2 = (catalog[0].measure[m].dophot == 2);171 // fprintf (stderr, "fix the dophot / type selections!");172 // abort ();173 174 /* skip measurements by measurement error */175 // if ((pass < 2) && !(d1 || d2)) goto skip;176 177 /* if ((pass < 1) && (catalog[0].measure[m].dM > SIGMA_LIM)) goto skip; */178 // if ((pass < 1) && !d1) goto skip;179 Nkeep ++;180 181 continue;182 183 skip:184 catalog[0].measure [m].dbFlags |= ID_MEAS_SKIP_PHOTOM;185 catalog[0].measureT[m].dbFlags |= ID_MEAS_SKIP_PHOTOM;186 Nskip ++;187 203 } 188 204 }
Note:
See TracChangeset
for help on using the changeset viewer.
