Changeset 33485
- Timestamp:
- Mar 12, 2012, 8:51:39 PM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/relastro/src
- Files:
-
- 2 edited
-
BrightCatalog.c (modified) (12 diffs)
-
select_images.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/BrightCatalog.c
r33448 r33485 28 28 FTable ftable; 29 29 30 header.buffer = NULL; 31 matrix.buffer = NULL; 32 ftable.buffer = NULL; 33 theader.buffer = NULL; 30 34 BrightCatalog *catalog = NULL; 31 35 … … 33 37 if (!f) { 34 38 fprintf (stderr, "ERROR: cannot open image subset file %s\n", filename); 35 return NULL;39 goto escape; 36 40 } 37 41 … … 40 44 if (VERBOSE) fprintf (stderr, "can't read image subset header\n"); 41 45 fclose (f); 42 return NULL;46 goto escape; 43 47 } 44 48 if (!gfits_fread_matrix (f, &matrix, &header)) { … … 46 50 gfits_free_header (&header); 47 51 fclose (f); 48 return NULL;52 goto escape; 49 53 } 50 54 … … 58 62 { 59 63 // load data for this header 60 if (!gfits_load_header (f, &theader)) return (NULL);64 if (!gfits_load_header (f, &theader)) goto escape; 61 65 62 66 // 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; 64 68 65 69 // need to create and assign to flat-field correction … … 80 84 GET_COLUMN(catID, "CAT_ID", int); 81 85 GET_COLUMN(photcode, "PHOTCODE", short); 82 // XXX free the fits table data here 86 gfits_free_header (&theader); 87 gfits_free_table (&ftable); 83 88 84 89 MeasureTiny *measure = NULL; … … 129 134 130 135 // load data for this header 131 if (!gfits_load_header (f, &theader)) return (NULL);136 if (!gfits_load_header (f, &theader)) goto escape; 132 137 133 138 // 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; 135 140 136 141 GET_COLUMN(R, "RA", double); … … 163 168 GET_COLUMN(catID, "CAT_ID", int); 164 169 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); 166 172 167 173 Average *average = NULL; … … 238 244 239 245 // load data for this header 240 if (!gfits_load_header (f, &theader)) return (NULL);246 if (!gfits_load_header (f, &theader)) goto escape; 241 247 242 248 // 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; 244 250 245 251 // need to create and assign to flat-field correction … … 252 258 GET_COLUMN(M_20, "MAG_20", short); 253 259 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); 255 262 256 263 SecFilt *secfilt = NULL; … … 280 287 } 281 288 282 // close files 289 290 gfits_free_header (&header); 291 gfits_free_matrix (&matrix); 292 fclose (f); 283 293 284 294 return catalog; 295 296 escape: 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; 285 305 } 286 306 … … 304 324 return FALSE; 305 325 } 306 326 307 327 gfits_fwrite_header (f, &header); 308 328 gfits_fwrite_matrix (f, &matrix); -
branches/eam_branches/ipp-20111122/Ohana/src/relastro/src/select_images.c
r33452 r33485 25 25 26 26 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; 28 28 off_t *line_number; 29 29 int InRange, found; … … 68 68 DminSkyRegion = +90.0; 69 69 DmaxSkyRegion = -90.0; 70 71 D_NIMAGE = 6000; 70 72 71 73 /* compare with each region file */ … … 113 115 114 116 nimage = 0; 115 NIMAGE = 100;117 NIMAGE = D_NIMAGE; 116 118 ALLOCATE (image, Image, NIMAGE); 117 119 ALLOCATE (line_number, off_t, NIMAGE); … … 167 169 168 170 /* 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; 171 173 double DminImage = +90.0; 172 174 double DmaxImage = -90.0; … … 249 251 nimage ++; 250 252 if (nimage == NIMAGE) { 251 NIMAGE += 100; 253 NIMAGE += D_NIMAGE; 254 D_NIMAGE = MAX (100000, D_NIMAGE * 1.5); 252 255 REALLOCATE (image, Image, NIMAGE); 253 256 REALLOCATE (line_number, off_t, NIMAGE); … … 261 264 REALLOCATE (line_number, off_t, MAX (nimage, 1)); 262 265 free (skycoords); 266 free (RmaxSky); 267 free (index); 263 268 264 269 *Nimage = nimage;
Note:
See TracChangeset
for help on using the changeset viewer.
