#Check images
!../chkim /data/oXXXXX/
ǥեȤ IRS1 κǿ 20 
!../chkim /data/oXXXXX/ 1 40

========================================================================================
#Ana Υ
ID: u07425  PW: oHRK8ir.

#s2o file ξ
echidna@192.168.109.64:/home/echidna2/s2ofiles
(PW: echidna)
========================================================================================
#export
!rm *.gif
export irs1_SXDS5a_lrxpb.fits irs1_SXDS5a_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5b_lrxpb.fits irs1_SXDS5b_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5c_lrxpb.fits irs1_SXDS5c_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5d_lrxpb.fits irs1_SXDS5d_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5e_lrxpb.fits irs1_SXDS5e_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5f_lrxpb.fits irs1_SXDS5f_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5g_lrxpb.fits irs1_SXDS5g_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5h_lrxpb.fits irs1_SXDS5h_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5i_lrxpb.fits irs1_SXDS5i_lrxpb.gif gif outban='setcmap(zscale(i1,-20,40),"heat")'
export irs1_SXDS5_lrypb.fits irs1_SXDS5_lrypb.gif gif outban='setcmap(zscale(i1,-12,24),"heat")'
export irs1_SXDS5_lrypbw.fits irs1_SXDS5_lrypbw.gif gif outban='setcmap(zscale(i1,-6,12),"heat")'
export irs1_SXDS5_linepos_lr.fits irs1_SXDS5_linepos_lr.gif gif outban='setcmap(zscale(i1,0,10),"heat")'
!convert -delay 100 -loop 0 -resize 50%  irs1_SXDS5?_lrxpb.gif irs1_SXDS5abcd_lrxpb.gif
!rm irs1_SXDS5?_lrxpb.gif

export irs2_SXDS5a_lrxpb.fits irs2_SXDS5a_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5b_lrxpb.fits irs2_SXDS5b_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5c_lrxpb.fits irs2_SXDS5c_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5d_lrxpb.fits irs2_SXDS5d_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5e_lrxpb.fits irs2_SXDS5e_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5f_lrxpb.fits irs2_SXDS5f_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5g_lrxpb.fits irs2_SXDS5g_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5h_lrxpb.fits irs2_SXDS5h_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5i_lrxpb.fits irs2_SXDS5i_lrxpb.gif gif outban='setcmap(zscale(i1,-10,20),"heat")'
export irs2_SXDS5_lrypb.fits irs2_SXDS5_lrypb.gif gif outban='setcmap(zscale(i1,-6,12),"heat")'
export irs2_SXDS5_lrypbw.fits irs2_SXDS5_lrypbw.gif gif outban='setcmap(zscale(i1,-6,12),"heat")'
export irs2_SXDS5_linepos_lr.fits irs2_SXDS5_linepos_lr.gif gif outban='setcmap(zscale(i1,0,10),"heat")'
!convert -delay 100 -loop 0 -resize 50%  irs2_SXDS5?_lrxpb.gif irs2_SXDS5ab_lrxpb.gif
!rm irs2_SXDS5?_lrxpb.gif

#clean
!ls FMSA?????????.fits
!rm FMSA?????????.fits
imdel *.imh,mask,mask2,check,bkg
imdel *x1.fits,*x2.fits,*x3.fits,*x4.fits,*x5.fits,*x6.fits,*x7.fits,*x8.fits,*x9.fits
imdel *y1.fits,*y2.fits,*y3.fits,*y4.fits,*y5.fits,*y6.fits,*y7.fits,*y8.fits,*y9.fits
!rm tmp* *~

========================================================================================
#Raster

!.../chkim /home/fmos01/reduction/20101113/ 1 25

displ /home/fmos01/reduction/20100928/FMSA00003065[0] 1
imarith @tmp4.tbl - /home/fmos01/reduction/20100928/FMSA00003065[0] @tmp3.tbl
!sed -e 's/FMSA/\!sed -e s\/fileno\//g' tmp3.tbl > tmp5.tbl
!sed -e 's/\.fits/\/g \.\.\/redscrs | sed -e s\/BAND\/lr\/g | sed -e s\/SHIFT\/0\/g > tmpscr\ncl < tmpscr/g' tmp5.tbl > tmpscr2
cl < tmpscr2

!sed -e 's/raster/raster2_lr/g' ../raster > tmpscr
cl < tmpscr
!sed -e 's/raster/raster2_js/g' ../raster | sed -e 's/100:1950/91:530/g' > tmpscr
cl < tmpscr
!sed -e 's/raster/raster2_jl/g' ../raster | sed -e 's/100:1950/531:970/g' > tmpscr
cl < tmpscr
!sed -e 's/raster/raster2_hs/g' ../raster | sed -e 's/100:1950/1071:1550/g' > tmpscr
cl < tmpscr
!sed -e 's/raster/raster2_hl/g' ../raster | sed -e 's/100:1950/1551:2030/g' > tmpscr
cl < tmpscr
#3x3 ξ
!sed -e 's/raster/raster2_lr/g' ../rasters > tmpscr
cl < tmpscr

========================================================================================
#weight ĤŤ͹碌
!echo ../20091028/irs1_SXDS5_lrxx > tmp1.tbl
!echo irs1_LKHA101b_lrxx >> tmp1.tbl
!echo irs1_SXDS5d_lrxx >> tmp1.tbl
!echo ../20091028/irs1_SXDS5_lryp > tmp2.tbl
!echo irs1_LKHA101b_lryp >> tmp2.tbl
!echo irs1_SXDS5d_lryp >> tmp2.tbl
!echo tmp1 > tmp.tbl
!echo tmp2 >> tmp.tbl
!echo tmp3 >> tmp.tbl
!echo tmp1a > tmpa.tbl
!echo tmp2a >> tmpa.tbl
!echo tmp3a >> tmpa.tbl
mdisp @tmp1.tbl 0

imdel @tmp.tbl,@tmpa.tbl,tmp0
fit1d @tmp1.tbl @tmp.tbl fit axis=1 inter- function=legendre order=1
imcopy @tmp.tbl @tmpa.tbl
imcomb @tmp.tbl tmp0 reject=minmax nhigh=0 nlow=2
imarith @tmp.tbl / tmp0 @tmp.tbl
imrepl tmp0 0. upper=50
imrepl tmp0 1. lower=50
imrepl @tmpa.tbl 1. lower=-50
imrepl @tmpa.tbl 0. upper=-50
imarith @tmp.tbl - 1. @tmp.tbl
imarith @tmp.tbl * tmp0 @tmp.tbl
imarith @tmp.tbl + 1. @tmp.tbl
imrepl @tmp.tbl 0. upper=0.
imarith @tmp.tbl * @tmpa.tbl @tmp.tbl
magnify @tmp.tbl @tmp.tbl 1. 9. y1=0.5 y2=200.5 interpo=nearest fluxcon-
imarith @tmp2.tbl * @tmp.tbl @tmp.tbl
imdel irs1_LKHA101all_lryp.fits
imsum @tmp.tbl irs1_LKHA101all_lryp.fits

======================================================================================
ޥ˥奢
export irs1_flat_lr.fits irs1_flat_lr.gif gif outban='setcmap(zscale(i1,0,20000),"heat")'
export tmp0.fits cont_tmp0.gif gif outban='setcmap(zscale(i1,0,40000),"heat")'
export mask.fits cont_mask.gif gif outban='setcmap(zscale(i1,1,0),"heat")'
export irs1_cont_lrm.fits irs1_cont_lrm.gif gif outban='setcmap(zscale(i1,0,40000),"heat")'
export check.fits cont_check.gif gif outban='setcmap(zscale(i1,0,40000),"heat")'
export irs1_cont_lre.fits irs1_cont_lre.gif gif outban='setcmap(zscale(i1,0,200000),"heat")'
export bkg.fits cont_bkg.gif gif outban='setcmap(zscale(i1,0,20000),"heat")'
export irs1_cont_lrs.fits irs1_cont_lrs.gif gif outban='setcmap(zscale(i1,0,200000),"heat")'
export irs1_cont_lra_bak.fits irs1_cont_lra_bak.gif gif outban='setcmap(zscale(i1,0,200000),"heat")'
export irs1_cont_lra.fits irs1_cont_lra.gif gif outban='setcmap(zscale(i1,0,2),"heat")'
export tmp0.fits flat_tmp0.gif gif outban='setcmap(zscale(i1,0,20000),"heat")'
export mask.fits flat_mask.gif gif outban='setcmap(zscale(i1,1,0),"heat")'
export irs1_flat_lrm.fits irs1_flat_lrm.gif gif outban='setcmap(zscale(i1,0,20000),"heat")'
export check.fits flat_check.gif gif outban='setcmap(zscale(i1,0,20000),"heat")'
export irs1_flat_lre.fits irs1_flat_lre.gif gif outban='setcmap(zscale(i1,0,100000),"heat")'
export bkg.fits flat_bkg.gif gif outban='setcmap(zscale(i1,0,10000),"heat")'
export irs1_flat_lrs.fits irs1_flat_lrs.gif gif outban='setcmap(zscale(i1,0,100000),"heat")'
export irs1_flat_lra.fits irs1_flat_lra.gif gif outban='setcmap(zscale(i1,0,100000),"heat")'
export irs1_flat_lrx.fits irs1_flat_lrx.gif gif outban='setcmap(zscale(i1,-3500,3500),"heat")'
export tmp0.fits ar_tmp0.gif gif outban='setcmap(zscale(i1,-100,1000),"heat")'
export mask.fits ar_mask.gif gif outban='setcmap(zscale(i1,1,0),"heat")'
export irs1_ar_lrm.fits irs1_ar_lrm.gif gif outban='setcmap(zscale(i1,-100,1000),"heat")'
export check.fits ar_check.gif gif outban='setcmap(zscale(i1,-100,1000),"heat")'
export irs1_ar_lre.fits irs1_ar_lre.gif gif outban='setcmap(zscale(i1,-500,5000),"heat")'
export bkg.fits ar_bkg.gif gif outban='setcmap(zscale(i1,-500,200),"heat")'
export irs1_ar_lrs.fits irs1_ar_lrs.gif gif outban='setcmap(zscale(i1,-500,5000),"heat")'
export irs1_ar_lra.fits irs1_ar_lra.gif gif outban='setcmap(zscale(i1,-500,5000),"heat")'
export irs1_ar_lrx.fits irs1_ar_lrx.gif gif outban='setcmap(zscale(i1,-500,500),"heat")'
export tmp1.fits ar_tmp1.gif gif outban='setcmap(zscale(i1,-500,5000),"heat")'
export check.fits ar_check2.gif gif outban='setcmap(zscale(i1,0,1),"heat")'
export irs1_ar_lrx.fits irs1_ar_lrx.gif gif outban='setcmap(zscale(i1,-500,500),"heat")'
export irs1_ar_lrw.fits irs1_ar_lrw.gif gif outban='setcmap(zscale(i1,0.9,1.8),"heat")'
export tmp0.fits sample1a1_tmp0.gif gif outban='setcmap(zscale(i1,-100,100),"heat")'
export mask.fits sample1a1_mask.gif gif outban='setcmap(zscale(i1,1,0),"heat")'
export irs1_sample1a1_lrm.fits irs1_sample1a1_lrm.gif gif outban='setcmap(zscale(i1,-100,100),"heat")'
export check.fits sample1a1_check.gif gif outban='setcmap(zscale(i1,-100,100),"heat")'
export irs1_sample1a1_lre.fits irs1_sample1a1_lre.gif gif outban='setcmap(zscale(i1,-500,500),"heat")'
export bkg.fits sample1a1_bkg.gif gif outban='setcmap(zscale(i1,-70,50),"heat")'
export irs1_sample1a1_lrs.fits irs1_sample1a1_lrs.gif gif outban='setcmap(zscale(i1,-500,500),"heat")'
export irs1_sample1a1_lra.fits irs1_sample1a1_lra.gif gif outban='setcmap(zscale(i1,-500,500),"heat")'
export irs1_sample1a1_lrx.fits irs1_sample1a1_lrx.gif gif outban='setcmap(zscale(i1,-500,500),"heat")'
export irs1_sample1_lr_spineerror.fits irs1_sample1_lr_spineerror.gif gif outban='setcmap(zscale(i1,0,1),"heat")'
export irs1_sample1a_lrxpb.fits irs1_sample1a_lrxpb.gif gif outban='setcmap(zscale(i1,-40,40),"heat")'
export irs1_sample1b_lrxpb.fits irs1_sample1b_lrxpb.gif gif outban='setcmap(zscale(i1,-40,40),"heat")'
export irs1_sample1c_lrxpb.fits irs1_sample1c_lrxpb.gif gif outban='setcmap(zscale(i1,-40,40),"heat")'
export irs1_sample1d_lrxpb.fits irs1_sample1d_lrxpb.gif gif outban='setcmap(zscale(i1,-40,40),"heat")'
export irs1_sample1_lrxpb.fits irs1_sample1_lrxpb.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_lryp.fits irs1_sample1_lryp.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export mask.fits sample1_mask.gif gif outban='setcmap(zscale(i1,1,0),"heat")'
export irs1_sample1_lrypb.fits irs1_sample1_lrypb0.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_flat_sample1_lra.fits irs1_flat_sample1_lra.gif gif outban='setcmap(zscale(i1,0,2),"heat")'
export irs1_sample1_lrypb1.fits irs1_sample1_lrypb1.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_lrypb2.fits irs1_sample1_lrypb2.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_lrypb.fits irs1_sample1_lrypb.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_linepos_lr.fits irs1_sample1_linepos_lr.gif gif outban='setcmap(zscale(i1,0,10),"heat")'
export tmp1 irs1_sample1_lrypb_beforemask.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export tmp1 irs1_sample1_lrypb_aftermask.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1a_lrxpb.fits irs1_sample1a_lrxpb_2nd.gif gif outban='setcmap(zscale(i1,-40,40),"heat")'
export irs1_sample1b_lrxpb.fits irs1_sample1b_lrxpb_2nd.gif gif outban='setcmap(zscale(i1,-40,40),"heat")'
export irs1_sample1c_lrxpb.fits irs1_sample1c_lrxpb_2nd.gif gif outban='setcmap(zscale(i1,-40,40),"heat")'
export irs1_sample1d_lrxpb.fits irs1_sample1d_lrxpb_2nd.gif gif outban='setcmap(zscale(i1,-40,40),"heat")'
export irs1_sample1_lrxpb.fits irs1_sample1_lrxpb_2nd.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_lryp.fits irs1_sample1_lryp_2nd.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export mask.fits sample1_mask_2nd.gif gif outban='setcmap(zscale(i1,1,0),"heat")'
export irs1_sample1_lrypb.fits irs1_sample1_lrypb0_2nd.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_lrypb.fits irs1_sample1_lrypb_2nd.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_linepos_lr.fits irs1_sample1_linepos_lr_2nd.gif gif outban='setcmap(zscale(i1,0,10),"heat")'
export tmp1 irs1_sample1_lrypb_beforemask_2nd.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export tmp1 irs1_sample1_lrypb_aftermask_2nd.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_lrypb_nosq.fits irs1_sample1_lrypb_nosq.gif gif outban='setcmap(zscale(i1,0,50),"heat")'
export irs1_sample1_lrypbw.fits irs1_sample1_lrypbw.gif gif outban='setcmap(zscale(i1,-20,20),"heat")'
export irs1_sample1_lrypbw_nosq.fits irs1_sample1_lrypbw_nosq.gif gif outban='setcmap(zscale(i1,0,50),"heat")'
export irs1_sample1_lrypbwx.fits irs1_sample1_lrypbwx.gif gif outban='setcmap(zscale(i1,-100,100),"heat")'
export irs1_sample1_lrypbwx_no.fits irs1_sample1_lrypbwx_no.gif gif outban='setcmap(zscale(i1,0,20),"heat")'
export tmp1.fits irs1_sample1_lrypbwx_fill.gif gif outban='setcmap(zscale(i1,-100,100),"heat")'
export tmp1.fits irs1_sample1_lrypbwx_fill_box.gif gif outban='setcmap(zscale(i1,-100,100),"heat")'


!ls FMSA*cr.fits

!ls FMSA*_054.fits | sed -e's/_054.fits//g' > tmp0
!sed -e's/^/\!~\/moritani\/irs1ramp /g' tmp0 > tmp1
!ls FMSA*_054.fits | sed -e's/_054/cr/g' > tmp2
!paste -d" " tmp1 tmp2 > tmp3
cl < tmp3
!ls FMSA*_054.fits | sed -e's/_054/tmp/g' > tmp3
imarith @tmp0 - @tmp2 @tmp3
imstati @tmp3 lower=1
imdel @tmp3
!rm tmp*

##20110212
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00005857tmp.fits      5460      677.     1896.       21.    63198.

##20101124
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00004201tmp.fits      9386     540.2     1236.       22.    27956.
 FMSA00004203tmp.fits      5928     819.9     2051.       21.    61389.
 FMSA00004205tmp.fits      7365     551.2     1409.       21.    28599.

##20101123
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00004101tmp.fits     15953     401.1     1231.       21.    66978.
 FMSA00004103tmp.fits      7089     655.6     1465.       23.    28480.
 FMSA00004107tmp.fits     40506     196.7     605.7       21.    33549.
 FMSA00004109tmp.fits     21187     400.5     1001.       22.    71034.
 FMSA00004111tmp.fits     10854      484.     1039.       22.    22679.
 FMSA00004121tmp.fits      4502     737.8     1818.       23.    33117.

##20101122
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00003995tmp.fits      8953     579.6     1282.       21.    26105.
 FMSA00003997tmp.fits     13039     456.6     1077.       21.    26182.
 FMSA00003999tmp.fits      5761     687.2     1643.       21.    25771.

##20101121
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00003895tmp.fits      6327     694.3     1588.       21.    28990.
 FMSA00003897tmp.fits      9656     531.6     1264.       22.    27854.
 FMSA00003903tmp.fits      8679     483.2     1561.       21.    45017.
 FMSA00003905tmp.fits     14730     357.2     1110.       21.    32800.
 FMSA00003907tmp.fits      7108     536.7     1680.       21.    44926.
 FMSA00003909tmp.fits     17984     410.1     924.4       21.    27166.
 FMSA00003911tmp.fits      8186     466.7     1441.       21.    38028.
 FMSA00003913tmp.fits     30491     394.2     713.1       21.    26814.
 FMSA00003917tmp.fits      8184      559.     1330.       21.    34007.
 FMSA00003919tmp.fits      5147     809.3     1645.       21.    24981.
 FMSA00003923tmp.fits      5086     798.9     1912.       21.    24965.
 FMSA00003929tmp.fits      5625     602.4     1683.       21.    28513.

##20101114
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00003593tmp.fits      6406     564.1     1450.       21.    24353.

##20100929
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00003301tmp.fits     22063     344.8     897.4       21.    30227.
 FMSA00003303tmp.fits     11858     393.7     1058.       21.    29265.
 FMSA00003305tmp.fits     27250     386.1     920.5       22.    68479.
 FMSA00003307tmp.fits     26474      388.     820.8       22.    31786.
 FMSA00003309tmp.fits     16188     398.2     998.4       21.    27850.
 FMSA00003311tmp.fits     23450     348.5     863.3       21.    29756.
 FMSA00003321tmp.fits     16055     319.9     996.7       21.    30244.
 FMSA00003323tmp.fits     24448     250.8     902.8       21.    37979.
 FMSA00003325tmp.fits      6485      699.     1618.       21.    44399.
 FMSA00003327tmp.fits     10877     458.4     1265.       21.    29968.

##20100928
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00003163tmp.fits      4863      649.     1666.       21.    26988.

##20100927
#               IMAGE      NPIX      MEAN    STDDEV       MIN       MAX
 FMSA00002919tmp.fits      5423     749.3     1847.       24.    37770.
 FMSA00002921tmp.fits      4831     685.9     1814.       21.    44742.
 FMSA00002927tmp.fits      4341     769.5     1539.       21.    22251.
 FMSA00002929tmp.fits     10064     374.7     1338.       21.    30413.
 FMSA00002931tmp.fits     15169     328.4     1193.       21.    36595.
 FMSA00002933tmp.fits     10494     416.3     1224.       21.    34919.
 FMSA00002937tmp.fits      5026     731.7     1813.       21.    32010.
 FMSA00002939tmp.fits      8785     458.8     1409.       21.    32003.

------------------------------------------------------------------------------------
#Flat

!../irs1ramp thermal00 test1.fits cr
!../irs1ramp thermal01 test1.fits cr
!../irs1ramp thermal02 test1.fits cr
!../irs1ramp thermal03 test1.fits cr
!../irs1ramp thermal04 test1.fits cr
!../irs1ramp thermal05 test1.fits cr
!../irs1ramp thermal06 test1.fits cr
!../irs1ramp thermal07 test1.fits cr
!../irs1ramp thermal08 test1.fits cr
!../irs1ramp thermal09 test1.fits cr
!../irs1ramp thermal10 test1.fits cr
!../irs1ramp thermal11 test1.fits cr
!../irs1ramp thermal12 test1.fits cr
!../irs1ramp thermal13 test1.fits cr
!../irs1ramp thermal14 test1.fits cr
!../irs1ramp thermal15 test1.fits cr
!../irs1ramp thermal16 test1.fits cr
!../irs1ramp thermal17 test1.fits cr
!../irs1ramp thermal18 test1.fits cr
!../irs1ramp thermal19 test1.fits cr
!../irs1ramp thermal20 test1.fits cr
!../irs1ramp thermal21 test1.fits cr
!../irs1ramp thermal22 test1.fits cr
!../irs1ramp thermal23 test1.fits cr
!../irs1ramp thermal24 test1.fits cr
!../irs1ramp thermal25 test1.fits cr
!../irs1ramp thermal26 test1.fits cr
!../irs1ramp thermal27 test1.fits cr
!../irs1ramp thermal28 test1.fits cr
!../irs1ramp thermal29 test1.fits cr
!../irs1ramp thermal30 test1.fits cr

!ls thermal00_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal00_000cr @tmp1.tbl
!ls thermal01_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal01_000cr @tmp1.tbl
!ls thermal02_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal02_000cr @tmp1.tbl
!ls thermal03_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal03_000cr @tmp1.tbl
!ls thermal04_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal04_000cr @tmp1.tbl
!ls thermal05_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal05_000cr @tmp1.tbl
!ls thermal06_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal06_000cr @tmp1.tbl
!ls thermal07_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal07_000cr @tmp1.tbl
!ls thermal08_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal08_000cr @tmp1.tbl
!ls thermal09_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal09_000cr @tmp1.tbl
!ls thermal10_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal10_000cr @tmp1.tbl
!ls thermal11_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal11_000cr @tmp1.tbl
!ls thermal12_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal12_000cr @tmp1.tbl
!ls thermal13_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal13_000cr @tmp1.tbl
!ls thermal14_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal14_000cr @tmp1.tbl
!ls thermal15_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal15_000cr @tmp1.tbl
!ls thermal16_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal16_000cr @tmp1.tbl
!ls thermal17_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal17_000cr @tmp1.tbl
!ls thermal18_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal18_000cr @tmp1.tbl
!ls thermal19_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal19_000cr @tmp1.tbl
!ls thermal20_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal20_000cr @tmp1.tbl
!ls thermal21_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal21_000cr @tmp1.tbl
!ls thermal22_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal22_000cr @tmp1.tbl
!ls thermal23_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal23_000cr @tmp1.tbl
!ls thermal24_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal24_000cr @tmp1.tbl
!ls thermal25_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal25_000cr @tmp1.tbl
!ls thermal26_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal26_000cr @tmp1.tbl
!ls thermal27_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal27_000cr @tmp1.tbl
!ls thermal28_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal28_000cr @tmp1.tbl
!ls thermal29_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal29_000cr @tmp1.tbl
!ls thermal30_???cr.fits | tail -n+2 > tmp1.tbl
imarith @tmp1.tbl - thermal30_000cr @tmp1.tbl

imdel tmp1,tmp2
!ls thermal??_001cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_001cr.fits
imfunc tmp2 noise_001cr.fits sqrt
imcopy tmp1 thermal_001cr.fits

imdel tmp1,tmp2
!ls thermal??_002cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_002cr.fits
imfunc tmp2 noise_002cr.fits sqrt
imcopy tmp1 thermal_002cr.fits

imdel tmp1,tmp2
!ls thermal??_003cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_003cr.fits
imfunc tmp2 noise_003cr.fits sqrt
imcopy tmp1 thermal_003cr.fits

imdel tmp1,tmp2
!ls thermal??_004cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_004cr.fits
imfunc tmp2 noise_004cr.fits sqrt
imcopy tmp1 thermal_004cr.fits

imdel tmp1,tmp2
!ls thermal??_005cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_005cr.fits
imfunc tmp2 noise_005cr.fits sqrt
imcopy tmp1 thermal_005cr.fits

imdel tmp1,tmp2
!ls thermal??_006cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_006cr.fits
imfunc tmp2 noise_006cr.fits sqrt
imcopy tmp1 thermal_006cr.fits

imdel tmp1,tmp2
!ls thermal??_007cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_007cr.fits
imfunc tmp2 noise_007cr.fits sqrt
imcopy tmp1 thermal_007cr.fits

imdel tmp1,tmp2
!ls thermal??_008cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_008cr.fits
imfunc tmp2 noise_008cr.fits sqrt
imcopy tmp1 thermal_008cr.fits

imdel tmp1,tmp2
!ls thermal??_009cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_009cr.fits
imfunc tmp2 noise_009cr.fits sqrt
imcopy tmp1 thermal_009cr.fits

imdel tmp1,tmp2
!ls thermal??_010cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_010cr.fits
imfunc tmp2 noise_010cr.fits sqrt
imcopy tmp1 thermal_010cr.fits

imdel tmp1,tmp2
!ls thermal??_011cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_011cr.fits
imfunc tmp2 noise_011cr.fits sqrt
imcopy tmp1 thermal_011cr.fits

imdel tmp1,tmp2
!ls thermal??_012cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_012cr.fits
imfunc tmp2 noise_012cr.fits sqrt
imcopy tmp1 thermal_012cr.fits

imdel tmp1,tmp2
!ls thermal??_013cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_013cr.fits
imfunc tmp2 noise_013cr.fits sqrt
imcopy tmp1 thermal_013cr.fits

imdel tmp1,tmp2
!ls thermal??_014cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_014cr.fits
imfunc tmp2 noise_014cr.fits sqrt
imcopy tmp1 thermal_014cr.fits

imdel tmp1,tmp2
!ls thermal??_015cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_015cr.fits
imfunc tmp2 noise_015cr.fits sqrt
imcopy tmp1 thermal_015cr.fits

imdel tmp1,tmp2
!ls thermal??_016cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_016cr.fits
imfunc tmp2 noise_016cr.fits sqrt
imcopy tmp1 thermal_016cr.fits

imdel tmp1,tmp2
!ls thermal??_017cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_017cr.fits
imfunc tmp2 noise_017cr.fits sqrt
imcopy tmp1 thermal_017cr.fits

imdel tmp1,tmp2
!ls thermal??_018cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_018cr.fits
imfunc tmp2 noise_018cr.fits sqrt
imcopy tmp1 thermal_018cr.fits

imdel tmp1,tmp2
!ls thermal??_019cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_019cr.fits
imfunc tmp2 noise_019cr.fits sqrt
imcopy tmp1 thermal_019cr.fits

imdel tmp1,tmp2
!ls thermal??_020cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_020cr.fits
imfunc tmp2 noise_020cr.fits sqrt
imcopy tmp1 thermal_020cr.fits

imdel tmp1,tmp2
!ls thermal??_021cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_021cr.fits
imfunc tmp2 noise_021cr.fits sqrt
imcopy tmp1 thermal_021cr.fits

imdel tmp1,tmp2
!ls thermal??_022cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_022cr.fits
imfunc tmp2 noise_022cr.fits sqrt
imcopy tmp1 thermal_022cr.fits

imdel tmp1,tmp2
!ls thermal??_023cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_023cr.fits
imfunc tmp2 noise_023cr.fits sqrt
imcopy tmp1 thermal_023cr.fits

imdel tmp1,tmp2
!ls thermal??_024cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_024cr.fits
imfunc tmp2 noise_024cr.fits sqrt
imcopy tmp1 thermal_024cr.fits

imdel tmp1,tmp2
!ls thermal??_025cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_025cr.fits
imfunc tmp2 noise_025cr.fits sqrt
imcopy tmp1 thermal_025cr.fits

imdel tmp1,tmp2
!ls thermal??_026cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_026cr.fits
imfunc tmp2 noise_026cr.fits sqrt
imcopy tmp1 thermal_026cr.fits

imdel tmp1,tmp2
!ls thermal??_027cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_027cr.fits
imfunc tmp2 noise_027cr.fits sqrt
imcopy tmp1 thermal_027cr.fits

imdel tmp1,tmp2
!ls thermal??_028cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_028cr.fits
imfunc tmp2 noise_028cr.fits sqrt
imcopy tmp1 thermal_028cr.fits

imdel tmp1,tmp2
!ls thermal??_029cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_029cr.fits
imfunc tmp2 noise_029cr.fits sqrt
imcopy tmp1 thermal_029cr.fits

imdel tmp1,tmp2
!ls thermal??_030cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_030cr.fits
imfunc tmp2 noise_030cr.fits sqrt
imcopy tmp1 thermal_030cr.fits

imdel tmp1,tmp2
!ls thermal??_031cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_031cr.fits
imfunc tmp2 noise_031cr.fits sqrt
imcopy tmp1 thermal_031cr.fits

imdel tmp1,tmp2
!ls thermal??_032cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_032cr.fits
imfunc tmp2 noise_032cr.fits sqrt
imcopy tmp1 thermal_032cr.fits

imdel tmp1,tmp2
!ls thermal??_033cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_033cr.fits
imfunc tmp2 noise_033cr.fits sqrt
imcopy tmp1 thermal_033cr.fits

imdel tmp1,tmp2
!ls thermal??_034cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_034cr.fits
imfunc tmp2 noise_034cr.fits sqrt
imcopy tmp1 thermal_034cr.fits

imdel tmp1,tmp2
!ls thermal??_035cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_035cr.fits
imfunc tmp2 noise_035cr.fits sqrt
imcopy tmp1 thermal_035cr.fits

imdel tmp1,tmp2
!ls thermal??_036cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_036cr.fits
imfunc tmp2 noise_036cr.fits sqrt
imcopy tmp1 thermal_036cr.fits

imdel tmp1,tmp2
!ls thermal??_037cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_037cr.fits
imfunc tmp2 noise_037cr.fits sqrt
imcopy tmp1 thermal_037cr.fits

imdel tmp1,tmp2
!ls thermal??_038cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_038cr.fits
imfunc tmp2 noise_038cr.fits sqrt
imcopy tmp1 thermal_038cr.fits

imdel tmp1,tmp2
!ls thermal??_039cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_039cr.fits
imfunc tmp2 noise_039cr.fits sqrt
imcopy tmp1 thermal_039cr.fits

imdel tmp1,tmp2
!ls thermal??_040cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_040cr.fits
imfunc tmp2 noise_040cr.fits sqrt
imcopy tmp1 thermal_040cr.fits

imdel tmp1,tmp2
!ls thermal??_041cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_041cr.fits
imfunc tmp2 noise_041cr.fits sqrt
imcopy tmp1 thermal_041cr.fits

imdel tmp1,tmp2
!ls thermal??_042cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_042cr.fits
imfunc tmp2 noise_042cr.fits sqrt
imcopy tmp1 thermal_042cr.fits

imdel tmp1,tmp2
!ls thermal??_043cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_043cr.fits
imfunc tmp2 noise_043cr.fits sqrt
imcopy tmp1 thermal_043cr.fits

imdel tmp1,tmp2
!ls thermal??_044cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_044cr.fits
imfunc tmp2 noise_044cr.fits sqrt
imcopy tmp1 thermal_044cr.fits

imdel tmp1,tmp2
!ls thermal??_045cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_045cr.fits
imfunc tmp2 noise_045cr.fits sqrt
imcopy tmp1 thermal_045cr.fits

imdel tmp1,tmp2
!ls thermal??_046cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_046cr.fits
imfunc tmp2 noise_046cr.fits sqrt
imcopy tmp1 thermal_046cr.fits

imdel tmp1,tmp2
!ls thermal??_047cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_047cr.fits
imfunc tmp2 noise_047cr.fits sqrt
imcopy tmp1 thermal_047cr.fits

imdel tmp1,tmp2
!ls thermal??_048cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_048cr.fits
imfunc tmp2 noise_048cr.fits sqrt
imcopy tmp1 thermal_048cr.fits

imdel tmp1,tmp2
!ls thermal??_049cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_049cr.fits
imfunc tmp2 noise_049cr.fits sqrt
imcopy tmp1 thermal_049cr.fits

imdel tmp1,tmp2
!ls thermal??_050cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_050cr.fits
imfunc tmp2 noise_050cr.fits sqrt
imcopy tmp1 thermal_050cr.fits

imdel tmp1,tmp2
!ls thermal??_051cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_051cr.fits
imfunc tmp2 noise_051cr.fits sqrt
imcopy tmp1 thermal_051cr.fits

imdel tmp1,tmp2
!ls thermal??_052cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_052cr.fits
imfunc tmp2 noise_052cr.fits sqrt
imcopy tmp1 thermal_052cr.fits

imdel tmp1,tmp2
!ls thermal??_053cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_053cr.fits
imfunc tmp2 noise_053cr.fits sqrt
imcopy tmp1 thermal_053cr.fits

imdel tmp1,tmp2
!ls thermal??_054cr.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl tmp1
imarith @tmp1.tbl - tmp1 @tmp1.tbl
!rm tmp2.tbl
imstati @tmp1.tbl fields=mean format- > tmp2.tbl
imarith @tmp1.tbl - @tmp2.tbl @tmp1.tbl
imarith @tmp1.tbl * @tmp1.tbl @tmp1.tbl
imcomb @tmp1.tbl tmp2
imarith tmp1 / tmp2 convfac_054cr.fits
imfunc tmp2 noise_054cr.fits sqrt
imcopy tmp1 thermal_054cr.fits

imhist convfac_050cr z1=-0.005 z2=10.005 binwidt=0.01 nbins=1001 listout+ > convfac_hist.tbl
imhist convfac_025cr z1=-0.005 z2=10.005 binwidt=0.01 nbins=1001 listout+ > convfac_hist2.tbl
!scp convfac_hist*.tbl fmos@192.168.109.64:iwamuro/

!rm tmp?.tbl
imstati thermal_???cr.fits fields=midpt format- > tmp1.tbl
imstati noise_???cr.fits fields=midpt format- > tmp2.tbl
imstati thermal_???cr.fits fields=stddev format- > tmp3.tbl
imstati noise_???cr.fits fields=stddev format- > tmp4.tbl
!paste -d" " tmp1.tbl tmp2.tbl tmp3.tbl tmp4.tbl > count_noise.tbl
!scp count_noise.tbl fmos@192.168.109.64:iwamuro/

!ls thermal??.fits | tail -n+2 > tmp1.tbl
imcomb @tmp1.tbl thermal.fits reject=sigclip lsigma=2 hsigma=2
imdel test1
imarith thermal / 54 test1

!ls thermal_???cr.fits > tmp1.tbl
!cat -n tmp1.tbl | cut -f1 > tmp2.tbl
!sed -e 's/thermal/resfrac/g' tmp1.tbl > tmp3.tbl
imdel @tmp3.tbl
imarith @tmp1.tbl / @tmp2.tbl @tmp3.tbl
imarith @tmp3.tbl / test1 @tmp3.tbl
imarith @tmp3.tbl - 1. @tmp3.tbl
!rm tmp.tbl
imstati @tmp3.tbl fields=mean,stddev format- > tmp.tbl
!cat -n tmp.tbl > count_resfrac.tbl
#imstati thermal
#!emacs -nw count_resfrac.tbl
!scp count_resfrac.tbl fmos@192.168.109.64:iwamuro/

------------------------------------------------------------------------------------------------------------
!ls convfac_???cr.fits | tail -n+10 > tmp.tbl
imcomb @tmp.tbl convfac reject=sigclip lsigma=2 hsigma=2

!rm tmp.tbl
imstati thermal fields=midpt format- > tmp.tbl
imarith thermal / @tmp.tbl flat
imdel tmp1
imcopy flat tmp1
imrepl tmp1 0. upper=0.1
imrepl tmp1 0. lower=2
imrepl tmp1 1. lower=0.1
imstati tmp1 upper=0.5
imdel tmp2
imcopy convfac tmp2
imrepl tmp2 0. upper=0.2
imrepl tmp2 0. lower=8
imrepl tmp2 1. lower=0.2
imstati tmp2 upper=0.5
imdel badpixr
imarith tmp1 * tmp2 badpixr
imstati badpixr upper=0.5

imdel mask,tmp1
convolve badpixr.fits mask.fits "0. 0.2 0.; 0.2 0.2 0.2; 0. 0.2 0."
imrepl mask 0. upper=0.9
!../fixbadpix flat.fits tmp1.fits
imdel flat
imrename tmp1 flat
