/* C program that prints header information for a list of STIS FITS */ /* images. */ /* It makes use of the imio.h functions. */ /* Created by R. Katsanis, 12-September-1997. */ /* Phil Hodge, 15-October-1997: include option to run as iraf task */ # include # include # include # include # include # define SZ_FNAME 255 # define FITS_LINE 81 static int PrintOne (char *); static void WriteError (int, char *); # if defined (NATIVE_IRAF) IRAFTASK(infostis) { # else int main(int argc, char **argv) { # endif char input[SZ_FNAME]; /* list of input files */ IRAFPointer imlist; char infile[SZ_FNAME]; /* one input image name */ int nfiles; /* total number of input files */ int j; /* loop index for file number */ int status; c_irafinit (argc,argv); # if defined (NATIVE_IRAF) c_clgstr ("input", input, SZ_FNAME); imlist = c_imtopen (input); nfiles = c_imtlen (imlist); if (nfiles < 1) { printf ("Null input, or no file matches input template.\n"); return; } # else if (argc < 2) { printf ("syntax: infostis file1 file2 ...\n"); exit (1); } nfiles = argc - 1; # endif /* Loop over all input files. */ for (j=0; j 0 ) imsets = nextend / 3; else imsets = 0; /* Convert RA to hh:mm:ss */ num1 = ra_targ / 15.0; num = modf(num1, &hh); num = (num1 - hh) * 60.0; ss = modf (num, &mm); ss = (num - mm) * 60.0; /* Convert declination decimal to dd:mm:ss */ if ( dec_targ < 0 ) dec = dec_targ * -1; else dec = dec_targ; num = modf (dec,&dd); num = (dec - dd) * 60.0; ds = modf (num,&dm); ds = (num - dm) * 60.0; /* Print formatted output. */ for (i=0; i<80; i+=1) printf ("-"); printf ("\n"); printf (" S T I S\n"); for (i=0; i<80; i+=1) printf ("-"); printf ("\n\n"); printf ("%18s %-18s %16s %-25s\n", "Rootname:", rootname, "Detector:", detector); printf ("%18s %-18s %16s %-25s\n", "Proposal ID:", propid, "Obs Type:", obstype); printf ("%18s %-18s %16s %-25s\n", "Exposure ID:", linenum, "Obs Mode:", obsmode); printf ("%54s %s\n", "Lamp:", sclamp); printf ("%18s %-18s %16s %-25s\n", "Target Name:", targname, "Aperture:", aperture); printf ("%19s %02.0f%s%02.0f%s%04.1f %23s %s\n", "Right Ascension: ", hh, ":", mm, ":", ss, "Filter:", filter); if ( dec_targ >= 0 ) printf ("%18s %s%02.0f%s%02.0f%s%04.1f %23s %s\n", "Declination:", "+", dd, ":", dm, ":", ds, "Opt Element:", opt_elem); else printf ("%18s %s%02.0f%s%02.0f%s%04.1f %23s %s\n", "Declination:", "-", dd,":", dm, ":", ds, "Opt Element:", opt_elem); if ( spectra ) printf ("%18s %-18.1f %16s %-25d\n", "Equinox:", equinox, "Central Wave:", cenwave); else if ( ccd ) printf ("%18s %-18.1f %16s %s\n", "Equinox:", equinox, "CCD amp:", ccdamp); else printf ("%18s %-18.1f\n", "Equinox:", equinox); if ( ccd && spectra ) printf ("%54s %s", "CCD amp:", ccdamp); else if ( ccd ) printf ("%54s %d", "Gain:", ccdgain); printf ("\n"); if ( ccd && spectra ) printf ("%18s %-18d %16s %-25d", "Axis 1 binning:", bin1, "Gain:", ccdgain); else if ( ccd ) printf ("%18s %-18d %16s %-25d", "Axis 1 binning:", bin1, "CR-split:", crsplit); else printf ("%18s %-18d","Axis 1 binning:", bin1); printf ("\n"); if ( ccd && spectra ) printf ("%18s %-18d %16s %-25d", "Axis 2 binning:", bin2, "CR-split:", crsplit); else printf ("%18s %-18d", "Axis 2 binning:", bin2); printf ("\n"); if ( subarray ) printf ("%18s %s\n\n", "Subarray:", "yes"); else printf ("%18s %s\n\n", "Subarray:", "no"); printf ("%18s %-.1f %s\n", "Total Exp. Time:", exptime, "sec"); printf ("%18s %-18d\n\n", "Number of imsets:", imsets); return (0); } static void WriteError (int errcode, char *infile) { if (errcode == 827) printf ("Can't open %s; skipping ...\n", infile); else printf ("ERROR (IRAF) %d: %s\n", c_iraferr(), c_iraferrmsg()); }