------------------------------------------------------------------
FMOS Data Reduction Appendix
------------------------------------------------------------------
#When very faint stripes apper in pair "X" image...
#Do followings before "#Combine" section, and make reduction of set "X" again.

!ls irs1_TARGET_NAME?_MODExpb.fits >  tmplist.tbl
#Remove the names of bad images from this table...
!emacs tmplist.tbl &
imdel tmp0,tmp1,check
imcomb @tmplist.tbl tmp0
imarith irs1_TARGET_NAMEX_MODExpb - tmp0 tmp0
!../inverse tmp0.fits tmp1.fits 2.0 irs1_cont_MODEa.dat irs1_cont_MODEe1.dat irs1_cont_MODEe2.dat
displ irs1_TARGET_NAMEX_MODE.fits 1
imarith irs1_TARGET_NAMEX_MODE.fits - check irs1_TARGET_NAMEX_MODE.fits
displ irs1_TARGET_NAMEX_MODE.fits 2

------------------------------------------------------------------
#When the initial subtracted image has a slope in its background...
displ irs1_TARGET_NAMEX_MODE.fits 1
imdel tmp1
imsur irs1_TARGET_NAMEX_MODE tmp1 3 3 type_ou=fit functio=spline3 cross_t+ xmedian=30 ymedian=30
displ tmp1 2
#If it is acceptable,
imarith irs1_TARGET_NAMEX_MODE.fits - tmp1 irs1_TARGET_NAMEX_MODE.fits
displ irs1_TARGET_NAMEX_MODE.fits 3

------------------------------------------------------------------
#When one of the quadrant has no data ...

#Insert
| sed -e 's/#[quadrant No.]#//g'
#just after redscr0s*,redscr1s*,redscr2, and redscr3.
#(Take care redscr0s* are redscr1s* appear in the script
# generated by mkscr command.)
#Quadrant number is defined as follows.
#+---+
#|3|4|
#+-+-+
#|1|2|
#+-+-+
#For example, redproc_common_Q4dead and redproc_Q4dead is the template
#script for the case of no Q4 data in IRS2, corresponding to redproc_common 
#and redproc_, respectively.

------------------------------------------------------------------
#If you want gif images...

export irs1_TARGET_NAMEa_MODExpb.fits irs1_TARGET_NAMEa_MODExpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_TARGET_NAMEb_MODExpb.fits irs1_TARGET_NAMEb_MODExpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_TARGET_NAMEc_MODExpb.fits irs1_TARGET_NAMEc_MODExpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_TARGET_NAMEd_MODExpb.fits irs1_TARGET_NAMEd_MODExpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
!convert -delay 100 -loop 0 -resize 50%  irs1_TARGET_NAME?_MODExpb.gif irs1_TARGET_NAMEabcd_MODExpb.gif
!rm irs1_TARGET_NAME?_MODExpb.gif
export irs1_TARGET_NAME_MODEypb.fits irs1_TARGET_NAME_MODEypb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs1_TARGET_NAME_MODEypbw.fits irs1_TARGET_NAME_MODEypbw.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'

------------------------------------------------------------------
#If you want clean up your directory...

imdel *.imh,mask,mask2,check,bkg,*x?.fits,*y?.fits
!rm tmp* *~

------------------------------------------------------------------
