Changeset 33221
- Timestamp:
- Feb 8, 2012, 10:30:30 AM (14 years ago)
- Location:
- branches/eam_branches/ipp-20111122/Ohana/src/libdvo
- Files:
-
- 5 edited
-
include/dvo.h (modified) (1 diff)
-
src/dvo_catalog.c (modified) (1 diff)
-
src/dvo_catalog_mef.c (modified) (12 diffs)
-
src/dvo_catalog_split.c (modified) (3 diffs)
-
src/dvo_convert.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/include/dvo.h
r33215 r33221 464 464 int WriteRawSecFilt (FILE *f, SecFilt *secfilt, off_t Nsecfilt, char format); 465 465 466 DVOTableFormat FtableGetFormat (FTable *ftable); 467 466 468 Average *FtableToAverage (FTable *ftable, off_t *Naverage, char *format, SecFilt **primary); 467 469 Measure *FtableToMeasure (FTable *ftable, off_t *Nmeasure, char *format); -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_catalog.c
r31663 r33221 250 250 251 251 dvo_catalog_init (catalog, FALSE); 252 253 // reset the file pointer in case we've already read some data 254 fseeko (catalog[0].f, 0, SEEK_SET); 252 255 253 256 // load the main catalog header, determine characteristics -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_catalog_mef.c
r33215 r33221 3 3 int dvo_catalog_load_mef (Catalog *catalog, int VERBOSE) { 4 4 5 off_t Nbytes; 6 off_t Naverage; 7 off_t Nmeasure; 8 off_t Nmissing; 9 off_t Nitems, Nexpect; 5 10 int Nsecfilt; 6 off_t Nitems, Nbytes, Nexpect, Naverage, Nmeasure, Nmissing;7 FILE *f;8 11 9 12 Header header; 10 Matrix matrix;11 13 FTable ftable; 12 14 13 15 SecFilt *primary = NULL; 14 16 15 f = catalog[0].f;16 17 ftable.header = &header; 17 18 18 /* move pointer past header -- must be already read (load_catalog) */19 fseeko (f, catalog[0].header.datasize, SEEK_SET);20 21 /* matrix should be empty */22 if (!gfits_fread_matrix (f, &matrix, &catalog[0].header)) {23 if (VERBOSE) fprintf (stderr, "can't read primary matrix");24 return (FALSE);25 }26 19 /* get the components from the header */ 27 20 if (!gfits_scan (&catalog[0].header, "NSTARS", OFF_T_FMT, 1, &Naverage)) return (FALSE); … … 58 51 catalog[0].secfilt = NULL; 59 52 60 /* validate table mode */ 53 /* validate table mode ?*/ 54 55 /*** Average Table ***/ 56 57 /* need to read the table header to determine format (whether or not we read averages) */ 58 /* move pointer past PHU header -- must be already read (load_catalog) */ 59 Nbytes = catalog[0].header.datasize + gfits_data_size (&catalog[0].header); 60 fseeko (catalog[0].f, Nbytes, SEEK_SET); 61 61 62 62 /* read Average table header */ 63 if (!gfits_fread_header ( f, &header)) {63 if (!gfits_fread_header (catalog[0].f, &header)) { 64 64 if (VERBOSE) fprintf (stderr, "can't read table average header"); 65 65 return (FALSE); 66 66 } 67 67 68 /* read Average table data (or skip) */ 68 69 if (catalog[0].catflags & LOAD_AVES) { 69 if (!gfits_fread_ftable_data ( f, &ftable, FALSE)) {70 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 70 71 if (VERBOSE) fprintf (stderr, "can't read table average data"); 71 72 return (FALSE); … … 79 80 catalog[0].Naves_off = 0; 80 81 } else { 82 catalog[0].catformat = FtableGetFormat (&ftable); 81 83 Nbytes = gfits_data_size (&header); 82 fseeko ( f, Nbytes, SEEK_CUR);84 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 83 85 ALLOCATE (catalog[0].average, Average, 1); 84 86 catalog[0].Naverage = 0; … … 89 91 90 92 /* read Measure table header */ 91 if (!gfits_fread_header ( f, &header)) {93 if (!gfits_fread_header (catalog[0].f, &header)) { 92 94 if (VERBOSE) fprintf (stderr, "can't read table measure header"); 93 95 return (FALSE); … … 95 97 /* read Measure table data */ 96 98 if (catalog[0].catflags & LOAD_MEAS) { 97 if (!gfits_fread_ftable_data ( f, &ftable, FALSE)) {99 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 98 100 if (VERBOSE) fprintf (stderr, "can't read table measure data"); 99 101 return (FALSE); … … 107 109 } else { 108 110 Nbytes = gfits_data_size (&header); 109 fseeko ( f, Nbytes, SEEK_CUR);111 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 110 112 ALLOCATE (catalog[0].measure, Measure, 1); 111 113 catalog[0].Nmeasure = 0; … … 114 116 115 117 /* read Missing table header */ 116 if (!gfits_fread_header ( f, &header)) {118 if (!gfits_fread_header (catalog[0].f, &header)) { 117 119 if (VERBOSE) fprintf (stderr, "can't read table missing header"); 118 120 return (FALSE); … … 120 122 /* read Missing table data */ 121 123 if (catalog[0].catflags & LOAD_MISS) { 122 if (!gfits_fread_ftable_data ( f, &ftable, FALSE)) {124 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 123 125 if (VERBOSE) fprintf (stderr, "can't read table missing data"); 124 126 return (FALSE); … … 137 139 } else { 138 140 Nbytes = gfits_data_size (&header); 139 fseeko ( f, Nbytes, SEEK_CUR);141 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 140 142 ALLOCATE (catalog[0].missing, Missing, 1); 141 143 catalog[0].Nmissing = 0; … … 144 146 145 147 /* read secfilt table header */ 146 if (!gfits_fread_header ( f, &header)) {148 if (!gfits_fread_header (catalog[0].f, &header)) { 147 149 if (VERBOSE) fprintf (stderr, "can't read table secfilt header"); 148 150 return (FALSE); … … 150 152 /* read secfilt table data */ 151 153 if (catalog[0].catflags & LOAD_SECF) { 152 if (!gfits_fread_ftable_data ( f, &ftable, FALSE)) {154 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { 153 155 if (VERBOSE) fprintf (stderr, "can't read table secfilt data"); 154 156 return (FALSE); … … 188 190 /* no real need to skip the data array here... */ 189 191 Nbytes = gfits_data_size (&header); 190 fseeko ( f, Nbytes, SEEK_CUR);192 fseeko (catalog[0].f, Nbytes, SEEK_CUR); 191 193 if (primary != NULL) { 192 194 free (primary); -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_catalog_split.c
r31663 r33221 160 160 161 161 off_t Nbytes; 162 off_t Naverage, Nmeasure, Nmissing; 162 off_t Naverage; 163 off_t Nmeasure; 164 off_t Nmissing; 163 165 off_t Nitems; 164 166 int status, Nsecfilt; … … 209 211 210 212 /*** Average Table ***/ 213 214 /* need to read the table header to determine format (whether or not we read averages) */ 215 /* move pointer past PHU header -- must be already read (load_catalog) */ 216 Nbytes = catalog[0].header.datasize + gfits_data_size (&catalog[0].header); 217 fseeko (catalog[0].f, Nbytes, SEEK_SET); 218 219 /* read Average table header */ 220 if (!gfits_fread_header (catalog[0].f, &header)) { 221 if (VERBOSE) fprintf (stderr, "can't read table average header"); 222 return (FALSE); 223 } 211 224 if (catalog[0].catflags & LOAD_AVES) { 212 /* move pointer past header -- must be already read (load_catalog) */213 Nbytes = catalog[0].header.datasize + gfits_data_size (&catalog[0].header);214 fseeko (catalog[0].f, Nbytes, SEEK_SET);215 /* read Average table header */216 if (!gfits_fread_header (catalog[0].f, &header)) {217 if (VERBOSE) fprintf (stderr, "can't read table average header");218 return (FALSE);219 }220 225 /* read Average table data : format is irrelevant here */ 221 226 if (!gfits_fread_ftable_data (catalog[0].f, &ftable, FALSE)) { … … 234 239 catalog[0].Naves_off = 0; 235 240 } else { 241 catalog[0].catformat = FtableGetFormat (&ftable); 236 242 ALLOCATE (catalog[0].average, Average, 1); 237 243 catalog[0].Naverage = 0; -
branches/eam_branches/ipp-20111122/Ohana/src/libdvo/src/dvo_convert.c
r29001 r33221 10 10 /** this file might be more readable if I use macros for the repetative 11 11 constructions below **/ 12 13 DVOTableFormat FtableGetFormat (FTable *ftable) { 14 15 DVOTableFormat format; 16 char extname[80]; 17 18 /* read the format of this table */ 19 if (!gfits_scan (ftable[0].header, "EXTNAME", "%s", 1, extname)) { 20 fprintf (stderr, "EXTNAME missing for average table\n"); 21 return (DVO_FORMAT_UNDEF); 22 } 23 24 if (!strcmp (extname, "DVO_AVERAGE")) { 25 format = DVO_FORMAT_INTERNAL; 26 return (format); 27 } 28 # define CONVERT_FORMAT(NAME, FORMAT) \ 29 if (!strcmp (extname, NAME)) { \ 30 format = DVO_FORMAT_##FORMAT; \ 31 return (format); } 32 33 CONVERT_FORMAT ("DVO_AVERAGE_ELIXIR", ELIXIR); 34 CONVERT_FORMAT ("DVO_AVERAGE_LONEOS", LONEOS); 35 CONVERT_FORMAT ("DVO_AVERAGE_PANSTARRS_DEV_0", PANSTARRS_DEV_0); 36 CONVERT_FORMAT ("DVO_AVERAGE_PANSTARRS_DEV_1", PANSTARRS_DEV_1); 37 CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_1", PS1_DEV_1); 38 CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_2", PS1_DEV_2); 39 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V1", PS1_V1); 40 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V2", PS1_V2); 41 CONVERT_FORMAT ("DVO_AVERAGE_PS1_REF", PS1_REF); 42 # undef CONVERT_FORMAT 43 44 fprintf (stderr, "table format unknown: %s\n", extname); 45 return (DVO_FORMAT_UNDEF); 46 } 12 47 13 48 /*** Average / FTable conversion functions ***/
Note:
See TracChangeset
for help on using the changeset viewer.
