Changeset 33422
- Timestamp:
- Mar 6, 2012, 7:07:53 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/relastro
- Files:
-
- 7 edited
-
doc/parallel.txt (modified) (1 diff)
-
src/FixProblemImages.c (modified) (1 diff)
-
src/ImageOps.c (modified) (21 diffs)
-
src/StarMaps.c (modified) (1 diff)
-
src/UpdateObjectOffsets.c (modified) (1 diff)
-
src/UpdateObjects.c (modified) (6 diffs)
-
src/bcatalog.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/relastro/doc/parallel.txt
r33419 r33422 15 15 * relastro_objects, high_speed_catalogs, and standard relastro all call UpdateObjects, one way or another. 16 16 17 The big question is if we can use17 The big question is if / how we can use MeasureTiny (or if we need a separate astrometry version) 18 18 19 UpdateObjects: 20 * if (catalog[i].average[j].Nmeasure == 0) { 19 * average.d fields we are NOT using in UpdateObjects (28 / 120 bytes) 20 FIELD Nmissing, NMISSING, unsigned short, number of missings 21 FIELD Nextend, NEXTEND, unsigned short, number of extended measurements 22 FIELD missingOffset, OFF_MISSING, int, offset to first missing obs 23 FIELD extendOffset, OFF_EXTEND, int, offset to first extended measurement 24 FIELD photFlagsUpper, PHOTFLAGS_U, uint32_t, upper bit of 2 bit summary of per-measure photflags 25 FIELD photFlagsLower, PHOTFLAGS_L, uint32_t, lower bit of 2 bit summary of per-measure photflags 26 FIELD extID, EXT_ID, uint64_t, external ID for object (eg PSPS objID) 27 28 * measure.d fields in use in UpdateObjects 29 * measure[m].t 30 * measure[m].dbFlags 31 * measure[m].dt 32 * measure[0].dR 33 * measure[0].dD 34 * measure[0].M 35 * measure[0].dM 36 * measure[0].photcode 37 * measure[0].photFlags 38 * measure[m].Xccd; 39 * measure[m].Yccd; 40 * measure[m].averef; 41 * measure[0].imageID; 42 * measure[0].airmass 43 * measure[0].Mcal (only used in PhotRelTiny) 44 + measure[0].dXccd 45 + measure[0].dYccd 46 + measure[m].dRsys 47 48 float dR; 49 float dD; 50 float M; 51 float Mcal; 52 float dM; 53 float airmass; 54 float Xccd; 55 float Yccd; 56 float dt; 57 int t; 58 unsigned int averef; 59 unsigned int imageID; 60 unsigned int dbFlags; 61 unsigned int photFlags; 62 - int catID; // unsigned int? 63 unsigned short photcode; 64 65 maybe 66 FIELD Map, M_APER, float, aperture mag, mag 67 FIELD psfQual, PSF_QF, float, psf coverage/quality factor 68 69 not used 70 FIELD dMcal, MAG_CAL_ERR, float, systematic calibration error, mag 71 FIELD az, AZ, float, telescope azimuth 72 FIELD Sky, SKY_FLUX, float, local estimate of sky flux, counts/sec 73 FIELD dSky, SKY_FLUX_ERR, float, local estimate of sky flux, counts/sec 74 FIELD t_msec, TIME_MSEC, unsigned short, time fraction of second, milliseconds 75 FIELD detID, DET_ID, unsigned int, detection ID 76 FIELD objID, OBJ_ID, unsigned int, unique ID for object in table 77 FIELD catID, CAT_ID, unsigned int, unique ID for table in which object was first realized 78 FIELD psfChisq, PSF_CHISQ, float, psf fit chisq 79 FIELD psfNdof, PSF_NDOF, int, psf degrees of freedom 80 FIELD psfNpix, PSF_NPIX, int, psf number of pixels 81 FIELD crNsigma, CR_NSIGMA, float, Nsigma deviation towards CR 82 FIELD extNsigma, EXT_NSIGMA, float, Nsigma deviation towards EXT 83 FIELD FWx, FWHM_MAJOR, short, object fwhm major axis, 1/100 of pixels 84 FIELD FWy, FWHM_MINOR, short, object fwhm minor axis, 1/100 of pixels 85 FIELD theta, PSF_THETA, short, angle wrt ccd X dir, (0xffff/360) deg 86 FIELD Mxx, MXX, short, second moments in pixel coords, 1/100 of pixels^2 87 FIELD Mxy, MXY, short, second moments in pixel coords, 1/100 of pixels^2 88 FIELD Myy, MYY, short, second moments in pixel coords, 1/100 of pixels^2 89 FIELD posangle, POSANGLE, short, position angle sky to chip, (0xffff/360) deg 90 FIELD pltscale, PLTSCALE, float, plate scale, arcsec/pixel 91 -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/FixProblemImages.c
r32346 r33422 5 5 6 6 int FixProblemImages (SkyList *skylist) { 7 8 fprintf (stderr, "this function is currently not used : check on change from measure -> measureT in load_catalogs\n"); 9 abort(); 7 10 8 11 int Nbad; -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/ImageOps.c
r32695 r33422 181 181 182 182 off_t idx, ID; 183 Measure *measure;183 MeasureTiny *measure; 184 184 int i, found; 185 185 186 measure = &catalog[cat].measure [meas];186 measure = &catalog[cat].measureT[meas]; 187 187 188 188 ID = measure[0].imageID; … … 241 241 242 242 off_t i; 243 Measure *measure;244 245 measure = &catalog[cat].measure [meas];243 MeasureTiny *measure; 244 245 measure = &catalog[cat].measureT[meas]; 246 246 247 247 /* find the image that supplied this measurement */ … … 333 333 } 334 334 335 void dump_measures(Average *average, Measure *measure) {335 void dump_measures(Average *average, MeasureTiny *measure) { 336 336 337 337 off_t j, off; … … 406 406 c = clist[im][i]; 407 407 408 X = catalog[c].measure[m].Xccd; 409 Y = catalog[c].measure[m].Yccd; 410 n = catalog[c].measure[m].averef; 408 MeasureTiny *measure = &catalog[c].measureT[m]; 409 410 X = measure[0].Xccd; 411 Y = measure[0].Yccd; 412 n = measure[0].averef; 411 413 412 414 if (moscoords == NULL) { … … 429 431 if (fabs(dR) > 3.0*ADDSTAR_RADIUS) { 430 432 fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD); 431 dump_measures (&catalog[c].average[n], catalog[c].measure );433 dump_measures (&catalog[c].average[n], catalog[c].measureT); 432 434 // abort (); 433 435 } 434 436 if (fabs(dD) > 3.0*ADDSTAR_RADIUS) { 435 437 fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD); 436 dump_measures (&catalog[c].average[n], catalog[c].measure );438 dump_measures (&catalog[c].average[n], catalog[c].measureT); 437 439 // abort (); 438 440 } 439 441 440 442 // complain if the new location is far from the old location 441 if (fabs(catalog[c].measure [m].dR - dR) > DPOS_MAX_ASEC) {443 if (fabs(catalog[c].measureT[m].dR - dR) > DPOS_MAX_ASEC) { 442 444 fprintf (stderr, "measurement is far from original location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD); 443 dump_measures (&catalog[c].average[n], catalog[c].measure );445 dump_measures (&catalog[c].average[n], catalog[c].measureT); 444 446 // abort(); 445 447 } 446 if (fabs( catalog[c].measure[m].dD - dD) > DPOS_MAX_ASEC) {448 if (fabs(measure[0].dD - dD) > DPOS_MAX_ASEC) { 447 449 fprintf (stderr, "measurement is far from original location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD); 448 450 dump_measures (&catalog[c].average[n], catalog[c].measure); … … 450 452 } 451 453 452 dPos += SQ( catalog[c].measure[m].dR - dR) + SQ(catalog[c].measure[m].dD - dD);454 dPos += SQ(measure[0].dR - dR) + SQ(measure[0].dD - dD); 453 455 nPos ++; 454 456 455 catalog[c].measure[m].dR = dR;456 catalog[c].measure[m].dD = dD;457 458 if ( catalog[c].measure[m].dR > +180.0*3600.0) {457 measure[0].dR = dR; 458 measure[0].dD = dD; 459 460 if (measure[0].dR > +180.0*3600.0) { 459 461 // average on high end of boundary, move star up 460 462 R += 360.0; 461 catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R);462 } 463 if ( catalog[c].measure[m].dR < -180.0*3600.0) {463 measure[0].dR = 3600.0*(catalog[c].average[n].R - R); 464 } 465 if (measure[0].dR < -180.0*3600.0) { 464 466 // average on low end of boundary, move star down 465 467 R -= 360.0; 466 catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R);468 measure[0].dR = 3600.0*(catalog[c].average[n].R - R); 467 469 } 468 470 469 471 // set the systematic error for this image: 470 catalog[c].measure[m].dRsys = ToShortPixels(dPosSys);472 measure[0].dRsys = ToShortPixels(dPosSys); 471 473 } 472 474 … … 487 489 Mosaic *mosaic; 488 490 Coords *moscoords, *imcoords, *oldcoords; 491 492 fprintf (stderr, "fix resetImageRaw wrt MeasureTiny\n"); 493 abort(); 489 494 490 495 // check if this image is bad and should be skipped … … 511 516 c = clist[im][i]; 512 517 513 X = catalog[c].measure[m].Xccd; 514 Y = catalog[c].measure[m].Yccd; 515 n = catalog[c].measure[m].averef; 518 // XXX unclear if this should use Measure or MeasureTiny; it is only called by FixProblemImages, which has not been updated 519 Measure *measure = &catalog[c].measure[m]; 520 521 X = measure[0].Xccd; 522 Y = measure[0].Yccd; 523 n = measure[0].averef; 516 524 517 525 dR = dD = 0.0; … … 527 535 } 528 536 529 catalog[c].measure[m].dR = dR;530 catalog[c].measure[m].dD = dD;531 532 if ( catalog[c].measure[m].dR > +180.0*3600.0) {537 measure[0].dR = dR; 538 measure[0].dD = dD; 539 540 if (measure[0].dR > +180.0*3600.0) { 533 541 // average on high end of boundary, move star up 534 542 R += 360.0; 535 catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R);536 } 537 if ( catalog[c].measure[m].dR < -180.0*3600.0) {543 measure[0].dR = 3600.0*(catalog[c].average[n].R - R); 544 } 545 if (measure[0].dR < -180.0*3600.0) { 538 546 // average on low end of boundary, move star down 539 547 R -= 360.0; 540 catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R);548 measure[0].dR = 3600.0*(catalog[c].average[n].R - R); 541 549 } 542 550 } … … 573 581 c = clist[im][i]; 574 582 583 MeasureTiny *measure = &catalog[c].measure[m]; 584 575 585 /* apply the current image transformation or use the current value of R+dR, D+dD? */ 576 raw[i].X = catalog[c].measure[m].Xccd;577 raw[i].Y = catalog[c].measure[m].Yccd;578 579 raw[i].Mag = catalog[c].measure[m].M;580 raw[i].dMag = catalog[c].measure[m].dM;581 raw[i].dPos = GetAstromError (& catalog[c].measure[m], ERROR_MODE_POS);582 583 n = catalog[c].measure[m].averef;586 raw[i].X = measure[0].Xccd; 587 raw[i].Y = measure[0].Yccd; 588 589 raw[i].Mag = measure[0].M; 590 raw[i].dMag = measure[0].dM; 591 raw[i].dPos = GetAstromError (&measure[0], ERROR_MODE_POS); 592 593 n = measure[0].averef; 584 594 585 595 // an object with only one detection provides no information about the image calibration … … 589 599 raw[i].mask |= 0x0001; 590 600 } 591 if (!finite( catalog[c].measure[m].dR) || !finite(catalog[c].measure[m].dD)) {601 if (!finite(measure[0].dR) || !finite(measure[0].dD)) { 592 602 raw[i].mask |= 0x0002; 593 603 } … … 646 656 n = catalog[c].measure[m].averef; 647 657 658 MeasureTiny *measure = &catalog[c].measure[m]; 659 648 660 /* apply the current image transformation or use the current value of R+dR, D+dD? */ 649 661 ref[i].R = catalog[c].average[n].R; 650 662 ref[i].D = catalog[c].average[n].D; 651 663 652 ref[i].Mag = catalog[c].measure[m].M;653 ref[i].dMag = catalog[c].measure[m].dM;654 ref[i].dPos = GetAstromError (& catalog[c].measure[m], ERROR_MODE_POS);664 ref[i].Mag = measure[0].M; 665 ref[i].dMag = measure[0].dM; 666 ref[i].dPos = GetAstromError (&measure[0], ERROR_MODE_POS); 655 667 656 668 ref[i].mask = FALSE; … … 683 695 684 696 void FlagOutliers (Catalog *catalog) { 685 // XXX FlagOutliers is just using FlagOutliers2D 697 698 // XXX FlagOutliers is now just using FlagOutliers2D 686 699 FlagOutliers2D(catalog); 687 700 return; … … 716 729 for (j = 0; j < catalog[0].Naverage; j++) { 717 730 731 // pointer to this set of measurements 732 m = catalog[0].average[j].measureOffset; 733 MeasureTiny *measure = &catalog[0].measureT[m]; 734 718 735 /* accumulate list of valid measurements */ 719 m = catalog[0].average[j].measureOffset;720 736 N = 0; 721 for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) { 722 737 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) { 723 738 // skip measurements based on user selected criteria 724 if (!MeasFilterTest(& catalog[0].measure[m], FALSE)) continue;725 R[N] = catalog[0].measure[m].dR;726 D[N] = catalog[0].measure[m].dD;727 dR[N] = GetAstromError ( &catalog[0].measure[m], ERROR_MODE_RA);728 dD[N] = GetAstromError ( &catalog[0].measure[m], ERROR_MODE_DEC);739 if (!MeasFilterTest(&measure[k], FALSE)) continue; 740 R[N] = measure[k].dR; 741 D[N] = measure[k].dD; 742 dR[N] = GetAstromError (&measure[k], ERROR_MODE_RA); 743 dD[N] = GetAstromError (&measure[k], ERROR_MODE_DEC); 729 744 if (isnan(R[N]) || isnan(D[N])) continue; 730 745 N++; … … 741 756 742 757 /* compare per-object distance to this standard deviation, and flag outliers*/ 743 m = catalog[0].average[j].measureOffset;744 758 N = 0; 745 for (k = 0; k < catalog[0].average[j].Nmeasure; k++ , m++) {759 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) { 746 760 //reset flag on each invocation 747 catalog[0].measure[m].dbFlags &= ~ID_MEAS_POOR_ASTROM;761 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM; 748 762 749 763 // skip measurements based on user selected criteria 750 if (!MeasFilterTest(& catalog[0].measure[m], FALSE)) continue;764 if (!MeasFilterTest(&measure[k], FALSE)) continue; 751 765 752 x = catalog[0].measure[m].dR - statsR.median;753 y = catalog[0].measure[m].dD - statsD.median;766 x = measure[k].dR - statsR.median; 767 y = measure[k].dD - statsD.median; 754 768 theta = atan2(y,x); 755 769 if ((x*x + y*y) > (SQR(statsR.sigma * Ns * cos(theta)) + 756 770 SQR(statsD.sigma * Ns * sin(theta)))) { 757 catalog[0].measure[m].dbFlags |= ID_MEAS_POOR_ASTROM;771 measure[k].dbFlags |= ID_MEAS_POOR_ASTROM; 758 772 Ndel++; 759 773 } … … 809 823 for (j = 0; j < catalog[0].Naverage; j++) { 810 824 825 // pointer to this set of measurements 826 m = catalog[0].average[j].measureOffset; 827 MeasureTiny *measure = &catalog[0].measureT[m]; 828 811 829 /* accumulate list of valid measurements */ 812 m = catalog[0].average[j].measureOffset;813 830 N = 0; 814 815 for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) { 816 817 //reset flag on each invocation 818 catalog[0].measure[m].dbFlags &= ~ID_MEAS_POOR_ASTROM; 831 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) { 832 833 // reset flag on each invocation 834 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM; 819 835 820 836 // skip measurements based on user selected criteria 821 if (!MeasFilterTest(& catalog[0].measure[m], FALSE)) continue;822 R[N] = catalog[0].measure[m].dR;823 D[N] = catalog[0].measure[m].dD;824 dR[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_RA);825 dD[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_DEC);837 if (!MeasFilterTest(&measure[k], FALSE)) continue; 838 R[N] = measure[k].dR; 839 D[N] = measure[k].dD; 840 dR[N] = GetAstromError(&measure[k], ERROR_MODE_RA); 841 dD[N] = GetAstromError(&measure[k], ERROR_MODE_DEC); 826 842 if (isnan(R[N]) || isnan(D[N])) continue; 827 843 N++; … … 837 853 838 854 /* calculate deviations of all points*/ 839 m = catalog[0].average[j].measureOffset;840 855 N = 0; 841 for (k = 0; k < catalog[0].average[j].Nmeasure; k++ , m++) {842 // skip bad measurements843 if (!MeasFilterTest(& catalog[0].measure[m], FALSE)) continue;844 x = catalog[0].measure[m].dR - statsR.median;845 y = catalog[0].measure[m].dD - statsD.median;856 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) { 857 // skip bad measurements 858 if (!MeasFilterTest(&measure[k], FALSE)) continue; 859 x = measure[k].dR - statsR.median; 860 y = measure[k].dD - statsD.median; 846 861 theta = atan2(y,x); 847 862 d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) + 848 863 SQR(statsD.sigma * Ns * sin(theta))); 849 index[N] = m;864 index[N] = k; 850 865 N++; 851 866 } … … 856 871 857 872 // recalculate image center, sigma based on closest 50% of points 858 for (k = 0; k < N; k++) {873 for (k = 0; k < N; k++) { 859 874 off_t ind = (off_t) index[k]; 860 R[k] = catalog[0].measure[ind].dR;861 D[k] = catalog[0].measure[ind].dD;862 dR[k] = GetAstromError( &catalog[0].measure[ind], ERROR_MODE_RA);863 dD[k] = GetAstromError( &catalog[0].measure[ind], ERROR_MODE_DEC);875 R[k] = measure[ind].dR; 876 D[k] = measure[ind].dD; 877 dR[k] = GetAstromError(&measure[ind], ERROR_MODE_RA); 878 dD[k] = GetAstromError(&measure[ind], ERROR_MODE_DEC); 864 879 } 865 880 liststats (R, dR, N, &statsR); … … 869 884 870 885 // use these new statistics to flag outliers 871 m = catalog[0].average[j].measureOffset;872 886 N = 0; 873 for (k = 0; k < catalog[0].average[j].Nmeasure; k++ , m++) {887 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) { 874 888 //skip bad measurements 875 if (!MeasFilterTest(& catalog[0].measure[m], FALSE)) continue;876 x = catalog[0].measure[m].dR - statsR.median;877 y = catalog[0].measure[m].dD - statsD.median;889 if (!MeasFilterTest(&measure[k], FALSE)) continue; 890 x = measure[k].dR - statsR.median; 891 y = measure[k].dD - statsD.median; 878 892 theta = atan2(y,x); 879 893 d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) + 880 894 SQR(statsD.sigma * Ns * sin(theta))); 881 895 if ((d2[N]) > 1) { 882 catalog[0].measure[m].dbFlags |= ID_MEAS_POOR_ASTROM;896 measure[k].dbFlags |= ID_MEAS_POOR_ASTROM; 883 897 Ndel ++; 884 898 } 885 899 N++; 886 900 Nave++; 887 } // done rejecting outliers901 } // done rejecting outliers 888 902 889 903 // examine results 890 904 // relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, catalog[0].average[j].Nmeasure, statsR, statsD, Ns); 891 905 892 } // done looping over objects906 } // done looping over objects 893 907 894 908 if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave); … … 905 919 /** Determine whether a measurement should be included in the analysis, based on supplied filter criteria */ 906 920 // we only optionally apply the sigma limit: for object averages, this should not be used (should it?) 907 int MeasFilterTest(Measure *measure, int applySigmaLim) {921 int MeasFilterTest(MeasureTiny *measure, int applySigmaLim) { 908 922 int found, k; 909 923 long mask; … … 958 972 /* select measurements by mag limit */ 959 973 if (ImagSelect) { 960 mag = PhotInst (measure);974 mag = PhotInstTiny (measure); 961 975 if (mag < ImagMin || mag > ImagMax) return FALSE; 962 976 } -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/StarMaps.c
r32346 r33422 68 68 for (i = 0; i < catalog[0].Nmeasure; i++) { 69 69 70 N = getImageByID(catalog[0].measure[i].imageID); 70 MeasureTiny *measure = &catalog[0].measureT[i] 71 72 N = getImageByID(measure[0].imageID); 71 73 if (N < 0) continue; 72 74 73 xbin = catalog[0].measure[i].Xccd / starmap[N].Nx;74 ybin = catalog[0].measure[i].Yccd / starmap[N].Ny;75 xbin = measure[0].Xccd / starmap[N].Nx; 76 ybin = measure[0].Yccd / starmap[N].Ny; 75 77 76 78 xbin = MAX(0, MIN(NX_MAP-1, xbin)); -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/UpdateObjectOffsets.c
r30616 r33422 40 40 UpdateMeasures (&catalog, 1); 41 41 42 XXX: note that this version of UpdateObjects is / should be expecting catalog.measure, not catalog.measureT 42 43 UpdateObjects (&catalog, 1); 43 44 -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/UpdateObjects.c
r32854 r33422 86 86 XVERB = FALSE; 87 87 88 // skip objects which are known to be problematic89 // XXX include this code or not?90 # if (0)91 if (catalog[i].average[j].code & STAR_BAD) {92 Nskip ++;93 continue;94 }95 # endif96 97 88 if (catalog[i].average[j].Nmeasure == 0) { 98 89 continue; … … 101 92 N = 0; 102 93 m = catalog[i].average[j].measureOffset; 103 Tmin = Tmax = (catalog[i].measure[m].t - T2000) / (86400*365.25); 94 MeasureTiny *measure = &catalog[i].measureT[m]; 95 96 Tmin = Tmax = (measure[0].t - T2000) / (86400*365.25); 104 97 mode = FIT_MODE; 105 98 106 99 // find the basic properties of the detections for this object (Tmin, Tmax, Tmean) 107 100 Tmean = 0; 108 for (k = 0; k < catalog[i].average[j].Nmeasure; k++ , m++) {109 110 // does the measurement pass the supplied filtering constraints?111 if (!MeasFilterTest(& catalog[i].measure[m], FALSE)) {112 catalog[i].measure[m].dbFlags &= ~ID_MEAS_USED_OBJ;101 for (k = 0; k < catalog[i].average[j].Nmeasure; k++) { 102 103 // does the measurement pass the supplied filtering constraints? 104 if (!MeasFilterTest(&measure[k], FALSE)) { 105 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 113 106 continue; 114 107 } 115 108 116 109 //outlier rejection 117 if (FlagOutlier && ( catalog[i].measure[m].dbFlags & ID_MEAS_POOR_ASTROM)) {118 catalog[i].measure[m].dbFlags &= ~ID_MEAS_USED_OBJ;110 if (FlagOutlier && (measure[k].dbFlags & ID_MEAS_POOR_ASTROM)) { 111 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 119 112 continue; 120 113 } 121 114 122 // exclude measurements by previous outlier detection 123 // XXX include this code or not? 124 # if (0) 125 if (catalog[i].measure[m].dbFlags & MEAS_BAD) { 126 catalog[i].measure[m].dbFlags |= ID_MEAS_SKIP_ASTROM; 127 continue; 128 } 129 # endif 130 131 catalog[i].measure[m].dbFlags |= ID_MEAS_USED_OBJ; 132 133 R[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 134 D[N] = getMeanD (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 115 measure[k].dbFlags |= ID_MEAS_USED_OBJ; 116 117 R[N] = getMeanR (&measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 118 D[N] = getMeanD (&measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 135 119 136 120 // XXX I think this is a problem: T[] is time in years relative to J2000, but ParFactor expects 137 121 // to get Time in years relative to UNIX Tzero (1970/01/01) 138 T[N] = ( catalog[i].measure[m].t - T2000) / (86400*365.25) ; // time relative to J2000 in years122 T[N] = (measure[k].t - T2000) / (86400*365.25) ; // time relative to J2000 in years 139 123 140 124 Tmin = MIN(Tmin, T[N]); … … 143 127 144 128 // dX, dY : error in arcsec -- 145 dX[N] = GetAstromError (& catalog[i].measure[m], ERROR_MODE_RA);146 dY[N] = GetAstromError (& catalog[i].measure[m], ERROR_MODE_DEC);129 dX[N] = GetAstromError (&measure[k], ERROR_MODE_RA); 130 dY[N] = GetAstromError (&measure[k], ERROR_MODE_DEC); 147 131 148 132 // add systematic error in quadrature, if desired 149 133 // only do this after the fit has converged (or you will never improve the poor images) 150 134 // if (INCLUDE_SYS_ERR) { 151 // float dRsys = FromShortPixels( catalog[i].measure[m].dRsys);135 // float dRsys = FromShortPixels(measure[k].dRsys); 152 136 // dX[N] = hypot(dX[N], dRsys); 153 137 // dY[N] = hypot(dY[N], dRsys); … … 157 141 // dY[N] = 0.1; 158 142 159 dT[N] = catalog[i].measure[m].dt;143 dT[N] = measure[k].dt; 160 144 161 145 // XXX this is (slightly) inconsistent: dX,dY are the X and Y direction errors in … … 204 188 XVERB |= (catalog[i].average[j].objID == OBJ_ID_SRC) && (catalog[i].average[j].catID == CAT_ID_SRC); 205 189 XVERB |= (catalog[i].average[j].objID == OBJ_ID_DST) && (catalog[i].average[j].catID == CAT_ID_DST); 206 // XVERB = (catalog[i].measure[m].dM < 0.01) && (N == 6) && (mode == FIT_PM_ONLY);207 190 208 191 // to judge the quality of the PM and PAR fits, we need to fit all three models and compare Chisq … … 311 294 // the measure fields must be updated before the average fields 312 295 m = catalog[i].average[j].measureOffset; 296 MeasureTiny *measure = &catalog[i].measureT[m]; 313 297 for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) { 314 setMeanR (fit.Ro, & catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]);315 setMeanD (fit.Do, & catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]);298 setMeanR (fit.Ro, &measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 299 setMeanD (fit.Do, &measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 316 300 } 317 301 -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/bcatalog.c
r31664 r33422 12 12 13 13 /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */ 14 memset(subcatalog, 0, sizeof(Catalog)); 14 15 NAVERAGE = 50; 15 16 NMEASURE = 1000; 16 ALLOCATE (subcatalog[0].average, Average,NAVERAGE);17 ALLOCATE (subcatalog[0].secfilt, SecFilt,NAVERAGE*Nsecfilt);18 ALLOCATE (subcatalog[0].measure , Measure, NMEASURE);17 ALLOCATE (subcatalog[0].average, Average, NAVERAGE); 18 ALLOCATE (subcatalog[0].secfilt, SecFilt, NAVERAGE*Nsecfilt); 19 ALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 19 20 Nmeasure = Naverage = 0; 20 21 … … 70 71 // allowed. 71 72 72 // CopyMeasureTiny (&subcatalog[0].measureT[Nmeasure], &catalog[0].measure[offset]); 73 74 subcatalog[0].measure[Nmeasure] = catalog[0].measure[offset]; 75 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_SKIP_ASTROM; 76 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_NOCAL; 77 subcatalog[0].measure[Nmeasure].averef = Naverage; 73 CopyMeasureTiny (&subcatalog[0].measureT[Nmeasure], &catalog[0].measure[offset]); 74 // subcatalog[0].measure[Nmeasure] = catalog[0].measure[offset]; 75 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_SKIP_ASTROM; 76 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_NOCAL; 77 subcatalog[0].measureT[Nmeasure].averef = Naverage; 78 78 if (RESET) { 79 subcatalog[0].measure [Nmeasure].dbFlags &= ~ID_MEAS_POOR_ASTROM;80 subcatalog[0].measure [Nmeasure].dbFlags &= ~ID_MEAS_AREA;79 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_POOR_ASTROM; 80 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_AREA; 81 81 } 82 82 … … 85 85 if (Nmeasure == NMEASURE) { 86 86 NMEASURE += 1000; 87 REALLOCATE (subcatalog[0].measure , Measure, NMEASURE);87 REALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 88 88 } 89 89 } … … 96 96 } 97 97 } 98 REALLOCATE (subcatalog[0].average, Average,MAX (Naverage, 1));99 REALLOCATE (subcatalog[0].measure , Measure, MAX (Nmeasure, 1));100 REALLOCATE (subcatalog[0].secfilt, SecFilt,MAX (Naverage, 1)*Nsecfilt);98 REALLOCATE (subcatalog[0].average, Average, MAX (Naverage, 1)); 99 REALLOCATE (subcatalog[0].measureT, MeasureTiny, MAX (Nmeasure, 1)); 100 REALLOCATE (subcatalog[0].secfilt, SecFilt, MAX (Naverage, 1)*Nsecfilt); 101 101 subcatalog[0].Naverage = Naverage; 102 102 subcatalog[0].Nmeasure = Nmeasure; … … 168 168 169 169 // allocate the output data 170 ALLOCATE (tmpcatalog.average, Average,Nmax);171 ALLOCATE (tmpcatalog.measure , Measure, NMEASURE);172 ALLOCATE (tmpcatalog.secfilt, SecFilt,Nmax * Nsecfilt);170 ALLOCATE (tmpcatalog.average, Average, Nmax); 171 ALLOCATE (tmpcatalog.measureT, MeasureTiny, NMEASURE); 172 ALLOCATE (tmpcatalog.secfilt, SecFilt, Nmax * Nsecfilt); 173 173 174 174 off_t Nmeasure = 0; … … 181 181 for (j = 0; j < tmpcatalog.average[i].Nmeasure; j++) { 182 182 off_t offset = subcatalog[0].average[ave].measureOffset + j; 183 tmpcatalog.measure [Nmeasure] = subcatalog[0].measure[offset];184 tmpcatalog.measure [Nmeasure].averef = i;183 tmpcatalog.measureT[Nmeasure] = subcatalog[0].measureT[offset]; 184 tmpcatalog.measureT[Nmeasure].averef = i; 185 185 Nmeasure ++; 186 } 187 for (j = 0; j < Nsecfilt; j++) { 188 tmpcatalog.secfilt[i*Nsecfilt + j] = subcatalog[0].secfilt[ave*Nsecfilt + j]; 186 189 } 187 190 } … … 193 196 194 197 free (subcatalog[0].average); 195 free (subcatalog[0].measure );198 free (subcatalog[0].measureT); 196 199 free (subcatalog[0].secfilt); 197 200 198 201 subcatalog[0].average = tmpcatalog.average; 199 subcatalog[0].measure = tmpcatalog.measure;202 subcatalog[0].measureT = tmpcatalog.measureT; 200 203 subcatalog[0].secfilt = tmpcatalog.secfilt; 201 204 subcatalog[0].Naverage = Nmax;
Note:
See TracChangeset
for help on using the changeset viewer.
