Changeset 31160 for trunk/Ohana/src/relphot
- Timestamp:
- Apr 4, 2011, 1:19:27 PM (15 years ago)
- Location:
- trunk/Ohana/src/relphot/src
- Files:
-
- 4 edited
-
args.c (modified) (1 diff)
-
bcatalog.c (modified) (6 diffs)
-
load_images.c (modified) (3 diffs)
-
select_images.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relphot/src/args.c
r30616 r31160 78 78 remove_argument (N, &argc, argv); 79 79 PLOTDELAY = 1e6*atof(argv[N]); 80 PLOTSTUFF = TRUE; // always turn on plotting if i request a plot delay 80 81 remove_argument (N, &argc, argv); 81 82 } -
trunk/Ohana/src/relphot/src/bcatalog.c
r30616 r31160 7 7 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 8 8 float mag; 9 int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew ;9 int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Ngalaxy, Npsfqf; 10 10 11 11 // XXX PhotNsec as a global is a bad idea; either get it from catalog … … 23 23 Nmeasure = Naverage = 0; 24 24 25 Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = 0;25 Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = Npsfqf = Ngalaxy = 0; 26 26 27 27 /* exclude stars not in range or with too few measurements */ … … 44 44 45 45 Nm = 0; 46 int nEXT = 0; 47 int nPSF = 0; 46 48 for (j = 0; j < catalog[0].average[i].Nmeasure; j++) { 47 49 … … 62 64 // XXX chnage this to select by bitflags 63 65 if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) { Ndophot ++; continue; } 66 67 // skip garbage measurements 68 if (catalog[0].measure[offset].psfQual < 0.85) { Npsfqf ++; continue; } 69 70 // check for galaxies 71 if (!isnan(catalog[0].measure[offset].Map)) { 72 if (catalog[0].measure[offset].M - catalog[0].measure[offset].Map > 0.15) { 73 nEXT ++; 74 } else { 75 nPSF ++; 76 } 77 } 64 78 65 79 /* select measurements by mag limit */ … … 95 109 } 96 110 111 // skip object if it is likely to be a galaxy 112 if (nEXT >= nPSF) { 113 Nmeasure -= Nm; 114 Ngalaxy ++; 115 continue; 116 } 117 97 118 // XXXX test : what checks do I need to make elsewhere to avoid problems here? 98 119 if (Nm <= STAR_TOOFEW) { /* enough measurements in band? */ … … 121 142 fprintf (stderr, "using "OFF_T_FMT" stars ("OFF_T_FMT" measures) of "OFF_T_FMT" for catalog %s\n", 122 143 subcatalog[0].Naverage, subcatalog[0].Nmeasure, i, catalog[0].filename); 123 fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few \n",124 Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew );144 fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few, %d psfqf, %d galaxies\n", 145 Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Npsfqf, Ngalaxy); 125 146 } 126 147 return (TRUE); -
trunk/Ohana/src/relphot/src/load_images.c
r30616 r31160 7 7 fprintf (stderr, MSG, __VA_ARGS__); } 8 8 9 // This function generates a subset of the images based on selections. Input db has already 10 // been loaded with the raw fits table data 9 11 SkyList *load_images (FITS_DB *db, char *regionName, SkyRegion *region, int RegionSelect) { 10 12 … … 32 34 } 33 35 34 // convert database table to internal structure 36 // convert database table to internal structure (binary to Image) 35 37 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 36 38 if (!image) { … … 44 46 MARKTIME("selected images: %f sec\n", dtime); 45 47 48 // generate db->vtable from db->ftable based on the selection 49 // XXX does this simply duplicate the memory needlessly? we recreate these lines 50 // in reload_images. If we had saved the line numbers, we could avoid this 46 51 gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, LineNumber, Nsubset); 47 52 MARKTIME("converted ftable to vtable: %f sec\n", dtime); 48 53 54 // save the subset of images in the static reference in ImageOps, set up indexes 49 55 initImages (subset, Nsubset); 50 56 MARKTIME("init images: %f sec\n", dtime); 51 57 58 // match chips to mosaics (if applicable) 52 59 initMosaics (subset, Nsubset); 53 60 MARKTIME("init mosaics: %f sec\n", dtime); -
trunk/Ohana/src/relphot/src/select_images.c
r30616 r31160 33 33 struct timeval start, stop; 34 34 35 double RmaxSkyRegion, RminSkyRegion, DminSkyRegion, DmaxSkyRegion, RmidSkyRegion;35 double RmaxSkyRegion, RminSkyRegion, RmidSkyRegion, DminSkyRegion, DmaxSkyRegion; 36 36 37 37 double *RmaxSky; … … 131 131 } 132 132 133 /* define image corners */ 134 Xi[0] = 0; Yi[0] = 0; 135 Xi[1] = timage[i].NX; Yi[1] = 0; 136 Xi[2] = timage[i].NX; Yi[2] = timage[i].NY; 137 Xi[3] = 0; Yi[3] = timage[i].NY; 138 Xi[4] = 0; Yi[4] = 0; 133 /* define image corners - note the DIS images (mosaic phu) are special */ 134 if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) { 135 Xi[0] = -0.5*timage[i].NX; Yi[0] = -0.5*timage[i].NY; 136 Xi[1] = +0.5*timage[i].NX; Yi[1] = -0.5*timage[i].NY; 137 Xi[2] = +0.5*timage[i].NX; Yi[2] = +0.5*timage[i].NY; 138 Xi[3] = -0.5*timage[i].NX; Yi[3] = +0.5*timage[i].NY; 139 Xi[4] = -0.5*timage[i].NX; Yi[4] = -0.5*timage[i].NY; 140 } else { 141 Xi[0] = 0; Yi[0] = 0; 142 Xi[1] = timage[i].NX; Yi[1] = 0; 143 Xi[2] = timage[i].NX; Yi[2] = timage[i].NY; 144 Xi[3] = 0; Yi[3] = timage[i].NY; 145 Xi[4] = 0; Yi[4] = 0; 146 } 139 147 found = FALSE; 140 148 141 /* transform corners to ra,dec -- costs ~3sec for 3M images */149 /* transform corners to ra,dec -- costs ~3sec for 3M images (pikake) */ 142 150 double RminImage = 360.0; 143 151 double RmaxImage = 0.0; … … 147 155 XY_to_RD (&Ri[j], &Di[j], Xi[j], Yi[j], &timage[i].coords); 148 156 Ri[j] = ohana_normalize_angle_to_midpoint (Ri[j], RmidSkyRegion); 149 157 150 158 RminImage = MIN(RminImage, Ri[j]); 151 159 RmaxImage = MAX(RmaxImage, Ri[j]); … … 158 166 RminImage = tmp - 360.0; 159 167 } 160 168 161 169 // check that this image is even in range of the searched region 162 170 if (DminImage > DmaxSkyRegion) continue; … … 182 190 tcoords.crval2 = skycoords[m].Dc; 183 191 184 /* transform to ra,dec*/192 /* transform corner coords to X,Y in this catalog system */ 185 193 InRange = TRUE; 186 194 for (j = 0; (j < 5) && InRange; j++) { … … 352 360 return (Nlo); 353 361 } 354 355 off_t getRegionStopByRA (double R, double *Rref, off_t Nregions) {356 357 // use bisection to find the overlapping mosaic358 359 off_t Nlo, Nhi, N;360 361 // find the last mosaic before start362 Nlo = 0; Nhi = Nregions;363 while (Nhi - Nlo > 10) {364 N = 0.5*(Nlo + Nhi);365 if (Rref[N] < R) {366 Nlo = MAX(N, 0);367 } else {368 Nhi = MIN(N, Nregions);369 }370 }371 return (Nlo);372 }
Note:
See TracChangeset
for help on using the changeset viewer.
