- Timestamp:
- Mar 27, 2010, 10:39:57 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/relastro.20100326/src/FixProblemImages.c
r27488 r27489 4 4 // original coordinates and recalculate the positions 5 5 6 int FixProblemImages ( ) {6 int FixProblemImages (SkyList *skylist) { 7 7 8 off_t i m, Nimage;8 off_t i, Nimage; 9 9 Image *image; 10 SkyList sublist; 11 12 // allocate so we can reallocate below 13 ALLOCATE (sublist.regions, SkyRegion *, 1); 14 ALLOCATE (sublist.filename, char *, 1); 10 15 11 16 image = getimages (&Nimage); 12 17 18 // first check on the dPos reported for each image 13 19 for (i = 0; i < Nimage; i++) { 14 20 double dPosSum, dPos; 21 off_t nPos; 22 getOffsets (&dPosSum, &nPos, i); 23 dPos = sqrt(dPosSum / nPos); 24 if (dPos > 4.0) { 25 setBadCoords (i); 26 } 27 } 28 29 for (i = 0; i < Nimage; i++) { 30 int j, cat, Ncat, *catlist, Ncatlist; 31 Catalog *catalog; 32 15 33 // check if this image should be fixed 16 34 if (!badCoords(i)) continue; 17 35 18 // get list of catalogs containing measurements for the bad images: 19 catlist = getCatList(im, &Ncat); 20 measlist = getMeasList(im, &Nmeas); 36 // I need a list of the catalogs for this image 37 catlist = getCatlist(&Ncatlist, i); 21 38 22 for (i = 0; i < Nlist[im]; i++) { 23 m = mlist[im][i]; 24 c = clist[im][i]; 25 39 // allocate Ncatlist skylist regions 40 REALLOCATE (sublist.regions, SkyRegion *, Ncatlist); 41 REALLOCATE (sublist.filename, char *, Ncatlist); 42 sublist.Nregions = Ncatlist; 43 sublist.ownElements = FALSE; // this list is only holding a view to the elements 26 44 27 28 // set up the basic catalog info 29 catalog.filename = skylist[0].filename[i]; 30 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 31 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 32 catalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; 33 catalog.Nsecfilt = GetPhotcodeNsecfilt (); 34 35 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) { 36 fprintf (stderr, "ERROR: failure reading catalog %s\n", catalog.filename); 37 exit (1); 38 } 39 if (!catalog.Naves_disk) { 40 if (VERBOSE) fprintf (stderr, "no data in %s, skipping\n", catalog.filename); 41 dvo_catalog_unlock (&catalog); 42 dvo_catalog_free (&catalog); 43 continue; 45 // copy the desired catalogs from skylist to skylistSubset 46 for (j = 0; j < Ncatlist; j++) { 47 cat = catlist[j]; 48 sublist.filename[j] = skylist[0].filename[cat]; 49 sublist.regions[j] = skylist[0].regions[cat]; 44 50 } 45 51 52 catalog = load_catalogs (&sublist, &Ncat, FALSE); 53 assert (Ncat == Ncatlist); 54 46 55 // match measurements with images 47 initImageBins ( &catalog, 1);48 findImages ( &catalog, 1);56 initImageBins (catalog, Ncat, FALSE); 57 findImages (catalog, Ncat, FALSE); 49 58 50 59 // update the detection coordinates using the new image parameters 51 UpdateMeasures (&catalog, 1);60 resetImageRaw (catalog, Ncat, i); 52 61 53 freeImageBins ( 1);62 freeImageBins (Ncat); 54 63 55 64 // write the updated detections to disk 56 save_catalogs ( &catalog, 1);65 save_catalogs (catalog, Ncat); 57 66 } 58 67
Note:
See TracChangeset
for help on using the changeset viewer.
