! @@ inemmi input [output] ! ! purpose: read in an EMMI frame produced by the new chip ! and pastes the pieces into a file with a ! civilized name ! ! usage: ! @@ inemmi ONTT.2002-01-02T03:04:05.678.fits ! output: E02T030405.bdf ! or ! crea/aca emmi ONTT*fits ! exec/cat @@ inemmi emmi.cat ! or ! @@ inemmi toto.fits toto ! output: toto.bdf ! ! NOTE: ! works best with Midas version >= 02FEB. With prior version, some ! keywords will be missing from the final image. ! ! ! version: ! 2002-05-17 ohainaut CCD pre-scan adjusted to get correct gap. New Starts ! 2002-05-13 ohainaut hardcoded "START" to correct gap position ! 2002-05-12 ohainaut creation ! !---- defi/par p1 ? ? "input image" defi/par p2 emmi ? "output image" !- create output image file name defi/loc outname/c/1/72 {p2} if outname .eq. "emmi" .or. m$len(outname) .eq. 0 then if "{p1(1:5)}" .eq. "ONTT." then outname = "E{p1(14:15)}T{p1(17:18)}{p1(20:21)}{p1(23:24)}" endif endif wri/out "--> output file in {outname} ..." !- 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} emmiTmp | $ cat - > /dev/null $ mv emmiTmp.bdf emmiTmp0001.bdf $ mv emmiTmpa.bdf emmiTmp0002.bdf $ mv emmiTmpb.bdf emmiTmp0003.bdf $ mv emmiTmpc.bdf emmiTmp0004.bdf else indisk/mfits {p1} emmiTmp | $ cat - > /dev/null endif !- ensure the right START defi/loc i/i/1/1 0 defi/loc wstart/r/1/1 0. do i = 1 4 wstart = 1+ 1038*(4-i) writ/des emmiTmp{i} start {wstart},1 enddo !- what is that image? defi/loc binflag/i/1/1 0 binflag = {emmiTmp0001,step(1)} !- create big empty frame if binflag .eq. 1 then create/image {outname} 2,4152,4110 1.,1.,1.,1. else create/image {outname} 2,2076,2055 1.,1.,2.,2. endif !- insert pieces in the large frame inser/ima emmiTmp0001 {outname} inser/ima emmiTmp0002 {outname} inser/ima emmiTmp0003 {outname} inser/ima emmiTmp0004 {outname} writ/out "...done" !- update descriptors writ/out "updating descriptors..." if flagVers .eq. 0 then copy/dd emmiTmp0000 *,3 {outname} dele/desc {outname} IDENT copy/dd emmiTmp0000 ESO.OBS.NAME {outname} IDENT endif copy/dd emmiTmp0003 *DET*,3 {outname} ! copy the Detector stuff from 3, i.e. the one in the opt.axis. dele/desc {outname} CUNIT copy/dd emmiTmp0001 CUNIT {outname} CUNIT writ/out "...done" ! --oOo--