IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37665


Ignore:
Timestamp:
Nov 23, 2014, 9:37:13 AM (12 years ago)
Author:
eugene
Message:

fix measure & average object exchanges between region hosts

Location:
branches/eam_branches/ipp-20140904/Ohana/src/relastro
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/Makefile

    r37658 r37665  
    7575$(SRC)/relastro_parallel_regions.$(ARCH).o \
    7676$(SRC)/MeanPosIO.$(ARCH).o \
     77$(SRC)/MeasPosIO.$(ARCH).o \
    7778$(SRC)/share_mean_pos.$(ARCH).o \
     79$(SRC)/share_meas_pos.$(ARCH).o \
    7880$(SRC)/share_images_pos.$(ARCH).o \
    7981$(SRC)/share_icrf_obj.$(ARCH).o \
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/include/relastro.h

    r37664 r37665  
    3434
    3535typedef struct {
    36   float R;
    37   float D;
     36  double R;
     37  double D;
    3838  unsigned int objID;
    3939  unsigned int catID;
    4040} MeanPos;
     41
     42typedef struct {
     43  double R;
     44  double D;
     45  unsigned int objID;
     46  unsigned int catID;
     47  unsigned int imageID;
     48} MeasPos;
    4149
    4250typedef struct {
     
    451459int setImageRaw (Catalog *catalog, int Ncatalog, off_t im, StarData *raw, off_t Nraw, CoordMode mode);
    452460off_t getImageByID (off_t ID);
     461int updateImageRaw (Catalog *catalog, int Ncatalog, off_t im);
    453462
    454463Mosaic *getmosaics (off_t *N);
     
    552561MeanPos *MeanPosLoad(char *filename, off_t *nmeanpos);
    553562
     563int share_meas_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop);
     564int slurp_meas_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop);
     565int set_meas_pos (MeasPos *measpos, Average *average, MeasureTiny *measure);
     566MeasPos *merge_meas_pos (MeasPos *target, int *ntarget, MeasPos *source, int Nsource);
     567
     568int MeasPosSave(char *filename, MeasPos *measpos, off_t Nmeaspos);
     569MeasPos *MeasPosLoad(char *filename, off_t *nmeaspos);
     570
    554571int indexCatalogs (Catalog *catalog, int Ncatalog);
    555572int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq);
     
    561578
    562579int share_image_pos (RegionHostTable *regionHosts, int nloop);
    563 int slurp_image_pos (RegionHostTable *regionHosts, int nloop);
     580int slurp_image_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop);
    564581ImagePos *merge_image_pos (ImagePos *target, int *ntarget, ImagePos *source, int Nsource);
    565582int set_image_pos (ImagePos *image_pos, Image *image);
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ImageOps.c

    r37646 r37665  
    251251    return;
    252252  }
     253  measure->myDet = TRUE; // I 'own' this detection (I am calibrating its image)
    253254
    254255  // index for (catalog, measure) -> image
     
    906907      catalog[c].measure[m].R = raw[i].R;
    907908      catalog[c].measure[m].D = raw[i].D;
     909    }     
     910  }
     911  return TRUE;
     912}
     913
     914// return StarData values for detections in the specified image, converting coordinates from the
     915// chip positions: X,Y -> L,M -> P,Q -> R,D.  This function is used by the image fitting steps, for
     916// which the detections have already been filtered when they were loaded (bcatalog)
     917int updateImageRaw (Catalog *catalog, int Ncatalog, off_t im) {
     918
     919  off_t i, m, c;
     920
     921  for (i = 0; i < N_onImage[im]; i++) {
     922    m = ImageToMeasure[im][i];
     923    c = ImageToCatalog[im][i];
     924
     925    MeasureTiny *measure = &catalog[c].measureT[m];
     926
     927    /* apply the current image transformation or use the current value of R+dR, D+dD? */
     928    double X = measure[0].Xccd;
     929    double Y = measure[0].Yccd;
     930    if (USE_FIXED_PIXCOORDS) {
     931      if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) {
     932        float dX = measure[0].Xfix - measure[0].Xccd;
     933        float dY = measure[0].Yfix - measure[0].Yccd;
     934        if (hypot(dX,dY) < 2.0) {
     935          X = measure[0].Xfix;
     936          Y = measure[0].Yfix;
     937        }
     938      }
     939    }
     940
     941    double R, D;
     942    XY_to_RD (&R, &D, X, Y, &image[im].coords);
     943    measure->R = R;
     944    measure->D = D;
     945    if (catalog[c].measure) {
     946      catalog[c].measure[m].R = R;
     947      catalog[c].measure[m].D = D;
    908948    }     
    909949  }
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/launch_region_hosts.c

    r37664 r37665  
    88  // clear the I/O files
    99  for (i = 0; i < regionHosts->Nhosts; i++) {
    10     char *syncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanpos.sync");
    11     if (truncate (syncfile, 0)) fprintf (stderr, "trouble clearing syncfile %s\n", syncfile);
    12     free (syncfile);
    13 
    14     char *fitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanpos.fits");
    15     if (truncate (fitsfile, 0)) fprintf (stderr, "trouble clearing fitsfile %s\n", fitsfile);
    16     free (fitsfile);
     10    char *meansync = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanpos.sync");
     11    if (truncate (meansync, 0)) fprintf (stderr, "trouble clearing meansync %s\n", meansync);
     12    free (meansync);
     13
     14    char *meanfits = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanpos.fits");
     15    if (truncate (meanfits, 0)) fprintf (stderr, "trouble clearing meanfits %s\n", meanfits);
     16    free (meanfits);
     17
     18    char *meassync = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "measpos.sync");
     19    if (truncate (meassync, 0)) fprintf (stderr, "trouble clearing meassync %s\n", meassync);
     20    free (meassync);
     21
     22    char *measfits = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "measpos.fits");
     23    if (truncate (measfits, 0)) fprintf (stderr, "trouble clearing measfits %s\n", measfits);
     24    free (measfits);
    1725
    1826    char *icrfsync = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "icrfobj.sync");
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/markObjects.c

    r37038 r37665  
    1414      int m = catalog[i].average[j].measureOffset;
    1515      for (n = 0; n < catalog[i].average[j].Nmeasure; n++) {
    16         if (!catalog[i].measureT[m+n].myDet) continue;
    17         nOwn ++;
     16        // this is a detection I own (it is on one of my images)
     17        if (catalog[i].measureT[m+n].myDet) {
     18          nOwn ++;
     19          continue;
     20        }
     21        // 2MASS detections are counted as 'owned' (I completely control this object is nOwn_t == Nmeasure; no sharing needed)
     22        if ((catalog[i].measureT[m+n].photcode == 2011) ||
     23            (catalog[i].measureT[m+n].photcode == 2012) ||
     24            (catalog[i].measureT[m+n].photcode == 2013)) {
     25          nOwn ++;
     26          continue;
     27        }
    1828      }
    1929      catalog[i].nOwn_t[j] = nOwn;
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_parallel_images.c

    r37662 r37665  
    9999        UpdateSimple (catalog, Ncatalog);
    100100        share_image_pos (regionHosts, i);
    101         slurp_image_pos (regionHosts, i);
     101        slurp_image_pos (catalog, Ncatalog, regionHosts, i);
    102102      }
    103103      break;
     
    112112        UpdateChips (catalog, Ncatalog);
    113113        share_image_pos (regionHosts, i);
    114         slurp_image_pos (regionHosts, i);
     114        slurp_image_pos (catalog, Ncatalog, regionHosts, i);
     115        share_meas_pos (catalog, Ncatalog, regionHosts, i);
     116        slurp_meas_pos (catalog, Ncatalog, regionHosts, i);
    115117        MARKTIME("update chips: %f sec\n", dtime);
    116118      }
     
    126128        UpdateMosaic (catalog, Ncatalog);
    127129        share_image_pos (regionHosts, i);
    128         slurp_image_pos (regionHosts, i);
     130        slurp_image_pos (catalog, Ncatalog, regionHosts, i);
    129131      }
    130132      break;
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_parallel_regions.c

    r37658 r37665  
    4949
    5050  // retrieve updated image parameters from the remote hosts (also set Image.mcal)
    51   if (!slurp_image_pos (regionHosts, -1)) Shutdown ("error loading image updates");
     51  if (!slurp_image_pos (NULL, 0, regionHosts, -1)) Shutdown ("error loading image updates");
    5252
    5353  if (!UPDATE) {
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/share_images_pos.c

    r37664 r37665  
    5151}
    5252
    53 int slurp_image_pos (RegionHostTable *regionHosts, int nloop) {
     53int slurp_image_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop) {
    5454
    5555  off_t Nimage, i, j;
     
    9191    images[seq].flags      = image_pos[i].flags     ;
    9292  }
    93   free (image_pos);
    9493
    9594  // load the astrometry offset maps, if they exist, and apply
     
    113112    }
    114113  }
     114
     115  // apply the modified image parameters to my detections
     116  for (i = 0; FALSE && (Ncatalog > 0) && (i < Nimage_pos); i++) {
     117    off_t seq = getImageByID (image_pos[i].imageID);
     118    if (seq < 0) continue;
     119    updateImageRaw (catalog, Ncatalog, seq);
     120  }
     121  free (image_pos);
     122
    115123  fprintf (stderr, "DONE grabbing image mags from other hosts\n");
    116124
Note: See TracChangeset for help on using the changeset viewer.