Changeset 36630 for trunk/Ohana/src/relastro
- Timestamp:
- Apr 1, 2014, 12:03:17 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
- 12 copied
-
. (modified) (1 prop)
-
Ohana/src/relastro/Makefile (modified) (1 diff)
-
Ohana/src/relastro/include/relastro.h (modified) (8 diffs)
-
Ohana/src/relastro/src/ConfigInit.c (modified) (3 diffs)
-
Ohana/src/relastro/src/ImageOps.c (modified) (2 diffs)
-
Ohana/src/relastro/src/ImagePosIO.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/ImagePosIO.c )
-
Ohana/src/relastro/src/ImageTable.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/ImageTable.c )
-
Ohana/src/relastro/src/MeanPosIO.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/MeanPosIO.c )
-
Ohana/src/relastro/src/MosaicOps.c (modified) (8 diffs)
-
Ohana/src/relastro/src/StarMaps.c (modified) (1 diff)
-
Ohana/src/relastro/src/UpdateObjects.c (modified) (4 diffs)
-
Ohana/src/relastro/src/args.c (modified) (14 diffs)
-
Ohana/src/relastro/src/assign_images.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/assign_images.c )
-
Ohana/src/relastro/src/indexCatalogs.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/indexCatalogs.c )
-
Ohana/src/relastro/src/initialize.c (modified) (1 diff)
-
Ohana/src/relastro/src/launch_region_hosts.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/launch_region_hosts.c )
-
Ohana/src/relastro/src/load_catalogs.c (modified) (2 diffs)
-
Ohana/src/relastro/src/load_images.c (modified) (3 diffs)
-
Ohana/src/relastro/src/markObjects.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/markObjects.c )
-
Ohana/src/relastro/src/relastro.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastro_client.c (modified) (4 diffs)
-
Ohana/src/relastro/src/relastro_images.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastro_objects.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastro_parallel_images.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/relastro_parallel_images.c )
-
Ohana/src/relastro/src/relastro_parallel_regions.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/relastro_parallel_regions.c )
-
Ohana/src/relastro/src/resort_catalog.c (modified) (1 diff)
-
Ohana/src/relastro/src/select_images.c (modified) (4 diffs)
-
Ohana/src/relastro/src/share_images_pos.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_images_pos.c )
-
Ohana/src/relastro/src/share_mean_pos.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_mean_pos.c )
-
Ohana/src/relastro/src/syncfile.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/syncfile.c )
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
trunk/Ohana/src/relastro/Makefile
r35416 r36630 69 69 $(SRC)/resort_catalog.$(ARCH).o \ 70 70 $(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 \ 71 83 $(SRC)/relastroVisual.$(ARCH).o 72 84 -
trunk/Ohana/src/relastro/include/relastro.h
r35763 r36630 6 6 # include <pthread.h> 7 7 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 8 17 // choose off_t or int depending on full-scale relphot analysis resources 9 18 // # define IDX_T off_t … … 20 29 typedef enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_PAR_ONLY, FIT_PM_AND_PAR} FitMode; 21 30 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; 31 typedef 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 33 typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS} FitTarget; 23 34 24 35 typedef enum { … … 30 41 MARK_BIG_OFFSET = 0x0010, 31 42 } MeasurementMask; 43 44 typedef struct { 45 float R; 46 float D; 47 unsigned int objID; 48 unsigned int catID; 49 } MeanPos; 50 51 typedef struct { 52 Coords coords; 53 float dXpixSys; 54 float dYpixSys; 55 unsigned int imageID; 56 int nFitAstrom; 57 int flags; 58 } ImagePos; 32 59 33 60 typedef struct { … … 93 120 unsigned int start; 94 121 unsigned int stop; 122 off_t myImage; 95 123 float Mcal; 96 124 float dMcal; … … 113 141 } StatType; 114 142 115 # define MARKTIME(MSG,...) { \116 float dtime; \117 gettimeofday (&stop, (void *) NULL); \118 dtime = DTIME (stop, start); \119 fprintf (stderr, MSG, __VA_ARGS__); }120 121 143 /* global variables set in parameter file */ 122 144 # define DVO_MAX_PATH 1024 … … 129 151 char SKY_TABLE[DVO_MAX_PATH]; 130 152 int SKY_DEPTH; /** XXX EAM : depth of catalog tables, fix usage */ 153 154 // globals for parallel region operations 155 char *REGION_FILE; 156 char *IMAGE_TABLE; 157 int REGION_HOST_ID; 158 int PARALLEL_REGIONS_MANUAL; 131 159 132 160 int HOST_ID; … … 208 236 FitMode FIT_MODE; 209 237 238 RelastroOp RELASTRO_OP; 210 239 FitTarget FIT_TARGET; 211 240 … … 450 479 int hpm_catalogs_parallel (SkyList *skylist); 451 480 int hpm_objects (SkyRegion *region, Catalog *catalog); 481 482 int strextend (char *input, char *format,...); 483 int launch_region_hosts (RegionHostTable *regionHosts); 484 485 int assign_images (FITS_DB *db, RegionHostTable *regionHosts); 486 int select_images_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage); 487 int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax, double Rmid); 488 int calculate_host_image_bounds (RegionHostTable *regionHosts); 489 int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc); 490 491 int relastro_parallel_regions (); 492 int relastro_parallel_images (); 493 494 char *make_filename (char *dirname, char *hostname, int hostID, char *tailname); 495 int check_sync_file (char *filename, int nloop); 496 int clear_sync_file (char *filename); 497 int update_sync_file (char *filename, int nloop); 498 499 int share_mean_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 500 int slurp_mean_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 501 int set_mean_pos (MeanPos *meanpos, Average *average); 502 MeanPos *merge_mean_pos (MeanPos *target, int *ntarget, MeanPos *source, int Nsource); 503 504 int MeanPosSave(char *filename, MeanPos *meanpos, off_t Nmeanpos); 505 MeanPos *MeanPosLoad(char *filename, off_t *nmeanpos); 506 507 int indexCatalogs (Catalog *catalog, int Ncatalog); 508 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq); 509 510 int markObjects (Catalog *catalog, int Ncatalog); 511 512 int ImagePosSave(char *filename, ImagePos *image_pos, off_t Nimage_pos); 513 ImagePos *ImagePosLoad(char *filename, off_t *nimage_pos); 514 515 int share_image_pos (RegionHostTable *regionHosts, int nloop); 516 int slurp_image_pos (RegionHostTable *regionHosts, int nloop); 517 ImagePos *merge_image_pos (ImagePos *target, int *ntarget, ImagePos *source, int Nsource); 518 int set_image_pos (ImagePos *image_pos, Image *image); 519 520 Image *ImageTableLoad(char *filename, off_t *nimage); 521 int ImageTableSave (char *filename, Image *images, off_t Nimages); 522 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage); -
trunk/Ohana/src/relastro/src/ConfigInit.c
r35105 r36630 18 18 if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file); 19 19 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; 22 23 23 24 if (!ScanConfig (config, "RELASTRO_IMFIT_CLIP_NITER", "%d", 0, &IMFIT_CLIP_NITER)) IMFIT_CLIP_NITER = 3; … … 25 26 if (!ScanConfig (config, "RELASTRO_IMFIT_SYS_SIGMA_LIM", "%lf", 0, &IMFIT_SYS_SIGMA_LIM)) IMFIT_SYS_SIGMA_LIM = 0.01; 26 27 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; 30 36 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; 41 38 42 39 // force CATDIR to be absolute (so parallel mode will work) … … 56 53 sprintf (ImageCat, "%s/Images.dat", CATDIR); 57 54 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; 64 57 65 58 if (*CATMODE == 0) strcpy (CATMODE, "RAW"); -
trunk/Ohana/src/relastro/src/ImageOps.c
r35763 r36630 226 226 Measure *measureBig = &catalog[cat].measure[meas]; 227 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);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); 230 230 if (TESTPT) { 231 231 fprintf (stderr, "got test det\n"); … … 462 462 int TESTPT = FALSE; 463 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);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); 466 466 if (TESTPT) { 467 467 fprintf (stderr, "got test det\n"); -
trunk/Ohana/src/relastro/src/MosaicOps.c
r27581 r36630 11 11 12 12 // list of mosaic associated with each image 13 static off_t Nmosaic_for_images; // number of images (for off_ternal checks)13 static off_t Nmosaic_for_images; // number of images (for internal checks) 14 14 static off_t *mosaic_for_images; // array of: image -> mosaic 15 15 … … 105 105 mosaic[Nmosaic].secz = image[i].secz; 106 106 mosaic[Nmosaic].coords = image[i].coords; 107 mosaic[Nmosaic].myImage = i; 107 108 108 109 // init the mosaic_own_images array data … … 135 136 ALLOCATE (mosaic_for_images, off_t, Nmosaic_for_images); 136 137 138 // emit an error if we miss mosaics, but stop if we miss too many 139 int NmissMosaic = 0; 140 int NtestMosaic = 0; 141 137 142 /* now assign the WRP images to these mosaics */ 138 143 for (i = 0; i < Nimage; i++) { … … 140 145 141 146 if (strcmp(&image[i].coords.ctype[4], "-WRP")) continue; 147 NtestMosaic ++; 142 148 143 149 /* set image time range */ … … 147 153 Nmos = getMosaicByTimes (start, stop, startMos, stopMos, indexMos); 148 154 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 ++; 150 159 continue; 151 160 } … … 164 173 } 165 174 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 166 181 free (startMos); 167 182 free (stopMos); … … 250 265 if (im >= Nmosaic_for_images) abort(); 251 266 252 // search for the mosaic that 267 // search for the mosaic that matches this image 253 268 mos = mosaic_for_images[im]; 254 269 if (mos < 0) return NULL; … … 256 271 return &mosaic[mos]; 257 272 } 273 274 // extend each host image table to include the mosaic 'images' needed by the host 275 int 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 = ®ionHosts->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 59 59 off_t i, N, Nimages; 60 60 int xbin, ybin; 61 struct timeval start, stop;62 61 63 gettimeofday (&start, (void *) NULL);62 INITTIME; 64 63 65 64 // Images *images = getimages(&Nimages, NULL); return value ignored -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r36482 r36630 1 1 # include "relastro.h" 2 2 3 static off_t Nmax;3 static off_t Nmax; 4 4 static double *X, *dX; 5 5 static double *Y, *dY; … … 36 36 ALLOCATE (pX, double, MAX (1, Nmax)); 37 37 ALLOCATE (pY, double, MAX (1, Nmax)); 38 } 39 40 void 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); 38 56 } 39 57 … … 205 223 if (((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) && (N <= PM_TOOFEW)) mode = FIT_AVERAGE; 206 224 207 if ( FIT_TARGET == TARGET_HIGH_SPEED) {225 if (RELASTRO_OP == OP_HIGH_SPEED) { 208 226 Tmean = 0.5*(Tmax - Tmin); 209 227 } else { … … 412 430 } 413 431 432 freeObjectData (); 433 414 434 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); 415 435 return (TRUE); -
trunk/Ohana/src/relastro/src/args.c
r35763 r36630 13 13 /* possible operations */ 14 14 FIT_TARGET = TARGET_NONE; 15 RELASTRO_OP = OP_NONE; 15 16 FIT_MODE = FIT_AVERAGE; 16 17 … … 21 22 if (N > argc - 6) usage_merge_source(); 22 23 if (strcmp(argv[N+3], "into")) usage_merge_source(); 23 FIT_TARGET = TARGET_MERGE_SOURCE;24 RELASTRO_OP = OP_MERGE_SOURCE; 24 25 remove_argument (N, &argc, argv); 25 26 OBJ_ID_SRC = strtol(argv[N], &endptr, 0); … … 43 44 if ((N = get_argument (argc, argv, "-update-objects"))) { 44 45 remove_argument (N, &argc, argv); 45 FIT_TARGET = TARGET_UPDATE_OBJECTS;46 RELASTRO_OP = OP_UPDATE_OBJECTS; 46 47 } 47 48 48 49 if ((N = get_argument (argc, argv, "-update-offsets"))) { 49 50 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 } 51 93 } 52 94 … … 90 132 // XXX include a parallax / no-parallax option 91 133 if (N >= argc - 4) usage(); 92 FIT_TARGET = TARGET_HIGH_SPEED;134 RELASTRO_OP = OP_HIGH_SPEED; 93 135 remove_argument (N, &argc, argv); 94 136 PHOTCODE_A_LIST = strcreate(argv[N]); … … 104 146 if ((N = get_argument (argc, argv, "-hpm"))) { 105 147 if (N >= argc - 2) usage(); 106 FIT_TARGET = TARGET_HPM;148 RELASTRO_OP = OP_HPM; 107 149 remove_argument (N, &argc, argv); 108 150 RADIUS = atof(argv[N]); … … 116 158 remove_argument (N, &argc, argv); 117 159 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)) { 119 161 fprintf (stderr, "-parallel-output only valid for -high-speed or -hpm modes\n"); 120 162 exit (1); … … 143 185 } 144 186 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(); 146 190 147 191 /* specify portion of the sky : allow default of all sky? */ … … 427 471 428 472 /* possible operations */ 429 FIT_TARGET= TARGET_NONE;473 RELASTRO_OP = TARGET_NONE; 430 474 FIT_MODE = FIT_AVERAGE; 431 475 … … 437 481 BCATALOG = NULL; 438 482 483 REGION_FILE = NULL; 484 REGION_HOST_ID = 0; 485 IMAGE_TABLE = NULL; 486 PARALLEL_REGIONS_MANUAL = FALSE; 487 439 488 HOST_ID = 0; 440 489 if ((N = get_argument (argc, argv, "-hostID"))) { … … 457 506 BCATALOG = strcreate(argv[N]); 458 507 remove_argument (N, &argc, argv); 459 FIT_TARGET = TARGET_LOAD_OBJECTS;508 RELASTRO_OP = OP_LOAD_OBJECTS; 460 509 } 461 510 462 511 if ((N = get_argument (argc, argv, "-update-objects"))) { 463 512 remove_argument (N, &argc, argv); 464 FIT_TARGET = TARGET_UPDATE_OBJECTS;513 RELASTRO_OP = OP_UPDATE_OBJECTS; 465 514 } 466 515 467 516 if ((N = get_argument (argc, argv, "-update-offsets"))) { 468 517 remove_argument (N, &argc, argv); 469 FIT_TARGET = TARGET_UPDATE_OFFSETS;518 RELASTRO_OP = OP_UPDATE_OFFSETS; 470 519 } 471 520 … … 487 536 // XXX include a parallax / no-parallax option 488 537 if (N >= argc - 5) usage_client(); 489 FIT_TARGET = TARGET_HIGH_SPEED;538 RELASTRO_OP = OP_HIGH_SPEED; 490 539 remove_argument (N, &argc, argv); 491 540 PHOTCODE_A_LIST = strcreate(argv[N]); … … 501 550 if ((N = get_argument (argc, argv, "-hpm"))) { 502 551 if (N >= argc - 3) usage(); 503 FIT_TARGET = TARGET_HPM;552 RELASTRO_OP = OP_HPM; 504 553 remove_argument (N, &argc, argv); 505 554 RADIUS = atof(argv[N]); … … 539 588 } 540 589 541 if ( FIT_TARGET == TARGET_NONE) usage_client();590 if (RELASTRO_OP == OP_NONE) usage_client(); 542 591 543 592 /* specify portion of the sky : allow default of all sky? */ … … 718 767 719 768 void 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"); 723 778 fprintf (stderr, " OR: relastro -update-objects [options]\n"); 724 779 fprintf (stderr, " OR: relastro -high-speed [options]\n"); -
trunk/Ohana/src/relastro/src/initialize.c
r34429 r36630 6 6 args (argc, argv); 7 7 8 if ( FIT_TARGET == TARGET_MERGE_SOURCE) return;8 if (RELASTRO_OP == OP_MERGE_SOURCE) return; 9 9 10 10 fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); -
trunk/Ohana/src/relastro/src/load_catalogs.c
r35105 r36630 115 115 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog) { 116 116 117 char uniquer[12]; 118 int TIME = time(NULL); 119 int PID = getpid(); 120 snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000); 121 117 122 // load the list of hosts 118 123 HostTable *table = HostTableLoad (CATDIR, sky->hosts); … … 131 136 132 137 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); 134 139 135 140 // options / arguments that can affect relastro_client -load: -
trunk/Ohana/src/relastro/src/load_images.c
r35763 r36630 1 1 # 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__); }8 2 9 3 int load_images (FITS_DB *db, SkyList *skylist, int UseFullOverlap) { … … 12 6 off_t Nimage, Nsubset; 13 7 off_t *LineNumber; 14 struct timeval start, stop;15 8 16 gettimeofday (&start, (void *) NULL);9 INITTIME; 17 10 18 11 // convert database table to internal structure … … 35 28 36 29 /* 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); 38 31 if (unlockImages) dvo_image_unlock (db); 39 32 -
trunk/Ohana/src/relastro/src/relastro.c
r35763 r36630 10 10 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 11 11 12 switch ( FIT_TARGET) {13 case TARGET_UPDATE_OBJECTS:12 switch (RELASTRO_OP) { 13 case OP_UPDATE_OBJECTS: 14 14 /* the object analysis is a separate process iterating over catalogs */ 15 15 relastro_objects (skylist, 0, NULL); 16 16 exit (0); 17 17 18 case TARGET_HIGH_SPEED:18 case OP_HIGH_SPEED: 19 19 /* high-speed is a 2pt cross-correlation process for linking moving objects (high PM) */ 20 20 high_speed_catalogs (sky, skylist, 0, NULL); 21 21 exit (0); 22 22 23 case TARGET_HPM:23 case OP_HPM: 24 24 hpm_catalogs (sky, skylist, 0, NULL); 25 25 exit (0); 26 26 27 case TARGET_MERGE_SOURCE:27 case OP_MERGE_SOURCE: 28 28 /* a special method to manually merge unlinked detections of sources togther (not parallel) */ 29 29 relastro_merge_source (sky); 30 30 exit (0); 31 31 32 case TARGET_SIMPLE: 33 case TARGET_CHIPS: 34 case TARGET_MOSAICS: 32 case OP_IMAGES: 35 33 relastro_images (skylist); 36 34 exit (0); 37 35 38 case TARGET_UPDATE_OFFSETS:36 case OP_UPDATE_OFFSETS: 39 37 // iterate over catalogs to make detection coordinates consistant 40 38 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 (); 41 49 exit (0); 42 50 -
trunk/Ohana/src/relastro/src/relastro_client.c
r35763 r36630 28 28 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 29 29 30 switch ( FIT_TARGET) {30 switch (RELASTRO_OP) { 31 31 32 case TARGET_LOAD_OBJECTS: {32 case OP_LOAD_OBJECTS: { 33 33 // USAGE: relastro_client -load-objects 34 34 int Ncatalog; 35 35 Catalog *catalog = load_catalogs (skylist, &Ncatalog, TRUE, HOST_ID, HOSTDIR); 36 36 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); 39 39 } 40 40 BrightCatalog *bcatalog = BrightCatalogMerge (catalog, Ncatalog); 41 41 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); 44 44 } 45 45 break; 46 46 } 47 47 48 case TARGET_UPDATE_OBJECTS: {48 case OP_UPDATE_OBJECTS: { 49 49 // USAGE: relastro_client -update-objects 50 50 relastro_objects (skylist, HOST_ID, HOSTDIR); … … 52 52 } 53 53 54 case TARGET_HIGH_SPEED: {54 case OP_HIGH_SPEED: { 55 55 // USAGE: relastro_client -high-speed 56 56 high_speed_catalogs (sky, skylist, HOST_ID, HOSTDIR); … … 58 58 } 59 59 60 case TARGET_HPM: {60 case OP_HPM: { 61 61 // USAGE: relastro_client -high-speed 62 62 hpm_catalogs (sky, skylist, HOST_ID, HOSTDIR); … … 64 64 } 65 65 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: { 68 68 FITS_DB db; 69 69 -
trunk/Ohana/src/relastro/src/relastro_images.c
r35763 r36630 6 6 Catalog *catalog; 7 7 FITS_DB db; 8 struct timeval start, stop;9 8 10 gettimeofday (&start, (void *) NULL);9 INITTIME; 11 10 12 11 /* register database handle with shutdown procedure */ -
trunk/Ohana/src/relastro/src/relastro_objects.c
r35763 r36630 144 144 // PM_TOOFEW 145 145 // SRC_MEAS_TOOFEW 146 // FIT_TARGET147 146 148 147 char command[1024]; -
trunk/Ohana/src/relastro/src/resort_catalog.c
r34088 r36630 30 30 if (catalog[0].sorted == TRUE) return; 31 31 32 // struct timeval start, stop; 33 // gettimeofday (&start, NULL); 32 // INITTIME; 34 33 35 34 /* internal counters */ -
trunk/Ohana/src/relastro/src/select_images.c
r36482 r36630 15 15 void dsortindex (double *X, off_t *Y, int N); 16 16 off_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__); }23 17 24 18 Image *select_images (SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage, int UseFullOverlap) { … … 31 25 Coords tcoords; 32 26 SkyRegionCoords *skycoords; 33 struct timeval start, stop;34 27 35 28 double RmaxSkyRegion, RminSkyRegion, RmidSkyRegion, DminSkyRegion, DmaxSkyRegion; … … 50 43 } 51 44 52 gettimeofday (&start, (void *) NULL);45 INITTIME; 53 46 54 47 // the comparison is made in the catalog local projection. below we set crval1,2 … … 132 125 if (NphotcodesKeep > 0) { 133 126 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; 135 129 for (k = 0; (k < NphotcodesKeep) && !found; k++) { 136 130 if (photcodesKeep[k][0].code == timage[i].photcode) found = TRUE;
Note:
See TracChangeset
for help on using the changeset viewer.
