IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36611


Ignore:
Timestamp:
Mar 21, 2014, 10:46:28 AM (12 years ago)
Author:
eugene
Message:

handle images with very bad astrometry (exclude for now)

Location:
branches/eam_branches/ipp-20140206/Ohana/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/assign_images.c

    r36574 r36611  
    9595    }
    9696   
     97    // Exclude images with crazy astrometry
     98    // XXX NOTE : this is gpc1-specific
     99    {
     100      double dP1 = hypot(image[j].coords.pc1_1, image[j].coords.pc1_2);
     101      double dP2 = hypot(image[j].coords.pc2_1, image[j].coords.pc2_2);
     102      if (fabs(dP1 - 1.0) > 0.02) continue;
     103      if (fabs(dP2 - 1.0) > 0.02) continue;
     104
     105      double X00, Y00, X10, Y10, X01, Y01;
     106      XY_to_LM (&X00, &Y00, 0.0, 0.0, &image[j].coords);
     107      XY_to_LM (&X10, &Y10, image[j].NX, 0.0, &image[j].coords);
     108      XY_to_LM (&X01, &Y01, 0.0, image[j].NY, &image[j].coords);
     109      double dS0 = hypot ((X00 - X10), (Y00 - Y10));
     110      double dS1 = hypot ((X00 - X01), (Y00 - Y01));
     111      if (dS0 > 6000) continue;
     112      if (dS1 > 6500) continue;
     113    }   
     114
    97115    // use a reference coordinate for each image to assign to hosts
    98116    // define image center - note the DIS images (mosaic phu) are special
     
    104122    XY_to_RD (&Rc, &Dc, Xc, Yc, &image[j].coords);
    105123    Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);
     124    image[j].RAo  = Rc;
     125    image[j].DECo = Dc;
    106126
    107127    i = find_host_for_coords (regionHosts, Rc, Dc);
     
    241261  int i;
    242262
     263  if (isnan(Rc)) return -1;
     264  if (isnan(Dc)) return -1;
     265
    243266  for (i = 0; i < regionHosts->Nhosts; i++) {
    244267
  • branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/launch_region_hosts.c

    r36591 r36611  
    5555
    5656    char command[1024];
    57     snprintf (command, 1024, "relastro -parallel-images %s -region-hosts %s -region-hostID %d -D CATDIR %s -region %f %f %f %f -statmode %s -minerror %f",
    58               filename, REGION_FILE, host->hostID, CATDIR, host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat, STATMODE, MIN_ERROR);
     57    snprintf (command, 1024, "relastro -parallel-images %s", filename);
     58    strextend (command, "-region-hosts %s", REGION_FILE);
     59    strextend (command, "-region-hostID %d", host->hostID);
     60    strextend (command, "-D CATDIR %s", CATDIR);
     61    strextend (command, "-region %f %f %f %f", host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat);
     62    strextend (command, "-statmode %s", STATMODE);
     63    strextend (command, "-minerror %f", MIN_ERROR);
     64    strextend (command, "-nloop %d", NLOOP);
     65    strextend (command, "-threads %d", NTHREADS);
    5966
    6067    switch (FIT_TARGET) {
     
    8289    if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST);
    8390
     91    if (MaxDensityUse)      strextend (command, "-max-density %f", MaxDensityValue);
     92    if (ImagSelect)         strextend (command, "-instmag %f %f", ImagMin, ImagMax);
     93    if (PhotFlagSelect)     strextend (command, "+photflags");
     94    if (PhotFlagBad)        strextend (command, "+photflagbad %d", PhotFlagBad);
     95    if (PhotFlagPoor)       strextend (command, "+photflagpoor %d", PhotFlagPoor);
     96
     97    if (MinBadQF > 0.0)        strextend (command, "-min-bad-psfqf %f", MinBadQF);
     98    if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset  %f", MaxMeanOffset);
     99
     100    if (TimeSelect) {
     101      char *tstart = ohana_sec_to_date (TSTART);
     102      char *tstop  = ohana_sec_to_date (TSTOP);
     103      strextend (command, "-time %s %s", tstart, tstop);
     104      free (tstart);
     105      free (tstop);
     106    }
     107
    84108    fprintf (stderr, "command: %s\n", command);
    85109   
     
    102126    // remove client is done, go ahead with next client
    103127    check_sync_file (syncfile, 1);
    104     clear_sync_file (syncfile);
    105128    free (syncfile);
    106129  }
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/MosaicOps.c

    r36558 r36611  
    511511  /* send results to initGridBins */
    512512
    513   off_t i, j, m, NX, NY;
     513  off_t i, j, m, NX, NY, NC, Nc;
    514514  double R, D, Rmid, Dmid;
    515515  double Mcal, dMcal, Xm;
    516 
    517   for (i = 0; i < Nmosaic; i++) {
    518     Rmid = Dmid = 0.0;
     516  double *Rc, *Dc;
     517
     518  NC = 100;
     519  ALLOCATE (Rc, double, NC);
     520  ALLOCATE (Dc, double, NC);
     521
     522  for (i = 0; i < Nmosaic; i++) {
     523    Nc = 0;
     524    Rmid = Dmid = NAN;
    519525    Mcal = dMcal = Xm = 0;
    520526    for (j = 0; j < MosaicN_Image[i]; j++) {
     
    529535      NY = image[m].NY;
    530536      XY_to_RD (&R, &D, 0.5*NX, 0.5*NY, &image[m].coords);
    531 
    532       Rmid += R;
    533       Dmid += D;
     537      R = ohana_normalize_angle_to_midpoint (R, 180.0);
     538
     539      // Exclude images with crazy astrometry
     540      // XXX NOTE : this is gpc1-specific
     541      {
     542        double dP1 = hypot(image[m].coords.pc1_1, image[m].coords.pc1_2);
     543        double dP2 = hypot(image[m].coords.pc2_1, image[m].coords.pc2_2);
     544        if (fabs(dP1 - 1.0) > 0.02) continue;
     545        if (fabs(dP2 - 1.0) > 0.02) continue;
     546
     547        double X00, Y00, X10, Y10, X01, Y01;
     548        XY_to_LM (&X00, &Y00, 0.0, 0.0, &image[m].coords);
     549        XY_to_LM (&X10, &Y10, image[m].NX, 0.0, &image[m].coords);
     550        XY_to_LM (&X01, &Y01, 0.0, image[m].NY, &image[m].coords);
     551        double dS0 = hypot ((X00 - X10), (Y00 - Y10));
     552        double dS1 = hypot ((X00 - X01), (Y00 - Y01));
     553        if (dS0 > 6000) continue;
     554        if (dS1 > 6500) continue;
     555      }
     556
     557      Rc[Nc] = R;
     558      Dc[Nc] = D;
     559      Nc ++;
     560      if (Nc >= NC) {
     561        NC += 100;
     562        REALLOCATE (Rc, double, NC);
     563        REALLOCATE (Dc, double, NC);
     564      }
    534565
    535566      Mcal  += image[m].Mcal;
     
    544575      image[m].Xm    = NAN_S_SHORT;
    545576    }
    546     Rmid = Rmid / MosaicN_Image[i];
    547     Dmid = Dmid / MosaicN_Image[i];
     577    if (Nc > 0) {
     578      dsort (Rc, Nc);
     579      dsort (Dc, Nc);
     580      Rmid = Rc[(int)(0.5*Nc)];
     581      Dmid = Dc[(int)(0.5*Nc)];
     582    }
    548583
    549584    strcpy (mosaic[i].coords.ctype, "DEC--TAN");
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/assign_images.c

    r36558 r36611  
    8888    }
    8989   
     90    // Exclude images with crazy astrometry
     91    // XXX NOTE : this is gpc1-specific
     92    {
     93      double dP1 = hypot(image[j].coords.pc1_1, image[j].coords.pc1_2);
     94      double dP2 = hypot(image[j].coords.pc2_1, image[j].coords.pc2_2);
     95      if (fabs(dP1 - 1.0) > 0.02) continue;
     96      if (fabs(dP2 - 1.0) > 0.02) continue;
     97
     98      double X00, Y00, X10, Y10, X01, Y01;
     99      XY_to_LM (&X00, &Y00, 0.0, 0.0, &image[j].coords);
     100      XY_to_LM (&X10, &Y10, image[j].NX, 0.0, &image[j].coords);
     101      XY_to_LM (&X01, &Y01, 0.0, image[j].NY, &image[j].coords);
     102      double dS0 = hypot ((X00 - X10), (Y00 - Y10));
     103      double dS1 = hypot ((X00 - X01), (Y00 - Y01));
     104      if (dS0 > 6000) continue;
     105      if (dS1 > 6500) continue;
     106    }   
     107
    90108    // use a reference coordinate for each image to assign to hosts
     109    // define image center - note the DIS images (mosaic phu) are special, but we have
     110    // already excluded them above.  we also save the image centers for reference
     111    double Xc, Yc;
    91112    double Rc, Dc;
     113
     114    Xc = 0.5*image[j].NX;
     115    Yc = 0.5*image[j].NY;
     116
     117    XY_to_RD (&Rc, &Dc, Xc, Yc, &image[j].coords);
     118    Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);
     119    image[j].RAo  = Rc;
     120    image[j].DECo = Dc;
     121
    92122    if (MOSAIC_ZEROPT) {
    93123      // use the coords of the associated mosaic to select
     
    95125      Rc = mosaic->coords.crval1;
    96126      Dc = mosaic->coords.crval2;
    97     } else {
    98 
    99       // define image center - note the DIS images (mosaic phu) are special
    100       double Xc, Yc;
    101       Xc = 0.5*image[j].NX;
    102       Yc = 0.5*image[j].NY;
    103 
    104       XY_to_RD (&Rc, &Dc, Xc, Yc, &image[j].coords);
    105127      Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);
    106128    }
     
    242264  int i;
    243265
     266  if (isnan(Rc)) return -1;
     267  if (isnan(Dc)) return -1;
     268
    244269  for (i = 0; i < regionHosts->Nhosts; i++) {
    245270
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/client_logger.c

    r36562 r36611  
    55
    66static FILE *logfile = NULL;
    7 int client_logger_init () {
     7int client_logger_init (char *dirname) {
    88
    99  char filename[DVO_MAX_PATH];
    1010
    11   snprintf (filename, DVO_MAX_PATH, "%s/log.rlpc.XXXXXX", HOSTDIR);
     11  snprintf (filename, DVO_MAX_PATH, "%s/log.rlpc.XXXXXX", dirname);
    1212   
    1313  int fd = mkstemp (filename);
     
    3232  vfprintf (logfile, format, argp);
    3333  va_end (argp);
     34
     35  fflush (logfile);
    3436  return TRUE;
    3537}
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/launch_region_hosts.c

    r36591 r36611  
    5858              PhotcodeList, filename, REGION_FILE, host->hostID, CATDIR, host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat, STATMODE, CAMERA, STAR_TOOFEW, MIN_ERROR);
    5959
    60     if (VERBOSE)         strextend (command, "-v");
    61     if (VERBOSE2)        strextend (command, "-vv");
    62     if (RESET)           strextend (command, "-reset");
    63     if (RESET_ZEROPTS)   strextend (command, "-reset-zpts");
    64     if (UPDATE)          strextend (command, "-update");
    65     if (MOSAIC_ZEROPT)   strextend (command, "-mosaic");
    66     if (FREEZE_IMAGES)   strextend (command, "-imfreeze");
    67     if (FREEZE_MOSAICS)  strextend (command, "-mosfreeze");
    68     if (!KEEP_UBERCAL)   strextend (command, "-reset-ubercal");
    69     if (PARALLEL)        strextend (command, "-parallel");
    70     if (PARALLEL_MANUAL) strextend (command, "-parallel-manual");
    71     if (PARALLEL_SERIAL) strextend (command, "-parallel-serial");
     60    if (VERBOSE)             strextend (command, "-v");
     61    if (VERBOSE2)            strextend (command, "-vv");
     62    if (RESET)               strextend (command, "-reset");
     63    if (RESET_ZEROPTS)       strextend (command, "-reset-zpts");
     64    if (!KEEP_UBERCAL)       strextend (command, "-reset-ubercal");
     65    if (DophotSelect)        strextend (command, "-dophot %d", DophotValue);
     66    if (ImagSelect)          strextend (command, "-instmag %f %f", ImagMin, ImagMax);
     67    if (MaxDensityUse)       strextend (command, "-max-density %f", MaxDensityValue);
     68    if (SyntheticPhotometry) strextend (command, "-synthphot");
     69
     70    if (UPDATE)              strextend (command, "-update");
     71    if (MOSAIC_ZEROPT)       strextend (command, "-mosaic");
     72    if (FREEZE_IMAGES)       strextend (command, "-imfreeze");
     73    if (FREEZE_MOSAICS)      strextend (command, "-mosfreeze");
     74    if (PARALLEL)            strextend (command, "-parallel");
     75    if (PARALLEL_MANUAL)     strextend (command, "-parallel-manual");
     76    if (PARALLEL_SERIAL)     strextend (command, "-parallel-serial");
    7277
    7378    // XXX deprecate this if we are happy with the new version
     
    9499    // remote client is done, go ahead with next client
    95100    check_sync_file (syncfile, 1);
    96     clear_sync_file (syncfile);
    97101    free (syncfile);
    98102  }
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/relphot_client.c

    r33963 r36611  
    1919  // get configuration info, args, lockfile (set CATDIR, HOST_ID, HOSTDIR, etc)
    2020  initialize_client (argc, argv);
    21   client_logger_init ();
     21  client_logger_init (HOSTDIR);
    2222
    2323  // load the current sky table (layout of all SkyRegions)
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/relphot_parallel_images.c

    r36590 r36611  
    1919  INITTIME;
    2020
     21  client_logger_init (CATDIR);
     22
    2123  // load the RegionTable (UserRegion should not be used at this level)
    2224  RegionHostTable *regionHosts = RegionHostTableLoad (CATDIR, REGION_FILE);
    2325  int myHost = regionHosts->index[REGION_HOST_ID];
    2426  RegionHostFindNeighbors (regionHosts, myHost);
     27  client_logger_message ("started parallel images on %s\n", regionHosts->hosts[myHost].hostname);
    2528
    2629  // load the subset images belonging to this host
     
    5255  catalog = load_catalogs (skylist, &Ncatalog, 0, NULL);
    5356  MARKTIME("-- load catalog data: %f sec\n", dtime);
     57  client_logger_message ("loaded catalog data\n");
    5458
    5559  // NOTE: if I let all hosts load blindly, I saturate the data clients with too many
     
    6165  // generate tables go from catID,objID -> catSeq,objSeq
    6266  indexCatalogs (catalog, Ncatalog);
     67  client_logger_message ("indexed Catalogs\n");
    6368
    6469  /* match measurements with images, mosaics */
     
    7580  MARKTIME("-- set up mosaic indexes: %f sec\n", dtime);
    7681
     82  client_logger_message ("done setting up indexes\n");
     83
    7784  // dumpObjects ("test.obj.dat", catalog, Ncatalog);
    78 
    7985  markObjects (catalog, Ncatalog);
    8086
     
    94100
    95101  /* determine fit values */
     102  client_logger_message ("starting the loops : %d \n", NLOOP);
    96103  for (i = 0; i < NLOOP; i++) {
    97104
     
    101108    // share mean mags for objects at the boundary (number of unowned meas > 0)
    102109    share_mean_mags (catalog, Ncatalog, regionHosts, i);
     110    client_logger_message ("shared mean mag data : loop %d \n", i);
    103111
    104112    // load mean mags from other region hosts
    105113    slurp_mean_mags (catalog, Ncatalog, regionHosts, i);
     114    client_logger_message ("slurped mean mag data : loop %d \n", i);
    106115
    107116    // set the image (Mcal) and mosaic (Mmos) zero point offsets given the mean mags and measurements
     
    112121    // share image mags for images with non-zero unowned detections
    113122    share_image_mags (regionHosts, i);
     123    client_logger_message ("shared image data : loop %d \n", i);
    114124
    115125    slurp_image_mags (regionHosts, i);
     126    client_logger_message ("slurped image data : loop %d \n", i);
    116127
    117128    if ((i > 8) && (i % 8 == 2)) clean_measures (catalog, Ncatalog, FALSE, flatcorr);
     
    123134    MARKTIME("-- finished loop %d: %f sec\n", i, dtime);
    124135  }
     136  client_logger_message ("done with loops\n");
    125137
    126138  // this is a checkpoint to make sure all hosts have finished the loop above
     
    135147    free (loopsync);
    136148  }   
     149  client_logger_message ("all hosts are done the loops\n");
    137150
    138151  /* set Mcal & Mmos for bad images */
     
    144157
    145158  share_image_mags (regionHosts, -1);
     159  client_logger_message ("done with parallel images\n");
    146160
    147161  exit (0);
Note: See TracChangeset for help on using the changeset viewer.