Changeset 36517
- Timestamp:
- Feb 16, 2014, 6:51:33 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140206/Ohana/src/relphot
- Files:
-
- 1 added
- 4 edited
-
doc/parallel.txt (modified) (2 diffs)
-
src/ImageMagIO.c (added)
-
src/indexCatalog.c (modified) (1 diff)
-
src/share_image_mags.c (modified) (6 diffs)
-
src/share_mean_mags.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140206/Ohana/src/relphot/doc/parallel.txt
r36516 r36517 1 2 2014.02.15 3 4 Nearly done with the relphot mods. some outstanding questions; 5 6 * image vs mosaic? 7 * how do decide which images need to be shared? 1 8 2 9 2014.02.14 … … 22 29 * from which hosts do I slurp mean mags? 23 30 o function to merge a new meanmag array into the existing one 24 *how to go from (objID,catID) to a given catalog[i].average[j]31 o how to go from (objID,catID) to a given catalog[i].average[j] 25 32 26 33 2014.02.06 -
branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/indexCatalog.c
r36516 r36517 1 1 # include "relphot.h" 2 3 static int *catIDseq = NULL; 4 static int **objIDseq = NULL; 2 5 3 6 int indexCatalogs (catalog, Ncatalog) { 4 7 5 // do I know 8 // find the max value of catID 9 int catIDmax = 0; 10 for (i = 0; i < Ncatalog; i++) { 11 catIDmax = MAX (catalog[i].catID, catIDmax); 12 } 13 14 ALLOCATE (catIDseq, int, catIDmax + 1); 15 for (i = 0; i < catIDmax + 1; i++) { 16 catIDseq[i] = -1; 17 } 18 19 for (i = 0; i < Ncatalog; i++) { 20 int catID = catalog[i].catID; 21 catIDseq[catID] = i; 22 } 6 23 7 24 ALLOCATE (objIDseq, int *, Ncatalog); 25 for (i = 0; i < Ncatalog; i++) { 26 int objIDmax = 0; 27 for (j = 0; j < catalog[i].Naverage; j++) { 28 objIDmax = MAX (catalog[i].average[j].objID, objIDmax); 29 } 30 31 ALLOCATE (objIDseq[i], int, objIDmax + 1); 32 for (j = 0; j < objIDmax + 1; j++) { 33 objIDseq[i][j] = -1; 34 } 35 36 for (j = 0; j < catalog[i].Naverage; j++) { 37 int objID = catalog[i].average[j].objID; 38 objIDseq[i][objID] = j; 39 } 40 } 41 return TRUE; 8 42 } 43 44 int catID_and_objID_to_seq (int catID, int objID, *catSeq, *objSeq) { 45 46 int cat = catIDseq[catID]; 47 if (cat < 1) return FALSE; 48 49 int obj = objIDseq[cat][objID]; 50 if (obj < 1) return FALSE; 51 52 *catSeq = cat; 53 *objSeq = obj; 54 return TRUE; 55 } -
branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_image_mags.c
r36516 r36517 3 3 // we are sharing image calibrations mags for all images which (a) I own and (b) which have unowned detections 4 4 5 // XXX Image vs Mosaic... 5 # define D_NIMAGEMAGS 1000 6 6 int share_image_mags (RegionHostTable *regionHosts, int nloop) { 7 7 8 Image *images = get _images (&Nimages);8 Image *images = getimages (&Nimages, NULL); 9 9 10 off_t Nimage_mags = 0; 11 off_t NIMAGE_MAGS = D_NIMAGEMAGS; 12 10 13 ImageMag *image_mags = NULL; 11 14 ALLOCATE (image_mags, ImageMag, NIMAGE_MAGS); 12 15 13 16 for (i = 0; i < Nimages; i++) { 14 15 // XXX do I need to test the center coordinates? 16 17 // does this object have missing detections (does someone else need it?) 18 // XXX : sky objects without missing detections 17 // XXX does this image have missing detections (does someone else need it?) 19 18 if (imageExtra[i].Nmiss == 0) continue; 20 19 21 image_mags[Nimage_mags] = something(image[i]);20 set_image_mags (&image_mags[Nimage_mags], &images[i]); 22 21 Nimage_mags ++; 23 22 24 // check realloc..23 CHECK_REALLOCATE (image_mags, ImageMag, NIMAGE_MAGS, Nimage_mags, D_NIMAGEMAGS); 25 24 } 26 25 … … 38 37 } 39 38 40 int slurp_image_mags ( Catalog *catalog, int Ncatalog,RegionHostTable *regionHosts, int nloop) {39 int slurp_image_mags (RegionHostTable *regionHosts, int nloop) { 41 40 41 Image *getimages (&Nimage, NULL); 42 43 int Nimage_mags = 0; 42 44 ImageMag *image_mags = NULL; 43 ALLOCATE (image_mags, ImageMag, NIMAGE_MAGS);45 ALLOCATE (image_mags, ImageMag, 1); 44 46 45 47 for (i = 0; i < Nhost; i++) { 46 if ( not_neighbor(host[i])) continue;47 // XXX skip regions->hosts[i].hostID == REGION_HOST_ID48 if (regionHosts->hosts.hostsID == REGION_HOST_ID) continue; 49 // XXX add neighbor check? : if (not_neighbor(host[i])) continue; 48 50 49 51 check_imsync_file (regionHosts->hosts[i].hostname, nloop); … … 51 53 char filename[1024]; 52 54 snprintf (filename, 1024, "%s/%s.imagemags.fits", CATDIR, regionHosts->hosts[i].hostname); 53 image_mags_subset = LoadImageMags(host[i], &Nsubset);55 ImageMag *image_mags_subset = ImageMagLoad (host[i], &Nsubset); 54 56 55 57 image_mags = merge_image_mags (image_mags, &Nimage_mags, image_mags_subset, Nsubset); … … 57 59 58 60 for (i = 0; i < Nimage_mags; i++) { 59 seq = Image_ID_to_seq (image_mags[i].ID); 60 image[seq].mag = image_mags[i].mag; 61 seq = getImageByID (image_mags[i].ID); 62 if (seq < 0) { 63 // XXX is this a problem? (no, other hosts don't know which images I own) 64 continue; 65 } 66 image[seq].Mcal = image_mags[i].Mcal; 67 image[seq].dMcal = image_mags[i].dMcal; 68 image[seq].dMagSys = image_mags[i].dMagSys; 69 image[seq].Xm = image_mags[i].Xm; 70 image[seq].nFitPhotom = image_mags[i].nFitPhotom; 71 image[seq].flags = image_mags[i].flags; 72 image[seq].ubercalDist = image_mags[i].ubercalDist; 61 73 } 62 74 } … … 69 81 sprintf (filename, "%s/%s.image.sync", CATDIR, hostname); 70 82 71 // XXX I need a rule to generate the filename for each host72 83 FILE *f = NULL; 73 84 … … 115 126 return TRUE; 116 127 } 128 129 int clear_imsync_file (char *hostname) { 130 131 char filename[1024]; 132 sprintf (filename, "%s/%s.image.sync", CATDIR, hostname); 133 134 // delete file contents 135 truncate (filename, 0); 136 137 return TRUE; 138 } 139 140 int set_image_mags (ImageMag *image_mags, Image *image) { 141 142 image_mags->M = image->Mcal; 143 144 return TRUE; 145 } 146 147 ImageMag *merge_image_mags (ImageMag *target, int *ntarget, ImageMag *source, int Nsource) { 148 149 REALLOCATE (target, ImageMag, *ntarget + Nsource); 150 for (i = 0; i < Nsource; i++) { 151 int n = i + *ntarget; 152 target[n] = source[i]; 153 } 154 155 free (source); 156 157 *ntarget += Nsource; 158 return (target); 159 } 160 -
branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_mean_mags.c
r36516 r36517 80 80 81 81 // set the mean mag 82 // XXX I need to figure out how to go from catID,objID to catSeq,objSeq 83 catSeq = catalog_ID_to_seq (catID); 84 objSeq = object_ID_to_seq (catID, objID); 82 if (!catID_and_objID_to_seq (catID, objID, &catSeq, &objSeq)) { 83 // XXX what should I do if this does not match? 84 continue; 85 } 85 86 86 87 Nsecfit = photcode_to_secfilt (meanmags[i].photcode); … … 123 124 return TRUE; 124 125 } 126 } 127 128 int clear_sync_file (char *hostname) { 129 130 char filename[1024]; 131 sprintf (filename, "%s/%s.meanmags.sync", CATDIR, hostname); 132 133 // delete file contents 134 truncate (filename, 0); 135 136 return TRUE; 125 137 } 126 138
Note:
See TracChangeset
for help on using the changeset viewer.
