IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33485


Ignore:
Timestamp:
Mar 12, 2012, 8:51:39 PM (14 years ago)
Author:
eugene
Message:

free unneeded data

Location:
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/BrightCatalog.c

    r33448 r33485  
    2828  FTable ftable;
    2929
     30  header.buffer = NULL;
     31  matrix.buffer = NULL;
     32  ftable.buffer = NULL;
     33  theader.buffer = NULL;
    3034  BrightCatalog *catalog = NULL;
    3135
     
    3337  if (!f) {
    3438    fprintf (stderr, "ERROR: cannot open image subset file %s\n", filename);
    35     return NULL;
     39    goto escape;
    3640  }
    3741
     
    4044    if (VERBOSE) fprintf (stderr, "can't read image subset header\n");
    4145    fclose (f);
    42     return NULL;
     46    goto escape;
    4347  }
    4448  if (!gfits_fread_matrix (f, &matrix, &header)) {
     
    4650    gfits_free_header (&header);
    4751    fclose (f);
    48     return NULL;
     52    goto escape;
    4953  }
    5054
     
    5862  {
    5963    // load data for this header
    60     if (!gfits_load_header (f, &theader)) return (NULL);
     64    if (!gfits_load_header (f, &theader)) goto escape;
    6165
    6266    // read the fits table bytes
    63     if (!gfits_fread_ftable_data (f, &ftable, FALSE)) return (NULL);
     67    if (!gfits_fread_ftable_data (f, &ftable, FALSE)) goto escape;
    6468 
    6569    // need to create and assign to flat-field correction
     
    8084    GET_COLUMN(catID,     "CAT_ID",     int);
    8185    GET_COLUMN(photcode,  "PHOTCODE",   short);
    82     // XXX free the fits table data here
     86    gfits_free_header (&theader);
     87    gfits_free_table  (&ftable);
    8388
    8489    MeasureTiny *measure = NULL;
     
    129134
    130135    // load data for this header
    131     if (!gfits_load_header (f, &theader)) return (NULL);
     136    if (!gfits_load_header (f, &theader)) goto escape;
    132137
    133138    // read the fits table bytes
    134     if (!gfits_fread_ftable_data (f, &ftable, FALSE)) return (NULL);
     139    if (!gfits_fread_ftable_data (f, &ftable, FALSE)) goto escape;
    135140
    136141    GET_COLUMN(R,              "RA",          double);
     
    163168    GET_COLUMN(catID,          "CAT_ID",      int);
    164169    GET_COLUMN(extID,          "EXT_ID",      int64_t);
    165     // XXX free the fits table data here
     170    gfits_free_header (&theader);
     171    gfits_free_table  (&ftable);
    166172
    167173    Average *average = NULL;
     
    238244
    239245    // load data for this header
    240     if (!gfits_load_header (f, &theader)) return (NULL);
     246    if (!gfits_load_header (f, &theader)) goto escape;
    241247
    242248    // read the fits table bytes
    243     if (!gfits_fread_ftable_data (f, &ftable, FALSE)) return (NULL);
     249    if (!gfits_fread_ftable_data (f, &ftable, FALSE)) goto escape;
    244250 
    245251    // need to create and assign to flat-field correction
     
    252258    GET_COLUMN(M_20,  "MAG_20",   short);
    253259    GET_COLUMN(M_80,  "MAG_80",   short);
    254     // XXX free the fits table data here
     260    gfits_free_header (&theader);
     261    gfits_free_table  (&ftable);
    255262
    256263    SecFilt *secfilt = NULL;
     
    280287  }
    281288
    282   // close files
     289
     290  gfits_free_header (&header);
     291  gfits_free_matrix (&matrix);
     292  fclose (f);
    283293
    284294  return catalog;
     295
     296escape:
     297  gfits_free_header (&header);
     298  gfits_free_matrix (&matrix);
     299  gfits_free_header (&theader);
     300  gfits_free_table  (&ftable);
     301  if (catalog) free (catalog);
     302
     303  fclose (f);
     304  return NULL;
    285305}
    286306
     
    304324    return FALSE;
    305325  }
    306 
     326 
    307327  gfits_fwrite_header  (f, &header);
    308328  gfits_fwrite_matrix  (f, &matrix);
  • branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/select_images.c

    r33452 r33485  
    2525 
    2626  Image *image;
    27   off_t i, j, k, m, nStart, iSky, nimage, NIMAGE;
     27  off_t i, j, k, m, nStart, iSky, nimage, NIMAGE, D_NIMAGE;
    2828  off_t *line_number;
    2929  int InRange, found;
     
    6868  DminSkyRegion = +90.0;
    6969  DmaxSkyRegion = -90.0;
     70
     71  D_NIMAGE = 6000;
    7072
    7173  /* compare with each region file */
     
    113115
    114116  nimage = 0;
    115   NIMAGE = 100;
     117  NIMAGE = D_NIMAGE;
    116118  ALLOCATE (image, Image, NIMAGE);
    117119  ALLOCATE (line_number, off_t, NIMAGE);
     
    167169
    168170    /* transform corners to ra,dec -- costs ~3sec for 3M images (pikake) */
    169     double RminImage = 360.0;
    170     double RmaxImage =   0.0;
     171    double RminImage = RmidSkyRegion + 180.0;
     172    double RmaxImage = RmidSkyRegion - 180.0;
    171173    double DminImage = +90.0;
    172174    double DmaxImage = -90.0;
     
    249251    nimage ++;
    250252    if (nimage == NIMAGE) {
    251       NIMAGE += 100;
     253      NIMAGE += D_NIMAGE;
     254      D_NIMAGE = MAX (100000, D_NIMAGE * 1.5);
    252255      REALLOCATE (image, Image, NIMAGE);
    253256      REALLOCATE (line_number, off_t, NIMAGE);
     
    261264  REALLOCATE (line_number, off_t, MAX (nimage, 1));
    262265  free (skycoords);
     266  free (RmaxSky);
     267  free (index);
    263268
    264269  *Nimage  = nimage;
Note: See TracChangeset for help on using the changeset viewer.