IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2014, 12:03:17 PM (12 years ago)
Author:
eugene
Message:

merge changes from EAM dev branches 20140206 (relastro, relphot extensions to parallel processing)

Location:
trunk
Files:
18 edited
12 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Ohana/src/relastro/Makefile

    r35416 r36630  
    6969$(SRC)/resort_catalog.$(ARCH).o  \
    7070$(SRC)/BrightCatalog.$(ARCH).o  \
     71$(SRC)/assign_images.$(ARCH).o \
     72$(SRC)/launch_region_hosts.$(ARCH).o \
     73$(SRC)/relastro_parallel_images.$(ARCH).o \
     74$(SRC)/relastro_parallel_regions.$(ARCH).o \
     75$(SRC)/MeanPosIO.$(ARCH).o \
     76$(SRC)/share_mean_pos.$(ARCH).o \
     77$(SRC)/share_images_pos.$(ARCH).o \
     78$(SRC)/ImagePosIO.$(ARCH).o \
     79$(SRC)/ImageTable.$(ARCH).o \
     80$(SRC)/markObjects.$(ARCH).o \
     81$(SRC)/indexCatalogs.$(ARCH).o \
     82$(SRC)/syncfile.$(ARCH).o \
    7183$(SRC)/relastroVisual.$(ARCH).o
    7284
  • trunk/Ohana/src/relastro/include/relastro.h

    r35763 r36630  
    66# include <pthread.h>
    77
     8# define MARKTIME(MSG,...) {                    \
     9    gettimeofday (&stopTimer, (void *) NULL);   \
     10    float dtime = DTIME (stopTimer, startTimer);        \
     11    fprintf (stderr, MSG, __VA_ARGS__); }
     12
     13# define INITTIME \
     14  struct timeval startTimer, stopTimer; \
     15  gettimeofday (&startTimer, (void *) NULL);
     16
    817// choose off_t or int depending on full-scale relphot analysis resources
    918// # define IDX_T off_t
     
    2029typedef enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_PAR_ONLY, FIT_PM_AND_PAR} FitMode;
    2130
    22 typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS, TARGET_HIGH_SPEED, TARGET_MERGE_SOURCE, TARGET_UPDATE_OBJECTS, TARGET_UPDATE_OFFSETS, TARGET_LOAD_OBJECTS, TARGET_HPM} FitTarget;
     31typedef enum {OP_NONE, OP_IMAGES, OP_HIGH_SPEED, OP_MERGE_SOURCE, OP_UPDATE_OBJECTS, OP_UPDATE_OFFSETS, OP_LOAD_OBJECTS, OP_HPM, OP_PARALLEL_REGIONS, OP_PARALLEL_IMAGES} RelastroOp;
     32
     33typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS} FitTarget;
    2334
    2435typedef enum {
     
    3041  MARK_BIG_OFFSET    = 0x0010,
    3142} MeasurementMask;
     43
     44typedef struct {
     45  float R;
     46  float D;
     47  unsigned int objID;
     48  unsigned int catID;
     49} MeanPos;
     50
     51typedef struct {
     52  Coords coords;
     53  float dXpixSys;
     54  float dYpixSys;
     55  unsigned int imageID;
     56  int nFitAstrom;
     57  int flags;
     58} ImagePos;
    3259
    3360typedef struct {
     
    93120  unsigned int start;
    94121  unsigned int stop;
     122  off_t myImage;
    95123  float Mcal;
    96124  float dMcal;
     
    113141} StatType;
    114142
    115 # define MARKTIME(MSG,...) { \
    116   float dtime; \
    117   gettimeofday (&stop, (void *) NULL); \
    118   dtime = DTIME (stop, start); \
    119   fprintf (stderr, MSG, __VA_ARGS__); }
    120 
    121143/* global variables set in parameter file */
    122144# define DVO_MAX_PATH 1024
     
    129151char   SKY_TABLE[DVO_MAX_PATH];
    130152int    SKY_DEPTH;  /** XXX EAM : depth of catalog tables, fix usage */
     153
     154// globals for parallel region operations
     155char  *REGION_FILE;
     156char  *IMAGE_TABLE;
     157int    REGION_HOST_ID;
     158int    PARALLEL_REGIONS_MANUAL;
    131159
    132160int          HOST_ID;
     
    208236FitMode FIT_MODE;
    209237
     238RelastroOp RELASTRO_OP;
    210239FitTarget FIT_TARGET;
    211240
     
    450479int hpm_catalogs_parallel (SkyList *skylist);
    451480int hpm_objects (SkyRegion *region, Catalog *catalog);
     481
     482int strextend (char *input, char *format,...);
     483int launch_region_hosts (RegionHostTable *regionHosts);
     484
     485int assign_images (FITS_DB *db, RegionHostTable *regionHosts);
     486int select_images_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage);
     487int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax, double Rmid);
     488int calculate_host_image_bounds (RegionHostTable *regionHosts);
     489int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc);
     490
     491int relastro_parallel_regions ();
     492int relastro_parallel_images ();
     493
     494char *make_filename (char *dirname, char *hostname, int hostID, char *tailname);
     495int check_sync_file (char *filename, int nloop);
     496int clear_sync_file (char *filename);
     497int update_sync_file (char *filename, int nloop);
     498
     499int share_mean_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop);
     500int slurp_mean_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop);
     501int set_mean_pos (MeanPos *meanpos, Average *average);
     502MeanPos *merge_mean_pos (MeanPos *target, int *ntarget, MeanPos *source, int Nsource);
     503
     504int MeanPosSave(char *filename, MeanPos *meanpos, off_t Nmeanpos);
     505MeanPos *MeanPosLoad(char *filename, off_t *nmeanpos);
     506
     507int indexCatalogs (Catalog *catalog, int Ncatalog);
     508int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq);
     509
     510int markObjects (Catalog *catalog, int Ncatalog);
     511
     512int ImagePosSave(char *filename, ImagePos *image_pos, off_t Nimage_pos);
     513ImagePos *ImagePosLoad(char *filename, off_t *nimage_pos);
     514
     515int share_image_pos (RegionHostTable *regionHosts, int nloop);
     516int slurp_image_pos (RegionHostTable *regionHosts, int nloop);
     517ImagePos *merge_image_pos (ImagePos *target, int *ntarget, ImagePos *source, int Nsource);
     518int set_image_pos (ImagePos *image_pos, Image *image);
     519
     520Image *ImageTableLoad(char *filename, off_t *nimage);
     521int ImageTableSave (char *filename, Image *images, off_t Nimages);
     522int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage);
  • trunk/Ohana/src/relastro/src/ConfigInit.c

    r35105 r36630  
    1818  if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file);
    1919
    20   GetConfig (config, "RELASTRO_SIGMA_LIM",         "%lf", 0, &SIGMA_LIM); // exclude measurements on this basis
    21   GetConfig (config, "RELASTRO_SRC_MEAS_TOOFEW",   "%d",  0, &SRC_MEAS_TOOFEW);
     20  // set defaults for all of these if they are not used by parallel / remote clients
     21  if (!ScanConfig (config, "RELASTRO_SIGMA_LIM",         "%lf", 0, &SIGMA_LIM))       SIGMA_LIM = 0.01;
     22  if (!ScanConfig (config, "RELASTRO_SRC_MEAS_TOOFEW",   "%d",  0, &SRC_MEAS_TOOFEW)) SRC_MEAS_TOOFEW = 3;
    2223
    2324  if (!ScanConfig (config, "RELASTRO_IMFIT_CLIP_NITER",    "%d",  0, &IMFIT_CLIP_NITER))    IMFIT_CLIP_NITER  = 3;
     
    2526  if (!ScanConfig (config, "RELASTRO_IMFIT_SYS_SIGMA_LIM", "%lf", 0, &IMFIT_SYS_SIGMA_LIM)) IMFIT_SYS_SIGMA_LIM = 0.01;
    2627
    27   GetConfig (config, "PM_DT_MIN",              "%lf", 0, &PM_DT_MIN);
    28   GetConfig (config, "PM_TOOFEW",              "%d",  0, &PM_TOOFEW);
    29   GetConfig (config, "POS_TOOFEW",             "%d",  0, &POS_TOOFEW);
     28  if (!ScanConfig (config, "PM_DT_MIN",              "%lf", 0, &PM_DT_MIN))        PM_DT_MIN = 0.25;   
     29  if (!ScanConfig (config, "PM_TOOFEW",              "%d",  0, &PM_TOOFEW))        PM_TOOFEW = 4;   
     30  if (!ScanConfig (config, "POS_TOOFEW",             "%d",  0, &POS_TOOFEW))       POS_TOOFEW = 1; 
     31  if (!ScanConfig (config, "PAR_FACTOR_MIN",         "%lf", 0, &PAR_FACTOR_MIN))   PAR_FACTOR_MIN = 0.2;
     32  if (!ScanConfig (config, "RELASTRO_MAP_NX",        "%d",  0, &NX_MAP))           NX_MAP = 5;
     33  if (!ScanConfig (config, "RELASTRO_MAP_NY",        "%d",  0, &NY_MAP))           NY_MAP = 5;
     34  if (!ScanConfig (config, "RELASTRO_DPOS_MAX",      "%lf", 0, &DPOS_MAX))         DPOS_MAX = 6.0;   
     35  if (!ScanConfig (config, "ADDSTAR_RADIUS",         "%lf", 0, &ADDSTAR_RADIUS))   ADDSTAR_RADIUS = 1.0;
    3036
    31   GetConfig (config, "PAR_FACTOR_MIN",         "%lf", 0, &PAR_FACTOR_MIN);
    32 
    33   GetConfig (config, "RELASTRO_MAP_NX",        "%d",  0, &NX_MAP);
    34   GetConfig (config, "RELASTRO_MAP_NY",        "%d",  0, &NY_MAP);
    35   GetConfig (config, "RELASTRO_DPOS_MAX",      "%lf", 0, &DPOS_MAX);
    36   GetConfig (config, "ADDSTAR_RADIUS",         "%lf", 0, &ADDSTAR_RADIUS);
    37 
    38   if (!ScanConfig (config, "USE_FIXED_PIXCOORDS", "%d", 0, &USE_FIXED_PIXCOORDS)) {
    39     USE_FIXED_PIXCOORDS = FALSE;
    40   }
     37  if (!ScanConfig (config, "USE_FIXED_PIXCOORDS", "%d", 0, &USE_FIXED_PIXCOORDS))  USE_FIXED_PIXCOORDS = FALSE;
    4138
    4239  // force CATDIR to be absolute (so parallel mode will work)
     
    5653  sprintf (ImageCat, "%s/Images.dat", CATDIR);
    5754
    58   if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) {
    59     SKY_DEPTH = 2;
    60   }
    61   if (!ScanConfig (config, "SKY_TABLE",         "%s",  0, SKY_TABLE)) {
    62     SKY_TABLE[0] = 0;
    63   }
     55  if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) SKY_DEPTH = 2;
     56  if (!ScanConfig (config, "SKY_TABLE",         "%s",  0, SKY_TABLE)) SKY_TABLE[0] = 0;
    6457
    6558  if (*CATMODE == 0) strcpy (CATMODE, "RAW");
  • trunk/Ohana/src/relastro/src/ImageOps.c

    r35763 r36630  
    226226    Measure *measureBig = &catalog[cat].measure[meas];
    227227    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);
     228    TESTPT |= CAT_ID_SRC && OBJ_ID_SRC && (measureBig->imageID == CAT_ID_SRC) && (measureBig->detID == OBJ_ID_SRC);
     229    TESTPT |= CAT_ID_DST && OBJ_ID_DST && (measureBig->imageID == CAT_ID_DST) && (measureBig->detID == OBJ_ID_DST);
    230230    if (TESTPT) {
    231231      fprintf (stderr, "got test det\n");
     
    462462    int TESTPT = FALSE;
    463463
    464     TESTPT |= (measure->imageID == CAT_ID_SRC) && (measure->detID == OBJ_ID_SRC);
    465     TESTPT |= (measure->imageID == CAT_ID_DST) && (measure->detID == OBJ_ID_DST);
     464    TESTPT |= CAT_ID_SRC && OBJ_ID_SRC && (measure->imageID == CAT_ID_SRC) && (measure->detID == OBJ_ID_SRC);
     465    TESTPT |= CAT_ID_DST && OBJ_ID_DST && (measure->imageID == CAT_ID_DST) && (measure->detID == OBJ_ID_DST);
    466466    if (TESTPT) {
    467467      fprintf (stderr, "got test det\n");
  • trunk/Ohana/src/relastro/src/MosaicOps.c

    r27581 r36630  
    1111
    1212// list of mosaic associated with each image 
    13 static off_t    Nmosaic_for_images; // number of images (for off_ternal checks)
     13static off_t    Nmosaic_for_images; // number of images (for internal checks)
    1414static off_t    *mosaic_for_images; // array of: image -> mosaic
    1515
     
    105105    mosaic[Nmosaic].secz  = image[i].secz;
    106106    mosaic[Nmosaic].coords = image[i].coords;
     107    mosaic[Nmosaic].myImage = i;
    107108
    108109    // init the mosaic_own_images array data
     
    135136  ALLOCATE (mosaic_for_images, off_t, Nmosaic_for_images);
    136137
     138  // emit an error if we miss mosaics, but stop if we miss too many
     139  int NmissMosaic = 0;
     140  int NtestMosaic = 0;
     141
    137142  /* now assign the WRP images to these mosaics */
    138143  for (i = 0; i < Nimage; i++) {
     
    140145
    141146    if (strcmp(&image[i].coords.ctype[4], "-WRP")) continue;
     147    NtestMosaic ++;
    142148
    143149    /* set image time range */
     
    147153    Nmos = getMosaicByTimes (start, stop, startMos, stopMos, indexMos);
    148154    if (Nmos == -1) {
    149       fprintf (stderr, "cannot match mosaic for %s\n", image[i].name);
     155      if (NmissMosaic < 1000) {
     156        fprintf (stderr, "cannot match mosaic for %s\n", image[i].name);
     157      }
     158      NmissMosaic ++;
    150159      continue;
    151160    }
     
    164173  }
    165174
     175  fprintf (stderr, "mosaic matching : %d of possible %d failed to match\n", NmissMosaic, NtestMosaic);
     176  if (NmissMosaic > 0.5*NtestMosaic) {
     177    fprintf (stderr, "serious problem with mosaic matching\n");
     178    exit (5);
     179  }
     180
    166181  free (startMos);
    167182  free (stopMos);
     
    250265  if (im >= Nmosaic_for_images) abort();
    251266
    252   // search for the mosaic that
     267  // search for the mosaic that matches this image
    253268  mos = mosaic_for_images[im];
    254269  if (mos < 0) return NULL;
     
    256271  return &mosaic[mos];
    257272}
     273
     274// extend each host image table to include the mosaic 'images' needed by the host
     275int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage) {
     276
     277  int i;
     278  off_t j;
     279  char *mosaicUsed;
     280
     281  ALLOCATE (mosaicUsed, char, Nmosaic);
     282
     283  // we need to add the mosaics to each of the region hosts lists of images
     284  for (i = 0; i < regionHosts->Nhosts; i++) {
     285
     286    int Nadd = 0;
     287    int NADD = 100;
     288    off_t *addMosaic = NULL;
     289    ALLOCATE (addMosaic, off_t, NADD);
     290
     291    // reset the mosaicUsed flags (valid only for this host)
     292    memset (mosaicUsed, 0, Nmosaic * sizeof(char));
     293
     294    RegionHostInfo *host = &regionHosts->hosts[i];
     295
     296    // find the mosaics associated with a given
     297    for (j = 0; j < host->Nimage; j++) {
     298
     299      int im = host->imseq[j];
     300     
     301      if (im < 0) abort();
     302      if (im >= Nmosaic_for_images) abort();
     303
     304      // search for the mosaic that matches this image (skip unmatched images)
     305      off_t mos = mosaic_for_images[im];
     306      if (mos < 0) continue;
     307
     308      if (mosaicUsed[mos]) continue;
     309
     310      mosaicUsed[mos] = TRUE;
     311      addMosaic[Nadd] = mos;
     312      Nadd ++;
     313     
     314      CHECK_REALLOCATE (addMosaic, off_t, NADD, Nadd, 100);
     315    }
     316
     317    REALLOCATE (host->image, Image, host->Nimage + Nadd);
     318
     319    for (j = 0; j < Nadd; j++) {
     320      off_t mos = addMosaic[j];
     321      off_t mos_im = mosaic[mos].myImage;
     322
     323      host->image[host->Nimage + j] = image[mos_im];
     324    }
     325   
     326    host->Nimage += Nadd;
     327  }
     328  return TRUE;
     329}
     330
  • trunk/Ohana/src/relastro/src/StarMaps.c

    r35105 r36630  
    5959  off_t i, N, Nimages;
    6060  int xbin, ybin;
    61   struct timeval start, stop;
    6261
    63   gettimeofday (&start, (void *) NULL);
     62  INITTIME;
    6463
    6564  // Images *images = getimages(&Nimages, NULL); return value ignored
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r36482 r36630  
    11# include "relastro.h"
    22
    3 static off_t   Nmax;
     3static off_t Nmax;
    44static double *X, *dX;
    55static double *Y, *dY;
     
    3636  ALLOCATE (pX, double, MAX (1, Nmax));
    3737  ALLOCATE (pY, double, MAX (1, Nmax));
     38
     39
     40void freeObjectData () {
     41
     42  free (R);
     43  free (D);
     44  free (T);
     45  free (X);
     46  free (Y);
     47
     48  free (dR);
     49  free (dD);
     50  free (dT);
     51  free (dX);
     52  free (dY);
     53
     54  free (pX);
     55  free (pY);
    3856
    3957
     
    205223      if (((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) && (N <= PM_TOOFEW)) mode = FIT_AVERAGE;
    206224
    207       if (FIT_TARGET == TARGET_HIGH_SPEED) {
     225      if (RELASTRO_OP == OP_HIGH_SPEED) {
    208226          Tmean = 0.5*(Tmax - Tmin);
    209227      } else {
     
    412430  }
    413431
     432  freeObjectData ();
     433
    414434  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);
    415435  return (TRUE);
  • trunk/Ohana/src/relastro/src/args.c

    r35763 r36630  
    1313  /* possible operations */
    1414  FIT_TARGET = TARGET_NONE;
     15  RELASTRO_OP = OP_NONE;
    1516  FIT_MODE = FIT_AVERAGE;
    1617
     
    2122    if (N > argc - 6) usage_merge_source();
    2223    if (strcmp(argv[N+3], "into")) usage_merge_source();
    23     FIT_TARGET = TARGET_MERGE_SOURCE;
     24    RELASTRO_OP = OP_MERGE_SOURCE;
    2425    remove_argument (N, &argc, argv);
    2526    OBJ_ID_SRC = strtol(argv[N], &endptr, 0);
     
    4344  if ((N = get_argument (argc, argv, "-update-objects"))) {
    4445    remove_argument (N, &argc, argv);
    45     FIT_TARGET = TARGET_UPDATE_OBJECTS;
     46    RELASTRO_OP = OP_UPDATE_OBJECTS;
    4647  }
    4748
    4849  if ((N = get_argument (argc, argv, "-update-offsets"))) {
    4950    remove_argument (N, &argc, argv);
    50     FIT_TARGET = TARGET_UPDATE_OFFSETS;
     51    RELASTRO_OP = OP_UPDATE_OFFSETS;
     52  }
     53
     54  // elements needed for parallel regions / parallel images
     55  REGION_FILE = NULL;
     56  if ((N = get_argument (argc, argv, "-region-hosts"))) {
     57    remove_argument (N, &argc, argv);
     58    REGION_FILE = strcreate (argv[N]);
     59    remove_argument (N, &argc, argv);
     60  }
     61
     62  REGION_HOST_ID = 0;
     63  if ((N = get_argument (argc, argv, "-region-hostID"))) {
     64    remove_argument (N, &argc, argv);
     65    REGION_HOST_ID = atoi (argv[N]);
     66    remove_argument (N, &argc, argv);
     67  }
     68
     69  IMAGE_TABLE = NULL;
     70  if ((N = get_argument (argc, argv, "-parallel-images"))) {
     71    remove_argument (N, &argc, argv);
     72    RELASTRO_OP = OP_PARALLEL_IMAGES;
     73    if (N >= argc) usage();
     74    IMAGE_TABLE = strcreate (argv[N]);
     75    remove_argument (N, &argc, argv);
     76    if (!REGION_FILE) usage();
     77  }
     78
     79  if ((N = get_argument (argc, argv, "-images"))) {
     80    remove_argument (N, &argc, argv);
     81    RELASTRO_OP = OP_IMAGES;
     82  }
     83
     84  PARALLEL_REGIONS_MANUAL = FALSE;
     85  if ((N = get_argument (argc, argv, "-parallel-regions"))) {
     86    remove_argument (N, &argc, argv);
     87    RELASTRO_OP = OP_PARALLEL_REGIONS;
     88    if (!REGION_FILE) usage();
     89    if ((N = get_argument (argc, argv, "-parallel-regions-manual"))) {
     90      remove_argument (N, &argc, argv);
     91      PARALLEL_REGIONS_MANUAL = TRUE;
     92    }
    5193  }
    5294
     
    90132    // XXX include a parallax / no-parallax option
    91133    if (N >= argc - 4) usage();
    92     FIT_TARGET = TARGET_HIGH_SPEED;
     134    RELASTRO_OP = OP_HIGH_SPEED;
    93135    remove_argument (N, &argc, argv);
    94136    PHOTCODE_A_LIST = strcreate(argv[N]);
     
    104146  if ((N = get_argument (argc, argv, "-hpm"))) {
    105147    if (N >= argc - 2) usage();
    106     FIT_TARGET = TARGET_HPM;
     148    RELASTRO_OP = OP_HPM;
    107149    remove_argument (N, &argc, argv);
    108150    RADIUS = atof(argv[N]);
     
    116158    remove_argument (N, &argc, argv);
    117159    PARALLEL_OUTPUT = TRUE;
    118     if ((FIT_TARGET != TARGET_HIGH_SPEED) && (FIT_TARGET != TARGET_HPM)) {
     160    if ((RELASTRO_OP != OP_HIGH_SPEED) && (RELASTRO_OP != OP_HPM)) {
    119161      fprintf (stderr, "-parallel-output only valid for -high-speed or -hpm modes\n");
    120162      exit (1);
     
    143185  }
    144186
    145   if (FIT_TARGET == TARGET_NONE) usage();
     187  if (RELASTRO_OP == OP_NONE) usage();
     188
     189  if (((RELASTRO_OP == OP_IMAGES) || (RELASTRO_OP == OP_PARALLEL_REGIONS) || (RELASTRO_OP == OP_PARALLEL_IMAGES)) && (FIT_TARGET == TARGET_NONE)) usage();
    146190
    147191  /* specify portion of the sky : allow default of all sky? */
     
    427471
    428472  /* possible operations */
    429   FIT_TARGET = TARGET_NONE;
     473  RELASTRO_OP = TARGET_NONE;
    430474  FIT_MODE = FIT_AVERAGE;
    431475
     
    437481  BCATALOG = NULL;
    438482
     483  REGION_FILE = NULL;
     484  REGION_HOST_ID = 0;
     485  IMAGE_TABLE = NULL;
     486  PARALLEL_REGIONS_MANUAL = FALSE;
     487
    439488  HOST_ID = 0;
    440489  if ((N = get_argument (argc, argv, "-hostID"))) {
     
    457506    BCATALOG = strcreate(argv[N]);
    458507    remove_argument (N, &argc, argv);
    459     FIT_TARGET = TARGET_LOAD_OBJECTS;
     508    RELASTRO_OP = OP_LOAD_OBJECTS;
    460509  }
    461510
    462511  if ((N = get_argument (argc, argv, "-update-objects"))) {
    463512    remove_argument (N, &argc, argv);
    464     FIT_TARGET = TARGET_UPDATE_OBJECTS;
     513    RELASTRO_OP = OP_UPDATE_OBJECTS;
    465514  }
    466515
    467516  if ((N = get_argument (argc, argv, "-update-offsets"))) {
    468517    remove_argument (N, &argc, argv);
    469     FIT_TARGET = TARGET_UPDATE_OFFSETS;
     518    RELASTRO_OP = OP_UPDATE_OFFSETS;
    470519  }
    471520
     
    487536    // XXX include a parallax / no-parallax option
    488537    if (N >= argc - 5) usage_client();
    489     FIT_TARGET = TARGET_HIGH_SPEED;
     538    RELASTRO_OP = OP_HIGH_SPEED;
    490539    remove_argument (N, &argc, argv);
    491540    PHOTCODE_A_LIST = strcreate(argv[N]);
     
    501550  if ((N = get_argument (argc, argv, "-hpm"))) {
    502551    if (N >= argc - 3) usage();
    503     FIT_TARGET = TARGET_HPM;
     552    RELASTRO_OP = OP_HPM;
    504553    remove_argument (N, &argc, argv);
    505554    RADIUS = atof(argv[N]);
     
    539588  }
    540589
    541   if (FIT_TARGET == TARGET_NONE) usage_client();
     590  if (RELASTRO_OP == OP_NONE) usage_client();
    542591
    543592  /* specify portion of the sky : allow default of all sky? */
     
    718767
    719768void usage () {
    720   fprintf (stderr, "ERROR: USAGE: relastro -update-simple [options]\n");
    721   fprintf (stderr, "       OR:    relastro -update-chips [options]\n");
    722   fprintf (stderr, "       OR:    relastro -update-mosaic [options]\n");
     769  fprintf (stderr, "ERROR: USAGE: relastro -images -update-simple [options]\n");
     770  fprintf (stderr, "       OR:    relastro -images -update-chips [options]\n");
     771  fprintf (stderr, "       OR:    relastro -images -update-mosaic [options]\n");
     772  fprintf (stderr, "       OR:    relastro -parallel-regions -update-simple [options]\n");
     773  fprintf (stderr, "       OR:    relastro -parallel-regions -update-chips [options]\n");
     774  fprintf (stderr, "       OR:    relastro -parallel-regions -update-mosaic [options]\n");
     775  fprintf (stderr, "       OR:    relastro -parallel-images -update-simple [options]\n");
     776  fprintf (stderr, "       OR:    relastro -parallel-images -update-chips [options]\n");
     777  fprintf (stderr, "       OR:    relastro -parallel-images -update-mosaic [options]\n");
    723778  fprintf (stderr, "       OR:    relastro -update-objects [options]\n");
    724779  fprintf (stderr, "       OR:    relastro -high-speed [options]\n");
  • trunk/Ohana/src/relastro/src/initialize.c

    r34429 r36630  
    66  args (argc, argv);
    77
    8   if (FIT_TARGET == TARGET_MERGE_SOURCE) return;
     8  if (RELASTRO_OP == OP_MERGE_SOURCE) return;
    99
    1010  fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST);
  • trunk/Ohana/src/relastro/src/load_catalogs.c

    r35105 r36630  
    115115Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog) {
    116116
     117  char uniquer[12];
     118  int TIME = time(NULL);
     119  int PID = getpid();
     120  snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000);
     121
    117122  // load the list of hosts
    118123  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     
    131136
    132137    ALLOCATE (table->hosts[i].results, char, 1024);
    133     snprintf (table->hosts[i].results, 1024, "%s/relastro.catalog.subset.dat", table->hosts[i].pathname);
     138    snprintf (table->hosts[i].results, 1024, "%s/relastro.catalog.%s.dat", table->hosts[i].pathname, uniquer);
    134139
    135140    // options / arguments that can affect relastro_client -load:
  • trunk/Ohana/src/relastro/src/load_images.c

    r35763 r36630  
    11# include "relastro.h"
    2 
    3 # define MARKTIME(MSG,...) { \
    4   float dtime; \
    5   gettimeofday (&stop, (void *) NULL); \
    6   dtime = DTIME (stop, start); \
    7   fprintf (stderr, MSG, __VA_ARGS__); }
    82
    93int load_images (FITS_DB *db, SkyList *skylist, int UseFullOverlap) {
     
    126  off_t      Nimage, Nsubset;
    137  off_t     *LineNumber;
    14   struct timeval start, stop;
    158
    16   gettimeofday (&start, (void *) NULL);
     9  INITTIME;
    1710
    1811  // convert database table to internal structure
     
    3528 
    3629  /* unlock, if we can (else, unlocked below) */
    37   int unlockImages = !UPDATE || (FIT_TARGET == TARGET_UPDATE_OFFSETS);
     30  int unlockImages = !UPDATE || (RELASTRO_OP == OP_UPDATE_OFFSETS);
    3831  if (unlockImages) dvo_image_unlock (db);
    3932
  • trunk/Ohana/src/relastro/src/relastro.c

    r35763 r36630  
    1010  SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch);
    1111
    12   switch (FIT_TARGET) {
    13     case TARGET_UPDATE_OBJECTS:
     12  switch (RELASTRO_OP) {
     13    case OP_UPDATE_OBJECTS:
    1414      /* the object analysis is a separate process iterating over catalogs */
    1515      relastro_objects (skylist, 0, NULL);
    1616      exit (0);
    1717
    18     case TARGET_HIGH_SPEED:
     18    case OP_HIGH_SPEED:
    1919      /* high-speed is a 2pt cross-correlation process for linking moving objects (high PM) */
    2020      high_speed_catalogs (sky, skylist, 0, NULL);
    2121      exit (0);
    2222
    23     case TARGET_HPM:
     23    case OP_HPM:
    2424      hpm_catalogs (sky, skylist, 0, NULL);
    2525      exit (0);
    2626
    27     case TARGET_MERGE_SOURCE:
     27    case OP_MERGE_SOURCE:
    2828      /* a special method to manually merge unlinked detections of sources togther (not parallel) */
    2929      relastro_merge_source (sky);
    3030      exit (0);
    3131
    32     case TARGET_SIMPLE:
    33     case TARGET_CHIPS:
    34     case TARGET_MOSAICS:
     32    case OP_IMAGES:
    3533      relastro_images (skylist);
    3634      exit (0);
    3735
    38     case TARGET_UPDATE_OFFSETS:
     36    case OP_UPDATE_OFFSETS:
    3937      // iterate over catalogs to make detection coordinates consistant
    4038      UpdateObjectOffsets (skylist, 0, NULL);
     39      exit (0);
     40
     41    case OP_PARALLEL_REGIONS:
     42      // run image updates in parallel across multiple remote machines
     43      relastro_parallel_regions ();
     44      exit (0);
     45
     46    case OP_PARALLEL_IMAGES:
     47      // operation on the remote machines in the PARALLEL_REGION mode
     48      relastro_parallel_images ();
    4149      exit (0);
    4250
  • trunk/Ohana/src/relastro/src/relastro_client.c

    r35763 r36630  
    2828  SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch);
    2929
    30   switch (FIT_TARGET) {
     30  switch (RELASTRO_OP) {
    3131
    32     case TARGET_LOAD_OBJECTS: {
     32    case OP_LOAD_OBJECTS: {
    3333      // USAGE: relastro_client -load-objects
    3434      int Ncatalog;
    3535      Catalog *catalog = load_catalogs (skylist, &Ncatalog, TRUE, HOST_ID, HOSTDIR);
    3636      if (!catalog) {
    37           fprintf (stderr, "ERROR loading catalogs from %s\n", CATDIR);
    38           exit (2);
     37        fprintf (stderr, "ERROR loading catalogs from %s\n", CATDIR);
     38        exit (2);
    3939      }
    4040      BrightCatalog *bcatalog = BrightCatalogMerge (catalog, Ncatalog);
    4141      if (!BrightCatalogSave (BCATALOG, bcatalog)) {
    42           fprintf (stderr, "ERROR saving bright catalog from %s\n", CATDIR);
    43           exit (2);
     42        fprintf (stderr, "ERROR saving bright catalog from %s\n", CATDIR);
     43        exit (2);
    4444      }
    4545      break;
    4646    }
    4747     
    48     case TARGET_UPDATE_OBJECTS: {
     48    case OP_UPDATE_OBJECTS: {
    4949      // USAGE: relastro_client -update-objects
    5050      relastro_objects (skylist, HOST_ID, HOSTDIR);
     
    5252    }
    5353
    54     case TARGET_HIGH_SPEED: {
     54    case OP_HIGH_SPEED: {
    5555      // USAGE: relastro_client -high-speed
    5656      high_speed_catalogs (sky, skylist, HOST_ID, HOSTDIR);
     
    5858    }
    5959
    60     case TARGET_HPM: {
     60    case OP_HPM: {
    6161      // USAGE: relastro_client -high-speed
    6262      hpm_catalogs (sky, skylist, HOST_ID, HOSTDIR);
     
    6464    }
    6565
    66       // XXX loading the images is fairly costly -- see if we can do an image subset
    67     case TARGET_UPDATE_OFFSETS: {
     66      // XXX loading the images is fairly costly -- see if we can do an image subset?
     67    case OP_UPDATE_OFFSETS: {
    6868      FITS_DB db;
    6969     
  • trunk/Ohana/src/relastro/src/relastro_images.c

    r35763 r36630  
    66  Catalog *catalog;
    77  FITS_DB db;
    8   struct timeval start, stop;
    98
    10   gettimeofday (&start, (void *) NULL);
     9  INITTIME;
    1110
    1211  /* register database handle with shutdown procedure */
  • trunk/Ohana/src/relastro/src/relastro_objects.c

    r35763 r36630  
    144144    // PM_TOOFEW
    145145    // SRC_MEAS_TOOFEW
    146     // FIT_TARGET
    147146
    148147    char command[1024];
  • trunk/Ohana/src/relastro/src/resort_catalog.c

    r34088 r36630  
    3030  if (catalog[0].sorted == TRUE) return;
    3131
    32   // struct timeval start, stop;
    33   // gettimeofday (&start, NULL);
     32  // INITTIME;
    3433
    3534  /* internal counters */
  • trunk/Ohana/src/relastro/src/select_images.c

    r36482 r36630  
    1515void dsortindex (double *X, off_t *Y, int N);
    1616off_t getRegionStartByRA (double R, double *Rref, off_t Nregions);
    17 
    18 # define MARKTIME(MSG,...) { \
    19   float dtime; \
    20   gettimeofday (&stop, (void *) NULL); \
    21   dtime = DTIME (stop, start); \
    22   fprintf (stderr, MSG, __VA_ARGS__); }
    2317
    2418Image *select_images (SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage, int UseFullOverlap) {
     
    3125  Coords tcoords;
    3226  SkyRegionCoords *skycoords;
    33   struct timeval start, stop;
    3427 
    3528  double RmaxSkyRegion, RminSkyRegion, RmidSkyRegion, DminSkyRegion, DmaxSkyRegion;
     
    5043  }
    5144
    52   gettimeofday (&start, (void *) NULL);
     45  INITTIME;
    5346
    5447  // the comparison is made in the catalog local projection. below we set crval1,2
     
    132125    if (NphotcodesKeep > 0) {
    133126      found = FALSE;
    134       // XXX this bit of code excludes DIS mosaics and should be fixed
     127      // we have to keep DIS mosaics explicitly (photcode = 0)
     128      if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) found = TRUE;
    135129      for (k = 0; (k < NphotcodesKeep) && !found; k++) {
    136130        if (photcodesKeep[k][0].code == timage[i].photcode) found = TRUE;
Note: See TracChangeset for help on using the changeset viewer.