Changeset 36808
- Timestamp:
- Jun 3, 2014, 8:04:22 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140423/Ohana/src/relastro
- Files:
-
- 7 edited
-
include/relastro.h (modified) (3 diffs)
-
src/BrightCatalog.c (modified) (7 diffs)
-
src/FitChip.c (modified) (7 diffs)
-
src/ImageOps.c (modified) (3 diffs)
-
src/UpdateObjects.c (modified) (7 diffs)
-
src/args.c (modified) (1 diff)
-
src/initialize.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140423/Ohana/src/relastro/include/relastro.h
r36796 r36808 83 83 double L, M; /* Focal Plane - pixels */ 84 84 double X, Y; /* Chip Coords - pixels */ 85 double Mag; 86 double dMag; 87 double dPos; 85 float Mag; 86 float Color; 87 float dMag; 88 float dPos; 88 89 int mask; 89 90 int Nmeas; … … 216 217 char WHERE_A[10000], WHERE_B[10000]; 217 218 SkyRegionSelection SELECTION; 219 220 char *DCR_COLOR_POS, *DCR_COLOR_NEG; 221 PhotCode *DCR_PHOTCODE_POS, *DCR_PHOTCODE_NEG; 222 int DCR_NSEC_POS, DCR_NSEC_NEG; 218 223 219 224 int ImagSelect; … … 526 531 int ImageTableSave (char *filename, Image *images, off_t Nimages); 527 532 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage); 533 534 float getColor (off_t meas, int cat); -
branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/BrightCatalog.c
r35105 r36808 167 167 GET_COLUMN(measureOffset, "OFF_MEASURE", int); 168 168 GET_COLUMN(missingOffset, "OFF_MISSING", int); 169 GET_COLUMN( extendOffset, "OFF_EXTEND", int);169 GET_COLUMN(refColor, "REF_COLOR", float); 170 170 GET_COLUMN(flags, "FLAGS", int); 171 171 GET_COLUMN(photFlagsUpper, "PHOTFLAGS_U", int); … … 202 202 average[i].measureOffset = measureOffset[i] ; 203 203 average[i].missingOffset = missingOffset[i] ; 204 average[i]. extendOffset = extendOffset[i] ;204 average[i].refColor = refColor[i] ; 205 205 average[i].flags = flags[i] ; 206 206 average[i].photFlagsUpper = photFlagsUpper[i] ; … … 234 234 free (measureOffset); 235 235 free (missingOffset); 236 free ( extendOffset);236 free (refColor); 237 237 free (flags); 238 238 free (photFlagsUpper); … … 510 510 int *measureOffset ; ALLOCATE (measureOffset , int , catalog->Naverage); 511 511 int *missingOffset ; ALLOCATE (missingOffset , int , catalog->Naverage); 512 int *extendOffset ; ALLOCATE (extendOffset , int , catalog->Naverage);512 float *refColor ; ALLOCATE (refColor , float , catalog->Naverage); 513 513 int *flags ; ALLOCATE (flags , int , catalog->Naverage); 514 514 int *photFlagsUpper; ALLOCATE (photFlagsUpper, int , catalog->Naverage); … … 543 543 measureOffset[i] = average[i].measureOffset ; 544 544 missingOffset[i] = average[i].missingOffset ; 545 extendOffset[i] = average[i].extendOffset;545 refColor[i] = average[i].refColor ; 546 546 flags[i] = average[i].flags ; 547 547 photFlagsUpper[i] = average[i].photFlagsUpper ; … … 575 575 gfits_set_bintable_column (&theader, &ftable, "OFF_MEASURE", measureOffset, catalog->Naverage); 576 576 gfits_set_bintable_column (&theader, &ftable, "OFF_MISSING", missingOffset, catalog->Naverage); 577 gfits_set_bintable_column (&theader, &ftable, " OFF_EXTEND", extendOffset, catalog->Naverage);577 gfits_set_bintable_column (&theader, &ftable, "REF_COLOR", refColor, catalog->Naverage); 578 578 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags, catalog->Naverage); 579 579 gfits_set_bintable_column (&theader, &ftable, "PHOTFLAGS_U", photFlagsUpper, catalog->Naverage); … … 605 605 free (measureOffset); 606 606 free (missingOffset); 607 free ( extendOffset);607 free (refColor); 608 608 free (flags); 609 609 free (photFlagsUpper); -
branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/FitChip.c
r36769 r36808 4 4 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) { 5 5 6 int i, NstatFull, Nstat, Niter ;6 int i, NstatFull, Nstat, Niter, Nkeep; 7 7 float dLsig, dMsig, dRsig; 8 8 float dLsigFull, dMsigFull, dRsigFull; … … 24 24 25 25 // measure the scatter distribution (use only the bright end detections) 26 Nkeep = 0; 26 27 for (i = 0; i < Nmatch; i++) { 27 28 if (raw[i].mask) continue; … … 42 43 continue; 43 44 } 44 } 45 Nkeep ++; 46 } 47 48 // I'm rejecting some points from the fit above; I count the remainders and actually 49 // use that count to set order_use below 45 50 46 51 // figures to assess the fitting process: … … 50 55 relastroVisualPlotChipFit(raw, ref, dRmax, Nmatch); 51 56 52 // set the maximum order for the polynomial (based on number of stars )57 // set the maximum order for the polynomial (based on number of stars kept above) 53 58 int order_use = 0; 54 if (N match> 5) order_use = 1; // 4 stars per polynomial term (per dimension)55 if (N match> 30) order_use = 2; // 5 stars per polynomial term (per dimension)56 if (N match> 60) order_use = 3; // 6 stars per polynomial term (per dimension)59 if (Nkeep > 5) order_use = 1; // 4 stars per polynomial term (per dimension) 60 if (Nkeep > 30) order_use = 2; // 5 stars per polynomial term (per dimension) 61 if (Nkeep > 60) order_use = 3; // 6 stars per polynomial term (per dimension) 57 62 if (order_use < 1) { 58 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", N match);63 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nkeep); 59 64 image[0].flags |= ID_IMAGE_ASTROM_FEW; 60 65 return FALSE; 61 66 } 62 67 image[0].coords.Npolyterms = order_use; 63 64 # if (0)65 if (CHIPORDER > 0) {66 int Ndof_min = 3;67 int order_max = 0.5*(sqrt(4*Nmatch - 4*Ndof_min + 1) - 3);68 int order_use = MIN (CHIPORDER, order_max);69 if (order_use < 1) {70 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nmatch);71 image[0].flags |= ID_IMAGE_ASTROM_FEW;72 return FALSE;73 }74 image[0].coords.Npolyterms = order_use;75 }76 # endif77 68 78 69 if (fit) fit_free (fit); … … 84 75 fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos); 85 76 } 86 87 # if (0)88 // check if the fit has enough data points for the polynomial order89 skip = FALSE;90 switch (image[0].coords.Npolyterms) {91 case 0:92 case 1:93 skip = (fit[0].Npts < 8);94 break;95 case 2:96 skip = (fit[0].Npts < 11);97 break;98 case 3:99 skip = (fit[0].Npts < 15);100 break;101 default:102 fprintf (stderr, "invalid chip order %d\n", image[0].coords.Npolyterms);103 skip = TRUE;104 }105 if (skip) {106 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for requested order (%d)\n", fit[0].Npts, image[0].coords.Npolyterms);107 fit_free (fit);108 image[0].flags |= ID_IMAGE_ASTROM_FEW;109 return FALSE;110 }111 # endif112 77 113 78 // measure the fit, update the coords & object coordinates … … 147 112 } 148 113 114 int Ncolor = 0; 115 float *colorList = NULL; 116 ALLOCATE (colorList, float, Nmatch); 117 118 for (i = 0; i < Nmatch; i++) { 119 if (!raw[i].mask) continue; 120 if (!isnan(ref[i].Color)) { 121 colorList[Ncolor] = ref[i].Color; 122 Ncolor ++; 123 } 124 } 125 fsort (colorList, Ncolor); 126 float colorMedian = (Ncolor > 0) ? colorList[(int)(0.5*Ncolor)] : NAN; 127 image[0].refColor = colorMedian; 128 free (colorList); 129 149 130 GetScatterRawRef(&dLsigFull, &dMsigFull, &dRsigFull, &NstatFull, raw, ref, Nmatch, SIGMA_LIM); 150 131 GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nmatch, IMFIT_SYS_SIGMA_LIM); … … 164 145 image[0].dYpixSys = dMsig; 165 146 image[0].nFitAstrom = fit[0].Npts; 147 148 // fprintf (stderr, "%s %6.3f %4d %4d\n", image[0].name, image[0].refColor, Ncolor, image[0].nFitAstrom); 166 149 167 150 if (fit) fit_free (fit); -
branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/ImageOps.c
r36800 r36808 333 333 */ 334 334 335 float getColor (off_t meas, int cat) { 336 337 off_t i; 338 339 i = MeasureToImage[cat][meas]; 340 if (i == -1) return (NAN); 341 return (image[i].refColor); 342 } 343 335 344 void plot_images () { 336 345 … … 738 747 StarData *ref; 739 748 749 int Nsecfilt = GetPhotcodeNsecfilt(); 750 740 751 mosaic = NULL; 741 752 moscoords = NULL; … … 765 776 ref[i].dMag = measure[0].dM; 766 777 ref[i].dPos = GetAstromErrorTiny (&measure[0], ERROR_MODE_POS); 778 779 if ((DCR_NSEC_POS >= 0) && (DCR_NSEC_NEG >= -1)) { 780 ref[i].Color = catalog[c].secfilt[n*Nsecfilt + DCR_NSEC_POS].M - catalog[c].secfilt[n*Nsecfilt + DCR_NSEC_NEG].M; 781 } 767 782 768 783 ref[i].mask = FALSE; -
branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/UpdateObjects.c
r36800 r36808 10 10 static double *T; 11 11 static double *dT; 12 static double *C; 12 13 13 14 void initObjectData (Catalog *catalog, int Ncatalog) { … … 36 37 ALLOCATE (pX, double, MAX (1, Nmax)); 37 38 ALLOCATE (pY, double, MAX (1, Nmax)); 39 40 ALLOCATE (C, double, MAX (1, Nmax)); 38 41 } 39 42 … … 54 57 free (pX); 55 58 free (pY); 59 60 free (C); 56 61 } 57 62 … … 61 66 62 67 off_t j, k, m; 63 int i, N, N secfilt, mode, result, status, XVERB;68 int i, N, Nc, Nsecfilt, mode, result, status, XVERB; 64 69 StatType statsR, statsD; 65 70 Coords coords; … … 116 121 } 117 122 123 Nc = 0; 118 124 N = 0; 119 125 m = catalog[i].average[j].measureOffset; … … 222 228 dD[N] = dY[N] / 3600.0; 223 229 230 float color = getColor (m+k, i); 231 if (!isnan(color)) { 232 C[Nc] = color; 233 Nc++; 234 } 235 224 236 N++; 225 237 } … … 341 353 Nave ++; 342 354 } 355 356 dsort (C, Nc); 357 float colorMedian = (Nc > 0) ? C[(int)(0.5*Nc)] : NAN; 358 catalog[i].average[j].refColor = colorMedian; 343 359 344 360 /* choose the result based on the chisq values */ -
branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/args.c
r36800 r36808 292 292 remove_argument (N, &argc, argv); 293 293 TimeSelect = TRUE; 294 } 295 296 DCR_COLOR_POS = NULL; 297 DCR_COLOR_NEG = NULL; 298 if ((N = get_argument (argc, argv, "-dcr-color"))) { 299 remove_argument (N, &argc, argv); 300 DCR_COLOR_POS = strcreate(argv[N]); 301 remove_argument (N, &argc, argv); 302 DCR_COLOR_NEG = strcreate(argv[N]); 303 remove_argument (N, &argc, argv); 294 304 } 295 305 -
branches/eam_branches/ipp-20140423/Ohana/src/relastro/src/initialize.c
r36746 r36808 7 7 8 8 if (RELASTRO_OP == OP_MERGE_SOURCE) return; 9 10 if (DCR_COLOR_POS) fprintf (stderr, "DCR_COLOR_POS: %s\n", DCR_COLOR_POS); 11 if (DCR_COLOR_NEG) fprintf (stderr, "DCR_COLOR_NEG: %s\n", DCR_COLOR_NEG); 9 12 10 13 if (PHOTCODE_KEEP_LIST) fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); … … 19 22 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 20 23 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 24 25 DCR_NSEC_POS = DCR_NSEC_NEG = -1; 26 if (DCR_COLOR_POS) { 27 DCR_PHOTCODE_POS = GetPhotcodebyName (DCR_COLOR_POS); 28 if (!DCR_PHOTCODE_POS) { 29 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_COLOR_POS); 30 exit (1); 31 } 32 DCR_NSEC_POS = GetPhotcodeNsec (DCR_PHOTCODE_POS[0].code); 33 } 34 if (DCR_COLOR_NEG) { 35 DCR_PHOTCODE_NEG = GetPhotcodebyName (DCR_COLOR_NEG); 36 if (!DCR_PHOTCODE_NEG) { 37 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_COLOR_NEG); 38 exit (1); 39 } 40 DCR_NSEC_NEG = GetPhotcodeNsec (DCR_PHOTCODE_NEG[0].code); 41 } 21 42 22 43 initstats (STATMODE);
Note:
See TracChangeset
for help on using the changeset viewer.
