Changeset 33568
- Timestamp:
- Mar 19, 2012, 6:09:12 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/relastro/src
- Files:
-
- 7 edited
-
FitChip.c (modified) (7 diffs)
-
ImageOps.c (modified) (1 diff)
-
UpdateChips.c (modified) (2 diffs)
-
bcatalog.c (modified) (10 diffs)
-
fitpoly.c (modified) (1 diff)
-
load_catalogs.c (modified) (3 diffs)
-
select_images.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/FitChip.c
r33566 r33568 4 4 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) { 5 5 6 int i, NstatFull, Nstat, Niter , skip;6 int i, NstatFull, Nstat, Niter; 7 7 float dLsig, dMsig, dRsig; 8 8 float dLsigFull, dMsigFull, dRsigFull; … … 52 52 // fit the requested order polynomial 53 53 if (CHIPORDER > 0) { 54 image[0].coords.Npolyterms = CHIPORDER; 55 } 54 int Ndof_min = 3; 55 int order_max = 0.5*(sqrt(4*Nmatch - 4*Ndof_min + 1) - 3); 56 int order_use = MIN (CHIPORDER, order_max); 57 if (order_use < 1) { 58 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nmatch); 59 image[0].flags |= ID_IMAGE_ASTROM_FEW; 60 return FALSE; 61 } 62 image[0].coords.Npolyterms = order_use; 63 } 64 56 65 if (fit) fit_free (fit); 57 66 fit = fit_init (image[0].coords.Npolyterms); … … 63 72 } 64 73 74 # if (0) 65 75 // check if the fit has enough data points for the polynomial order 66 76 skip = FALSE; … … 86 96 return FALSE; 87 97 } 98 # endif 88 99 89 100 // measure the fit, update the coords & object coordinates … … 91 102 fprintf (stderr, "failed to fit new model\n"); 92 103 image[0].flags |= ID_IMAGE_ASTROM_FAIL; 104 if (fit) fit_free (fit); 93 105 return FALSE; 94 106 } … … 97 109 fprintf (stderr, "failed to fit new model\n"); 98 110 image[0].flags |= ID_IMAGE_ASTROM_FAIL; 111 if (fit) fit_free (fit); 99 112 return FALSE; 100 113 } … … 133 146 image[0].nLinkAstrom = (Nm / Ns); 134 147 135 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);148 if (VERBOSE2) 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); 136 149 137 150 image[0].dXpixSys = dLsig; -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/ImageOps.c
r33566 r33568 181 181 } 182 182 183 for (i = 0; VERBOSE && (i < Nimage); i++) { 184 name = GetPhotcodeNamebyCode (image[i].photcode); 185 fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s)\n", i, image[i].imageID, image[i].name, N_onImage[i], image[i].nstar, 186 ohana_sec_to_date(image[i].tzero), name); 187 } 183 // watch for chips with few stars 184 int Nfew = 0; 185 int Nbad = 0; 186 for (i = 0; i < Nimage; i++) { 187 // ignore the PHU entries 188 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue; 189 if (VERBOSE2 || (MATCHCAT && (N_onImage[i] < 20))) { 190 name = GetPhotcodeNamebyCode (image[i].photcode); 191 fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s)", i, image[i].imageID, image[i].name, N_onImage[i], image[i].nstar, 192 ohana_sec_to_date(image[i].tzero), name); 193 if (N_onImage[i] < 20) { 194 fprintf (stderr, "*"); 195 Nfew ++; 196 } 197 if (N_onImage[i] < 15) { 198 fprintf (stderr, "*** warning ***"); 199 Nbad ++; 200 } 201 fprintf (stderr, "\n"); 202 } 203 } 204 fprintf (stderr, OFF_T_FMT" total images, %d with < 20 measurements, %d with < 15\n", Nimage, Nfew, Nbad); 188 205 } 189 206 -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/UpdateChips.c
r33566 r33568 25 25 ALLOCATE (mode, char, Nimage); 26 26 27 // XXX for faster processing in the future, this can be easily run in parallel 28 // each chip is fitted independently, so we could do N at once in parallel 27 29 for (i = 0; i < Nimage; i++) { 28 30 … … 47 49 Nskip ++; 48 50 mode[i] = 0; 51 free (raw); 49 52 continue; 50 53 } -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/bcatalog.c
r33567 r33568 1 1 # include "relastro.h" 2 3 static int Nskip1 = 0; 4 static int Nskip2 = 0; 5 static unsigned int Tref = 1323353985; 6 static short Cref = 10355; 2 7 3 8 int bcatalog (Catalog *subcatalog, Catalog *catalog) { … … 34 39 if (catalog[0].average[i].Nmeasure <= SRC_MEAS_TOOFEW) { 35 40 continue; 41 // XXX can't (easily) count this for a given chip 36 42 } 37 43 … … 55 61 if (!MeasFilterTest(&catalog[0].measure[offset], TRUE)) { 56 62 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; 63 if (FALSE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { 64 Nskip1 ++; 65 } 57 66 continue; 58 67 } … … 61 70 if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) { 62 71 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; 72 if (FALSE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { 73 Nskip2 ++; 74 } 63 75 continue; 64 76 } … … 115 127 if (MaxDensityUse) { 116 128 LimitDensityCatalog_ByNmeasure (subcatalog, catalog); 117 } 118 119 if (VERBOSE) { 120 fprintf (stderr, OFF_T_FMT": using "OFF_T_FMT" stars ("OFF_T_FMT" measures) for catalog\n", i, subcatalog[0].Naverage, subcatalog[0].Nmeasure); 121 } 129 } else { 130 if (VERBOSE) { 131 char *basename = filebasename (catalog[0].filename); 132 fprintf (stderr, "subset of "OFF_T_FMT" ("OFF_T_FMT" total) stars, "OFF_T_FMT" ("OFF_T_FMT" total) measures for catalog %s\n", 133 subcatalog[0].Naverage, catalog[0].Naverage, subcatalog[0].Nmeasure, catalog[0].Nmeasure, basename); 134 free (basename); 135 } 136 } 122 137 return (TRUE); 138 } 139 140 void bcatalog_show_skips () { 141 fprintf (stderr, "Nskip: %d, %d\n", Nskip1, Nskip2); 123 142 } 124 143 … … 140 159 141 160 /* this version does NOT use AverageTiny, MeasureTiny */ 142 int LimitDensityCatalog_ByNmeasure (Catalog *subcatalog, Catalog * catalog) {161 int LimitDensityCatalog_ByNmeasure (Catalog *subcatalog, Catalog *oldcatalog) { 143 162 144 163 Catalog tmpcatalog; … … 148 167 int Nsecfilt = GetPhotcodeNsecfilt (); 149 168 150 gfits_scan (& catalog[0].header, "RA0", "%lf", 1, &Rmin);151 gfits_scan (& catalog[0].header, "DEC0", "%lf", 1, &Dmin);152 gfits_scan (& catalog[0].header, "RA1", "%lf", 1, &Rmax);153 gfits_scan (& catalog[0].header, "DEC1", "%lf", 1, &Dmax);169 gfits_scan (&oldcatalog[0].header, "RA0", "%lf", 1, &Rmin); 170 gfits_scan (&oldcatalog[0].header, "DEC0", "%lf", 1, &Dmin); 171 gfits_scan (&oldcatalog[0].header, "RA1", "%lf", 1, &Rmax); 172 gfits_scan (&oldcatalog[0].header, "DEC1", "%lf", 1, &Dmax); 154 173 155 174 if (VERBOSE2) fprintf (stderr, "extracting from catalog covering region %f,%f to %f,%f\n", Rmin, Dmin, Rmax, Dmax); … … 177 196 for (i = 0; i < Naverage; i++) { 178 197 index[i] = i; 179 value[i] = catalog[0].average[i].Nmeasure;198 value[i] = subcatalog[0].average[i].Nmeasure; 180 199 } 181 200 sort_by_Nmeasure (value, index, Naverage); … … 212 231 213 232 if (VERBOSE) { 214 fprintf (stderr, "limited to "OFF_T_FMT" of "OFF_T_FMT" stars ("OFF_T_FMT" of "OFF_T_FMT" measures) for catalog %s\n", 215 Nmax, subcatalog[0].Naverage, Nmeasure, subcatalog[0].Nmeasure, catalog[0].filename); 233 char *basename = filebasename (oldcatalog[0].filename); 234 fprintf (stderr, "limited to "OFF_T_FMT" ("OFF_T_FMT" subset, "OFF_T_FMT" total) stars, "OFF_T_FMT" ("OFF_T_FMT" subset, "OFF_T_FMT" total) measures for catalog %s\n", 235 Nmax, subcatalog[0].Naverage, oldcatalog[0].Naverage, Nmeasure, subcatalog[0].Nmeasure, oldcatalog[0].Nmeasure, basename); 236 free (basename); 216 237 } 217 238 … … 227 248 subcatalog[0].Naverage = Nmax; 228 249 subcatalog[0].Nmeasure = Nmeasure; 229 subcatalog[0].Nsecfilt = catalog[0].Nsecfilt;230 subcatalog[0].Nsecf_mem = Naverage * catalog[0].Nsecfilt;250 subcatalog[0].Nsecfilt = oldcatalog[0].Nsecfilt; 251 subcatalog[0].Nsecf_mem = Naverage * oldcatalog[0].Nsecfilt; 231 252 232 253 return (TRUE); -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/fitpoly.c
r29001 r33568 149 149 150 150 if (!dgaussjordan (matrix, vector, fit[0].Nelems, 2)) { 151 array_free (matrix, fit[0].Nelems); 152 array_free (vector, fit[0].Nelems); 151 153 return (FALSE); 152 154 } -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/load_catalogs.c
r33565 r33568 2 2 3 3 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog); 4 void bcatalog_show_skips (); 4 5 5 6 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath) { … … 83 84 } 84 85 86 // XXX TEST : bcatalog_show_skips(); 87 85 88 Nstar = 0; 86 89 for (i = 0; i < Ncat; i++) { … … 139 142 140 143 char command[1024]; 141 snprintf (command, 1024, "relastro_client -load-objects %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f ",142 table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR );144 snprintf (command, 1024, "relastro_client -load-objects %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f -D RELASTRO_SIGMA_LIM %f", 145 table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR, SIGMA_LIM); 143 146 144 147 char tmpline[1024]; -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/select_images.c
r33485 r33568 196 196 if (RmaxImage < RminSkyRegion) continue; 197 197 198 if (!strncmp(timage[i].name, "o5903g0638o", 10) && (timage[i].photcode == 10355)) { 199 fprintf (stderr, "test image\n"); 200 } 201 202 // require that the full image be inside the region of interest (only for non PHU 203 // images) XXX : if we calibrate the mosaic, require that the full mosaic be inside 204 // the region and all of its chips.. 205 # define FULL_OVERLAP 1 206 if (FULL_OVERLAP && strcmp(&timage[i].coords.ctype[4], "-DIS")) { 207 if (RmaxImage > UserPatch.Rmax) continue; 208 if (RminImage < UserPatch.Rmin) continue; 209 if (DmaxImage > UserPatch.Dmax) continue; 210 if (DminImage < UserPatch.Dmin) continue; 211 } 212 198 213 // image overlaps region, keep it 199 214 if (USE_BASIC_CHECK) goto found_it;
Note:
See TracChangeset
for help on using the changeset viewer.
