IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7


Ignore:
Timestamp:
Nov 27, 2002, 1:26:15 PM (23 years ago)
Author:
eugene
Message:

added KEY, TBNULL, TBNA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/imregister/detrend/output.c

    r3 r7  
    2222
    2323/* write out complete binary FITS table in format of db */
    24 void DumpFitsBintable (char *filename, DetReg *image, Match *match, int Nmatch) {
     24int DumpFitsBintable (char *filename, DetReg *image, Match *match, int Nmatch) {
    2525
    2626  int i, j, Nx;
     
    4949
    5050int DumpFitsTable (char *filename, DetReg *detdata, Match *match, int Nmatch) {
     51# define NL 453
    5152 
    5253  Header header, theader;
     
    5556  DetReg *newdata;
    5657  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;
    5960  int i;
    6061  unsigned long tsecond;
     
    7778
    7879  /* define table layout */
     80  fits_define_table_column (&theader, "A32",  "KEY",        "unique identifier",         "");
    7981  fits_define_table_column (&theader, "A20",  "START_TIME", "start time of measurement", "yyyy/mm/dd,hh:mm:ss");
    8082  fits_define_table_column (&theader, "A20",  "STOP_TIME",  "stop time of measurement",  "yyyy/mm/dd,hh:mm:ss");
     
    8991  fits_define_table_column (&theader, "A256", "PATH",       "filename in db",            "");
    9092 
     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
    91120  /* create table, add data values */
    92121  fits_create_table (&theader, &table);
     
    95124  for (i = 0; i < Nmatch; i++) {
    96125    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
    97138    startstr = sec_to_date (newdata[0].tstart);
    98139    stopstr  = sec_to_date (newdata[0].tstop);
     
    101142    filtstr  = filterhash[newdata[0].filter];
    102143    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,
    105146              typestr, filtstr, ccdstr,
    106147              newdata[0].Nentry, newdata[0].Norder,
     
    122163  fits_fwrite_table   (f, &table);
    123164  fclose (f);
    124   return (TRUE);
     165  exit (0);
    125166}
    126167
Note: See TracChangeset for help on using the changeset viewer.