------------------------------------------------------------------
FMOS Data Reduction (see README2 also for extra cases)
------------------------------------------------------------------
### Manual ###
http://www.kusastro.kyoto-u.ac.jp/~iwamuro/FMOS/MANUAL/

### Download ###
wget http://www.kusastro.kyoto-u.ac.jp/~iwamuro/FMOS/REDUCTION/all.tgz
tar xvfz all.tgz
make
(cfitsio libraries are required to compile.)

### IRAF ###
mkiraf
...
emacs login.cl &
#Change default parameter
set     stdimage        = imt2048
set     imtype          = "fits"
#Add following lines before "keep" at the end of login.cl.
task imstatrej = home$imstatrej.cl
task mdisp = home$mdisp.cl
task rmstripe = home$rmstripe.cl
task rmstripe1 = home$rmstripe1.cl
task rmstripe2 = home$rmstripe2.cl
task rmstripe3 = home$rmstripe3.cl
task rmcross = home$rmcross.cl
task rmcross_ = home$rmcross_.cl
task quadlev = home$quadlev.cl
task rmchecker = home$rmchecker.cl

#!!!!!!!!!!!!!!!
#!!! Caution !!!
#!!!!!!!!!!!!!!!
# Make sure that "set -o noclobber" is disabled (or commented out) 
# in ~/.bashrc (or ~/.cshrc) to enable to overwrite temporary files 
# in the script.

ds9 &
cl
!mkdir oXXXXX
cd oXXXXX

ls -lt /data/oXXXXX
!../headerinfo /data/oXXXXX/ 1
!../headerinfo /data/oXXXXX/ 2
displ /data/oXXXXX/FMSA00000000[0] 1

### Dome Flat & CAL Lamp ###
#low resolution mode [lr]
!sed -e 's/MODE/lr/g' ../redproc_common > redproc_common
#high resolution mode [js/jm/jl/hs/hm/hl] ("J long" in this case)
!sed -e 's/MODE/jl/g' ../redproc_common | sed -e 's/redscr0s/redscr0/g' | sed -e 's/redscr1s/redscr1/g' > redproc_common
!emacs redproc_common &
#When MODEs of IRS1/IRS2 are not the same, join two scripts by ">> redproc_common" and delete unnecessary parts.

### OBJECT ###
#Replace "xxxx" to the object name before you paste these lines.
!sed -e 's/TARGET_NAME/xxxx/g' ../redproc | sed -e 's/MODE/lr/g' > redproc_xxxx
!sed -e 's/TARGET_NAME/xxxx/g' ../redproc_ | sed -e 's/MODE/lr/g' >> redproc_xxxx
!emacs redproc_xxxx &

#!!!!!!!!!!!!!!!
#!!! Caution !!!
#!!!!!!!!!!!!!!!
#Some stary images appear when the stellar spectra are too bright.
#You can see an example image having ghost images at
#http://www.kusastro.kyoto-u.ac.jp/~iwamuro/FMOS/MANUAL/irs1_ghost_lrypb.html
