%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1990 European Southern Observatory
%.IDENT      indiskmfit.hlq
%.AUTHOR     KB, IPG/ESO
%.KEYWORDS   MIDAS, help files, INDISK/MFITS
%.PURPOSE    On-line help file for the command: INDISK/MFITS
%.VERSION    1.0  31-AUG-2000 : Creation, KB
%----------------------------------------------------------------
\se
SECTION./MFIT
\es\co
INDISK/MFITS						30-OCT-2003  KB
\oc\su
INDISK/MFITS in_file [res_spec] [options] [backw_flg] [out_cat] [fhead_proc]
	create multiple images/tables from a (single) FITS file 
\us\pu
Purpose:
	Create Midas images/tables from all extensions of a single FITS file.
\up\sy
Syntax: 
	INDISK/MFITS in_file [res_spec] [options] [backw_flg] [out_cat]
                     [fhead_proc]
\ys\pa
	in_file = name of FITS file, i.e. `file.type' (a), 
            or name of FITS extensions (b), 
               specified as: `file.type[exta,extb,...]' 
	       with exta = n (number >= 0), or na-nb (interval), 
	       or string (to match keyword EXTNAME of an extension)
\ap\pa
	res_spec = root string for name generation (max. 4 chars)
            if in_file = (a), or name of result frame (image/table) 
	             for (b) if single extension;
            defaulted to `toto'
\ap\pa
	options = 3-character flag: list, create, keyword
            list flag:    F(ull), S(hort), N(one) \\
            create flag:  N(o create), O(original format),
                          F(loating point format) \\
            keyword flag: Y(es history stored), N(o history stored),
	    these flags correspond to the relevant flags in INTAPE/FITS;
	    defaulted to: SOY
\ap\pa
	backw_flg = Yes/No (backwards compatibility flag with INTAPE/FITS)
	    only applicable for (a) containing no FITS extension,
            i.e. single FITS image or table - to yield same result name; 
	    defaulted to: Yes
\ap\pa
	out_cat = name of optional catalog which will contain the
	    names of all the Midas frames created from this FITS file
\ap\pa
	fhead_proc = optional FITS header processing flag,
	    of the form `action',exta,extb,extc,... 
	    or `action',* (for all extensions)
	    currently, only action = COPY is supported and copies keywords
	    of the FITS header of the primary FITS extension to other
	    extensions
\ap\sa
See also:
	INTAPE/FITS, INDISK/FITS
\as\on
Notes:
	  The no. of extensions processed (including an empty header if 
	present) is stored in keyword MID$INFO(4), the return status of 
	the FITS reader is saved in OUTPUTI(15).
	  Extensions in a FITS file may be accessed directly in Midas 
	via their number (primary header is no. 0), or via a string matching
	the keyword EXTNAME of a given FITS extension. Thus,
	      STATISTICS/IMAGE myfile.fits[7] 
	calculates the statistics of the 7th extension of `myfile.fits'.
	The same syntax is also possible for INDISK/MFITS, i.e. you can 
	read in just specific extensions or an empty primary header from 
	a FITS file. 
	OJO: This syntax is not valid for INTAPE/FITS nor INDISK/FITS!
	  The type of each extension is stored as a single char. into 
	keyword OUTPUTC, beginning with element 1 and going up. 
	So, max. 80 extensions of a FITS file can be handled this way. 
	The types are E (empty header), I (image), A (ASCII table), 
	B (Binary table), U (unknown FITS extension), and 'X' if the reading 
	of the data failed.
	  The output catalog option is useful, if you want to rebuild the
	FITS file from all its extensions later on.
	  The 'fhead_process' flag is needed for FITS files with general info
	for all extensions stored in the primary (maybe empty) FITS header.
 
	This command also works if the Midas work environment has been
	set to use FITS format for data files, whereas INDISK/FITS or
        INTAPE/FITS do not work in these circumstances. 
	INDISK/MFITS can then be used to split up a FITS file with 
	extensions into single FITS files (one per extension):
	  SET/MIDAS workenv=FITS
	  INDISK/MFITS fits_file split
          SET/MIDAS workenv=Midas		!if you want it...
	Then you have all extensions of `fits_file' as single FITS
	files `split*.fits' and `split*.tfits'.
	Param 'fhead_process' is not applicable in FITS working mode...
\no\exs
Examples:
\ex
	INDISK/MFITS lola.fits 
	  Assuming, that `lola.fits' has no extensions, we convert this FITS
          file to `toto0001.bdf' or `toto0001.tbl', depending upon if 
	  `lola.fits' was an image or a table (backw_flag defaulted is to Yes).
\xe\ex
	INDISK/MFITS lola.fits ? ? no
	  Convert FITS `lola.fits' to `toto0000.bdf' or `toto0001.tbl',
	  depending upon if `lola.fits' was an image or a table.
\xe\ex
	INDISK/MFITS tst0012.mt[4] chango.tbl
	  Convert extension #4 of FITS file `tst0012.mt' (assuming that
          it is a table extension) to Midas table `chango.tbl'.
\xe\ex
	INDISK/MFITS tst0012.mt[Asciitable] chango.tbl
	  Same as above, if extension #4 has keyword EXTNAME = 'Asciitable'.
\xe\ex
	INDISK/MFITS tst0003.mt 
	  Convert FITS file `tst0003.mt' to `toto0000.xyz', 
          `toto0001.xyz', ..., `totodddd.xyz' (dddd = no. of extensions in
          FITS file `tst0003.mt'. The file type `xyz' = `bdf' or `tbl'
          (`.bdf' also for empty FITS header), depending on type of extension.
\xe\ex
	INDISK/MFITS tst0003.mt p5=names.cat
	  As above but also store all the created file names in image catalog
          `names.cat'.
\xe\ex
	INDISK/MFITS tst0020.mt[1,quality,5-6,asciitable,10]
          Read in extensions #1,#5,#6,#10 and the ones with keyword
          EXTNAME=quality and asciitable from FITS file `tst0020.mt' and
	  create Midas files toto*.bdf or toto*.tbl.
\xe\ex
	INDISK/MFITS tst0011.mt p6=copy,*
	  Convert FITS file `tst0011.mt' to toto0000.bdf, toto0001.bdf, and
	  toto0002.tbl and copy all keywords (descriptors) of the primary
	  FITS header to toto0001.bdf and toto0002.tbl - but do not
	  overwrite any existing descriptors in the two files.
	  Keywords OUTPUTC(1:3) = EIT, MID$INFO(4) = 3.
\xe\ex
	For the FITS test file `tst0011.mt' used in the verifications of Midas
	  the difference in the three FITS input commands of Midas
	  INDISK/MFITS, INDISK/FITS, and INTAPE/FITS  is:
	INDISK/MFITS tst0011.mt kb
	 EFH   kb0000           : empty primary FITS header (NAXIS=0)
	 Image kb0001           : Ramp 16-bit      , naxis:  3, pixels:   73, 31
	 Table kb0002           :                  , Table r,c:       53,     8
	 (3 files created: kb0000.bdf, kb0001.bdf, kb0002.tbl)
	INDISK/FITS tst0011.mt kb
	 FITS file: tst0011.mt converted to: kb.bdf
	 FITS file: tst0011.mt converted to: kb.tbl
	 (2 files created: kb.bdf, kb.tbl)
	INTAPE/FITS 1 kb tst0011.mt
	 Image kb0001           : Ramp 16-bit      , naxis:  3, pixels:   73, 31
	 Table kb0001           :                  , Table r,c:       53,     8
	 (2 files created: bdf, kb0001.bdf, kb0002.tbl)
	 For INDIK/FITS, INTAPE/FITS the empty primary header is ignored.
\xe \sxe

