Changeset 7
- Timestamp:
- Nov 27, 2002, 1:26:15 PM (23 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/imregister/detrend/output.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/imregister/detrend/output.c
r3 r7 22 22 23 23 /* write out complete binary FITS table in format of db */ 24 voidDumpFitsBintable (char *filename, DetReg *image, Match *match, int Nmatch) {24 int DumpFitsBintable (char *filename, DetReg *image, Match *match, int Nmatch) { 25 25 26 26 int i, j, Nx; … … 49 49 50 50 int DumpFitsTable (char *filename, DetReg *detdata, Match *match, int Nmatch) { 51 # define NL 453 51 52 52 53 Header header, theader; … … 55 56 DetReg *newdata; 56 57 FILE *f; 57 char *startstr, *stopstr, *regstr, line[ 421];58 char *filtstr, *typestr, *ccdstr, *datestr ;58 char *startstr, *stopstr, *regstr, line[NL], key[33]; 59 char *filtstr, *typestr, *ccdstr, *datestr, *p; 59 60 int i; 60 61 unsigned long tsecond; … … 77 78 78 79 /* define table layout */ 80 fits_define_table_column (&theader, "A32", "KEY", "unique identifier", ""); 79 81 fits_define_table_column (&theader, "A20", "START_TIME", "start time of measurement", "yyyy/mm/dd,hh:mm:ss"); 80 82 fits_define_table_column (&theader, "A20", "STOP_TIME", "stop time of measurement", "yyyy/mm/dd,hh:mm:ss"); … … 89 91 fits_define_table_column (&theader, "A256", "PATH", "filename in db", ""); 90 92 93 /* define TNULL, TBNA values */ 94 fits_modify (&theader, "TNULL1", "%s", 1, ""); 95 fits_modify (&theader, "TNULL2", "%s", 1, ""); 96 fits_modify (&theader, "TNULL3", "%s", 1, ""); 97 fits_modify (&theader, "TNULL4", "%s", 1, ""); 98 fits_modify (&theader, "TNULL5", "%lf", 1, (float) -1); 99 fits_modify (&theader, "TNULL6", "%s", 1, ""); 100 fits_modify (&theader, "TNULL7", "%s", 1, ""); 101 fits_modify (&theader, "TNULL8", "%s", 1, ""); 102 fits_modify (&theader, "TNULL9", "%d", 1, -1); 103 fits_modify (&theader, "TNULL10", "%d", 1, -1); 104 fits_modify (&theader, "TNULL11", "%s", 1, ""); 105 fits_modify (&theader, "TNULL12", "%s", 1, ""); 106 107 fits_modify (&theader, "TBNA1", "%s", 1, "NA"); 108 fits_modify (&theader, "TBNA2", "%s", 1, "NA"); 109 fits_modify (&theader, "TBNA3", "%s", 1, "NA"); 110 fits_modify (&theader, "TBNA4", "%s", 1, "NA"); 111 fits_modify (&theader, "TBNA5", "%lf", 1, (float) -2); 112 fits_modify (&theader, "TBNA6", "%s", 1, "NA"); 113 fits_modify (&theader, "TBNA7", "%s", 1, "NA"); 114 fits_modify (&theader, "TBNA8", "%s", 1, "NA"); 115 fits_modify (&theader, "TBNA9", "%d", 1, -2); 116 fits_modify (&theader, "TBNA10", "%d", 1, -2); 117 fits_modify (&theader, "TBNA11", "%s", 1, "NA"); 118 fits_modify (&theader, "TBNA12", "%s", 1, "NA"); 119 91 120 /* create table, add data values */ 92 121 fits_create_table (&theader, &table); … … 95 124 for (i = 0; i < Nmatch; i++) { 96 125 newdata = &detdata[match[i].image]; 126 127 /* key = 02Bk02.flat.V.00.00 */ 128 p = strrchr (newdata[0].filename, '/'); 129 if (p == (char *) NULL) { 130 p = newdata[0].filename; 131 } else { 132 p ++; 133 } 134 bzero (key, 33); 135 strncpy (key, p, 32); 136 if ((p = strrchr (key, '.')) != (char *) NULL) *p = 0; 137 97 138 startstr = sec_to_date (newdata[0].tstart); 98 139 stopstr = sec_to_date (newdata[0].tstop); … … 101 142 filtstr = filterhash[newdata[0].filter]; 102 143 ccdstr = ccds[newdata[0].ccd]; 103 snprintf (line, 421, "%20s%20s%20s%7.1f%10s%10s%7s%3d%3d%64s%256s",104 startstr, stopstr, regstr, newdata[0].exptime,144 snprintf (line, NL, "%32s%20s%20s%20s%7.1f%10s%10s%7s%3d%3d%64s%256s", 145 key, startstr, stopstr, regstr, newdata[0].exptime, 105 146 typestr, filtstr, ccdstr, 106 147 newdata[0].Nentry, newdata[0].Norder, … … 122 163 fits_fwrite_table (f, &table); 123 164 fclose (f); 124 return (TRUE);165 exit (0); 125 166 } 126 167
Note:
See TracChangeset
for help on using the changeset viewer.
