!------------------------------------------------------------------------ ! E.S.O. - VLT project ! ! "@(#) $Id: insusi.prg,v 2.0+ 2003/09/06 02:20:11 vltsccm Exp $" ! ! usage: ! @@ insusi ONTT.2002-01-02T03:04:05.678.fits ! output: su_02T030405.bdf ! or ! crea/aca susi ONTT*fits ! exec/cat @@ insusi susi.cat ! or ! @@ insusi toto.fits toto ! output: toto.bdf ! ! purpose: read in an SUSI frame produced by the multiextension standard ! and pastes the pieces into a file with a ! civilized name ! ! NOTE: ! works best with Midas version >= 02FEB. With prior version, some ! keywords will be missing from the final image. ! ! SUSI context: ! indisk/susi ! insusi/telescope ! ! ! who when what ! --------- -------- ---------------------------------------------- ! ohainaut 2003-09-30 fixed output name ! ohainaut 2003-09-04 creation from inemmi ! ! !------------------------------------------------------------------------- defi/par p1 ? ? "input image" defi/par p2 susi ? "output image" defi/loc i/i/1/1 0 !- create output image file name defi/loc outname/c/1/72 {p2} if outname .eq. "susi" .or. m$len(outname) .eq. 0 then if "{p1(1:5)}" .eq. "ONTT." then outname = "su_{p1(14:15)}T{p1(17:18)}{p1(20:21)}{p1(23:24)}" endif if "{p1(1:5)}" .eq. "SUSI2" then outname = "su_{p1(15:16)}T{p1(18:19)}{p1(21:22)}{p1(24:25)}" endif endif wri/out "--> output file in {outname}..." $ rm -f susiTmp0*bdf !- which version of MIDAS are we using? defi/loc midVers/c/1/2 {MID$SESS(16:17)} defi/loc flagVers/i/1/1 0 if {midVers} .ge. 98 flagVers = 1 if {midvers} .le. 01 flagVers = 1 !- read in the fits if flagVers .eq. 1 then writ/out "WARNING: using Midas version earlier than 02FEB" writ/out " some keywords will be missing from the header" writ/out " You may want to upgrade " indis/fits {p1} susiTmp | $ cat - > /dev/null $ mv susiTmp.bdf susiTmp0001.bdf $ mv susiTmpa.bdf susiTmp0002.bdf else indisk/mfits {p1} susiTmp | $ cat - > /dev/null endif !- check if it was a multiple extension fits i = m$exist("susiTmp0002.bdf") if i .eq. 1 then !-- we have a mult. extension !- what is that image? defi/loc binflag/i/1/1 0 binflag = {susiTmp0001,step(1)} aver/ima {outname} = susiTmp0001,susiTmp0002 M 0 average !- update descriptors writ/out "updating descriptors..." if flagVers .eq. 0 then copy/dd susiTmp0000 *,3 {outname} dele/desc {outname} IDENT copy/dd susiTmp0000 ESO.OBS.NAME {outname} IDENT endif copy/dd susiTmp0001 *DET*,3 {outname} ! copy the Detector stuff from 3, i.e. the one in the opt.axis. dele/desc {outname} CUNIT copy/dd susiTmp0001 CUNIT {outname} CUNIT else !- this was not a mult. ext. image $ mv susiTmp0001.bdf {outname}.bdf endif outputc = "{outname}.bdf" wri/out "...done" ! --oOo--