Changeset 35393
- Timestamp:
- Apr 11, 2013, 2:35:05 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130307/Ohana/src
- Files:
-
- 2 added
- 16 edited
-
addstar/src/MatchHeaders.c (modified) (1 diff)
-
libdvo/include/dvo.h (modified) (2 diffs)
-
libdvo/src/dbExtractMeasures.c (modified) (3 diffs)
-
libdvo/src/dbFields.c (modified) (2 diffs)
-
libdvo/src/dvo_catalog.c (modified) (3 diffs)
-
relphot/Makefile (modified) (2 diffs)
-
relphot/include/relphot.h (modified) (4 diffs)
-
relphot/src/MosaicOps.c (modified) (3 diffs)
-
relphot/src/args.c (modified) (3 diffs)
-
relphot/src/bcatalog.c (modified) (2 diffs)
-
relphot/src/global_stats.c (modified) (2 diffs)
-
relphot/src/load_catalogs.c (modified) (1 diff)
-
relphot/src/load_images.c (modified) (4 diffs)
-
relphot/src/relphot.c (modified) (2 diffs)
-
relphot/src/relphot_images.c (added)
-
relphot/src/select_images.c (modified) (5 diffs)
-
relphot/src/synthetic_mags.c (added)
-
uniphot/src/match_flatcorr_to_images.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130307/Ohana/src/addstar/src/MatchHeaders.c
r35316 r35393 62 62 if (!strcmp (exttype, "PS1_SV2")) goto keep; 63 63 if (!strcmp (exttype, "PS1_DV3")) { 64 fprintf (stderr, "exttype, ..%s..\n", exttype);65 64 goto keep; 66 65 } 67 fprintf (stderr, "exttype, ..%s..\n", exttype);68 66 continue; 69 67 -
branches/eam_branches/ipp-20130307/Ohana/src/libdvo/include/dvo.h
r35316 r35393 129 129 ID_MEAS_BLEND_MEAS_X = 0x00001000, // detection is within radius of multiple objects across catalogs 130 130 ID_MEAS_ARTIFACT = 0x00002000, // detection is thought to be non-astronomical 131 ID_MEAS_ UNDEF_5 = 0x00004000, // unused131 ID_MEAS_SYNTH_MAG = 0x00004000, // magnitude is synthetic 132 132 ID_MEAS_PHOTOM_UBERCAL = 0x00008000, // externally-supplied zero point from ubercal analysis 133 133 ID_MEAS_STACK_PRIMARY = 0x00010000, // this stack measurement is in the primary skycell … … 720 720 721 721 void dvo_average_init (Average *average); 722 void dvo_averageT_init (AverageTiny *average); 722 723 void dvo_secfilt_init (SecFilt *secfilt); 723 724 void dvo_measure_init (Measure *measure); 725 void dvo_measureT_init (MeasureTiny *measure); 724 726 725 727 # endif // DVO_H -
branches/eam_branches/ipp-20130307/Ohana/src/libdvo/src/dbExtractMeasures.c
r35342 r35393 92 92 93 93 Coords *mosaic, *fieldc; 94 94 95 PhotCode *equiv; 95 96 … … 98 99 99 100 switch (field->ID) { 100 case MEAS_MAG: /* magnitudes are already determined above */ 101 equiv = GetPhotcodeEquivbyCode (measure[0].photcode); 102 103 // we return the magnitude for this measure if: 104 if (field->photcode->type == PHOT_MAG) goto valid_photcode; 101 case MEAS_MAG: { /* magnitudes are already determined above */ 102 PhotCode *myEquiv = GetPhotcodeEquivbyCode (measure[0].photcode); 103 104 // if we request mag:ave, use equiv for photcode 105 if (field->photcode->type == PHOT_MAG) { 106 equiv = myEquiv; 107 goto valid_photcode; 108 } 109 110 // if we ask for 2MASS_K, etc (REF values), return NAN unless measure->code matches 105 111 if ((field->photcode->type == PHOT_REF) && (measure[0].photcode == field->photcode->code)) goto valid_photcode; 112 113 // if we ask for GPC1.g.XY03:rel, etc (DEP values), return NAN unless measure->code matches 106 114 if ((field->photcode->type == PHOT_DEP) && (measure[0].photcode == field->photcode->code)) goto valid_photcode; 107 115 108 if ((equiv != NULL) && (field->photcode->type == PHOT_SEC) && (equiv[0].code == field->photcode->code)) goto valid_photcode; 116 // if we ask for g:ave, or other SEC-level values, return the corresponding field 117 if (field->photcode->type == PHOT_SEC) { 118 switch (field->magMode) { 119 // measure-like : return non-NAN if measure.equiv.photcode matches field.photcode 120 case MAG_INST: 121 case MAG_CAT: 122 case MAG_SYS: 123 case MAG_REL: 124 case MAG_CAL: 125 case MAG_APER: 126 case MAG_APER_INST: 127 case MAG_KRON: 128 case MAG_KRON_INST: 129 case MAG_KRON_ERR: 130 case MAG_ERR: 131 case MAG_PHOT_FLAGS: 132 equiv = myEquiv; 133 if (equiv && (equiv->code == field->photcode->code)) goto valid_photcode; 134 break; 135 136 // mean-like : return value for the given photcode 137 case MAG_AVE: 138 case MAG_REF: 139 case MAG_CHISQ: 140 case MAG_AVE_ERR: 141 case MAG_NCODE: 142 case MAG_NPHOT: 143 case MAG_FLUX_PSF: 144 case MAG_FLUX_PSF_ERR: 145 case MAG_FLUX_KRON: 146 case MAG_FLUX_KRON_ERR: 147 equiv = field->photcode; 148 goto valid_photcode; 149 break; 150 default: 151 fprintf (stderr, "error"); 152 return value; 153 } 154 } 109 155 break; 110 156 … … 195 241 } 196 242 break; 243 } 197 244 case MEAS_RA: /* OK */ 198 245 value.Flt = average[0].R - measure[0].dR / 3600.0; -
branches/eam_branches/ipp-20130307/Ohana/src/libdvo/src/dbFields.c
r35342 r35393 87 87 strcpy (code[0].name, "MAG"); 88 88 code[0].type = PHOT_MAG; 89 // the field call 'mag' is only valid for mextract 90 // it should default to REL, but other types should default to AVE 91 if (useDefault) { 92 *mode = MAG_REL; 93 } 89 94 free (tmpstring); 90 95 return (code); … … 256 261 257 262 // check for code:mode in photcode name 258 code = ParsePhotcodeField (fieldName, &mode, MAG_ REL);263 code = ParsePhotcodeField (fieldName, &mode, MAG_AVE); 259 264 if (code == NULL) { 260 265 gprint (GP_ERR, "unknown field '%s' for measurement table in DVO database\n", fieldName); -
branches/eam_branches/ipp-20130307/Ohana/src/libdvo/src/dvo_catalog.c
r35102 r35393 112 112 113 113 // init all data, or just catalog data 114 void dvo_averageT_init (AverageTiny *average) { 115 average->R = 0; 116 average->D = 0; 117 average->flags = 0; 118 average->Nmeasure = 0; 119 average->measureOffset = -1; 120 average->catID = 0; 121 } 122 123 // init all data, or just catalog data 114 124 void dvo_secfilt_init (SecFilt *secfilt) { 115 125 secfilt->M = NAN; … … 142 152 measure->dR = NAN; 143 153 measure->dD = NAN; 144 measure->M = NAN;145 154 measure->Mcal = NAN; 146 155 measure->Map = NAN; … … 203 212 measure->dbFlags = 0; 204 213 measure->photFlags = 0; 214 } 215 216 void dvo_measureT_init (MeasureTiny *measure) { 217 measure->dR = NAN; 218 measure->dD = NAN; 219 measure->M = NAN; 220 measure->Mcal = NAN; 221 measure->dM = NAN; 222 223 measure->airmass = NAN; 224 measure->Xccd = NAN; 225 measure->Yccd = NAN; 226 measure->Xfix = NAN; 227 measure->Yfix = NAN; 228 229 measure->t = 0; 230 measure->dt = NAN; 231 measure->averef = 0; 232 233 measure->imageID = 0; 234 235 measure->dbFlags = 0; 236 measure->photFlags = 0; 237 measure->photcode = 0; 238 239 measure->catID = 0; 240 241 measure->dXccd = 0; 242 measure->dYccd = 0; 243 measure->dRsys = 0; 205 244 } 206 245 -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/Makefile
r34844 r35393 40 40 $(SRC)/load_catalogs.$(ARCH).o \ 41 41 $(SRC)/load_images.$(ARCH).o \ 42 $(SRC)/synthetic_mags.$(ARCH).o \ 42 43 $(SRC)/plot_scatter.$(ARCH).o \ 43 44 $(SRC)/plotstuff.$(ARCH).o \ 44 45 $(SRC)/reload_catalogs.$(ARCH).o \ 45 46 $(SRC)/relphot.$(ARCH).o \ 47 $(SRC)/relphot_images.$(ARCH).o \ 46 48 $(SRC)/relphot_objects.$(ARCH).o \ 47 49 $(SRC)/select_images.$(ARCH).o \ … … 69 71 $(SRC)/args.$(ARCH).o \ 70 72 $(SRC)/help.$(ARCH).o \ 73 $(SRC)/synthetic_mags.$(ARCH).o \ 71 74 $(SRC)/plotstuff.$(ARCH).o \ 72 75 $(SRC)/liststats.$(ARCH).o \ -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/include/relphot.h
r35104 r35393 4 4 # include <signal.h> 5 5 # include <pthread.h> 6 7 # define MARKTIME(MSG,...) { \ 8 gettimeofday (&stopTimer, (void *) NULL); \ 9 float dtime = DTIME (stopTimer, startTimer); \ 10 fprintf (stderr, MSG, __VA_ARGS__); } 11 12 # define INITTIME \ 13 struct timeval startTimer, stopTimer; \ 14 gettimeofday (&startTimer, (void *) NULL); 6 15 7 16 /* # define GRID_V1 */ … … 193 202 int UpdateAverages; 194 203 int ApplyOffsets; 204 int SyntheticPhotometry; 195 205 196 206 char *PhotcodeList; … … 353 363 void write_coords PROTO((Header *header, Coords *coords)); 354 364 int relphot_objects (int hostID, char *hostpath); 365 int relphot_images (void); 355 366 356 367 void relphot_usage (void); … … 390 401 391 402 void SetMrelInfoInit (SetMrelInfo *results, int allocLists); 403 404 int init_synthetic_mags (); 405 int add_synthetic_mags (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, off_t *Nmeasure, off_t *Nm); -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/MosaicOps.c
r34088 r35393 152 152 } 153 153 154 # define MARKTIME(MSG,...) { \155 float dtime; \156 gettimeofday (&stopTimer, (void *) NULL); \157 dtime = DTIME (stopTimer, startTimer); \158 fprintf (stderr, MSG, __VA_ARGS__); }159 160 154 /* find mosaic frames (unique time periods) (NOTE : we do NOT require matching photcodes...) 161 155 this function will also identify the images NOT in the subset which belong to a selected mosaic … … 167 161 char *pname; 168 162 169 struct timeval startTimer, stopTimer;170 171 163 if (!MOSAIC_ZEROPT) return; 172 164 173 gettimeofday (&startTimer, (void *) NULL);165 INITTIME; 174 166 175 167 /* a 'mosaic' in relphot is (unlike relastro) a virtual concept: there is no … … 264 256 } 265 257 } 266 fprintf (stderr, "%d total images, %d overlap skyregion , %d do not overlap, but match overlapping mosaics\n", (int) Nimage, (int) Nskip, (int) Nmark);258 fprintf (stderr, "%d total images, %d overlap skyregion & match selection criteria, %d do not overlap, but match overlapping mosaics\n", (int) Nimage, (int) Nskip, (int) Nmark); 267 259 MARKTIME("find unselected images matching selected mosaics: %f sec\n", dtime); 268 260 -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/args.c
r35104 r35393 251 251 remove_argument (N, &argc, argv); 252 252 MOSAIC_ZEROPT = TRUE; 253 if (!strcasecmp (MOSAICNAME, "none")) { 254 fprintf (stderr, "mosaic astrometry selected by MOSAICNAME not defined\n"); 255 exit (2); 256 } 253 257 } 254 258 … … 315 319 remove_argument (N, &argc, argv); 316 320 DophotSelect = TRUE; 321 } 322 323 SyntheticPhotometry = FALSE; 324 if ((N = get_argument (argc, argv, "-synthphot"))) { 325 remove_argument (N, &argc, argv); 326 SyntheticPhotometry = TRUE; 327 init_synthetic_mags(); 317 328 } 318 329 … … 516 527 } 517 528 529 SyntheticPhotometry = FALSE; 530 if ((N = get_argument (argc, argv, "-synthphot"))) { 531 remove_argument (N, &argc, argv); 532 SyntheticPhotometry = FALSE; 533 init_synthetic_mags(); 534 } 535 518 536 ImagSelect = FALSE; 519 537 if ((N = get_argument (argc, argv, "-instmag"))) { -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/bcatalog.c
r34405 r35393 179 179 REALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 180 180 } 181 myAssert (Nmeasure < NMEASURE, "realloc failure"); 181 182 } 182 183 … … 204 205 continue; 205 206 } 207 208 // for w-band photometry (& other cases?) convert gri photometry 209 // to a synthetic w-band magnitude 210 add_synthetic_mags (&subcatalog[0].averageT[Naverage], 211 &subcatalog[0].secfilt[Nsecfilt*Naverage], 212 &subcatalog[0].measureT[Nmeasure], 213 &Nmeasure, 214 &Nm); 215 if (Nmeasure == NMEASURE) { 216 NMEASURE += 1000; 217 REALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 218 } 219 myAssert (Nmeasure < NMEASURE, "realloc failure"); 206 220 207 221 subcatalog[0].averageT[Naverage].Nmeasure = Nm; -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/global_stats.c
r33963 r35393 1 1 # include "relphot.h" 2 3 # define MARKTIME(MSG,...) { \4 float dtime; \5 gettimeofday (&stopTimer, (void *) NULL); \6 dtime = DTIME (stopTimer, startTimer); \7 fprintf (stderr, MSG, __VA_ARGS__); }8 2 9 3 void global_stats (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) { … … 11 5 StatType stN, stX, stS, imN, imX, imM, imD, msM, msX, msN, msD; 12 6 13 // struct timeval startTimer, stopTimer;7 // INITTIME; 14 8 15 9 fprintf (stderr, "\n"); 16 10 fprintf (stderr, "STATS median mean sigma min max Nmeas\n"); 17 18 // gettimeofday (&startTimer, (void *) NULL);19 11 20 12 int Ns; -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/load_catalogs.c
r34642 r35393 148 148 149 149 char tmpline[1024]; 150 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 151 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 152 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 153 if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts", command); strcpy (command, tmpline); } 154 if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal", command); strcpy (command, tmpline); } 155 if (DophotSelect) { snprintf (tmpline, 1024, "%s -dophot %d", command, DophotValue); strcpy (command, tmpline); } 156 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } 157 if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue); strcpy (command, tmpline); } 150 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 151 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 152 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 153 if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts", command); strcpy (command, tmpline); } 154 if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal", command); strcpy (command, tmpline); } 155 if (DophotSelect) { snprintf (tmpline, 1024, "%s -dophot %d", command, DophotValue); strcpy (command, tmpline); } 156 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } 157 if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue); strcpy (command, tmpline); } 158 if (SyntheticPhotometry) { snprintf (tmpline, 1024, "%s -synthphot", command); strcpy (command, tmpline); } 159 158 160 if (TimeSelect) { 159 161 char *tstart = ohana_sec_to_date (TSTART); -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/load_images.c
r33963 r35393 1 1 # include "relphot.h" 2 3 # define MARKTIME(MSG,...) { \4 float dtime; \5 gettimeofday (&stop, (void *) NULL); \6 dtime = DTIME (stop, start); \7 fprintf (stderr, MSG, __VA_ARGS__); }8 2 9 3 // This function generates a subset of the images based on selections. Input db has already … … 14 8 off_t Nimage, Nsubset, Nchar; 15 9 off_t *LineNumber; 16 struct timeval start, stop;17 10 char *inSubset; 18 11 … … 20 13 SkyList *skylist = NULL; 21 14 22 gettimeofday (&start, (void *) NULL);15 INITTIME; 23 16 24 17 // load the current sky table (layout of all SkyRegions) … … 93 86 } 94 87 95 # if ( 1)88 # if (0) 96 89 FILE *ftest = fopen ("skydump.dat", "w"); 97 90 int i; -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/relphot.c
r33963 r35393 1 1 # include "relphot.h" 2 2 3 # define MARKTIME(MSG,...) { \4 float dtime; \5 gettimeofday (&stop, (void *) NULL); \6 dtime = DTIME (stop, start); \7 fprintf (stderr, MSG, __VA_ARGS__); }8 9 3 int main (int argc, char **argv) { 10 11 int i, status, Ncatalog;12 Catalog *catalog = NULL;13 FITS_DB db;14 struct timeval start, stop;15 SkyList *skylist = NULL;16 17 gettimeofday (&start, (void *) NULL);18 4 19 5 /* get configuration info, args */ … … 36 22 } 37 23 38 /* register database handle with shutdown procedure */ 39 set_db (&db); 40 db.mode = dvo_catalog_catmode (CATMODE); 41 db.format = dvo_catalog_catformat (CATFORMAT); 42 43 /* lock and load the image db table */ 44 status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT)); 45 if (!status && UPDATE) { 46 fprintf (stderr, "error\n"); 47 Shutdown ("ERROR: failure to lock image catalog %s", db.filename); 48 } 49 // if the file is missing, db.dbstate will have a value of either: 50 // LCK_EMPTY (if UPDATE) or LCK_MISSING (if !UPDATE) 51 if ((db.dbstate == LCK_EMPTY) || (db.dbstate == LCK_MISSING)) { 52 53 // 25.0 is the nominal zero point for measurements in the database 54 // for all measurements except PHOT_REF: 55 // measure.M contains: -2.5*log(DN) + 2.5*log(exptime) + 25.0 56 // for measurements using PHOT_REF: 57 // measure.M contains: -2.5*log(DN) + 2.5*log(exptime) + True Zero Point (but exptime and ZP are known) 58 dvo_image_create (&db, 25.0); 59 60 // XXX why are we running relphot on an empty database? 61 } else { 62 if (!dvo_image_load (&db, VERBOSE, FALSE)) Shutdown ("can't read image catalog %s", db.filename); 63 } 64 MARKTIME("-- load image data: %f sec\n", dtime); 65 66 /* load regions and images based on specified sky patch and/or catalog */ 67 skylist = load_images (&db, UserCatalog, &UserPatch); 68 MARKTIME("-- load images: %f sec\n", dtime); 69 70 /* unlock, if we can (else, unlocked below) */ 71 if (!UPDATE) dvo_image_unlock (&db); 72 73 // load the flat correction table (if defined) 74 char flatcorrfile[256]; 75 sprintf (flatcorrfile, "%s/flatcorr.fits", CATDIR); 76 FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrfile, VERBOSE); 77 78 if (NLOOP > 0) { 79 /* load catalog data from region files (hostID is 0 since we are not a client */ 80 catalog = load_catalogs (skylist, &Ncatalog, 0, NULL); 81 MARKTIME("-- load catalog data: %f sec\n", dtime); 82 83 /* add in a loop over the catalogs calling dvo_catalog_chipcoords */ 84 85 /* match measurements with images, mosaics */ 86 initImageBins (catalog, Ncatalog, TRUE); 87 MARKTIME("-- make image bins: %f sec\n", dtime); 88 89 initMosaicBins (catalog, Ncatalog, TRUE); 90 initGridBins (catalog, Ncatalog); 91 initMrel (catalog, Ncatalog); 92 93 findImages (catalog, Ncatalog, TRUE); 94 MARKTIME("-- set up image indexes: %f sec\n", dtime); 95 96 findMosaics (catalog, Ncatalog, TRUE); /* also sets Grid values */ 97 MARKTIME("-- set up mosaic indexes: %f sec\n", dtime); 98 99 SAVEPLOT = FALSE; 100 101 setExclusions (catalog, Ncatalog, TRUE); 102 103 global_stats (catalog, Ncatalog, flatcorr); 104 105 if (PLOTSTUFF) { 106 plot_star_coords (catalog, Ncatalog); 107 // plot_mosaic_fields (catalog); 108 } 109 110 // if we are measuring the flat-field correction grid, we need to perform a number of iterations first: 111 if (USE_GRID) { 112 int star_toofew; 113 114 // until we finish the grid analysis, do not reject stars out-of-hand based on ID_STAR_FEW 115 // XXX this is kind of poor: need to have a better distinctions about STAR_BAD in setMrel vs getMrel 116 star_toofew = STAR_TOOFEW; 117 STAR_TOOFEW = 0; 118 for (i = 0; i < NGRID; i++) { 119 STAR_BAD = ID_STAR_POOR; 120 setMrel (catalog, Ncatalog, flatcorr); 121 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 122 setMgrid (catalog, flatcorr); 123 } 124 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 125 STAR_TOOFEW = star_toofew; 126 } 127 128 /* determine fit values */ 129 for (i = 0; i < NLOOP; i++) { 130 if (PLOTSTUFF) { 131 plot_scatter (catalog, Ncatalog, flatcorr); 132 } 133 setMrel (catalog, Ncatalog, flatcorr); // threaded 134 if (PLOTSTUFF) { 135 plot_scatter (catalog, Ncatalog, flatcorr); 136 } 137 setMcal (catalog, FALSE, flatcorr); 138 setMmos (catalog, FALSE, flatcorr); 139 setMgrid (catalog, flatcorr); 140 MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime); 141 142 if (PLOTSTUFF) { 143 plot_scatter (catalog, Ncatalog, flatcorr); 144 plot_grid (catalog, flatcorr); 145 plot_mosaics (); 146 plot_images (); 147 plot_stars (catalog, Ncatalog); 148 plot_chisq (catalog, Ncatalog); 149 } 150 // if (i < NLOOP - 1) rationalize_mosaics (catalog, Ncatalog); 151 // if (i % 6 == 1) rationalize_images (); 152 153 // NOTE : in the past, I was not iterating enough before cleaning. make sure we do 154 // at least 8 loops first -- that should get the systematic errors down to the ~1% 155 // level, even in cases where we have an even split between photometric data and 156 // data with 1 mag of extinction. 157 158 if ((i > 8) && (i % 8 == 2)) clean_measures (catalog, Ncatalog, FALSE, flatcorr); 159 if ((i > 8) && (i % 8 == 3)) clean_stars (catalog, Ncatalog); 160 if ((i > 8) && (i % 8 == 5)) clean_mosaics (); 161 if ((i > 8) && (i % 8 == 5)) clean_images (); 162 163 // if ((i == 1) || (i == 5) || (i == 9) || (i == 13)) clean_measures (catalog, Ncatalog, FALSE); 164 // if ((i == 2) || (i == 6) || (i == 10) || (i == 14)) clean_stars (catalog, Ncatalog); 165 // if ((i == 4) || (i == 8) || (i == 12) || (i == 16)) clean_mosaics (); 166 // if ((i == 4) || (i == 8) || (i == 12) || (i == 16)) clean_images (); 167 if (i % 3 == 2) global_stats (catalog, Ncatalog, flatcorr); 168 MARKTIME("-- finished loop %d: %f sec\n", i, dtime); 169 } 170 171 if (PLOTSTUFF) { 172 plot_scatter (catalog, Ncatalog, flatcorr); 173 plot_grid (catalog, flatcorr); 174 plot_mosaics (); 175 plot_images (); 176 plot_stars (catalog, Ncatalog); 177 plot_chisq (catalog, Ncatalog); 178 } 179 180 if (USE_GRID) dump_grid (); 181 182 /* set Mcal & Mmos for bad images */ 183 setMcal (catalog, TRUE, flatcorr); 184 setMmos (catalog, TRUE, flatcorr); 185 MARKTIME("-- finalize Mcal values: %f sec\n", dtime); 186 187 setMcalFinal (); // copy per-mosaic calibrations to the images 188 189 if (SAVE_IMAGE_UPDATES) { 190 191 FITS_DB dbX; 192 off_t *LineNumber; 193 Image *image, *subset; 194 off_t Nimage, Nsubset, i, Nx; 195 char filename[1024]; 196 197 gfits_db_init (&dbX); 198 dbX.lockstate = LCK_XCLD; 199 dbX.timeout = 60.0; 200 dbX.mode = db.mode; 201 dbX.format = db.format; 202 203 snprintf (filename, 1024, "%s.bck", ImageCat); 204 if (!gfits_db_lock (&dbX, filename)) { 205 fprintf (stderr, "can't lock backup image image catalog\n"); 206 return (FALSE); 207 } 208 209 // apply the changes from the image subset to the full table: 210 211 // convert database table to internal structure (binary to Image) 212 // 'image' points to the same memory as db->ftable->buffer 213 image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped); 214 if (!image) { 215 fprintf (stderr, "ERROR: failed to read images\n"); 216 exit (2); 217 } 218 gfits_scan (db.ftable.header, "NAXIS1", OFF_T_FMT, 1, &Nx); 219 220 subset = getimages (&Nsubset, &LineNumber); 221 for (i = 0; i < Nsubset; i++) { 222 if (LineNumber[i] == -1) continue; 223 memcpy (&image[LineNumber[i]], &subset[i], Nx); 224 } 225 226 // copy Images.dat data (all or only the subset / vtable elements?) I think I need to dump 227 // the entire Image table, but with the updates in place I think this says: re-work the 228 // ftable/vtable usage in this program to be more sensible... 229 gfits_copy_header (&db.header, &dbX.header); 230 gfits_copy_matrix (&db.matrix, &dbX.matrix); 231 gfits_copy_header (&db.theader, &dbX.theader); 232 gfits_copy_ftable (&db.ftable, &dbX.ftable); 233 234 dbX.ftable.header = &dbX.theader; 235 dbX.virtual = FALSE; 236 237 // save Images.dat using the copied structure 238 if (UPDATE_CATFORMAT) { 239 // ensure the db format is updated 240 dbX.format = dvo_catalog_catformat (UPDATE_CATFORMAT); 241 char photcodeFile[1024]; 242 sprintf (photcodeFile, "%s/Photcodes.dat", CATDIR); 243 SavePhotcodesFITS (photcodeFile); 244 } 245 dvo_image_save (&dbX, VERBOSE); 246 dvo_image_unlock (&dbX); 247 MARKTIME("-- save Image.dat.bck: %f sec\n", dtime); 248 } 249 250 /* at this point, we have correct cal coeffs in the image/mosaic structures */ 251 for (i = 0; i < Ncatalog; i++) { 252 free_tiny_values (&catalog[i]); 253 dvo_catalog_free (&catalog[i]); 254 } 255 freeImageBins (Ncatalog, TRUE); 256 freeMosaicBins (Ncatalog, TRUE); 257 freeGridBins (Ncatalog); 258 259 } // (NLOOP > 0) : this loop determines the offsets per chip 260 261 reload_images (&db); 262 263 // only change the real database files if -update is requested 264 if (!UPDATE) exit (0); 265 266 /* load catalog data from region files, update Mrel include all data */ 267 reload_catalogs (skylist, flatcorr, 0, NULL); 268 MARKTIME("-- updated all catalogs: %f sec\n", dtime); 269 270 if (UPDATE_CATFORMAT) { 271 // ensure the db format is updated 272 db.format = dvo_catalog_catformat (UPDATE_CATFORMAT); 273 } 274 dvo_image_update (&db, VERBOSE); 275 dvo_image_unlock (&db); 24 relphot_images (); 276 25 277 26 exit (0); -
branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/select_images.c
r34642 r35393 17 17 off_t getRegionStartByRA (double R, double *Rref, off_t Nregions); 18 18 19 # define MARKTIME(MSG,...) { \20 float dtime; \21 gettimeofday (&stop, (void *) NULL); \22 dtime = DTIME (stop, start); \23 fprintf (stderr, MSG, __VA_ARGS__); }24 25 19 Image *select_images (SkyList *skylist, Image *timage, off_t Ntimage, char *inSubset, off_t **LineNumber, off_t *Nimage, SkyRegion *region) { 26 20 … … 31 25 double Ri[5], Di[5], Xi[5], Yi[5]; 32 26 Coords tcoords; 33 struct timeval start, stop;34 27 35 28 if (skylist[0].Nregions < 1) { … … 40 33 } 41 34 42 gettimeofday (&start, (void *) NULL);35 INITTIME; 43 36 44 37 // the comparison is made in the catalog local projection. below we set crval1,2 … … 82 75 } 83 76 84 # if ( 1)77 # if (0) 85 78 // XXX quick test of the dec bands: 86 79 FILE *fout = fopen ("dec.bands.dat", "w"); … … 132 125 // this adds 1.3 sec for 3M images 133 126 if (!FindMosaicForImage (timage, Ntimage, i)) { 134 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);127 if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i); 135 128 continue; 136 129 } -
branches/eam_branches/ipp-20130307/Ohana/src/uniphot/src/match_flatcorr_to_images.c
r33654 r35393 43 43 for (i = 0; i < Nimage; i++) { 44 44 if (!image[i].photcode) continue; // skip PHU images 45 if (image[i].photcode > maxCode) continue; // skip PHU images 45 46 46 47 int found = FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.
