IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35763


Ignore:
Timestamp:
Jul 3, 2013, 2:21:52 PM (13 years ago)
Author:
eugene
Message:

fix the constraints on object fits; do not apply fit if resulting position is off by max value; add option -reset-bad-images, -min-bad-psfqf -max-mean-offset; force detections to all be on the same side of the 0,360 boundary

Location:
trunk/Ohana/src/relastro
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relastro/include/relastro.h

    r35416 r35763  
    161161
    162162int    RESET;
     163int    RESET_BAD_IMAGES;
    163164int    NLOOP;
    164165int    NTHREADS;
     
    194195
    195196int PhotFlagSelect, PhotFlagPoor, PhotFlagBad;
     197
     198float MinBadQF;
     199float MaxMeanOffset;
    196200
    197201int TimeSelect;
     
    275279int           liststats_pos       PROTO((double *value, double *dvalue, int N, StatType *stats, int XVERB));
    276280Catalog      *load_catalogs       PROTO((SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath));
    277 int           load_images         PROTO((FITS_DB *db, SkyList *skylist));
    278 Image        *select_images       PROTO((SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage));
     281int           load_images         PROTO((FITS_DB *db, SkyList *skylist, int UseFullOverlap));
     282Image        *select_images       PROTO((SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage, int UseFullOverlap));
    279283
    280284void check_permissions (char *basefile);
  • trunk/Ohana/src/relastro/src

  • trunk/Ohana/src/relastro/src/ImageOps.c

    r35105 r35763  
    222222
    223223  ID = measure[0].imageID;
     224
     225  if (catalog[cat].measure) {
     226    Measure *measureBig = &catalog[cat].measure[meas];
     227    int TESTPT = FALSE;
     228    TESTPT |= (measureBig->imageID == CAT_ID_SRC) && (measureBig->detID == OBJ_ID_SRC);
     229    TESTPT |= (measureBig->imageID == CAT_ID_DST) && (measureBig->detID == OBJ_ID_DST);
     230    if (TESTPT) {
     231      fprintf (stderr, "got test det\n");
     232    }
     233  }
     234
    224235  idx = getImageByID (ID);
    225236  if (idx == -1) {
     
    379390}
    380391
     392static int NcatTotal = 0;
     393
    381394// return StarData values for detections in the specified image, converting coordinates from the
    382395// chip positions: X,Y -> L,M -> P,Q -> R,D
     
    445458
    446459    Measure *measure = &catalog[c].measure[m];
     460    MeasureTiny *measureT = &catalog[c].measureT[m];
     461
     462    int TESTPT = FALSE;
     463
     464    TESTPT |= (measure->imageID == CAT_ID_SRC) && (measure->detID == OBJ_ID_SRC);
     465    TESTPT |= (measure->imageID == CAT_ID_DST) && (measure->detID == OBJ_ID_DST);
     466    if (TESTPT) {
     467      fprintf (stderr, "got test det\n");
     468    }
    447469
    448470    if (USE_FIXED_PIXCOORDS) {
     
    454476    }
    455477    n = measure[0].averef;
     478    Average *average = &catalog[c].average[n];
    456479
    457480    if (moscoords == NULL) {
     
    467490
    468491    // new dR, dD : test
    469     dR = 3600.0*(catalog[c].average[n].R - R);
    470     dD = 3600.0*(catalog[c].average[n].D - D);
     492    dR = 3600.0*(average[0].R - R);
     493    dD = 3600.0*(average[0].D - D);
     494
     495    // make sure detection is on the same side of the 0,360 boundary as the average
     496    // this will give some funny results withing ~1 arcsec of the pol
     497    if (dR > +180.0*3600.0) {
     498      // average on high end of boundary, move star up
     499      R += 360.0;
     500      dR = 3600.0*(average[0].R - R);
     501    }
     502    if (dR < -180.0*3600.0) {
     503      // average on low end of boundary, move star down
     504      R -= 360.0;
     505      dR = 3600.0*(average[0].R - R);
     506    }
     507
     508    float csdec = cos(average[0].D * RAD_DEG);
    471509
    472510    // complain if the new location is far from the average location
    473511    // NOTE: This should never happen, or our StarMap tests are not working
    474     if (fabs(dR) > 3.0*ADDSTAR_RADIUS) {
     512    if (fabs(dR*csdec) > 3.0*ADDSTAR_RADIUS) {
    475513      NoffRAave ++;
    476514      if (VERBOSE2) {
    477         fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
    478         dump_measures (&catalog[c].average[n], catalog[c].measure);
     515        fprintf (stderr, "measurement is far from average location (R): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, dR*csdec, dD);
     516        dump_measures (&average[0], catalog[c].measure);
    479517      }
    480518      // abort ();
     
    483521      NoffDECave ++;
    484522      if (VERBOSE2) {
    485         fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
    486         dump_measures (&catalog[c].average[n], catalog[c].measure);
     523        fprintf (stderr, "measurement is far from average location (D): %f %f (%f %f)\n", average[0].R, average[0].D, dR, dD);
     524        dump_measures (&average[0], catalog[c].measure);
    487525      }
    488526      // abort ();
     
    490528
    491529    // complain if the new location is far from the old location
    492     if (fabs(catalog[c].measureT[m].dR - dR) > DPOS_MAX_ASEC) {
     530    if (fabs(csdec*(measure[0].dR - dR)) > DPOS_MAX_ASEC) {
    493531      NoffRAori ++;
    494532      if (VERBOSE2) {
    495         fprintf (stderr, "measurement is far from original location (R): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
    496         dump_measures (&catalog[c].average[n], catalog[c].measure);
     533        fprintf (stderr, "measurement moves far from original location (R): %f %f (%f %f %f %f)\n", average[0].R, average[0].D, measure[0].dR, dR, csdec*(measure[0].dR - dR), dD);
     534        dump_measures (&average[0], catalog[c].measure);
    497535      }
    498536      // abort();
     
    501539      NoffDECori ++;
    502540      if (VERBOSE2) {
    503         fprintf (stderr, "measurement is far from original location (D): %f %f (%f %f)\n", catalog[c].average[n].R, catalog[c].average[n].D, dR, dD);
    504         dump_measures (&catalog[c].average[n], catalog[c].measure);
     541        fprintf (stderr, "measurement moves far from original location (D): %f %f (%f %f %f)\n", average[0].R, average[0].D, dR, measure[0].dD, dD);
     542        dump_measures (&average[0], catalog[c].measure);
    505543      }      // abort();
    506544    }
     
    511549    measure[0].dR = dR;
    512550    measure[0].dD = dD;
     551    measureT[0].dR = dR;
     552    measureT[0].dD = dD;
    513553   
    514     if (measure[0].dR > +180.0*3600.0) {
    515       // average on high end of boundary, move star up
    516       R += 360.0;
    517       measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
    518     }
    519     if (measure[0].dR < -180.0*3600.0) {
    520       // average on low end of boundary, move star down
    521       R -= 360.0;
    522       measure[0].dR = 3600.0*(catalog[c].average[n].R - R);
    523     }
    524 
    525554    // set the systematic error for this image:
    526555    measure[0].dRsys = ToShortPixels(dPosSys);
    527   }
     556    measureT[0].dRsys = ToShortPixels(dPosSys);
     557  }
     558
     559  NcatTotal += nPos;
    528560
    529561  int Noff = NoffRAave + NoffDECave + NoffRAori + NoffDECori;
     
    531563  saveOffsets (dPos, nPos, im);
    532564
    533   // XXX this function should probably update the average positions as well.
    534 
    535565  return;
     566}
     567
     568void printNcatTotal () {
     569  fprintf (stderr, "NcatTotal: %d\n", NcatTotal);
    536570}
    537571
     
    10131047  } 
    10141048 
     1049  // if (MinBadQF > 0.0) {
     1050  //   if (measure[0].psfQF < MinBadQF) return FALSE;
     1051  // }
     1052
    10151053  /* select measurements by time */
    10161054  if (TimeSelect) {
     
    10751113  } 
    10761114 
     1115  if (MinBadQF > 0.0) {
     1116    if (measure[0].psfQF < MinBadQF) return FALSE;
     1117  }
     1118
    10771119  /* select measurements by time */
    10781120  if (TimeSelect) {
  • trunk/Ohana/src/relastro/src/UpdateMeasures.c

    r33652 r35763  
    11# include "relastro.h"
     2
     3void printNcatTotal ();
    24
    35// this function operates on Measure, not MeasureTiny
     
    1315    ID_IMAGE_ASTROM_SKIP |
    1416    ID_IMAGE_ASTROM_FEW;
     17
     18  if (RESET_BAD_IMAGES) badImage = 0;
    1519
    1620  image = getimages (&Nimage, NULL);
     
    2832  }
    2933
     34  printNcatTotal ();
     35
    3036  return (TRUE);
    3137}
  • trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c

    r35494 r35763  
    6565    freeImageBins (1);
    6666
     67    if (!UPDATE) {
     68      dvo_catalog_unlock (&catalog);
     69      dvo_catalog_free (&catalog);
     70      continue;
     71    }
     72   
    6773    // write the updated detections to disk
    6874    save_catalogs (&catalog, 1);
     
    8591  }   
    8692
    87   int i;
     93  int i, j;
    8894  for (i = 0; i < table->Nhosts; i++) {
     95
     96    if (sky->Nregions < table->Nhosts) {
     97      // do any of the regions want this host?
     98      int wantThisHost = FALSE;
     99      for (j = 0; j < sky->Nregions; j++) {
     100        if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) {
     101          wantThisHost = TRUE;
     102          break;
     103        }
     104      }
     105      if (!wantThisHost) {
     106        // fprintf (stderr, "skip host %s\n", table->hosts[i].hostname);
     107        continue;
     108      }
     109    }
    89110
    90111    // ensure that the paths are absolute path names
     
    113134    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command);                    strcpy (command, tmpline); }
    114135    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command);                    strcpy (command, tmpline); }
     136    if (UPDATE)        { snprintf (tmpline, 1024, "%s -update",         command);                    strcpy (command, tmpline); }
     137
     138    if (RESET_BAD_IMAGES) { snprintf (tmpline, 1024, "%s -reset-bad-images", command);               strcpy (command, tmpline); }
     139
    115140    if (ImagSelect)    { snprintf (tmpline, 1024, "%s -instmag %f %f",  command, ImagMin, ImagMax);  strcpy (command, tmpline); }
    116141    if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue);   strcpy (command, tmpline); }
     
    127152    if (PhotFlagPoor)      { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor);   strcpy (command, tmpline); }
    128153    // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
     154
     155    if (MinBadQF > 0.0)    { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f",        command, MinBadQF);      strcpy (command, tmpline); }
     156    if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset  %f", command, MaxMeanOffset); strcpy (command, tmpline); }
    129157
    130158    if (TimeSelect) {
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r35416 r35763  
    4848  PMFit fitAve, fitPM, fitPAR, fit;
    4949  time_t T2000;
    50   off_t Nave, Npm, Npar, Nskip;
    51   off_t NaveSum, NpmSum, NparSum, NskipSum;
     50  off_t Nave, Npm, Npar, Nskip, Noffset;
     51  off_t NaveSum, NpmSum, NparSum, NskipSum, NoffSum;
    5252  double Tmin, Tmax, Tmean, Trange;
    5353
     
    8080  }
    8181
    82   NaveSum = NparSum = NpmSum = NskipSum = 0;
     82  NaveSum = NparSum = NpmSum = NoffSum = NskipSum = 0;
    8383  for (i = 0; i < Ncatalog; i++) {
    8484
    8585    if (VERBOSE2) fprintf (stderr, "astrometrize catalog %d : "OFF_T_FMT" ave, "OFF_T_FMT" meas\n", i,  catalog[i].Naverage,  catalog[i].Nmeasure);
    8686
    87     Nave = Npar = Npm = Nskip = 0;
     87    Nave = Npar = Npm = Nskip = Noffset = 0;
    8888    for (j = 0; j < catalog[i].Naverage; j++) {
    8989      /* calculate the average value of R,D for a single star */
    9090
    9191      XVERB = FALSE;
     92      fitAve.chisq = NAN;
     93      fitPM.chisq = NAN;
     94      fitPAR.chisq = NAN;
    9295
    9396      if (catalog[i].average[j].Nmeasure == 0) {
     
    118121
    119122        // does the measurement pass the supplied filtering constraints?
    120         if (!MeasFilterTestTiny(&measure[k], FALSE)) {
     123        // MeasFilterTestTiny does not test psfQF
     124        int keepMeasure = measureBig ? MeasFilterTest(&measureBig[k], FALSE) : MeasFilterTestTiny(&measure[k], FALSE);
     125        if (!keepMeasure) {
    121126          measure[k].dbFlags &= ~ID_MEAS_USED_OBJ;
    122127          if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; }
     
    198203      Trange = Tmax - Tmin;
    199204      if (Trange < PM_DT_MIN) mode = FIT_AVERAGE;
    200       if ((mode == FIT_PM_ONLY) && (N < PM_TOOFEW)) mode = FIT_AVERAGE;
     205      if (((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) && (N <= PM_TOOFEW)) mode = FIT_AVERAGE;
    201206
    202207      if (FIT_TARGET == TARGET_HIGH_SPEED) {
     
    265270        float parRange = hypot (dXRange, dYRange);
    266271       
    267         if (parRange >= PAR_FACTOR_MIN) {
     272# define PAR_TOOFEW 5
     273        if ((parRange >= PAR_FACTOR_MIN) && (N > PAR_TOOFEW)) {
    268274          FitPMandPar (&fitPAR, X, dX, Y, dY, T, pX, pY, N, XVERB);
     275          if (XVERB) fprintf (stderr, "fitted PM+PAR:  %f - %f : %f %f : %f %f : %f %f : %f vs %f vs %f\n", Tmin, Tmax, fitPAR.Ro, fitPAR.Do, fitPAR.uR, fitPAR.uD, fitPAR.p, fitPAR.dp, fitPAR.chisq, fitPM.chisq, fitAve.chisq);
     276
    269277          XY_to_RD (&fitPAR.Ro, &fitPAR.Do, fitPAR.Ro, fitPAR.Do, &coords);
    270278          catalog[i].average[j].flags |= ID_STAR_FIT_PAR;
     
    315323        break;
    316324      }
    317       if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f)\n",
     325      if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f) plx=(%f +/- %f)\n",
    318326                          catalog[i].average[j].R,
    319327                          catalog[i].average[j].D,
     
    321329                          3600*(catalog[i].average[j].R - fit.Ro),
    322330                          3600*(catalog[i].average[j].D - fit.Do),
    323                           fit.uR,
    324                           fit.uD);
     331                          fit.uR, fit.uD, fit.p, fit.dp);
    325332
    326333      // make sure that the fit succeeded
     
    340347        continue;
    341348      }
     349
     350      // what is the offset relative to the mean fit position?
     351      coords.crval1 = catalog[i].average[j].R;
     352      coords.crval2 = catalog[i].average[j].D;
     353
     354      double dXoff, dYoff;
     355      RD_to_XY (&dXoff, &dYoff, fit.Ro, fit.Do, &coords);
     356      float dPos = hypot (dXoff, dYoff);
     357      if (dPos > MaxMeanOffset) {
     358        if (Noffset < 100) {
     359          fprintf (stderr, "(%f,%f) -> (%f,%f) (%f,%f)\n", coords.crval1, coords.crval2, fit.Ro, fit.Do, dXoff, dYoff);
     360        }
     361        Noffset ++;
     362        continue;
     363      }
     364
    342365
    343366      // the measure fields must be updated before the average fields
     
    385408    NparSum += Npar;
    386409    NskipSum += Nskip;
    387     if (VERBOSE) fprintf (stderr, "catalog %d : "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT"\n",  i,  Nave,  Npm,  Npar,  Nskip);
     410    NoffSum += Noffset;
     411    if (VERBOSE) fprintf (stderr, "catalog %d : "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n",  i,  Nave,  Npm,  Npar,  Nskip, Noffset);
    388412  }
    389413
    390   if (VERBOSE) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT"\n",  (NaveSum + NpmSum + NparSum),  NaveSum,  NpmSum,  NparSum,  NskipSum);
     414  if (VERBOSE) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n",  (NaveSum + NpmSum + NparSum),  NaveSum,  NpmSum,  NparSum,  NskipSum, NoffSum);
    391415  return (TRUE);
    392416}
  • trunk/Ohana/src/relastro/src/args.c

    r35416 r35763  
    315315  }
    316316
     317  RESET_BAD_IMAGES = FALSE;
     318  if ((N = get_argument (argc, argv, "-reset-bad-images"))) {
     319    remove_argument (N, &argc, argv);
     320    RESET_BAD_IMAGES = TRUE;
     321  }
     322
    317323  UPDATE = FALSE;
    318324  if ((N = get_argument (argc, argv, "-update"))) {
     
    379385    remove_argument (N, &argc, argv);
    380386    PhotFlagPoor = atoi (argv[N]);
     387    remove_argument (N, &argc, argv);
     388  }
     389
     390  MinBadQF = 0.0;
     391  if ((N = get_argument (argc, argv, "-min-bad-psfqf"))) {
     392    remove_argument (N, &argc, argv);
     393    MinBadQF = atof (argv[N]);
     394    remove_argument (N, &argc, argv);
     395  }
     396
     397  MaxMeanOffset = 10.0;
     398  if ((N = get_argument (argc, argv, "-max-mean-offset"))) {
     399    remove_argument (N, &argc, argv);
     400    MaxMeanOffset = atof (argv[N]);
    381401    remove_argument (N, &argc, argv);
    382402  }
     
    626646  }
    627647
     648  RESET_BAD_IMAGES = FALSE;
     649  if ((N = get_argument (argc, argv, "-reset-bad-images"))) {
     650    remove_argument (N, &argc, argv);
     651    RESET_BAD_IMAGES = TRUE;
     652  }
     653
    628654  UPDATE = FALSE;
    629655  if ((N = get_argument (argc, argv, "-update"))) {
    630656    remove_argument (N, &argc, argv);
    631657    UPDATE = TRUE;
    632   }
    633 
    634   // do not hold the lock on the Image table for relastro_client -update-offsets
    635   if (FIT_TARGET == TARGET_UPDATE_OFFSETS) {
    636     UPDATE = FALSE;
    637658  }
    638659
     
    675696    remove_argument (N, &argc, argv);
    676697    PhotFlagPoor = atoi (argv[N]);
     698    remove_argument (N, &argc, argv);
     699  }
     700
     701  MinBadQF = 0.0;
     702  if ((N = get_argument (argc, argv, "-min-bad-psfqf"))) {
     703    remove_argument (N, &argc, argv);
     704    MinBadQF = atof (argv[N]);
     705    remove_argument (N, &argc, argv);
     706  }
     707
     708  MaxMeanOffset = 10.0;
     709  if ((N = get_argument (argc, argv, "-max-mean-offset"))) {
     710    remove_argument (N, &argc, argv);
     711    MaxMeanOffset = atof (argv[N]);
    677712    remove_argument (N, &argc, argv);
    678713  }
  • trunk/Ohana/src/relastro/src/high_speed_catalogs.c

    r35105 r35763  
    8080// CATDIR is supplied globally
    8181# define DEBUG 1
    82 int high_speed_catalogs_parallel (SkyList *skylist) {
     82int high_speed_catalogs_parallel (SkyList *sky) {
    8383
    8484  // launch the setphot_client jobs to the parallel hosts
    8585
    8686  // load the list of hosts
    87   HostTable *table = HostTableLoad (CATDIR, skylist->hosts);
     87  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
    8888  if (!table) {
    89     fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", skylist->hosts, CATDIR);
     89    fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
    9090    exit (1);
    9191  }   
     
    9898  if (PARALLEL_OUTPUT) {
    9999    // load the list of hosts
    100     tableOut = HostTableLoad (HIGH_SPEED_DIR, skylist->hosts);
     100    tableOut = HostTableLoad (HIGH_SPEED_DIR, sky->hosts);
    101101    if (!tableOut) {
    102       fprintf (stderr, "ERROR: failure reading Host Table %s for output database %s\n", skylist->hosts, HIGH_SPEED_DIR);
     102      fprintf (stderr, "ERROR: failure reading Host Table %s for output database %s\n", sky->hosts, HIGH_SPEED_DIR);
    103103      exit (1);
    104104    }   
     
    109109  }
    110110
    111   int i;
     111  int i, j;
    112112  for (i = 0; i < table->Nhosts; i++) {
     113
     114    if (sky->Nregions < table->Nhosts) {
     115      // do any of the regions want this host?
     116      int wantThisHost = FALSE;
     117      for (j = 0; j < sky->Nregions; j++) {
     118        if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) {
     119          wantThisHost = TRUE;
     120          break;
     121        }
     122      }
     123      if (!wantThisHost) {
     124        // fprintf (stderr, "skip host %s\n", table->hosts[i].hostname);
     125        continue;
     126      }
     127    }
    113128
    114129    // ensure that the paths are absolute path names
     
    163178    // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
    164179
     180    if (MinBadQF > 0.0)    { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f",        command, MinBadQF);      strcpy (command, tmpline); }
     181    if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset  %f", command, MaxMeanOffset); strcpy (command, tmpline); }
     182
    165183    if (WHERE_A[0]) { snprintf (tmpline, 1024, "%s -D WHERE_A \"%s\"", command, WHERE_A);               strcpy (command, tmpline); }
    166184    if (WHERE_B[0]) { snprintf (tmpline, 1024, "%s -D WHERE_B \"%s\"", command, WHERE_B);               strcpy (command, tmpline); }
  • trunk/Ohana/src/relastro/src/hpm_catalogs.c

    r35416 r35763  
    7878// CATDIR is supplied globally
    7979# define DEBUG 1
    80 int hpm_catalogs_parallel (SkyList *skylist) {
     80int hpm_catalogs_parallel (SkyList *sky) {
    8181
    8282  // launch the setphot_client jobs to the parallel hosts
    8383
    8484  // load the list of hosts
    85   HostTable *table = HostTableLoad (CATDIR, skylist->hosts);
     85  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
    8686  if (!table) {
    87     fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", skylist->hosts, CATDIR);
     87    fprintf (stderr, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR);
    8888    exit (1);
    8989  }   
     
    9696  if (PARALLEL_OUTPUT) {
    9797    // load the list of hosts
    98     tableOut = HostTableLoad (HIGH_SPEED_DIR, skylist->hosts);
     98    tableOut = HostTableLoad (HIGH_SPEED_DIR, sky->hosts);
    9999    if (!tableOut) {
    100       fprintf (stderr, "ERROR: failure reading Host Table %s for output database %s\n", skylist->hosts, HIGH_SPEED_DIR);
     100      fprintf (stderr, "ERROR: failure reading Host Table %s for output database %s\n", sky->hosts, HIGH_SPEED_DIR);
    101101      exit (1);
    102102    }   
     
    107107  }
    108108
    109   int i;
     109  int i, j;
    110110  for (i = 0; i < table->Nhosts; i++) {
     111
     112    if (sky->Nregions < table->Nhosts) {
     113      // do any of the regions want this host?
     114      int wantThisHost = FALSE;
     115      for (j = 0; j < sky->Nregions; j++) {
     116        if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) {
     117          wantThisHost = TRUE;
     118          break;
     119        }
     120      }
     121      if (!wantThisHost) {
     122        // fprintf (stderr, "skip host %s\n", table->hosts[i].hostname);
     123        continue;
     124      }
     125    }
    111126
    112127    // ensure that the paths are absolute path names
     
    161176    // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
    162177
     178    if (MinBadQF > 0.0)    { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f",        command, MinBadQF);      strcpy (command, tmpline); }
     179    if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset  %f", command, MaxMeanOffset); strcpy (command, tmpline); }
     180
    163181    if (TimeSelect) {
    164182      char *tstart = ohana_sec_to_date (TSTART);
  • trunk/Ohana/src/relastro/src/load_images.c

    r33652 r35763  
    77  fprintf (stderr, MSG, __VA_ARGS__); }
    88
    9 int load_images (FITS_DB *db, SkyList *skylist) {
     9int load_images (FITS_DB *db, SkyList *skylist, int UseFullOverlap) {
    1010
    1111  Image     *image, *subset;
     
    2525
    2626  // select the images which overlap the selected sky regions
    27   subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset);
     27  subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset, UseFullOverlap);
    2828  MARKTIME("  select images: %f sec\n", dtime);
    2929
     
    3535 
    3636  /* unlock, if we can (else, unlocked below) */
    37   if (!UPDATE) dvo_image_unlock (db);
     37  int unlockImages = !UPDATE || (FIT_TARGET == TARGET_UPDATE_OFFSETS);
     38  if (unlockImages) dvo_image_unlock (db);
    3839
    3940  return TRUE;
  • trunk/Ohana/src/relastro/src/relastro.c

    r35416 r35763  
    3939      // iterate over catalogs to make detection coordinates consistant
    4040      UpdateObjectOffsets (skylist, 0, NULL);
     41      exit (0);
    4142
    4243    default:
  • trunk/Ohana/src/relastro/src/relastro_client.c

    r35416 r35763  
    7777
    7878      /* load regions and images based on specified sky patch (default depth) */
    79       load_images (&db, skylist);
     79      load_images (&db, skylist, FALSE);
    8080     
    8181      // // load the image subset table from the specified location
  • trunk/Ohana/src/relastro/src/relastro_images.c

    r33652 r35763  
    2020  MARKTIME("load image data: %f sec\n", dtime);
    2121
    22   /* load regions and images based on specified sky patch (default depth) */
    23   load_images (&db, skylist);
     22  /* load regions and images based on specified sky patch (default depth) (require full overlap) */
     23  load_images (&db, skylist, TRUE);
    2424  MARKTIME("load images: %f sec\n", dtime);
    2525
  • trunk/Ohana/src/relastro/src/relastro_objects.c

    r35105 r35763  
    110110  }   
    111111
    112   int i;
     112  int i, j;
    113113  for (i = 0; i < table->Nhosts; i++) {
     114
     115    if (sky->Nregions < table->Nhosts) {
     116      // do any of the regions want this host?
     117      int wantThisHost = FALSE;
     118      for (j = 0; j < sky->Nregions; j++) {
     119        if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) {
     120          wantThisHost = TRUE;
     121          break;
     122        }
     123      }
     124      if (!wantThisHost) {
     125        // fprintf (stderr, "skip host %s\n", table->hosts[i].hostname);
     126        continue;
     127      }
     128    }
    114129
    115130    // ensure that the paths are absolute path names
     
    154169    if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
    155170    if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
    156     if (PhotFlagSelect)    { snprintf (tmpline, 1024, "%s +photflags",   command);                     strcpy (command, tmpline); }
    157     if (PhotFlagBad)       { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad);     strcpy (command, tmpline); }
    158     if (PhotFlagPoor)      { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor);   strcpy (command, tmpline); }
     171    if (PhotFlagSelect)    { snprintf (tmpline, 1024, "%s +photflags",   command);                      strcpy (command, tmpline); }
     172    if (PhotFlagBad)       { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad);      strcpy (command, tmpline); }
     173    if (PhotFlagPoor)      { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor);    strcpy (command, tmpline); }
    159174    // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
     175
     176    if (MinBadQF > 0.0)    { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f",        command, MinBadQF);      strcpy (command, tmpline); }
     177    if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset  %f", command, MaxMeanOffset); strcpy (command, tmpline); }
    160178
    161179    if (TimeSelect) {
  • trunk/Ohana/src/relastro/src/select_images.c

    r34088 r35763  
    2222  fprintf (stderr, MSG, __VA_ARGS__); }
    2323
    24 Image *select_images (SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage) {
     24Image *select_images (SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage, int UseFullOverlap) {
    2525 
    2626  Image *image;
     
    122122  for (i = 0; i < Ntimage; i++) {
    123123     
     124    if (FALSE && !strncmp(timage[i].name, "o5479g0238o", 10)) {
     125      fprintf (stderr, "test image 1\n");
     126    }
     127    if (FALSE && !strncmp(timage[i].name, "o6227g0311o", 10)) {
     128      fprintf (stderr, "test image 2\n");
     129    }
     130
    124131    /* select images by photcode, or equiv photcode, if specified */
    125132    if (NphotcodesKeep > 0) {
    126133      found = FALSE;
     134      // XXX this bit of code excludes DIS mosaics and should be fixed
    127135      for (k = 0; (k < NphotcodesKeep) && !found; k++) {
    128136        if (photcodesKeep[k][0].code == timage[i].photcode) found = TRUE;
     
    196204    if (RmaxImage < RminSkyRegion) continue;
    197205
    198     if (!strncmp(timage[i].name, "o5903g0638o", 10) && (timage[i].photcode == 10355)) {
     206    if (FALSE && !strncmp(timage[i].name, "o5903g0638o", 10) && (timage[i].photcode == 10355)) {
    199207      fprintf (stderr, "test image\n");
    200208    }
     
    203211    // images) XXX : if we calibrate the mosaic, require that the full mosaic be inside
    204212    // the region and all of its chips..
    205 # define FULL_OVERLAP 1
    206     if (FULL_OVERLAP && strcmp(&timage[i].coords.ctype[4], "-DIS")) {
     213    if (UseFullOverlap && strcmp(&timage[i].coords.ctype[4], "-DIS")) {
    207214      if (RmaxImage > UserPatch.Rmax) continue;
    208215      if (RminImage < UserPatch.Rmin) continue;
Note: See TracChangeset for help on using the changeset viewer.