IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36517


Ignore:
Timestamp:
Feb 16, 2014, 6:51:33 AM (12 years ago)
Author:
eugene
Message:

relphot parallel is ready to build

Location:
branches/eam_branches/ipp-20140206/Ohana/src/relphot
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/doc/parallel.txt

    r36516 r36517  
     1
     22014.02.15
     3
     4Nearly done with the relphot mods.  some outstanding questions;
     5
     6 * image vs mosaic?
     7 * how do decide which images need to be shared?
    18
    292014.02.14
     
    2229 * from which hosts do I slurp mean mags?
    2330 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]
    2532
    26332014.02.06
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/indexCatalog.c

    r36516 r36517  
    11# include "relphot.h"
     2
     3static int  *catIDseq = NULL;
     4static int **objIDseq = NULL;
    25
    36int indexCatalogs (catalog, Ncatalog) {
    47
    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  }
    623 
    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;
    842}
     43
     44int 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  
    33// we are sharing image calibrations mags for all images which (a) I own and (b) which have unowned detections
    44
    5 // XXX Image vs Mosaic...
     5# define D_NIMAGEMAGS 1000
    66int share_image_mags (RegionHostTable *regionHosts, int nloop) {
    77
    8   Image *images = get_images (&Nimages);
     8  Image *images = getimages (&Nimages, NULL);
    99
     10  off_t Nimage_mags = 0;
     11  off_t NIMAGE_MAGS = D_NIMAGEMAGS;
     12 
    1013  ImageMag *image_mags = NULL;
    1114  ALLOCATE (image_mags, ImageMag, NIMAGE_MAGS);
    1215
    1316  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?)
    1918    if (imageExtra[i].Nmiss == 0) continue;
    2019   
    21     image_mags[Nimage_mags] = something(image[i]);
     20    set_image_mags (&image_mags[Nimage_mags], &images[i]);
    2221    Nimage_mags ++;
    2322
    24     // check realloc..
     23    CHECK_REALLOCATE (image_mags, ImageMag, NIMAGE_MAGS, Nimage_mags, D_NIMAGEMAGS);
    2524  }
    2625
     
    3837}
    3938
    40 int slurp_image_mags (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop) {
     39int slurp_image_mags (RegionHostTable *regionHosts, int nloop) {
    4140
     41  Image *getimages (&Nimage, NULL);
     42
     43  int Nimage_mags = 0;
    4244  ImageMag *image_mags = NULL;
    43   ALLOCATE (image_mags, ImageMag, NIMAGE_MAGS);
     45  ALLOCATE (image_mags, ImageMag, 1);
    4446
    4547  for (i = 0; i < Nhost; i++) {
    46     if (not_neighbor(host[i])) continue;
    47     // XXX skip regions->hosts[i].hostID == REGION_HOST_ID
     48    if (regionHosts->hosts.hostsID == REGION_HOST_ID) continue;
     49    // XXX add neighbor check? : if (not_neighbor(host[i])) continue;
    4850
    4951    check_imsync_file (regionHosts->hosts[i].hostname, nloop);
     
    5153    char filename[1024];
    5254    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);
    5456
    5557    image_mags = merge_image_mags (image_mags, &Nimage_mags, image_mags_subset, Nsubset);
     
    5759
    5860  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;
    6173  }
    6274}
     
    6981  sprintf (filename, "%s/%s.image.sync", CATDIR, hostname);
    7082
    71   // XXX I need a rule to generate the filename for each host
    7283  FILE *f = NULL;
    7384
     
    115126  return TRUE;
    116127}
     128
     129int 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
     140int set_image_mags (ImageMag *image_mags, Image *image) {
     141
     142  image_mags->M  = image->Mcal;
     143
     144  return TRUE;
     145}
     146
     147ImageMag *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  
    8080
    8181    // 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    }
    8586
    8687    Nsecfit = photcode_to_secfilt (meanmags[i].photcode);
     
    123124    return TRUE;
    124125  }
     126}
     127
     128int 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;
    125137}
    126138
Note: See TracChangeset for help on using the changeset viewer.