IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36617


Ignore:
Timestamp:
Mar 29, 2014, 12:54:58 PM (12 years ago)
Author:
eugene
Message:

free up some memory; allow mosaics to work with a photcode list

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

Legend:

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

    r36616 r36617  
    5353  fclose (f);
    5454
    55   // a bit annoying : we read the entire block of data, then extract the columns, then set the image structure values.
    56   // this means I need 3 copies in memory at some point.  ugh.
     55  // we read the entire block of data, then extract the columns, then set the image structure values.
     56  // I free the FITS table data after extracting the colums to avoid having 3 copies in memory.
    5757
    5858  char type[16];
     
    7777  GET_COLUMN (flags,            "FLAGS",             int);
    7878
     79  // free the memory associated with the FITS files
     80  gfits_free_header (&header);
     81  gfits_free_matrix (&matrix);
     82  gfits_free_header (&theader);
     83  gfits_free_table  (&ftable);
     84
    7985  ALLOCATE (image_pos, ImagePos, Nrow);
    8086  for (i = 0; i < Nrow; i++) {
     
    120126  free (nFitAstrom);
    121127  free (flags     );
    122 
    123   gfits_free_header (&header);
    124   gfits_free_matrix (&matrix);
    125   gfits_free_header (&theader);
    126   gfits_free_table  (&ftable);
    127128
    128129  *nimage_pos = Nrow;
  • branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/MosaicOps.c

    r36574 r36617  
    136136  ALLOCATE (mosaic_for_images, off_t, Nmosaic_for_images);
    137137
     138  // emit an error if we miss mosaics, but stop if we miss too many
     139  int NmissMosaic = 0;
     140  int NtestMosaic = 0;
     141
    138142  /* now assign the WRP images to these mosaics */
    139143  for (i = 0; i < Nimage; i++) {
     
    141145
    142146    if (strcmp(&image[i].coords.ctype[4], "-WRP")) continue;
     147    NtestMosaic ++;
    143148
    144149    /* set image time range */
     
    148153    Nmos = getMosaicByTimes (start, stop, startMos, stopMos, indexMos);
    149154    if (Nmos == -1) {
    150       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 ++;
    151159      continue;
    152160    }
     
    165173  }
    166174
     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
    167181  free (startMos);
    168182  free (stopMos);
  • branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/UpdateObjects.c

    r36574 r36617  
    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
     
    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);
  • branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/relastro_client.c

    r36574 r36617  
    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;
     
    6464    }
    6565
    66       // XXX loading the images is fairly costly -- see if we can do an image subset
     66      // XXX loading the images is fairly costly -- see if we can do an image subset?
    6767    case OP_UPDATE_OFFSETS: {
    6868      FITS_DB db;
  • branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/select_images.c

    r36569 r36617  
    125125    if (NphotcodesKeep > 0) {
    126126      found = FALSE;
    127       // 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;
    128129      for (k = 0; (k < NphotcodesKeep) && !found; k++) {
    129130        if (photcodesKeep[k][0].code == timage[i].photcode) found = TRUE;
Note: See TracChangeset for help on using the changeset viewer.