Changeset 30509
- Timestamp:
- Feb 7, 2011, 4:45:12 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20101205/Ohana/src/relastro
- Files:
-
- 11 edited
-
include/relastro.h (modified) (3 diffs)
-
src/ConfigInit.c (modified) (1 diff)
-
src/FitChip.c (modified) (6 diffs)
-
src/GetAstromError.c (modified) (1 diff)
-
src/ImageOps.c (modified) (8 diffs)
-
src/UpdateChips.c (modified) (5 diffs)
-
src/UpdateObjects.c (modified) (1 diff)
-
src/args.c (modified) (1 diff)
-
src/relastro.c (modified) (1 diff)
-
src/relastroVisual.c (modified) (20 diffs)
-
src/select_images.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20101205/Ohana/src/relastro/include/relastro.h
r29001 r30509 94 94 95 95 double SIGMA_LIM; 96 int SRC_MEAS_TOOFEW; //catalog objects wich fewer detections then this are ignored96 int SRC_MEAS_TOOFEW; //catalog objects wich fewer detections then this are ignored 97 97 double MIN_ERROR; 98 99 int IMFIT_CLIP_NITER; // number of clipping iterations to perform in FitChip 100 double IMFIT_CLIP_NSIGMA; // number of sigma to clip in FitChip 101 double IMFIT_SYS_SIGMA_LIM; // max dMag for objects used to measure systematic scatter 98 102 99 103 double RADIUS; // match radius for high-speed objects … … 325 329 int UpdateObjectOffsets (SkyList *skylist); 326 330 327 int relastroVisualPlotRawRef(StarData *raw, StarData *ref, double dRmax, int numObj); 328 int relastroVisualPlotScatter(double values[], double thresh, int npts); 329 int relastroVisualPlotOutliers(Catalog *catalog, int offset, int Nmeasure, 330 StatType statsR, StatType statsD, double thresh); 331 332 331 int relastroVisualPlotChipFit(StarData *raw, StarData *ref, double dRmax, int numObj); 332 // int relastroVisualPlotRawRef(StarData *raw, StarData *ref, double dRmax, int numObj); 333 // int relastroVisualPlotScatter(double values[], double thresh, int npts); 334 // int relastroVisualPlotOutliers(Catalog *catalog, int offset, int Nmeasure, StatType statsR, StatType statsD, double thresh); 335 void relastroSetVisual(int state); 333 336 334 337 int FixProblemImages (SkyList *skylist); … … 352 355 int createStarMapPoints(); 353 356 int checkStarMap(int N); 357 358 int GetScatterRawRef(float *dLsig, float *dMsig, float *dRsig, int *nKeep, StarData *raw, StarData *ref, int Nstars, float SigmaLimit); -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/ConfigInit.c
r29001 r30509 19 19 if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file); 20 20 21 GetConfig (config, "RELASTRO_SIGMA_LIM", "%lf", 0, &SIGMA_LIM);21 GetConfig (config, "RELASTRO_SIGMA_LIM", "%lf", 0, &SIGMA_LIM); // exclude measurements on this basis 22 22 GetConfig (config, "RELASTRO_SRC_MEAS_TOOFEW", "%d", 0, &SRC_MEAS_TOOFEW); 23 24 if (!ScanConfig (config, "RELASTRO_IMFIT_CLIP_NITER", "%d", 0, &IMFIT_CLIP_NITER)) IMFIT_CLIP_NITER = 3; 25 if (!ScanConfig (config, "RELASTRO_IMFIT_CLIP_NSIGMA", "%lf", 0, &IMFIT_CLIP_NSIGMA)) IMFIT_CLIP_NSIGMA = 3.0; 26 if (!ScanConfig (config, "RELASTRO_IMFIT_SYS_SIGMA_LIM", "%lf", 0, &IMFIT_SYS_SIGMA_LIM)) IMFIT_SYS_SIGMA_LIM = 0.01; 23 27 24 28 // XXX these are used in relphot to identify poor stars / images -- define -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/FitChip.c
r30478 r30509 2 2 # include "relastroVisual.h" 3 3 4 // XXX make these user parameters5 # define FIT_CHIP_NITER 36 # define FIT_CHIP_NSIGMA 3.07 8 // XXX save the fit[0].Npts value in the image table?9 10 // XXX save measurements of the fit quality (scatter, chisq) in the image table11 12 4 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) { 13 5 14 int i, Nscatter, Niter, skip; 15 CoordFit *fit; 16 double dL, dM, dR, dRmax, *values; 17 18 ALLOCATE (values, double, Nmatch); 19 for (Niter = 0; Niter < FIT_CHIP_NITER; Niter ++) { 6 int i, NstatFull, Nstat, Niter, skip; 7 float dLsig, dMsig, dRsig; 8 float dLsigFull, dMsigFull, dRsigFull; 9 float dL, dM, dR, dRmax; 10 11 CoordFit *fit = NULL; 12 13 for (Niter = 0; Niter < IMFIT_CLIP_NITER; Niter ++) { 14 15 // measure the scatter for the unmarked (good) measurements with dM < limit 16 // SIGMA_LIM here is redundant with ImageOps.c:915 17 GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nmatch, SIGMA_LIM); 18 dRmax = IMFIT_CLIP_NSIGMA*dRsig; 19 20 // (a) skip unfittable points 21 // (b) mark good and bad points for fit (in and outliers) 20 22 21 23 // measure the scatter distribution (use only the bright end detections) 22 for (i = Nscatter =0; i < Nmatch; i++) {24 for (i = 0; i < Nmatch; i++) { 23 25 if (raw[i].mask) continue; 24 if (isnan(raw[i].dMag) || raw[i].dMag > SIGMA_LIM) continue; 26 if (isnan(raw[i].dMag)) { 27 raw[i].mask |= 0x0004; 28 continue; 29 } 30 if (raw[i].dMag > SIGMA_LIM) { 31 raw[i].mask |= 0x0008; 32 continue; 33 } // is this redundant with ImageOps.c:915? 25 34 26 35 dL = raw[i].L - ref[i].L; 27 36 dM = raw[i].M - ref[i].M; 28 37 dR = hypot (dL, dM); 29 30 values[Nscatter] = dR; 31 Nscatter++; 32 } 33 34 if (Nscatter > 5) { 35 // for a 2D Gaussian, 40% of the points are within 1 sigma; dRmax is ~ 3 sigma 36 // XXX this test is not sensible for Nscatter < XXX (5?) 37 dsort (values, Nscatter); 38 dRmax = FIT_CHIP_NSIGMA*values[(int)(0.40*Nscatter)]; 39 relastroVisualPlotScatter(values, dRmax, Nscatter); 40 relastroVisualPlotRawRef(raw, ref, dRmax, Nmatch); 41 } else { 42 dRmax = 0; 43 } 38 if (dR > dRmax) { 39 raw[i].mask |= 0x0010; 40 continue; 41 } 42 } 43 44 // figures to assess the fitting process: 45 // x vs dx, x vs dy, y vs dx, y vs dy : 46 // residual vector field 47 // dx vs mag, dy vs mag 48 relastroVisualPlotChipFit(raw, ref, dRmax, Nmatch); 44 49 45 50 // fit the requested order polynomial … … 47 52 image[0].coords.Npolyterms = CHIPORDER; 48 53 } 54 if (fit) fit_free (fit); 49 55 fit = fit_init (image[0].coords.Npolyterms); 50 56 51 57 // generate the fit matches 52 58 for (i = 0; i < Nmatch; i++) { 53 if (raw[i].mask) { 54 continue; 55 } 56 if (isnan(raw[i].dMag) || raw[i].dMag > SIGMA_LIM) { 57 continue; 58 } 59 60 // only keep objects within dRmax 61 dL = raw[i].L - ref[i].L; 62 dM = raw[i].M - ref[i].M; 63 dR = hypot (dL, dM); 64 65 // fprintf (stderr, "fit %f %f -> %f %f : %f %f (%f vs %f) wt: %f\n", raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].L, raw[i].M, dR, dRmax, raw[i].dPos); 66 67 if ((dRmax > 0.0) && (dR > dRmax)) continue; 68 59 if (raw[i].mask) continue; 69 60 fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos); 70 61 } … … 90 81 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for requested order (%d)\n", fit[0].Npts, image[0].coords.Npolyterms); 91 82 fit_free (fit); 92 free (values);93 83 image[0].flags |= ID_IMAGE_ASTROM_FEW; 94 84 return FALSE; 95 85 } 96 97 // fprintf (stderr, "scatter limit: %f based on %d detections; using %d of %d for fit\n", dRmax, Nscatter, fit[0].Npts, Nmatch);98 86 99 87 // measure the fit, update the coords & object coordinates … … 110 98 } 111 99 112 fit_free (fit);113 114 100 for (i = 0; i < Nmatch; i++) { 115 101 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[0].coords); … … 118 104 } 119 105 120 free (values); 106 // count mask classes 107 int nMask1 = 0; 108 int nMask2 = 0; 109 int nMask3 = 0; 110 int nMask4 = 0; 111 int nMask5 = 0; 112 for (i = 0; i < Nmatch; i++) { 113 if (!raw[i].mask) continue; 114 if (raw[i].mask & 0x01) nMask1 ++; 115 if (raw[i].mask & 0x02) nMask2 ++; 116 if (raw[i].mask & 0x04) nMask3 ++; 117 if (raw[i].mask & 0x08) nMask4 ++; 118 if (raw[i].mask & 0x10) nMask5 ++; 119 } 120 121 GetScatterRawRef(&dLsigFull, &dMsigFull, &dRsigFull, &NstatFull, raw, ref, Nmatch, SIGMA_LIM); 122 GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nmatch, IMFIT_SYS_SIGMA_LIM); 123 if (VERBOSE) fprintf (stderr, "fit sigma: %f (%f, %f) : full: %f (%f, %f), scatter limit: %f (%d full, %d bright, %d fit, %d all) (%d %d %d %d %d)\n", dRsig, dLsig, dMsig, dRsigFull, dLsigFull, dMsigFull, dRmax, NstatFull, Nstat, fit[0].Npts, Nmatch, nMask1, nMask2, nMask3, nMask4, nMask5); 124 125 image[0].dXpixSys = dLsig; 126 image[0].dYpixSys = dMsig; 127 image[0].nFitAstrom = fit[0].Npts; 128 129 if (fit) fit_free (fit); 130 121 131 return TRUE; 132 } 133 134 // measure the scatter distribution (limit selected objects by dMag) 135 int GetScatterRawRef(float *dLsig, float *dMsig, float *dRsig, int *nKeep, StarData *raw, StarData *ref, int Nstars, float SigmaLimit) { 136 137 int i, Ns; 138 float dL, dM, dLsum, dLsum2, dMsum, dMsum2, *dR; 139 140 ALLOCATE (dR, float, Nstars); 141 142 Ns = 0; 143 dLsum = dLsum2 = dMsum = dMsum2 = 0.0; 144 for (i = 0; i < Nstars; i++) { 145 if (raw[i].mask) continue; 146 if (isnan(raw[i].dMag)) continue; 147 if ((SigmaLimit > 0.0) && (raw[i].dMag > SigmaLimit)) continue; 148 149 dL = raw[i].L - ref[i].L; 150 dM = raw[i].M - ref[i].M; 151 152 dLsum += dL; 153 dLsum2 += dL*dL; 154 dMsum += dM; 155 dMsum2 += dM*dM; 156 157 dR[Ns] = hypot (dL, dM); 158 Ns++; 159 } 160 161 *dLsig = sqrt((dLsum2 / Ns) - SQ(dLsum/Ns)); 162 *dMsig = sqrt((dMsum2 / Ns) - SQ(dMsum/Ns)); 163 *nKeep = Ns; 164 165 if (Ns < 5) { 166 *dRsig = NAN; 167 free (dR); 168 return (FALSE); 169 } 170 171 // for a 2D Gaussian, 40% of the points are within R = 1 sigma 172 fsort (dR, Ns); 173 *dRsig = dR[(int)(0.40*Ns)]; 174 175 free (dR); 176 return (TRUE); 122 177 } 123 178 … … 162 217 fclose (f); 163 218 */ 219 -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/GetAstromError.c
r30477 r30509 1 1 # include "relastro.h" 2 # define WEIGHTED_ERRORS 02 # define WEIGHTED_ERRORS 1 3 3 4 4 float GetAstromError (Measure *measure, int mode) { -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/ImageOps.c
r29001 r30509 336 336 off_t i, m, c, n, nPos; 337 337 double X, Y, L, M, P, Q, R, D, dR, dD; 338 double dPos, DPOS_MAX_ASEC;338 double dPos, dPosSys, DPOS_MAX_ASEC; 339 339 340 340 Mosaic *mosaic; … … 359 359 } 360 360 361 // accumulate the rms position offsets. if this value, or any specific entry, is too362 // large, we will reset the image to the original coords at the end of the analysis363 361 // these are used to accumulate the rms position offsets. if this value, or any 362 // specific entry, is too large, we will reset the image to the original coords at the 363 // end of the analysis 364 364 dPos = 0.0; 365 365 nPos = 0; 366 367 // convert the image systematic error in pixels to a value in arcsec 368 { 369 double dLsig, dMsig; 370 double Ro, Do, Rx, Dx, dP0, dP1; 371 Coords *coords; 372 373 // these values are in pixels, but we to convert to arcsec 374 dLsig = image[0].dXpixSys; 375 dMsig = image[0].dYpixSys; 376 377 if (moscoords == NULL) { 378 coords = imcoords; 379 } else { 380 coords = moscoords; 381 } 382 XY_to_LM (&Ro, &Do, 0.0, 0.0, coords); 383 XY_to_LM (&Rx, &Dx, dLsig, 0.0, coords); 384 dP0 = 3600.0 * hypot(Rx - Ro, Dx - Do); // convert to arcsec 385 XY_to_LM (&Rx, &Dx, 0.0, dLsig, coords); 386 dP1 = 3600.0 * hypot(Rx - Ro, Dx - Do); // convert to arcsec 387 dPosSys = 0.5 * (dP0 + dP1); 388 } 366 389 367 390 for (i = 0; i < Nlist[im]; i++) { … … 418 441 catalog[c].measure[m].dR = dR; 419 442 catalog[c].measure[m].dD = dD; 420 443 421 444 if (catalog[c].measure[m].dR > +180.0*3600.0) { 422 445 // average on high end of boundary, move star up … … 429 452 catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R); 430 453 } 454 455 // set the systematic error for this image: 456 catalog[c].measure[m].dRsys = ToShortPixels(dPosSys); 431 457 } 432 458 … … 544 570 545 571 // an object with only one detection provides no information about the image calibration 546 //XXX this is already taken care of in bcatalog 547 raw[i].mask = FALSE; 548 int mask = FALSE; 572 // XXX this is already taken care of in bcatalog 573 raw[i].mask = 0x0000; 549 574 if (catalog[c].average[n].Nmeasure <= SRC_MEAS_TOOFEW) { 550 mask = TRUE;575 raw[i].mask |= 0x0001; 551 576 } 552 577 if (!finite(catalog[c].measure[m].dR) || !finite(catalog[c].measure[m].dD)) { 553 mask = TRUE; 554 } 555 556 raw[i].mask = mask; 557 578 raw[i].mask |= 0x0002; 579 } 558 580 559 581 switch (mode) { … … 725 747 } 726 748 727 //examine results 728 relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, 729 catalog[0].average[j].Nmeasure, 730 statsR, statsD, Ns); 749 // examine results 750 // relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, catalog[0].average[j].Nmeasure, statsR, statsD, Ns); 731 751 } 732 752 … … 852 872 } //done rejecting outliers 853 873 854 //examine results 855 relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, 856 catalog[0].average[j].Nmeasure, 857 statsR, statsD, Ns); 874 // examine results 875 // relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, catalog[0].average[j].Nmeasure, statsR, statsD, Ns); 858 876 859 877 } //done looping over objects … … 917 935 918 936 /* select measurements by measurement error */ 919 if ((SIGMA_LIM > 0) && (measure[0].dM > SIGMA_LIM)) return FALSE; 937 if ((SIGMA_LIM > 0) && (measure[0].dM > SIGMA_LIM)) { 938 return FALSE; 939 } 920 940 921 941 /* select measurements by mag limit */ -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/UpdateChips.c
r30476 r30509 8 8 9 9 /* we can measure new image parameters for each non-mosaic chip independently */ 10 off_t i, Nimage, Nraw, Nref ;10 off_t i, Nimage, Nraw, Nref, nFitAstr; 11 11 Image *image; 12 12 StarData *raw, *ref; 13 13 Coords *oldCoords; 14 14 float dXpixSys, dYpixSys; 15 15 double *Ro, *Do; 16 16 char *mode; … … 19 19 20 20 image = getimages (&Nimage); 21 // XXX BuildChipMatch (image, Nimage);22 21 23 22 // save fit results for summary plot … … 54 53 assert (Nraw == Nref); 55 54 55 // save these in case of failure 56 56 saveCoords (&image[i].coords, i); 57 dXpixSys = image[i].dXpixSys; 58 dYpixSys = image[i].dYpixSys; 59 nFitAstr = image[i].nFitAstrom; 57 60 58 61 // FitChip does iterative, clipped fitting … … 60 63 if (!FitChip (raw, ref, Nraw, &image[i])) { 61 64 if (VERBOSE) fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name, i, Nraw); 65 66 // restore status quo ante 62 67 oldCoords = getCoords (i); 63 68 memcpy (&image[i].coords, oldCoords, sizeof(Coords)); 69 image[i].dXpixSys = dXpixSys; 70 image[i].dYpixSys = dYpixSys; 71 image[i].nFitAstrom = nFitAstr; 72 64 73 saveCenter (image, &Ro[i], &Do[i], i); 65 74 mode[i] = 1; … … 72 81 if (!checkStarMap (i)) { 73 82 if (VERBOSE) fprintf (stderr, "fit diverges too much for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT"\n", image[i].name, i, Nraw); 83 // restore status quo ante 74 84 oldCoords = getCoords (i); 75 85 memcpy (&image[i].coords, oldCoords, sizeof(Coords)); 86 image[i].dXpixSys = dXpixSys; 87 image[i].dYpixSys = dYpixSys; 88 image[i].nFitAstrom = nFitAstr; 89 76 90 saveCenter (image, &Ro[i], &Do[i], i); 77 91 mode[i] = 2; -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/UpdateObjects.c
r30475 r30509 136 136 dX[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_RA); 137 137 dY[N] = GetAstromError (&catalog[i].measure[m], ERROR_MODE_DEC); 138 139 // add systematic error in quadrature, if desired 140 // only do this after the fit has converged (or you will never improve the poor images) 141 // if (INCLUDE_SYS_ERR) { 142 // float dRsys = FromShortPixels(catalog[i].measure[m].dRsys); 143 // dX[N] = hypot(dX[N], dRsys); 144 // dY[N] = hypot(dY[N], dRsys); 145 // } 146 138 147 // dX[N] = 0.1; 139 148 // dY[N] = 0.1; -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/args.c
r28184 r30509 144 144 VERBOSE = VERBOSE2 = TRUE; 145 145 remove_argument (N, &argc, argv); 146 } 147 148 if ((N = get_argument (argc, argv, "-visual"))) { 149 remove_argument (N, &argc, argv); 150 relastroSetVisual(TRUE); 146 151 } 147 152 -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/relastro.c
r29001 r30509 78 78 MARKTIME("update chips: %f sec\n", dtime); 79 79 } 80 // create summary plots of the process 81 // relastroVisualSummaryChips(); 80 82 break; 81 83 -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/relastroVisual.c
r24308 r30509 11 11 #define KAPAY 700 12 12 13 static int kapa = -1;13 static int kapa1 = -1; 14 14 static int kapa2 = -1; 15 15 static int kapa3 = -1; 16 static int kapa4 = -1; 16 17 17 18 static int isVisual = FALSE; 18 static int plotRawRef = FALSE;19 static int plotScatter = FALSE;20 static int plotResid = FALSE;21 static int plotVector = FALSE;19 static int plotRawRef = TRUE; 20 // static int plotScatter = TRUE; 21 // static int plotResid = TRUE; 22 // static int plotVector = TRUE; 22 23 static int plotOutliers = TRUE; 23 24 … … 29 30 fprintf(stderr, "Failure to open kapa.\n"); 30 31 isVisual = 0; 31 return 0;32 return FALSE; 32 33 } 33 // KapaResize (*kapid, KAPAX, KAPAY); 34 } 35 return 1; 34 } 35 return TRUE; 36 36 } 37 37 … … 49 49 isVisual = 0; 50 50 } 51 return 1; 52 } 51 return TRUE; 52 } 53 54 void relastroSetVisual(int state) { 55 isVisual = state; 56 } 57 53 58 54 59 /** Size graphdata to encompass all points */ … … 70 75 graphdata->xmax = xhi; 71 76 graphdata->ymax = yhi; 72 return 1; 73 } 74 75 static int residPlot(float x[], float y[], 76 float xVec[], float yVec[], 77 int npts, int *kapaID) { 78 if (!isVisual || !plotResid) return TRUE; 77 return TRUE; 78 } 79 80 /** 4-panel plot of x vs dx, y vs dx, x vs dy, y vs dy **/ 81 int relastroVisualRawRef(int *kapaID, float *x, float *y, float *dx, float *dy, float *dPos, int npts) { 82 79 83 Graphdata graphdata; 80 84 KapaSection section; … … 83 87 84 88 KapaInitGraph(&graphdata); 85 KapaClear Plots(*kapaID);89 KapaClearSections(*kapaID); 86 90 KapaSetFont(*kapaID, "helvetica", 14); 87 91 … … 89 93 section.x = 0.0; section.y = 0.0; 90 94 section.dx = .45, section.dy = .45; 95 section.bg = KapaColorByName("white"); 91 96 graphdata.ptype = 7; 92 97 graphdata.style = 2; 98 graphdata.etype |= 0x01; 93 99 94 100 KapaSetSection(*kapaID, §ion); 95 if(!scaleGraphdata(x, xVec, &graphdata, npts)) return 0;101 if(!scaleGraphdata(x, dx, &graphdata, npts)) return 0; 96 102 KapaSetLimits(*kapaID, &graphdata); 97 103 KapaBox(*kapaID, &graphdata); … … 100 106 KapaPrepPlot(*kapaID, npts, &graphdata); 101 107 KapaPlotVector(*kapaID, npts, x, "x"); 102 KapaPlotVector(*kapaID, npts, xVec, "y"); 108 KapaPlotVector(*kapaID, npts, dx, "y"); 109 KapaPlotVector(*kapaID, npts, dPos, "dym"); 110 KapaPlotVector(*kapaID, npts, dPos, "dyp"); 103 111 104 112 section.x = .5; section.y = 0; section.name="1"; 105 113 KapaSetSection(*kapaID, §ion); 106 if(!scaleGraphdata(x, yVec, &graphdata, npts)) return 0;114 if(!scaleGraphdata(x, dy, &graphdata, npts)) return 0; 107 115 KapaSetLimits(*kapaID, &graphdata); 108 116 KapaBox(*kapaID, &graphdata); … … 111 119 KapaPrepPlot(*kapaID, npts, &graphdata); 112 120 KapaPlotVector(*kapaID, npts, x, "x"); 113 KapaPlotVector(*kapaID, npts, yVec, "y"); 121 KapaPlotVector(*kapaID, npts, dy, "y"); 122 KapaPlotVector(*kapaID, npts, dPos, "dym"); 123 KapaPlotVector(*kapaID, npts, dPos, "dyp"); 114 124 115 125 section.x = .0; section.y = .5; section.name="2"; 116 126 KapaSetSection(*kapaID, §ion); 117 if(!scaleGraphdata(y, xVec, &graphdata, npts)) return 0;;127 if(!scaleGraphdata(y, dx, &graphdata, npts)) return 0;; 118 128 KapaSetLimits(*kapaID, &graphdata); 119 129 KapaBox(*kapaID, &graphdata); … … 122 132 KapaPrepPlot(*kapaID, npts, &graphdata); 123 133 KapaPlotVector(*kapaID, npts, y, "x"); 124 KapaPlotVector(*kapaID, npts, xVec, "y"); 134 KapaPlotVector(*kapaID, npts, dx, "y"); 135 KapaPlotVector(*kapaID, npts, dPos, "dym"); 136 KapaPlotVector(*kapaID, npts, dPos, "dyp"); 125 137 126 138 section.x = .5; section.y = .5; section.name="3"; 127 139 KapaSetSection(*kapaID, §ion); 128 if(!scaleGraphdata(y, yVec, &graphdata, npts)) return 0;140 if(!scaleGraphdata(y, dy, &graphdata, npts)) return 0; 129 141 KapaSetLimits(*kapaID, &graphdata); 130 142 KapaBox(*kapaID, &graphdata); … … 133 145 KapaPrepPlot(*kapaID, npts, &graphdata); 134 146 KapaPlotVector(*kapaID, npts, y, "x"); 135 KapaPlotVector(*kapaID, npts, yVec, "y"); 136 137 return 1; 138 } 139 140 141 /**Plot a vector field*/ 142 static int plotVectorField(float x[], float y[], 143 float xVec[], float yVec[], 144 int npts, int *kapaID, double maxVecLength) { 145 146 if(!plotVector) return 1; 147 KapaPlotVector(*kapaID, npts, dy, "y"); 148 KapaPlotVector(*kapaID, npts, dPos, "dym"); 149 KapaPlotVector(*kapaID, npts, dPos, "dyp"); 150 151 return TRUE; 152 } 153 154 155 /** Plot a vector field (circles at vector origin, scaled lines giving vector directions */ 156 int relastroVisualVectorField(int *kapaID, float *x, float *y, float *dx, float *dy, int npts, double maxVecLength) { 147 157 148 158 Graphdata graphdata; 149 float singleX[2], singleY[2];159 float *xVec, *yVec; 150 160 float vecScaleFactor; 151 161 float graphSize; 152 162 int i; 153 163 char plotTitle[50]; 154 sprintf(plotTitle, "Maximum Vector Size = %5.1e", maxVecLength); 155 164 165 if (!npts) return FALSE; 156 166 if (!initWindow(kapaID)) return 0; 157 167 168 snprintf(plotTitle, 50, "Maximum Vector Size = %5.1e", maxVecLength); 169 158 170 KapaInitGraph(&graphdata); 159 KapaClearPlots(*kapaID); 160 if(!scaleGraphdata(x, y, &graphdata, npts)) return 0; 171 KapaClearSections(*kapaID); 172 KapaSetFont(*kapaID, "helvetica", 14); 173 174 if (!scaleGraphdata(x, y, &graphdata, npts)) return 0; 161 175 162 176 graphSize = graphdata.xmax - graphdata.xmin; … … 164 178 graphSize = graphdata.ymax - graphdata.ymin; 165 179 } 166 167 180 vecScaleFactor = graphSize * 0.02 / (float)maxVecLength; 168 #ifdef TESTING 169 fprintf(stderr, "GraphSize: %e\n maxVecLength: %e\n vecScaleFactor: %e\n", 170 graphSize, maxVecLength, vecScaleFactor); 171 #endif 172 181 182 // fprintf(stderr, "GraphSize: %e\n maxVecLength: %e\n vecScaleFactor: %e\n", graphSize, maxVecLength, vecScaleFactor); 173 183 174 184 KapaSetFont (*kapaID, "helvetica", 14); … … 179 189 graphdata.ptype = 7; 180 190 graphdata.style = 2; 191 graphdata.color = KapaColorByName("black"); 181 192 KapaPrepPlot(*kapaID, npts, &graphdata); 182 193 KapaPlotVector(*kapaID, npts, x, "x"); 183 194 KapaPlotVector(*kapaID, npts, y, "y"); 184 195 185 //plot each vector individually 186 graphdata.ptype = 0; 187 graphdata.style = 0; 196 ALLOCATE (xVec, float, 2*npts); 197 ALLOCATE (yVec, float, 2*npts); 198 for (i = 0; i < npts; i++) { 199 xVec[2*i + 0] = x[i]; 200 yVec[2*i + 0] = y[i]; 201 xVec[2*i + 1] = x[i] + dx[i] * vecScaleFactor; 202 yVec[2*i + 1] = y[i] + dy[i] * vecScaleFactor; 203 } 204 205 graphdata.ptype = 100; // line segements by point pair 206 graphdata.style = 2; 188 207 graphdata.color = KapaColorByName("blue"); 189 for(i = 0; i < npts; i++) { 190 singleX[0] = x[i]; 191 singleY[0] = y[i]; 192 singleX[1] = x[i] + xVec[i] * vecScaleFactor; 193 singleY[1] = y[i] + yVec[i] * vecScaleFactor; 194 KapaPrepPlot(*kapaID, 2, &graphdata); 195 KapaPlotVector(*kapaID, 2, singleX, "x"); 196 KapaPlotVector(*kapaID, 2, singleY, "y"); 197 } 198 return 1; 199 } 200 201 int relastroVisualPlotScatter(double values[], double thresh, int npts) { 202 float *x, *data; 203 int i; 204 float xline[2], yline[2]; 205 if (!isVisual || !plotScatter) return 1; 206 if (!initWindow(&kapa2)) return 0; 207 208 ALLOCATE(x, float, npts); 209 ALLOCATE(data, float, npts); 210 211 for(i = 0; i < npts; i++) { 212 x[i] = i; 213 data[i] = (float) values[i]; 214 } 208 KapaPrepPlot (*kapaID, 2*npts, &graphdata); 209 KapaPlotVector(*kapaID, 2*npts, xVec, "x"); 210 KapaPlotVector(*kapaID, 2*npts, yVec, "y"); 211 212 free (xVec); 213 free (yVec); 214 return TRUE; 215 } 216 217 int relastroVisualPlotScatter(int *kapaID, float *dXfit, float *dYfit, float *mag, int npts) { 215 218 216 219 Graphdata graphdata; 217 220 KapaSection section; 218 section.x = 0; section.y = 0; section.dx = 1; section.dy = 1; 219 section.name = "junk";221 222 if (!initWindow(kapaID)) return 0; 220 223 221 224 KapaInitGraph(&graphdata); 222 KapaClearPlots(kapa2); 223 KapaSetSection(kapa2, §ion); 224 225 graphdata.ptype = 0; 226 graphdata.style = 0; 227 graphdata.xmin = 0; 228 graphdata.xmax = npts; 229 graphdata.ymin = 0; 230 graphdata.ymax = data[npts-1]; 231 232 KapaSetFont(kapa2, "helvetica", 14); 233 KapaSetLimits(kapa2, &graphdata); 234 KapaBox(kapa2, &graphdata); 235 KapaSendLabel( kapa2, "Object", KAPA_LABEL_XM); 236 KapaSendLabel( kapa2, "Offset(pixels)", KAPA_LABEL_YM); 237 KapaSendLabel( kapa2, "Astrometric Offset with fit cutoff", 238 KAPA_LABEL_XP); 239 KapaPrepPlot(kapa2, npts, &graphdata); 240 KapaPlotVector(kapa2, npts, x, "x"); 241 KapaPlotVector(kapa2, npts, data, "y"); 242 243 graphdata.color = KapaColorByName("red"); 244 KapaPrepPlot(kapa2, 2, &graphdata); 245 yline[0] = (float) thresh; 246 yline[1] = (float) thresh; 247 xline[0] = graphdata.xmin; 248 xline[1] = graphdata.xmax; 249 KapaPlotVector(kapa2, 2, xline, "x"); 250 KapaPlotVector(kapa2, 2, yline, "y"); 251 252 askUser(&plotScatter); 253 return 1; 254 } 255 256 225 KapaClearSections(*kapaID); 226 KapaSetFont(*kapaID, "helvetica", 14); 227 228 section.name = "a"; 229 section.x = 0.0; section.y = 0.0; section.dx = 1.0; section.dy = 0.5; 230 section.bg = KapaColorByName("white"); 231 KapaSetSection(*kapaID, §ion); 232 233 graphdata.ptype = 2; 234 graphdata.style = 2; 235 236 if(!scaleGraphdata(mag, dXfit, &graphdata, npts)) return 0; 237 KapaSetLimits(*kapaID, &graphdata); 238 KapaBox(*kapaID, &graphdata); 239 KapaSendLabel(*kapaID, "mag", KAPA_LABEL_XM); 240 KapaSendLabel(*kapaID, "dXfit", KAPA_LABEL_YM); 241 KapaPrepPlot(*kapaID, npts, &graphdata); 242 KapaPlotVector(*kapaID, npts, mag, "x"); 243 KapaPlotVector(*kapaID, npts, dXfit, "y"); 244 245 section.name = "b"; 246 section.x = 0.0; section.y = 0.5; section.dx = 1.0; section.dy = 0.5; 247 section.bg = KapaColorByName("white"); 248 KapaSetSection(*kapaID, §ion); 249 250 graphdata.ptype = 2; 251 graphdata.style = 2; 252 253 if(!scaleGraphdata(mag, dYfit, &graphdata, npts)) return 0; 254 KapaSetLimits(*kapaID, &graphdata); 255 KapaBox(*kapaID, &graphdata); 256 KapaSendLabel(*kapaID, "mag", KAPA_LABEL_XM); 257 KapaSendLabel(*kapaID, "dYfit", KAPA_LABEL_YM); 258 KapaPrepPlot(*kapaID, npts, &graphdata); 259 KapaPlotVector(*kapaID, npts, mag, "x"); 260 KapaPlotVector(*kapaID, npts, dYfit, "y"); 261 262 return TRUE; 263 } 257 264 258 265 /** plot raw vs ref (L, M). Only those whose distance is < drMax are used in fit*/ 259 int relastroVisualPlotRawRef(StarData *raw, StarData *ref, double dRmax, int numObj) { 260 261 if( !isVisual || !plotRawRef) return 1; 262 if( !initWindow(&kapa)) return 0; 266 int relastroVisualPlotFittedStars(int *kapaID, float *rawX, float *rawY, float *refX, float *refY, int numNoFit, float *rawXfit, float *rawYfit, float *refXfit, float *refYfit, int numFit) { 267 268 Graphdata graphdata; 269 270 if (!initWindow(kapaID)) return 0; 271 272 KapaInitGraph(&graphdata); 273 KapaClearPlots(*kapaID); 274 275 graphdata.ptype = 7; 276 graphdata.style = 2; 277 278 if(!scaleGraphdata(rawXfit, rawYfit, &graphdata, numFit)) { 279 fprintf(stderr, "Not enough finite points for plotting"); 280 return 0; 281 } 282 283 KapaSetFont(*kapaID, "helvetica", 14); 284 KapaSetLimits(*kapaID, &graphdata); 285 KapaBox(*kapaID, &graphdata); 286 KapaSendLabel( *kapaID, "X", KAPA_LABEL_XM); 287 KapaSendLabel( *kapaID, "Y", KAPA_LABEL_YM); 288 KapaSendLabel( *kapaID, "orange, red, green, blue: (raw, ref), (nofit, fit)", 289 KAPA_LABEL_XP); 290 291 graphdata.color = KapaColorByName("orange"); 292 graphdata.size = 1; 293 KapaPrepPlot(*kapaID, numNoFit, &graphdata); 294 KapaPlotVector(*kapaID, numNoFit, rawX, "x"); 295 KapaPlotVector(*kapaID, numNoFit, rawY, "y"); 296 297 graphdata.color = KapaColorByName("red"); 298 graphdata.size = 2; 299 KapaPrepPlot(*kapaID, numNoFit, &graphdata); 300 KapaPlotVector(*kapaID, numNoFit, refX, "x"); 301 KapaPlotVector(*kapaID, numNoFit, refY, "y"); 302 303 graphdata.color = KapaColorByName("green"); 304 graphdata.size = 1; 305 KapaPrepPlot(*kapaID, numFit, &graphdata); 306 KapaPlotVector(*kapaID, numFit, rawXfit, "x"); 307 KapaPlotVector(*kapaID, numFit, rawYfit, "y"); 308 309 graphdata.color = KapaColorByName("blue"); 310 graphdata.size = 2; 311 KapaPrepPlot(*kapaID, numFit, &graphdata); 312 KapaPlotVector(*kapaID, numFit, refXfit, "x"); 313 KapaPlotVector(*kapaID, numFit, refYfit, "y"); 314 315 return TRUE; 316 } 317 318 /** create various plots using the data in raw and ref **/ 319 int relastroVisualPlotChipFit(StarData *raw, StarData *ref, double dRmax, int numObj) { 263 320 264 321 float *rawX, *rawY, *refX, *refY; 265 322 float *rawXfit, *rawYfit, *refXfit, *refYfit; 266 323 float *magRaw, *magRef, *magRawfit, *magReffit; 267 float * xVec, *yVec;324 float *dXfit, *dYfit, *dPos; 268 325 int numFit = 0, numNoFit = 0; 269 326 double dL, dM, dR; 327 328 if (!isVisual) return TRUE; 270 329 271 330 ALLOCATE(rawX, float, numObj); … … 273 332 ALLOCATE(refX, float, numObj); 274 333 ALLOCATE(refY, float, numObj); 334 ALLOCATE(magRaw, float, numObj); 335 ALLOCATE(magRef, float, numObj); 336 275 337 ALLOCATE(rawXfit, float, numObj); 276 338 ALLOCATE(rawYfit, float, numObj); 277 339 ALLOCATE(refXfit, float, numObj); 278 340 ALLOCATE(refYfit, float, numObj); 279 ALLOCATE(magRaw, float, numObj);280 ALLOCATE(magRef, float, numObj);281 341 ALLOCATE(magRawfit, float, numObj); 282 342 ALLOCATE(magReffit, float, numObj); 343 ALLOCATE(dXfit, float, numObj); 344 ALLOCATE(dYfit, float, numObj); 345 ALLOCATE(dPos, float, numObj); 283 346 284 347 int i; 285 348 for(i = 0; i < numObj; i++) { 286 if (raw[i].mask) continue;349 if (raw[i].mask) continue; // XXX 287 350 288 351 dL = raw[i].L - ref[i].L; 289 352 dM = raw[i].M - ref[i].M; 290 353 dR = hypot (dL, dM); 354 355 // XXX change the selection to a mask-based thing 291 356 if (dR > dRmax) { 357 // UNFITTED values 292 358 rawX[numNoFit] = raw[i].X; 293 359 rawY[numNoFit] = raw[i].Y; … … 298 364 numNoFit++; 299 365 } else { 300 rawXfit[numFit] = raw[i].X; 301 rawYfit[numFit] = raw[i].Y; 302 refXfit[numFit] = ref[i].X; 303 refYfit[numFit] = ref[i].Y; 304 magRaw[numFit] = raw[i].Mag; 305 magRef[numFit] = ref[i].Mag; 366 // FITTED values 367 rawXfit[numFit] = raw[i].X; 368 rawYfit[numFit] = raw[i].Y; 369 refXfit[numFit] = ref[i].X; 370 refYfit[numFit] = ref[i].Y; 371 magRawfit[numFit] = raw[i].Mag; 372 magReffit[numFit] = ref[i].Mag; 373 dPos[numFit] = ref[i].dPos; 374 dXfit[numFit] = raw[i].X - ref[i].X; 375 dYfit[numFit] = raw[i].Y - ref[i].Y; 306 376 numFit++; 307 377 } … … 310 380 if (numFit == 0) return 0; 311 381 312 Graphdata graphdata; 313 314 KapaInitGraph(&graphdata); 315 KapaClearPlots(kapa); 316 317 graphdata.ptype = 7; 318 graphdata.style = 2; 319 320 if(!scaleGraphdata(rawXfit, rawYfit, &graphdata, numFit)) { 321 fprintf(stderr, "Not enough finite points for plotting"); 322 return 0; 323 } 324 325 KapaSetFont(kapa, "helvetica", 14); 326 KapaSetLimits(kapa, &graphdata); 327 KapaBox(kapa, &graphdata); 328 KapaSendLabel( kapa, "X", KAPA_LABEL_XM); 329 KapaSendLabel( kapa, "Y", KAPA_LABEL_YM); 330 KapaSendLabel( kapa, "orange, red, green, blue: (raw, ref), (nofit, fit)", 331 KAPA_LABEL_XP); 332 333 graphdata.color = KapaColorByName("orange"); 334 graphdata.size = 1; 335 KapaPrepPlot(kapa, numNoFit, &graphdata); 336 KapaPlotVector(kapa, numNoFit, rawX, "x"); 337 KapaPlotVector(kapa, numNoFit, rawY, "y"); 338 339 graphdata.color = KapaColorByName("red"); 340 graphdata.size = 2; 341 KapaPrepPlot(kapa, numNoFit, &graphdata); 342 KapaPlotVector(kapa, numNoFit, refX, "x"); 343 KapaPlotVector(kapa, numNoFit, refY, "y"); 344 345 graphdata.color = KapaColorByName("green"); 346 graphdata.size = 1; 347 KapaPrepPlot(kapa, numFit, &graphdata); 348 KapaPlotVector(kapa, numFit, rawXfit, "x"); 349 KapaPlotVector(kapa, numFit, rawYfit, "y"); 350 351 graphdata.color = KapaColorByName("blue"); 352 graphdata.size = 2; 353 KapaPrepPlot(kapa, numFit, &graphdata); 354 KapaPlotVector(kapa, numFit, refXfit, "x"); 355 KapaPlotVector(kapa, numFit, refYfit, "y"); 356 357 ALLOCATE(xVec, float, numFit); 358 ALLOCATE(yVec, float, numFit); 359 360 //plot the fitted objects as vectors 361 for(i = 0; i < numFit; i++) { 362 xVec[i] = rawXfit[i] - refXfit[i]; 363 yVec[i] = rawYfit[i] - refYfit[i]; 364 } 365 366 plotVectorField(rawXfit, rawYfit, xVec, yVec, numFit, &kapa3, dRmax); 367 if(!residPlot(rawXfit, rawYfit, xVec, yVec, numFit, &kapa2)) { 368 fprintf(stderr, "Unable to plot residuals"); 369 return 0; 370 } 371 372 FREE(xVec); 373 FREE(yVec); 382 // 4-panel plot of x vs dx, y vs dx, x vs dy, y vs dy 383 relastroVisualRawRef(&kapa1, rawXfit, rawYfit, dXfit, dYfit, dPos, numFit); 384 385 // vector line plot for the fit 386 relastroVisualVectorField(&kapa2, rawXfit, rawYfit, dXfit, dYfit, numFit, dRmax); 387 388 // dXfit, dYfit vs mag 389 relastroVisualPlotScatter(&kapa3, dXfit, dYfit, magRawfit, numFit); 390 391 // plot the positions of the fitted stars on the chip 392 relastroVisualPlotFittedStars(&kapa4, rawX, rawY, refX, refY, numNoFit, rawXfit, rawYfit, refXfit, refYfit, numFit); 374 393 375 394 askUser(&plotRawRef); 376 395 396 FREE(dXfit); 397 FREE(dYfit); 398 FREE(dPos); 377 399 FREE(rawX); 378 400 FREE(rawY); … … 388 410 FREE(magReffit); 389 411 390 return 1;412 return TRUE; 391 413 } 392 414 … … 403 425 KapaSection section; 404 426 405 if (!isVisual || !plotOutliers) return 1;406 if (!initWindow(&kapa )) return 0;427 if (!isVisual || !plotOutliers) return TRUE; 428 if (!initWindow(&kapa1)) return 0; 407 429 408 430 // populate vectors … … 459 481 section.x = 0; section.y = 0; section.dx = 1; section.dy = 1; 460 482 section.name = "junk"; 483 section.bg = KapaColorByName("white"); 461 484 462 485 KapaInitGraph(&graphdata); 463 KapaClearPlots(kapa );464 KapaSetFont(kapa , "helvetica", 14);486 KapaClearPlots(kapa1); 487 KapaSetFont(kapa1, "helvetica", 14); 465 488 466 489 graphdata.ptype = 7; … … 472 495 graphdata.ymax = ymax; 473 496 474 KapaSetSection(kapa , §ion);475 KapaSetLimits(kapa , &graphdata);476 KapaBox(kapa , &graphdata);477 478 KapaSendLabel( kapa , "RA (arcsec)", KAPA_LABEL_XM);479 KapaSendLabel( kapa , "Dec (arcsec)", KAPA_LABEL_YM);480 KapaSendLabel( kapa , "Points flagged as outliers (red)",497 KapaSetSection(kapa1, §ion); 498 KapaSetLimits(kapa1, &graphdata); 499 KapaBox(kapa1, &graphdata); 500 501 KapaSendLabel( kapa1, "RA (arcsec)", KAPA_LABEL_XM); 502 KapaSendLabel( kapa1, "Dec (arcsec)", KAPA_LABEL_YM); 503 KapaSendLabel( kapa1, "Points flagged as outliers (red)", 481 504 KAPA_LABEL_XP); 482 505 483 506 graphdata.color = KapaColorByName("green"); 484 KapaPrepPlot(kapa , Nin, &graphdata);485 KapaPlotVector(kapa , Nin, Rin, "x");486 KapaPlotVector(kapa , Nin, Din, "y");507 KapaPrepPlot(kapa1, Nin, &graphdata); 508 KapaPlotVector(kapa1, Nin, Rin, "x"); 509 KapaPlotVector(kapa1, Nin, Din, "y"); 487 510 488 511 graphdata.color = KapaColorByName("red"); 489 KapaPrepPlot(kapa , Nout, &graphdata);490 KapaPlotVector(kapa , Nout, Rout, "x");491 KapaPlotVector(kapa , Nout, Dout, "y");512 KapaPrepPlot(kapa1, Nout, &graphdata); 513 KapaPlotVector(kapa1, Nout, Rout, "x"); 514 KapaPlotVector(kapa1, Nout, Dout, "y"); 492 515 493 516 graphdata.color = KapaColorByName("black"); 494 517 graphdata.ptype = 0; 495 518 graphdata.style = 0; 496 KapaPrepPlot(kapa, 100, &graphdata); 497 KapaPlotVector(kapa, 100, xCirc, "x"); 498 KapaPlotVector(kapa, 100, yCirc, "y"); 499 500 501 519 KapaPrepPlot(kapa1, 100, &graphdata); 520 KapaPlotVector(kapa1, 100, xCirc, "x"); 521 KapaPlotVector(kapa1, 100, yCirc, "y"); 522 502 523 askUser(&plotOutliers); 503 524 … … 510 531 } 511 532 512 533 # if (0) 534 int relastroVisualSummaryChips() { 535 536 // plot the dXsys, dYsys histograms 537 538 // plot x vs dx, y vs dy, etc for all mosaics 539 540 // plot a map of median star scatter 541 542 } 543 # endif 544 -
branches/eam_branches/ipp-20101205/Ohana/src/relastro/src/select_images.c
r30474 r30509 33 33 struct timeval start, stop; 34 34 35 double RmaxSkyRegion, RminSkyRegion, DminSkyRegion, DmaxSkyRegion;35 double RmaxSkyRegion, RminSkyRegion, RmidSkyRegion, DminSkyRegion, DmaxSkyRegion; 36 36 37 37 double *RmaxSky; … … 102 102 DmaxSkyRegion = MAX(DmaxSkyRegion, skylist[0].regions[i][0].Dmax); 103 103 } 104 RmidSkyRegion = 0.5*(RminSkyRegion + RmaxSkyRegion); 104 105 MARKTIME("create sky region coords: %f sec\n", dtime); 105 106 … … 169 170 double DminImage = +90.0; 170 171 double DmaxImage = -90.0; 172 int leftside = FALSE; 171 173 for (j = 0; j < 5; j++) { 172 174 XY_to_RD (&Ri[j], &Di[j], Xi[j], Yi[j], &timage[i].coords); 175 Ri[j] = ohana_normalize_angle (Ri[j]); 176 while (Ri[j] < RminSkyRegion) { Ri[j] += 360.0; } 177 while (Ri[j] > RmaxSkyRegion) { Ri[j] -= 360.0; } 178 if (j == 0) { 179 leftside = (Ri[j] < RmidSkyRegion); 180 } else { 181 if ( leftside && (Ri[j] > RmidSkyRegion + 90)) { Ri[j] -= 360.0; } 182 if (! leftside && (Ri[j] < RmidSkyRegion - 90)) { Ri[j] += 360.0; } 183 } 184 173 185 RminImage = MIN(RminImage, Ri[j]); 174 186 RmaxImage = MAX(RmaxImage, Ri[j]); … … 232 244 if (RESET) { 233 245 // XXX do we need / want to do this in relastro? 234 assignMcal (&image[nimage], (double *) NULL, -1); 235 image[nimage].dMcal = NAN; 246 // assignMcal (&image[nimage], (double *) NULL, -1); 247 // image[nimage].Mcal = NAN; 248 // image[nimage].dMcal = NAN; 236 249 image[nimage].flags &= ~badImage; 237 250 }
Note:
See TracChangeset
for help on using the changeset viewer.
