IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39481


Ignore:
Timestamp:
Mar 24, 2016, 10:03:04 AM (10 years ago)
Author:
eugene
Message:

add warp repair option (copied from relastro); free boundary & tessellation tree; free memory; call load_images in relphot_objects; when load_images is called by relphot_objects, free the full image set leaving only the subset; push SkyList load as high as possible

Location:
trunk/Ohana/src/relphot
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relphot/Makefile

    r39478 r39481  
    3232$(SRC)/Shutdown.$(ARCH).o        \
    3333$(SRC)/StarOps.$(ARCH).o         \
     34$(SRC)/WarpImageMaps.$(ARCH).o   \
     35$(SRC)/RepairWarpMeasures.$(ARCH).o      \
     36$(SRC)/myIndex.$(ARCH).o         \
     37$(SRC)/psps_ids.$(ARCH).o        \
    3438$(SRC)/args.$(ARCH).o            \
    3539$(SRC)/help.$(ARCH).o            \
     
    8387$(SRC)/Shutdown.$(ARCH).o        \
    8488$(SRC)/StarOps.$(ARCH).o         \
     89$(SRC)/WarpImageMaps.$(ARCH).o   \
     90$(SRC)/RepairWarpMeasures.$(ARCH).o      \
     91$(SRC)/myIndex.$(ARCH).o         \
     92$(SRC)/psps_ids.$(ARCH).o        \
    8593$(SRC)/bcatalog.$(ARCH).o        \
    8694$(SRC)/args.$(ARCH).o            \
  • trunk/Ohana/src/relphot/include/relphot.h

    r39479 r39481  
    1111# define ID_SECF_STACK_PRIMARY 0x00004000
    1212
     13# ifndef MAX_INT
     14# define MAX_INT 2147483647
     15# endif
     16
    1317// choose off_t or int depending on full-scale relphot analysis resources
    1418// # define IDX_T off_t
    1519# define IDX_T int
     20
     21typedef struct {
     22  int minID;
     23  int maxID;
     24  int *index;
     25  int Nindex;
     26  int NINDEX;
     27} myIndexType;
    1628
    1729typedef enum {
     
    279291int    RESET;
    280292int    RESET_ZEROPTS;
     293int    REPAIR_WARPS;
    281294int    UPDATE;
    282295int    SAVE_IMAGE_UPDATES;
     
    418431Catalog      *load_catalogs_parallel PROTO((SkyList *sky, int *Ncatalog, char *syncfile));
    419432
    420 int           load_images         PROTO((FITS_DB *db, SkyList *skylist, SkyRegion *region));
     433int           load_images         PROTO((FITS_DB *db, SkyList *skylist, SkyRegion *region, int unlockImages));
    421434Image        *select_images       PROTO((SkyList *skylist, Image *timage, off_t Ntimage, char *inSubset, off_t **LineNumber, off_t *Nimage, SkyRegion *region));
    422435
     
    475488void          wimages             PROTO((void));
    476489void          write_coords        PROTO((Header *header, Coords *coords));
    477 int relphot_objects (SkyTable *sky, SkyList *skylist, int hostID, char *hostpath);
     490int relphot_objects (SkyList *skylist, int hostID, char *hostpath);
    478491int relphot_images (SkyList *skylist);
    479492
     
    507520
    508521int load_tess (char *treefile);
     522void free_tess (void);
    509523int get_tess_ids (int *tessID, int *projID, int *skycellID, double ra, double dec);
    510524int TessellationIDsByImageName (int *tessID, int *projID, int *skycellID, char *name);
     
    532546int add_synthetic_mags (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, off_t *Nmeasure, off_t *Nm);
    533547
    534 int relphot_parallel_regions ();
     548int relphot_parallel_regions (SkyTable *sky);
     549int relphot_parallel_images (SkyTable *sky);
    535550
    536551int assign_images (FITS_DB *db, RegionHostTable *regionHosts);
     
    546561int indexCatalogs (Catalog *catalog, int Ncatalog);
    547562int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq);
     563void freeCatalogIndexes (int Ncatalog);
    548564
    549565int check_sync_file (char *filename, int nloop);
     
    569585
    570586int markObjects (Catalog *catalog, int Ncatalog);
    571 
    572 int relphot_parallel_images ();
    573 int relphot_parallel_regions ();
    574587
    575588// in extra.c
     
    587600SynthZeroPoints *SynthZeroPointsGet ();
    588601
    589 int relphot_synthphot (int hostID, char *hostpath);
     602int relphot_synthphot (SkyList *sky, int hostID, char *hostpath);
    590603int relphot_synthphot_parallel (SkyList *sky);
    591604
     
    598611
    599612void relphot_free (SkyTable *sky, SkyList *skylist);
    600 void freeImages ();
     613void freeImages (int freeImageData);
    601614void relphot_client_free (SkyTable *sky, SkyList *skylist);
    602615void BrightCatalogFree (BrightCatalog *bcatalog);
    603616
     617void put_astrom_table (AstromOffsetTable *myTable);
    604618void free_astrom_table ();
     619
     620int RepairWarpMeasures (Catalog *catalog);
     621
     622int FindWarpGroups (void);
     623int GetWarpSeq (Image *image, int obstime, unsigned short photcode, double Rave, double Dave, float X, float Y);
     624void FreeWarpGroups (void);
     625
     626myIndexType *myIndexInit ();
     627int myIndexFree (myIndexType *myIndex);
     628int myIndexUpdateLimits (myIndexType *myIndex, int value);
     629int myIndexSetRange (myIndexType *myIndex);
     630int myIndexSetEntry (myIndexType *myIndex, int value, int entry);
     631int myIndexGetEntry (myIndexType *myIndex, int value);
     632
     633uint64_t CreatePSPSObjectID(double ra, double dec);
     634uint64_t CreatePSPSStackDetectionID(int sourceID, int imageID, int detID);
     635uint64_t CreatePSPSDetectionID(double tobs, int ccdid, int detID);
  • trunk/Ohana/src/relphot/src/BoundaryTreeOps.c

    r37807 r39481  
    5555  return status;
    5656}
     57
     58void free_tess () {
     59
     60  if (!tess) return;
     61  TessellationTableFree (tess, Ntess);
     62  free (tess);
     63}
  • trunk/Ohana/src/relphot/src/ImageOps.c

    r39478 r39481  
    2424
    2525// we have an array of images: image[ImageIndex] (ImageIndex : 0 < Nimage)
    26 static off_t        Nimage;   // number of available images
    27 static Image        *image;   // array of available images 
     26static off_t        Nimage = 0;   // number of available images
     27static Image        *image = NULL;   // array of available images 
    2828
    2929// if we read only a subset of the rows from the Image FITS, LineNumber tells us to which row
     
    267267}
    268268
    269 void freeImages () {
    270 
    271   FREE (image);
     269void freeImages (int freeImageData) {
     270
     271  if (freeImageData) FREE (image);
    272272  FREE (LineNumber);
    273273
  • trunk/Ohana/src/relphot/src/ImageTable.c

    r38441 r39481  
    3333  }
    3434
     35  // i want to keep the image data, but free everything else
     36  db.ftable.buffer = NULL;
     37  gfits_db_free (&db);
     38
    3539  // XXX do not make the chip match -- we have not loaded the PHU entries (and do not need them here)
    3640  // BuildChipMatch (image, Nimage);
     
    6569  dvo_image_unlock (&db);
    6670
     71  gfits_db_free (&db);
     72
    6773  return TRUE;
    6874}
  • trunk/Ohana/src/relphot/src/MosaicOps.c

    r39478 r39481  
    316316
    317317void freeMosaics () {
     318 
     319
    318320}
    319321
  • trunk/Ohana/src/relphot/src/args.c

    r39478 r39481  
    193193    remove_argument (N, &argc, argv);
    194194    RESET_ZEROPTS = TRUE;
     195  }
     196
     197  REPAIR_WARPS = FALSE;
     198  if ((N = get_argument (argc, argv, "-repair-warps"))) {
     199    remove_argument (N, &argc, argv);
     200    REPAIR_WARPS = TRUE;
    195201  }
    196202
     
    483489  FREE (photcodes);
    484490 
     491  free_tess();
    485492  SkyTableFree (sky);
    486493  SkyListFree(skylist);
     
    619626    remove_argument (N, &argc, argv);
    620627    RESET_ZEROPTS = TRUE;
     628  }
     629
     630  REPAIR_WARPS = FALSE;
     631  if ((N = get_argument (argc, argv, "-repair-warps"))) {
     632    remove_argument (N, &argc, argv);
     633    REPAIR_WARPS = TRUE;
    621634  }
    622635
     
    762775  FREE (photcodes);
    763776 
     777  free_tess();
    764778  SkyTableFree (sky);
    765779  SkyListFree(skylist);
  • trunk/Ohana/src/relphot/src/assign_images.c

    r39353 r39481  
    3232    AstromOffsetTableMatchChips (image, Nimage, table);
    3333  }
     34  put_astrom_table (table);
    3435
    3536  if (MOSAIC_ZEROPT) {
  • trunk/Ohana/src/relphot/src/indexCatalog.c

    r36630 r39481  
    6363  return TRUE;
    6464}
     65
     66void freeCatalogIndexes (int Ncatalog) {
     67
     68  for (int i = 0; i < Ncatalog; i++) {
     69    FREE (objIDseq[i]);
     70  }
     71  FREE (catIDseq);
     72  FREE (objIDseq);
     73  FREE (objIDmax);
     74}
  • trunk/Ohana/src/relphot/src/launch_region_hosts.c

    r39353 r39481  
    8181    fprintf (stderr, "command: %s\n", command);
    8282   
    83     if (PARALLEL_REGIONS_MANUAL) continue;
     83    if (PARALLEL_REGIONS_MANUAL) {
     84      free (command);
     85      continue;
     86    }
    8487
    8588    // launch the job, then wait for it to be done loading catalogs.  force the remote
     
    100103    check_sync_file (syncfile, 1);
    101104    free (syncfile);
     105    free (command);
    102106  }
    103107
  • trunk/Ohana/src/relphot/src/load_images.c

    r39479 r39481  
    55// This function generates a subset of the images based on selections.  Input db has already
    66// been loaded with the raw fits table data
    7 int load_images (FITS_DB *db, SkyList *skylist, SkyRegion *region) {
     7int load_images (FITS_DB *db, SkyList *skylist, SkyRegion *region, int unlockImages) {
    88
    99  Image     *image, *subset;
     
    2626  MARKTIME("build chip match for %d images: %f sec\n", (int) Nimage, dtime);
    2727
    28   // XXX consider allowing relphot to skip the AstroMap load (do we need precise astrometry here?)
    29 
    30   char mapfile[DVO_MAX_PATH];
    31   snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
    32   table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);
    33 
    34   // assign images.coords.offsetMap -> table->map[i]
    35   if (table) {
    36     AstromOffsetTableMatchChips (image, Nimage, table);
    37   }
    38 
    3928  // allocate and init an array to identify the images included in the subset
    4029  ALLOCATE (inSubset, char, Nimage);
     
    4938    fprintf (stderr, "no images selected for analysis : problem with region or photcode?\n");
    5039    exit (4);
     40  }
     41
     42  // XXX consider allowing relphot to skip the AstroMap load (do we need precise astrometry here?)
     43
     44  // NOTE: unlock & free when running relphot_client (update-objects), but not when running relphot_images
     45  // note that if we have MOSAIC_ZEROPT selected, we cannot free images as the full array is needed by initMosaic
     46
     47  /* unlock, if we can (else, unlocked below) and free, if we can */
     48  if (unlockImages && !MOSAIC_ZEROPT) {
     49    if (subset != image) {
     50      // if we have generated an image subset and we are running UPDATE_OFFSETS, the we can free images here
     51      free (image);
     52      db[0].ftable.buffer = NULL;
     53      BuildChipMatch (subset, Nsubset);
     54    }
     55    dvo_image_unlock (db);
     56    // allocate and init an array to identify the images included in the subset
     57  }
     58
     59  char mapfile[DVO_MAX_PATH];
     60  snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);
     61  table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);
     62
     63  // assign images.coords.offsetMap -> table->map[i]
     64  if (table) {
     65    AstromOffsetTableMatchChips (subset, Nsubset, table);
    5166  }
    5267
     
    7994  }
    8095  return (TRUE);
     96}
     97
     98void put_astrom_table (AstromOffsetTable *myTable) {
     99  table = myTable;
    81100}
    82101
  • trunk/Ohana/src/relphot/src/reload_catalogs.c

    r39478 r39481  
    6767      fprintf (stderr, "ERROR: failure reading catalog %s, skipping\n", catalog.filename);
    6868      continue;
    69       // exit (1);
    7069    }
    7170    if (VERBOSE && (catalog.Naverage_disk == 0)) {
     
    152151    }
    153152    free (image);
    154 //  } else {
    155 //    // load the current sky table (layout of all SkyRegions)
    156 //    SkyTable *skytable = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
    157 //    // XXX kind of hackish...
    158 //    ALLOCATE (sky, SkyList, 1);
    159 //    strcpy (sky->hosts, skytable->hosts);
    160 //    SkyTableFree (skytable);
    161153  }
    162154
  • trunk/Ohana/src/relphot/src/relphot.c

    r39479 r39481  
    88  if (!mode) exit (2);
    99
     10  SkyList *skylist = NULL;
     11
    1012  SkyTable *sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE);
    1113  if (!sky) {
     
    1517  SkyTableSetFilenames (sky, CATDIR, "cpt");
    1618 
    17   SkyList *skylist = NULL;
    18   if (UserCatalog) {
    19     int Nchar = strlen(UserCatalog);
    20     if (!strcmp (&UserCatalog[Nchar-4], ".cpt")) UserCatalog[Nchar-4] = 0;
    21     skylist = SkyListByName (sky, UserCatalog);
    22   } else {
    23     skylist = SkyListByPatch (sky, -1, &UserPatch);
    24   }
    25   if (!skylist) {
    26     fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR);
    27     exit (2);
     19  if ((mode != PARALLEL_REGIONS) && (mode != PARALLEL_IMAGES)) {
     20    skylist = NULL;
     21    if (UserCatalog) {
     22      int Nchar = strlen(UserCatalog);
     23      if (!strcmp (&UserCatalog[Nchar-4], ".cpt")) UserCatalog[Nchar-4] = 0;
     24      skylist = SkyListByName (sky, UserCatalog);
     25    } else {
     26      skylist = SkyListByPatch (sky, -1, &UserPatch);
     27    }
     28    if (!skylist) {
     29      fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR);
     30      exit (2);
     31    }
    2832  }
    2933 
     
    3741    case UPDATE_AVERAGES:
    3842      // take the current set of detections and set the mean magnitudes
    39       // DOES NOT LOAD THE IMAGE TABLE
    40       relphot_objects (sky, skylist, 0, NULL);
     43      relphot_objects (skylist, 0, NULL);
    4144      relphot_free (sky, skylist);
    4245      exit (0);
     
    4447    case SYNTH_PHOT:
    4548      // set the mean magnitudes ONLY for SYNPHOT objects
    46       relphot_synthphot (0, NULL);
     49      relphot_synthphot (skylist, 0, NULL);
    4750      relphot_free (sky, skylist);
    4851      exit (0);
     
    5053    case PARALLEL_REGIONS:
    5154      // run image updates in parallel across multiple remote machines
    52       relphot_parallel_regions ();
     55      relphot_parallel_regions (sky);
    5356      relphot_free (sky, skylist);
    5457      exit (0);
     
    5659    case PARALLEL_IMAGES:
    5760      // operation on the remote machines in the PARALLEL_REGION mode
    58       relphot_parallel_images ();
     61      relphot_parallel_images (sky);
    5962      relphot_free (sky, skylist);
    6063      exit (0);
  • trunk/Ohana/src/relphot/src/relphot_client.c

    r39478 r39481  
    8383      FlatCorrectionTable *flatcorr = NULL;
    8484      reload_catalogs (skylist, flatcorr, HOST_ID, HOSTDIR);
    85       freeImages ();
     85      freeImages (TRUE);
    8686      free (image);
    8787      client_logger_message ("updated catalogs\n");
     
    9191
    9292    case MODE_UPDATE_OBJECTS: {
    93       relphot_objects (sky, skylist, HOST_ID, HOSTDIR);
     93      // take the current set of detections and set the mean magnitudes
     94      relphot_objects (skylist, HOST_ID, HOSTDIR);
    9495      relphot_client_free (sky, skylist);
    9596      client_logger_message ("updated objects\n");
     
    99100    case MODE_SYNTH_PHOT:
    100101      // set the mean magnitudes ONLY for SYNPHOT objects
    101       relphot_synthphot (HOST_ID, HOSTDIR);
     102      relphot_synthphot (skylist, HOST_ID, HOSTDIR);
    102103      client_logger_message ("set synth photometry\n");
    103104      break;
  • trunk/Ohana/src/relphot/src/relphot_images.c

    r39479 r39481  
    3939
    4040  /* load regions and images based on specified sky patch and/or catalog */
    41   load_images (&db, skylist, &UserPatch);
     41  load_images (&db, skylist, &UserPatch, FALSE);
    4242  MARKTIME("-- load images: %f sec\n", dtime);
    4343
     
    261261  dvo_image_unlock (&db);
    262262  gfits_db_free (&db);
    263   freeImages();
     263  freeImages (TRUE);
    264264
    265265  return TRUE;
  • trunk/Ohana/src/relphot/src/relphot_objects.c

    r39478 r39481  
    88int relphot_objects_parallel (SkyList *sky);
    99
    10 int relphot_objects (SkyTable *sky, SkyList *skylist, int hostID, char *hostpath) {
     10int relphot_objects (SkyList *skylist, int hostID, char *hostpath) {
    1111
    1212  off_t i, j, k;
    1313  int Nsecfilt;
     14  struct stat filestat;
    1415
    1516  Catalog catalog;
     
    2122  }
    2223
     24  FITS_DB db;
     25     
     26  set_db (&db);
     27  gfits_db_init (&db);
     28
     29  /* lock and load the image db table */
     30  int status = dvo_image_lock (&db, ImageCat, 60.0, LCK_SOFT);
     31  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
     32  if (db.dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db.filename);
     33  if (!dvo_image_load (&db, VERBOSE, FALSE)) Shutdown ("can't read image catalog %s", db.filename);
     34  // the raw FITS data is freed by dvo_image_load, leaving only the Image structure data
     35
     36  /* load regions and images based on specified sky patch (default depth) */
     37  load_images (&db, skylist, &UserPatch, TRUE);
     38
    2339  // load the ZP corrections here
    2440  if (SYNTH_ZERO_POINTS) SynthZeroPointsLoad (SYNTH_ZERO_POINTS);
     41
     42  if (REPAIR_WARPS) FindWarpGroups ();
    2543
    2644  // load data from each region file, only use bright stars
     
    3654    dvo_catalog_init (&catalog, TRUE);
    3755    catalog.filename    = hostID ? hostfile : skylist[0].filename[i];
     56
     57    // only update existing db tables
     58    int status = stat (catalog.filename, &filestat);
     59    if ((status == -1) && (errno == ENOENT)) {
     60      if (VERBOSE) fprintf (stderr, "no file %s, skipping\n", catalog.filename);
     61      continue;
     62    }
     63
    3864    catalog.catflags    = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
    3965    catalog.Nsecfilt    = GetPhotcodeNsecfilt ();
    4066
    4167    if (!dvo_catalog_open (&catalog, skylist[0].regions[i], VERBOSE, "w")) {
    42       fprintf (stderr, "ERROR: failure reading catalog %s\n", catalog.filename);
    43       exit (1);
     68      fprintf (stderr, "ERROR: failure reading catalog %s, skipping\n", catalog.filename);
     69      continue;
    4470    }
    4571    if (!catalog.Naverage_disk) {
     
    80106    populate_tiny_values(&catalog, DVO_TV_MEASURE | DVO_TV_AVERAGE);
    81107
     108    // XXX need to worry about the image subset data
     109    initImageBins  (&catalog, 1, FALSE);
     110    initMosaicBins (&catalog, 1, FALSE);
     111    initGridBins   (&catalog, 1);
     112
     113    findImages (&catalog, 1, FALSE);
     114    findMosaics (&catalog, 1, FALSE);
     115
     116    // update the detection coordinates using the new image parameters
     117    if (REPAIR_WARPS) RepairWarpMeasures (&catalog);
     118
    82119    initMrel (&catalog, 1);
    83120    setMrelFinal (&catalog, NULL, TRUE);
    84121    // XXX if we want to have options for setting warp, chip, stack independently, we need to init only the desired ones
     122    // NOTE flatcorr == NULL, but it should have been applied already by setphot
    85123
    86124    if (!UPDATE) {
     
    93131    if (VERBOSE) fprintf (stderr, "saving catalog %s\n", catalog.filename);
    94132   
     133    char history[128];
     134    struct timeval now;
     135    gettimeofday (&now, (void *) NULL);
     136    char *moddate = ohana_sec_to_date (now.tv_sec);
     137    gfits_modify (&catalog.header, "RELPHOT", "%s", 1, moddate);     
     138    snprintf (history, 128, "repair warp measure.imageID: %s", moddate);
     139    gfits_modify_alt (&catalog.header, "HISTORY", "%S", 0, history); // adds a new entry
     140    free (moddate);
     141
    95142    // we can optionally convert output format here
    96143    // but it would be better to define a dvo crawler program to do this
     
    100147    if (!dvo_catalog_unlock (&catalog)) { fprintf (stderr, "ERROR: failed to unlock %s\n", catalog.filename); exit (1); }
    101148    SetProtect (FALSE);
     149
    102150    free_tiny_values(&catalog);
    103151    dvo_catalog_free (&catalog);
    104   }
     152
     153    freeImageBins (1, FALSE);
     154    freeMosaicBins (1, FALSE);
     155    freeGridBins (1);
     156  }
     157
     158  if (REPAIR_WARPS) FreeWarpGroups ();
     159
     160  gfits_db_free (&db);
     161  freeImages(TRUE);
     162
    105163  return (TRUE);
    106164}
     
    118176    exit (1);
    119177  }   
     178
     179  if (BOUNDARY_TREE) {
     180    char *tmppath = abspath(BOUNDARY_TREE, DVO_MAX_PATH);
     181    free (BOUNDARY_TREE);
     182    BOUNDARY_TREE = tmppath;
     183  }
    120184
    121185  int i;
     
    147211    if (RESET)             { strextend (&command, "-reset"); }
    148212    if (RESET_ZEROPTS)     { strextend (&command, "-reset-zpts"); }
     213    if (REPAIR_WARPS)      { strextend (&command, "-repair-warps"); }
     214    if (IS_DIFF_DB)        { strextend (&command, "-is-diff-db"); }
    149215    if (UPDATE)            { strextend (&command, "-update"); }
    150216    if (!KEEP_UBERCAL)     { strextend (&command, "-reset-ubercal"); }
     217    if (BOUNDARY_TREE)     { strextend (&command, "-boundary-tree %s", BOUNDARY_TREE); }
    151218    if (SYNTH_ZERO_POINTS) { strextend (&command, "-synthphot-zpts %s", SYNTH_ZERO_POINTS); }
    152219
  • trunk/Ohana/src/relphot/src/relphot_parallel_images.c

    r39344 r39481  
    1212int dumpObjects (char *filename, Catalog *catalog, int Ncatalog);
    1313
    14 int relphot_parallel_images () {
     14int relphot_parallel_images (SkyTable *sky) {
    1515
    1616  int i, Ncatalog;
     
    5050# endif
    5151  FlatCorrectionTable *flatcorr = NULL;
    52 
    53   SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
    54   SkyTableSetFilenames (sky, CATDIR, "cpt");
    5552
    5653  // UserPatch.Rmin,Rmax may have range from a few degrees < 0.0 to few degrees > 360.0.
     
    161158
    162159  share_image_mags (regionHosts, -1);
     160
     161  for (i = 0; i < Ncatalog; i++) {
     162    // these tiny values are set by BrightCatalogSplit from load_catalogs
     163    free_tiny_values (&catalog[i]);
     164    dvo_catalog_free (&catalog[i]);
     165  }
     166  free (catalog);
     167 
     168  freeCatalogIndexes (Ncatalog);
     169  freeImageBins(Ncatalog, TRUE);
     170  freeMosaicBins (Ncatalog, TRUE);
     171  freeGridBins (Ncatalog);
     172  freeImages(TRUE);
     173
     174  SkyListFree(skylist);
     175  FreeRegionHostTable (regionHosts);
     176
    163177  client_logger_message ("done with parallel images\n");
    164178
    165   exit (0);
     179  return TRUE;
    166180}
  • trunk/Ohana/src/relphot/src/relphot_parallel_regions.c

    r39289 r39481  
    22int save_images_backup (FITS_DB *db);
    33
    4 int relphot_parallel_regions () {
     4int relphot_parallel_regions (SkyTable *sky) {
    55
    66  int status;
     
    7171  }
    7272
    73   SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
    74   SkyTableSetFilenames (sky, CATDIR, "cpt");
    7573  SkyList *skylist = SkyListByBounds (sky, -1, regionHosts->Rmin, regionHosts->Rmax, regionHosts->Dmin, regionHosts->Dmax);
     74  UserPatch.Rmin = regionHosts->Rmin;
     75  UserPatch.Rmax = regionHosts->Rmax;
     76  UserPatch.Dmin = regionHosts->Dmin;
     77  UserPatch.Dmax = regionHosts->Dmax;
    7678
    7779  // I have to save a copy because dvo_image_save and _unlock swap and free the data
     
    8284
    8385  // save the changes to the image parameters
    84   dvo_image_save (&db, VERBOSE);
     86  dvo_image_save (&db, VERBOSE); // this function modifies the db.ftable.buffer: do not free stored Image table
    8587  dvo_image_unlock (&db);
    8688  MARKTIME ("finished relphot -parallel-regions: %f sec total\n", dtime);
    8789
    88   exit (0);
     90  gfits_db_free (&db);
     91  freeImages(FALSE);
     92
     93  SkyListFree(skylist);
     94  FreeRegionHostTable (regionHosts);
     95
     96  return TRUE;
    8997}
    9098
     
    122130  MARKTIME("-- save Image.dat.bck: %f sec\n", dtime);
    123131
     132  gfits_db_free (&dbX);
    124133  return TRUE;
    125134}
  • trunk/Ohana/src/relphot/src/relphot_synthphot.c

    r38986 r39481  
    66int relphot_synthphot_parallel (SkyList *sky);
    77
    8 int relphot_synthphot (int hostID, char *hostpath) {
     8int relphot_synthphot (SkyList *skylist, int hostID, char *hostpath) {
    99
    1010  off_t i;
    1111
    12   SkyTable *sky = NULL;
    13   SkyList *skylist = NULL;
    1412  Catalog catalog;
    15 
    16   // load the current sky table (layout of all SkyRegions)
    17   sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
    18   SkyTableSetFilenames (sky, CATDIR, "cpt");
    19  
    20   // determine the populated SkyRegions overlapping the requested area (default depth)
    21   skylist = SkyListByPatch (sky, -1, &UserPatch);
    2213
    2314  // XXX need to decide how to determine PARALLEL mode...
Note: See TracChangeset for help on using the changeset viewer.