Changeset 36917
- Timestamp:
- Jun 19, 2014, 6:10:10 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140610/Ohana/src
- Files:
-
- 8 edited
-
libautocode/def/secfilt-ps1-v5.d (modified) (2 diffs)
-
libautocode/def/secfilt.d (modified) (2 diffs)
-
libdvo/include/dvo.h (modified) (1 diff)
-
libdvo/src/dvo_catalog.c (modified) (1 diff)
-
libdvo/src/dvo_convert_PS1_V5.c (modified) (4 diffs)
-
relphot/src/StarOps.c (modified) (1 diff)
-
relphot/src/setMrelCatalog.c (modified) (14 diffs)
-
relphot/src/setMrelFinal.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140610/Ohana/src/libautocode/def/secfilt-ps1-v5.d
r36899 r36917 2 2 EXTNAME DVO_SECFILT_PS1_V5 3 3 TYPE BINTABLE 4 SIZE 1 524 SIZE 160 5 5 DESCRIPTION DVO SecFilt : Secondary Filter Data 6 6 … … 10 10 FIELD Map, MAG_AP, float, ave aperture mag in this band, mags 11 11 FIELD dMap, MAG_AP_ERR, float, ave aperture mag in this band, mags 12 FIELD sMap, MAG_AP_STDEV, float, standard deviation of ap mags, mags 12 13 FIELD Mkron, MAG_KRON, float, ave kron mag in this band, mags 13 14 FIELD dMkron, MAG_KRON_ERR, float, formal error on average kron mag, mags 15 FIELD sMkron, MAG_KRON_STDEV, float, standard deviation of kron mags, mags 14 16 15 17 # these statistics are PSF-specific -
branches/eam_branches/ipp-20140610/Ohana/src/libautocode/def/secfilt.d
r36899 r36917 2 2 EXTNAME DVO_SECFILT 3 3 TYPE BINTABLE 4 SIZE 1 524 SIZE 160 5 5 DESCRIPTION DVO SecFilt : Secondary Filter Data 6 6 … … 10 10 FIELD Map, MAG_AP, float, average mag in this band, mags 11 11 FIELD dMap, MAG_AP_ERR, float, formal error on average mag, mags 12 FIELD sMap, MAG_AP_STDEV, float, standard deviation of ap mags, mags 12 13 FIELD Mkron, MAG_KRON, float, ave kron mag in this band, mags 13 14 FIELD dMkron, MAG_KRON_ERR, float, formal error on average kron mag, mags 15 FIELD sMkron, MAG_KRON_STDEV, float, standard deviation of kron mags, mags 14 16 15 17 # these statistics are PSF-specific -
branches/eam_branches/ipp-20140610/Ohana/src/libdvo/include/dvo.h
r36912 r36917 599 599 /* pointers for data manipulation */ 600 600 off_t *found; 601 off_t *foundWarp; 601 602 off_t *image; 602 603 off_t *mosaic; -
branches/eam_branches/ipp-20140610/Ohana/src/libdvo/src/dvo_catalog.c
r36898 r36917 166 166 secfilt->Map = NAN; 167 167 secfilt->dMap = NAN; 168 secfilt->sMap = NAN; 168 169 secfilt->Mkron = NAN; 169 170 secfilt->dMkron = NAN; 171 secfilt->sMkron = NAN; 170 172 171 173 secfilt->Mstdev = NAN; -
branches/eam_branches/ipp-20140610/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
r36900 r36917 284 284 out[i].dM = in[i].dM; 285 285 out[i].Map = in[i].Map; 286 out[i].dMap = in[i].dM; 286 out[i].dMap = in[i].dMap; 287 out[i].sMap = in[i].sMap; 287 288 out[i].Mkron = in[i].Mkron; 288 289 out[i].dMkron = in[i].dMkron; … … 329 330 out[i].sFapWrp = in[i].sFapWrp; 330 331 331 out[i].NusedWrp = in[i].Nused ;332 out[i].NusedKronWrp = in[i].NusedKron ;333 out[i].NusedApWrp = in[i].NusedAp ;332 out[i].NusedWrp = in[i].NusedWrp; 333 out[i].NusedKronWrp = in[i].NusedKronWrp; 334 out[i].NusedApWrp = in[i].NusedApWrp; 334 335 335 336 out[i].ubercalDist = in[i].ubercalDist; … … 350 351 out[i].dM = in[i].dM; 351 352 out[i].Map = in[i].Map; 352 out[i].dMap = in[i].dM; 353 out[i].dMap = in[i].dMap; 354 out[i].sMap = in[i].sMap; 353 355 out[i].Mkron = in[i].Mkron; 354 356 out[i].dMkron = in[i].dMkron; 357 out[i].sMkron = in[i].sMkron; 355 358 356 359 out[i].Mstdev = in[i].Mstdev; … … 395 398 out[i].sFapWrp = in[i].sFapWrp; 396 399 397 out[i].NusedWrp = in[i].Nused ;398 out[i].NusedKronWrp = in[i].NusedKron ;399 out[i].NusedApWrp = in[i].NusedAp ;400 out[i].NusedWrp = in[i].NusedWrp; 401 out[i].NusedKronWrp = in[i].NusedKronWrp; 402 out[i].NusedApWrp = in[i].NusedApWrp; 400 403 401 404 out[i].ubercalDist = in[i].ubercalDist; -
branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/StarOps.c
r36910 r36917 153 153 int i; 154 154 155 fprintf (stderr, "this version of setMrel is invalid for now\n"); 156 exit (1); 157 155 158 int Nsecfilt = GetPhotcodeNsecfilt (); 156 159 -
branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setMrelCatalog.c
r36910 r36917 1 1 # include "relphot.h" 2 # define UBERCAL_WEIGHT 100.0 2 3 3 4 # define SKIP_THIS_MEAS(REASON) { \ … … 13 14 continue; } 14 15 16 static float MagToFlux (float Mag) { 17 float Flux = pow(10.0, -0.4*(Mag)); 18 return (Flux); 19 } 20 15 21 int print_measure_set_alt (Average *average, SecFilt *secfilt, Measure *measure) { 16 22 … … 29 35 return (TRUE); 30 36 } 37 38 int setMrelAverageForcedWarp (off_t measureOffset, int cat, int pass, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, off_t *found); 31 39 32 40 int setMrel_catalog_alt (Catalog *catalog, int Nc, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt) { … … 59 67 setGlobalObjStats (&catalog[Nc].average[j], &catalog[Nc].measure[m]); 60 68 } 69 70 // only measure force-warp mean values if issetMrelFinal (make it optional?) 71 if (isSetMrelFinal) { 72 setMrelAverageForcedWarp (m, Nc, pass, results, &catalog[Nc].average[j], &catalog[Nc].secfilt[j*Nsecfilt], &catalog[Nc].measure[m], &catalog[Nc].foundWarp[Nsecfilt*j]); 73 setGlobalObjStats (&catalog[Nc].average[j], &catalog[Nc].measure[m]); 74 } 61 75 } 62 76 if (primaryCell) free (primaryCell); … … 64 78 } 65 79 80 // set mean of chip measurements (selected by photcode range for now): 66 81 int setMrelAverageExposure (off_t measureOffset, int cat, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, Average *average, AverageTiny *averageT, SecFilt *secfilt, Measure *measure, MeasureTiny *measureT, off_t *found) { 67 82 … … 199 214 } 200 215 201 // gpc1 stack data 202 if ((measure[k].photcode >= 11000) && (measure[k].photcode <= 11400)) { 216 // SKIP gpc1 stack data 217 if ((measure[k].photcode >= 11000) && (measure[k].photcode <= 11500)) { 218 continue; 219 } 220 221 // SKIP gpc1 forced-warp data 222 if ((measure[k].photcode >= 12000) && (measure[k].photcode <= 12500)) { 203 223 continue; 204 224 } … … 258 278 if (!isnan(Map)) { 259 279 Maplist[Nap] = Map - Mcal - Mmos - Mgrid; 260 daplist[Nap] = dMpsf; 261 waplist[Nap] = isUbercal ? 10.0: 1.0;280 daplist[Nap] = dMpsf;// XXX check on this... 281 waplist[Nap] = isUbercal ? UBERCAL_WEIGHT : 1.0; 262 282 Nap ++; 263 283 } … … 267 287 Mkronlist[Nkron] = Mkron - Mcal - Mmos - Mgrid; 268 288 dkronlist[Nkron] = measure[k].dMkron; 269 wkronlist[Nkron] = isUbercal ? 10.0: 1.0;289 wkronlist[Nkron] = isUbercal ? UBERCAL_WEIGHT : 1.0; 270 290 Nkron ++; 271 291 } … … 280 300 Mpsflist[Npsf] = Msys - Mcal - Mmos - Mgrid; 281 301 dpsflist[Npsf] = dMpsf; 282 wpsflist[Npsf] = isUbercal ? 10.0: 1.0;302 wpsflist[Npsf] = isUbercal ? UBERCAL_WEIGHT : 1.0; 283 303 284 304 // NOTE: … … 293 313 if (refPhotcode) { 294 314 if (code->code == refPhotcode->code) { 295 wpsflist[Npsf] = 100.0;315 wpsflist[Npsf] = UBERCAL_WEIGHT; 296 316 } 297 317 } … … 304 324 if (isSetMrelFinal && (pass == 0)) { 305 325 if ((thisCode < 6) || (thisCode == 9)) { 306 secfilt[Nsec].Ncode = NexpPS1; 326 secfilt[Nsec].Ncode = NexpPS1; 307 327 } else { 308 328 secfilt[Nsec].Ncode = Ncode; // 2MASS data if it exists … … 346 366 found[Nsec] = TRUE; 347 367 348 secfilt[Nsec].Mstdev = 1000.0*psfstats->sigma; // Mstdev is in millimags (not enough space for more precision)368 secfilt[Nsec].Mstdev = psfstats->sigma; // Mstdev is in millimags (not enough space for more precision) 349 369 // secfilt[Nsec].Ncode = Ncode; 350 370 secfilt[Nsec].Nused = psfstats->Nmeas; 351 371 352 secfilt[Nsec].Mmax = 1000 *psfstats->max;353 secfilt[Nsec].Mmin = 1000 *psfstats->min;372 secfilt[Nsec].Mmax = psfstats->max; 373 secfilt[Nsec].Mmin = psfstats->min; 354 374 355 375 // NOTE : use the modified weight for apmags as well as psf mags 356 376 liststats (Maplist, daplist, waplist, Nap, apstats); 357 377 secfilt[Nsec].Map = Nap > 0 ? apstats->mean : NAN; 378 secfilt[Nsec].dMap = Nap > 0 ? apstats->error : NAN; 379 secfilt[Nsec].sMap = Nap > 0 ? apstats->sigma : NAN; 380 secfilt[Nsec].NusedAp = Nap; 358 381 359 382 liststats (Mkronlist, dkronlist, wkronlist, Nkron, kronstats); 360 383 secfilt[Nsec].Mkron = Nkron > 0 ? kronstats->mean : NAN; 361 384 secfilt[Nsec].dMkron = Nkron > 0 ? kronstats->error : NAN; 385 secfilt[Nsec].sMkron = Nkron > 0 ? kronstats->sigma : NAN; 386 secfilt[Nsec].NusedKron = Nkron; 362 387 363 388 // NOTE: for 2MASS measurements, Next should be 1, as should N … … 585 610 secfilt[Nsec].FkronStk = zpFactor * measure[k].FluxKron; 586 611 secfilt[Nsec].dFkronStk = zpFactor * measure[k].dFluxKron; 612 secfilt[Nsec].FapStk = zpFactor * measure[k].FluxAp; 613 secfilt[Nsec].dFapStk = zpFactor * measure[k].dFluxAp; 614 615 secfilt[Nsec].MpsfStk = (measure[k].FluxPSF > 0.0) ? zp -2.5*log10(measure[k].FluxPSF) : NAN; 616 secfilt[Nsec].MkronStk = (measure[k].FluxKron > 0.0) ? zp -2.5*log10(measure[k].FluxKron) : NAN; 617 secfilt[Nsec].MapStk = (measure[k].FluxAp > 0.0) ? zp -2.5*log10(measure[k].FluxAp) : NAN; 587 618 588 619 secfilt[Nsec].stackDetectID = ID; … … 607 638 } 608 639 640 # undef SKIP_THIS_MEAS 641 # define SKIP_THIS_MEAS(REASON) { \ 642 measure[k].dbFlags |= ID_MEAS_SKIP_PHOTOM; \ 643 results->REASON ++; \ 644 continue; } 645 646 // set mean of forced-warp measurements (selected by photcode range for now): 647 // somewhat simplified relative to chip-photometry: 648 // * no grid, no mosaic, no 2MASS, no SYNTH, no Ubercal, no flatcorr 649 int setMrelAverageForcedWarp (off_t measureOffset, int cat, int pass, SetMrelInfo *results, Average *average, SecFilt *secfilt, Measure *measure, off_t *found) { 650 651 off_t k; 652 float Fsys = 0, Mcal= 0; 653 654 // we are measuring means for 3 types of FLUXes: psf, ap, kron. I am using the psf mag 655 // error for the ap mags, but krons have their own errors. it is an open question if I 656 // should be doing weighted or unweighted fits (this is a user option) 657 double *Fpsflist = results->Mpsflist; 658 double *dpsflist = results->dpsflist; 659 double *wpsflist = results->wpsflist; 660 661 double *Faplist = results->Maplist; 662 double *daplist = results->daplist; 663 double *waplist = results->waplist; 664 665 double *Fkronlist = results->Mkronlist; 666 double *dkronlist = results->dkronlist; 667 double *wkronlist = results->wkronlist; 668 669 StatType *psfstats = &results->psfstats; 670 StatType *apstats = &results->apstats; 671 StatType *kronstats = &results->kronstats; 672 673 // option for a test print 674 if (FALSE && (average[0].objID == 0x7146) && (average[0].catID == 0x49d8)) { 675 fprintf (stderr, "test obj\n"); 676 print_measure_set_alt (average, secfilt, measure); 677 } 678 679 int Ns; 680 for (Ns = 0; Ns < Nphotcodes; Ns++) { 681 682 int thisCode = photcodes[Ns][0].code; 683 int Nsec = GetPhotcodeNsec(thisCode); 684 685 /* calculate the average mag in this SEC photcode for a single star */ 686 687 /* star/photcodes already calibrated */ 688 if (found[Nsec]) continue; 689 690 off_t meas = measureOffset; 691 692 int Nap = 0; 693 int Npsf = 0; 694 int Nkron = 0; 695 for (k = 0; k < average[0].Nmeasure; k++, meas++) { 696 697 // skip measurements which are not ForcedWarp values 698 if ((measure[k].photcode < 12000) || (measure[k].photcode > 12500)) continue; 699 700 // skip measurements that do not match the current photcode 701 PhotCode *code = GetPhotcodebyCode (measure[k].photcode); 702 if (!code) continue; 703 if (code->equiv != thisCode) { continue; } 704 705 if (measure[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS(Nbad); 706 707 if (getImageEntry (meas, cat) < 0) { 708 // measurements without an image are either external reference photometry or 709 // data for which the associated image has not been loaded (probably because of 710 // overlaps). Msys + measure.Mcal is our best guess of the true magnitude 711 Mcal = measure[k].Mcal; // check that this is zero for loaded REF value 712 } else { 713 // use getMcal not getMcal_alt? 714 Mcal = getMcal_alt (meas, cat, NULL, measure[k].Xccd, measure[k].Yccd); 715 // Mcal = getMcal (meas, cat); 716 if (isnan(Mcal)) SKIP_THIS_MEAS(Ncal); 717 } 718 float Fcal = MagToFlux(Mcal); 719 720 // in the calculations below, 721 // ...list gives the error per measurement, wlist gives the weight 722 // we can modify the error and weight in a few ways: 723 // 1) MIN_ERROR guarantees a floor 724 // 2) photomErrSys is added in quadrature as a sytematic error, set per photcode 725 726 // skip some absurd values NAN 727 // NOTE : I am using PhotCat not PhotSys for now since GPC1 chip-to-chip color terms 728 // are small (and not measured) 729 float Fpsf = PhotFluxCat (&measure[k], MAG_CLASS_PSF); 730 if (isnan(Fsys)) SKIP_THIS_MEAS(Nsys); 731 // if (Msys < 0.0) SKIP_THIS_MEAS(Nsys); 732 // if (Msys > 30.0) SKIP_THIS_MEAS(Nsys); 733 734 float dFpsf = PhotFluxCatErr (&measure[k], MAG_CLASS_PSF); 735 dFpsf = MAX (dFpsf, MIN_ERROR*Fpsf); // MIN_ERROR is a fractional error 736 Fpsflist[Npsf] = Fpsf * Fcal; 737 dpsflist[Npsf] = dFpsf * Fcal; 738 wpsflist[Npsf] = 1.0; 739 Npsf ++; 740 741 float Fap = PhotFluxCat (&measure[k], MAG_CLASS_APER); 742 float dFap = PhotFluxCatErr (&measure[k], MAG_CLASS_APER); 743 if (!isnan(Fap)) { 744 Faplist[Nap] = Fap * Fcal; 745 daplist[Nap] = dFap * Fcal; 746 waplist[Nap] = 1.0; // drop weight lists? 747 Nap ++; 748 } 749 750 float Fkron = PhotFluxCat (&measure[k], MAG_CLASS_KRON); 751 float dFkron = PhotFluxCatErr (&measure[k], MAG_CLASS_KRON); 752 if (!isnan(Fkron)) { 753 Fkronlist[Nkron] = Fkron * Fcal; 754 dkronlist[Nkron] = dFkron * Fcal; 755 wkronlist[Nkron] = 1.0; 756 Nkron ++; 757 } 758 } 759 if (Npsf < 1) continue; 760 761 found[Nsec] = TRUE; 762 763 liststats (Fpsflist, dpsflist, wpsflist, Npsf, psfstats); 764 765 secfilt[Nsec].FpsfWrp = psfstats->mean; 766 secfilt[Nsec].dFpsfWrp = psfstats->error; 767 secfilt[Nsec].sFpsfWrp = psfstats->sigma; // Mstdev is in millimags (not enough space for more precision) 768 secfilt[Nsec].NusedWrp = psfstats->Nmeas; 769 secfilt[Nsec].MpsfWrp = isnan(secfilt[Nsec].FpsfWrp) ? NAN : -2.5*log(secfilt[Nsec].FpsfWrp); // XXX need to add zero-point 770 771 // NOTE : use the modified weight for apmags as well as psf mags 772 liststats (Faplist, daplist, waplist, Nap, apstats); 773 secfilt[Nsec].FapWrp = Nap > 0 ? apstats->mean : NAN; 774 secfilt[Nsec].dFapWrp = Nap > 0 ? apstats->error : NAN; 775 secfilt[Nsec].sFapWrp = Nap > 0 ? apstats->sigma : NAN; 776 secfilt[Nsec].NusedApWrp = Nap; 777 secfilt[Nsec].MapWrp = isnan(secfilt[Nsec].FapWrp) ? NAN : -2.5*log(secfilt[Nsec].FapWrp); // XXX need to add zero-point 778 779 liststats (Fkronlist, dkronlist, wkronlist, Nkron, kronstats); 780 secfilt[Nsec].FkronWrp = Nkron > 0 ? kronstats->mean : NAN; 781 secfilt[Nsec].dFkronWrp = Nkron > 0 ? kronstats->error : NAN; 782 secfilt[Nsec].sFkronWrp = Nkron > 0 ? kronstats->sigma : NAN; 783 secfilt[Nsec].NusedKronWrp = Nkron; 784 secfilt[Nsec].MkronWrp = isnan(secfilt[Nsec].FkronWrp) ? NAN : -2.5*log(secfilt[Nsec].FkronWrp); // XXX need to add zero-point 785 } 786 return (TRUE); 787 } 788 609 789 int setGlobalObjStats (Average *average, Measure *measure) { 610 790 -
branches/eam_branches/ipp-20140610/Ohana/src/relphot/src/setMrelFinal.c
r36910 r36917 86 86 /* set catalog[0].found[i] = FALSE */ 87 87 ALLOCATE (catalog[0].found, off_t, MAX (1, Nsecfilt*catalog[0].Naverage)); 88 ALLOCATE (catalog[0].foundWarp, off_t, MAX (1, Nsecfilt*catalog[0].Naverage)); 88 89 for (i = 0; i < Nsecfilt*catalog[0].Naverage; i++) { 89 90 catalog[0].found[i] = FALSE; 91 catalog[0].foundWarp[i] = FALSE; 90 92 } 91 93
Note:
See TracChangeset
for help on using the changeset viewer.
