Index: /BAORadio/AmasNancay/trunk/dabchrom_plot.pic
===================================================================
--- /BAORadio/AmasNancay/trunk/dabchrom_plot.pic	(revision 611)
+++ /BAORadio/AmasNancay/trunk/dabchrom_plot.pic	(revision 611)
@@ -0,0 +1,141 @@
+set user     "AST"
+set source   "Abell1205"
+set srclower "abell1205"
+set date     "20110415"
+set cycle    "8"
+set mode     "Off"
+set toppath  "/sps/baoradio/AmasNancay/${user}"
+set path     "${toppath}/${source}/dab"
+set ppf      "0"
+
+# Read DAB calibration in Jansky (Voie E / PKS1127-14)
+#-----------------------------------------------------
+n/read nt_dabjy ${toppath}/DAB_Jy.dat " " dabfreq,0 dabjy,1
+newwin 1 1
+n/pl nt_dabjy.dabjy%dabfreq 1 ! "marker=star,4 magenta notit"
+settitle "DAB Voie E / PKS1127-14. Juin 2011"
+
+
+# Read DAB calibration in A.U. (from BAORadio data)
+#--------------------------------------------------
+openppf ${path}/dabchrom_${date}_${srclower}_${mode}.ppf
+ls
+
+## Baseline
+del b0 b1 b0f b1f
+objaoper /home/base row 0 b0
+objaoper /home/base row 1 b1
+objaoper /home/basefilt row 0 b0f
+objaoper /home/basefilt row 1 b1f
+
+## First DAB
+del dab01 dab11 dab01f dab11f dab01n dab11n
+objaoper /home/firstdab row 0 dab01
+objaoper /home/firstdab row 1 dab11
+objaoper /home/firstdabfilt row 0 dab01f
+objaoper /home/firstdabfilt row 1 dab11f
+objaoper /home/firstdelta row 0 dab01d
+objaoper /home/firstdelta row 1 dab11d
+
+## Second DAB
+del dab02 dab12 dab02f dab12f dab02n dab12n
+objaoper /home/seconddab row 0 dab02
+objaoper /home/seconddab row 1 dab12
+objaoper /home/seconddabfilt row 0 dab02f
+objaoper /home/seconddabfilt row 1 dab12f
+objaoper /home/seconddelta row 0 dab02d
+objaoper /home/seconddelta row 1 dab12d
+
+## Mean(delta(first,second DAB)) per channel
+c++exec TVector<r_4> meandab0d(dab01.NElts()); KeepObj(meandab0d); \
+        TVector<r_4> meandab1d(dab01.NElts()); KeepObj(meandab1d); \
+        meandab0d=dab01d+dab02d; meandab0d/=2.; \
+        meandab1d=dab11d+dab12d; meandab1d/=2.;
+
+## Save Mean(delta(first,second DAB)) per channel into a ppf file
+#if ( ppf == "1" ) then
+#  del daboff
+#  c++exec TMatrix<r_4> daboff(2,dab01.NElts()); KeepObj(daboff); \
+#          daboff.Row(0)=meandab0d; daboff.Row(1)=meandab1d;
+#  saveppf daboff "${toppath}/${source}/daboff_${date}_${srclower}_calibcycle8.fits"
+#endif 
+
+# Plot results
+#--------------
+graphicatt "xylimits=1250,1500,0,3"
+
+## Baseline
+newwin 1 1
+plot2d b0 (n/8192)*250+1250 val n>0 "blue cpts nstat notit"
+plot2d b1 (n/8192)*250+1250 val n>0 "same red cpts nstat notit"
+settitle "Baseline raw $source $date $mode Ch0 blue Ch1 red"
+
+newwin 1 1
+plot2d b0f (n/8192)*250+1250 val n>0 "blue cpts nstat notit"
+plot2d b1f (n/8192)*250+1250 val n>0 "same red cpts nstat notit"
+settitle "Baseline filt $source $date $mode Ch0 blue Ch1 red"
+
+## First DAB
+#newwin 1 1
+#plot2d dab01 (n/8192)*250+1250 val n>0 "blue cpts nstat notit"
+#plot2d dab11 (n/8192)*250+1250 val n>0 "same red cpts nstat notit"
+#settitle "First DAB raw $source $date $mode Ch0 blue Ch1 red"
+
+newwin 1 1
+plot2d dab01f (n/8192)*250+1250 val n>0 "blue cpts nstat notit"
+plot2d dab11f (n/8192)*250+1250 val n>0 "same red cpts nstat notit"
+settitle "First DAB filt $source $date $mode Ch0 blue Ch1 red"
+
+## Second DAB
+#newwin 1 1
+#plot2d dab02 (n/8192)*250+1250 val n>0 "blue cpts nstat notit"
+#plot2d dab12 (n/8192)*250+1250 val n>0 "same red cpts nstat notit"
+#settitle "Second DAB raw $source $date $mode Ch0 blue Ch1 red"
+
+newwin 1 1
+plot2d dab02f (n/8192)*250+1250 val n>0 "blue cpts nstat notit"
+plot2d dab12f (n/8192)*250+1250 val n>0 "same red cpts nstat notit"
+settitle "Second DAB filt $source $date $mode Ch0 blue Ch1 red"
+
+## Delta=DAB-baseline + Calibrated DAB in Jansky
+graphicatt "xylimits=1100,1600,0,30"
+newwin 1 1
+n/pl nt_dabjy.dabjy%dabfreq 1 ! "marker=star,4 turquoise notit nstat"
+plot2d dab01d (n/8192)*250+1250 val*18 n>0 "same blue cpts nstat notit"
+plot2d dab11d (n/8192)*250+1250 val*22 n>0 "same red cpts nstat notit"
+settitle "First DAB delta $source $date $mode"
+setaxelabels "Freq (MHz)" "Intensity" "bigboldfont"
+addline 1420 4 1430 4 "turquoise line=solid,3"
+addline 1420 3 1430 3 "blue line=solid,3"
+addline 1420 2 1430 2 "red line=solid,3"
+addtext 1440 4 "DAB Voie E (Jy)" "bigfont"
+addtext 1440 3 "Ch0*18 (A.U.)" "bigfont"
+addtext 1440 2 "Ch1*22 (A.U.)" "bigfont"
+
+newwin 1 1
+n/pl nt_dabjy.dabjy%dabfreq 1 ! "marker=star,4 turquoise notit nstat"
+plot2d dab02d (n/8192)*250+1250 val*18 n>0 "same blue cpts nstat notit"
+plot2d dab12d (n/8192)*250+1250 val*22 n>0 "same red cpts nstat notit"
+settitle "Second DAB delta $source $date $mode"
+setaxelabels "Freq (MHz)" "Intensity" "bigboldfont"
+addline 1420 4 1430 4 "turquoise line=solid,3"
+addline 1420 3 1430 3 "blue line=solid,3"
+addline 1420 2 1430 2 "red line=solid,3"
+addtext 1440 4 "DAB Voie E (Jy)" "bigfont"
+addtext 1440 3 "Ch0*18 (A.U.)" "bigfont"
+addtext 1440 2 "Ch1*22 (A.U.)" "bigfont"
+
+## Delta=Mean(DAB-baseline) + Calibrated DAB in Jansky
+graphicatt "xylimits=1100,1600,0,30"
+newwin 1 1
+n/pl nt_dabjy.dabjy%dabfreq 1 ! "marker=star,4 turquoise notit nstat"
+plot2d meandab0d (n/8192)*250+1250 val*18 n>0 "same blue cpts nstat notit"
+plot2d meandab1d (n/8192)*250+1250 val*23 n>0 "same red cpts nstat notit"
+settitle "Mean DAB delta $source $date $mode"
+setaxelabels "Freq (MHz)" "Intensity" "bigboldfont"
+addline 1420 4 1430 4 "turquoise line=solid,3"
+addline 1420 3 1430 3 "blue line=solid,3"
+addline 1420 2 1430 2 "red line=solid,3"
+addtext 1440 4 "DAB Voie E (Jy)" "bigfont"
+addtext 1440 3 "Ch0*18 (A.U.)" "bigfont"
+addtext 1440 2 "Ch1*23 (A.U.)" "bigfont"
Index: /BAORadio/AmasNancay/trunk/emptydir.sh
===================================================================
--- /BAORadio/AmasNancay/trunk/emptydir.sh	(revision 611)
+++ /BAORadio/AmasNancay/trunk/emptydir.sh	(revision 611)
@@ -0,0 +1,26 @@
+#!/bin/sh -xvf
+#Basic tuning of system fuction used.
+AWK=/bin/awk
+SED=/bin/sed
+GREP=/bin/grep
+WC=/usr/bin/wc
+RM=/bin/rm
+CAT=/bin/cat
+TOUCH=/bin/touch
+DATE=/bin/date
+ECHO=/bin/echo
+LS=/bin/ls
+MKDIR=/bin/mkdir
+TR=/usr/bin/tr
+FIND=/usr/bin/find
+PRINTF=/usr/bin/printf
+XARGS=/usr/bin/xargs
+SORT=/bin/sort
+QSUB=qsub
+
+DefaultIFS=$' \t\n'
+IFS=$DefaultIFS
+
+dir=`pwd`
+listoffiles=`$FIND $dir -type f | $WC -l ` 
+echo "$listoffiles"
Index: /BAORadio/AmasNancay/trunk/etude_dab.pic
===================================================================
--- /BAORadio/AmasNancay/trunk/etude_dab.pic	(revision 611)
+++ /BAORadio/AmasNancay/trunk/etude_dab.pic	(revision 611)
@@ -0,0 +1,165 @@
+##############################################################
+# Check chromaticity of DAB from calib spectra (1204-window) #
+##############################################################
+
+set user     "AST"
+set toppath  "/sps/baoradio/AmasNancay/${user}"
+set source   "Abell1205"
+set srclower "abell1205"
+set date     "20110415"
+set cycle    "8"
+set mode     "Off"
+set path "${toppath}/${source}/${date}${srclower}/${mode}/calibcycle${cycle}"
+
+#
+# Power vs. run (calib monitoring)
+#-----------------------------------
+#shell ls ${path}/*.fits 
+shell ls ${path}/*.fits | wc -l > pp
+vecfrascii mm pp
+vec2var mm nfiles
+
+set mean0 " "
+set mean1 " "
+for i 0:$nfiles
+  openfits ${path}/medfiltmtx${i}.fits
+  del g0 g1 s0 s1 n0 n1
+  objaoper /home/medfiltmtx${i} row 0 g0
+  objaoper /home/medfiltmtx${i} row 1 g1
+  c++exec sa_size_t n0=g0.NElts()-1; TVector<r_4>s0=g0(Range(1,n0)); KeepObj(s0); \
+          sa_size_t n1=g1.NElts()-1; TVector<r_4>s1=g1(Range(1,n1)); KeepObj(s1);
+  m0 = ${s0.sum}/${s0.size}
+  m1 = ${s1.sum}/${s1.size}
+  set mean0 "${mean0} ${m0}"
+  set mean1 "${mean1} ${m1}"
+end
+echo ${mean0}
+echo ${mean1}
+line2vec vmean0 ${mean0}
+line2vec vmean1 ${mean1}
+
+maxplot = ${vmean1.max}+5
+newwin 1 1
+graphicatt "xylimits=0,116,0,3"
+plot2d vmean1 n val 1 "red cpts nsta notit"
+plot2d vmean0 n val 1 "same blue cpts nsta notit"
+settitle "Mean calib $source ${date} ${mode} Ch 0 (blue) Ch 1 (red)"
+setaxelabels "File #" "I (a.u)"
+
+#
+# Identify baseline, DAB_1, DAB_2 from monitoring plot
+#------------------------------------------------------
+## Baseline
+del ifirst count nspec sum0 sum1
+ifirst = 1
+count = 0
+for i 0:34
+#  echo "^^^^^^^^" $i $count
+  count = $count+1
+  del g0 g1
+  objaoper /home/medfiltmtx${i} row 0 g0
+  objaoper /home/medfiltmtx${i} row 1 g1
+  if ( $ifirst == 1 ) then
+    ifirst = 0
+    c++exec TVector<r_4> sum0=g0; KeepObj(sum0); \
+            TVector<r_4> sum1=g1; KeepObj(sum1);
+  else
+    c++exec sum0+=g0; sum1+=g1;
+  endif
+end
+for i 70:$nfiles
+  count = $count+1
+#  echo "^^^^^^^^" $i $count
+  del g0 g1
+  objaoper /home/medfiltmtx${i} row 0 g0
+  objaoper /home/medfiltmtx${i} row 1 g1
+  c++exec sum0+=g0; sum1+=g1;
+end
+echo $count
+line2vec nspec $count
+del base0 base1
+c++exec TVector<r_4> base0=sum0; KeepObj(base0); base0/=nspec[0]; \
+        TVector<r_4> base1=sum1; KeepObj(base1); base1/=nspec[0];
+
+## DAB Level 1
+idablev1 = 36
+idablev2 = 51
+
+del ifirst count nspec sum0 sum1
+ifirst = 1
+count = 0
+for i $idablev1:$idablev2 
+  count = $count+1
+  echo "^^^^^^^^" $i $count
+  del g0 g1
+  objaoper /home/medfiltmtx${i} row 0 g0
+  objaoper /home/medfiltmtx${i} row 1 g1
+  if ( $ifirst == 1 ) then
+    ifirst = 0
+    c++exec TVector<r_4> sum0=g0; KeepObj(sum0); \
+            TVector<r_4> sum1=g1; KeepObj(sum1);
+  else
+    c++exec sum0+=g0; sum1+=g1;
+  endif
+end
+echo $count
+line2vec nspec $count
+del dab01 dab11
+c++exec TVector<r_4> dab01=sum0; KeepObj(dab01); dab01/=nspec[0]; \
+        TVector<r_4> dab11=sum1; KeepObj(dab11); dab11/=nspec[0];
+
+## DAB Level 2
+idablev3 = 53
+idablev4 = 67
+
+del ifirst count nspec sum0 sum1
+ifirst = 1
+count = 0
+for i $idablev3:$idablev4
+  count = $count+1
+  echo "^^^^^^^^" $i $count
+  del g0 g1
+  objaoper /home/medfiltmtx${i} row 0 g0
+  objaoper /home/medfiltmtx${i} row 1 g1
+  if ( $ifirst == 1 ) then
+    ifirst = 0
+    c++exec TVector<r_4> sum0 = g0; KeepObj(sum0); \
+            TVector<r_4> sum1 = g1; KeepObj(sum1);
+  else
+    c++exec sum0+=g0; sum1+=g1;
+  endif
+end
+echo $count
+line2vec nspec $count
+del dab02 dab12
+c++exec TVector<r_4> dab02=sum0; KeepObj(dab02); dab02/=nspec[0]; \
+        TVector<r_4> dab12=sum1; KeepObj(dab12); dab12/=nspec[0];
+
+## Plot results
+newwin 1 1
+plot2d base0 (n/8192)*250+1250 val 1 "blue cpts notit nstat"
+plot2d base1 (n/8192)*250+1250 val 1 "same red cpts notit nstat"
+settitle "Mean baseline $source $date Ch0 blue Ch1 red"
+
+newwin 1 1
+graphicatt "xylimits=1250,1500,0,3"
+plot2d dab01 (n/8192)*250+1250 val 1 "blue cpts notit nstat"
+plot2d dab11 (n/8192)*250+1250 val 1 "same red cpts notit nstat"
+settitle "Mean First DAB $source $date Ch0 blue Ch1 red"
+
+newwin 1 1
+graphicatt "xylimits=1250,1500,0,3"
+plot2d dab02 (n/8192)*250+1250 val 1 "blue cpts notit nstat"
+plot2d dab12 (n/8192)*250+1250 val 1 "same red cpts notit nstat"
+settitle "Mean Second DAB $source $date Ch0 blue Ch1 red"
+
+## Save results in ppf files
+del mtxbase mtxdab1 mtxdab2
+
+c++exec TMatrix<r_4> mtxbase(2,base0.NElts()); mtxbase.Row(0)=base0; mtxbase.Row(1)=base1; KeepObj(mtxbase); \
+        TMatrix<r_4> mtxdab1(2,dab01.NElts()); mtxdab1.Row(0)=dab01; mtxdab1.Row(1)=dab11; KeepObj(mtxdab1); \
+        TMatrix<r_4> mtxdab2(2,dab02.NElts()); mtxdab2.Row(0)=dab02; mtxdab2.Row(1)=dab12; KeepObj(mtxdab2);
+
+saveppf mtxbase ${toppath}/${source}/${date}${srclower}/baseline_${date}_${srclower}_${mode}.ppf
+saveppf mtxdab1 ${toppath}/${source}/${date}${srclower}/dab1_${date}_${srclower}_${mode}.ppf
+saveppf mtxdab2 ${toppath}/${source}/${date}${srclower}/dab2_${date}_${srclower}_${mode}.ppf
Index: /BAORadio/AmasNancay/trunk/etude_gain_medfiltmtx.pic
===================================================================
--- /BAORadio/AmasNancay/trunk/etude_gain_medfiltmtx.pic	(revision 611)
+++ /BAORadio/AmasNancay/trunk/etude_gain_medfiltmtx.pic	(revision 611)
@@ -0,0 +1,32 @@
+set user "AST"
+set toppath "/sps/baoradio/AmasNancay/${user}"
+set source "Abell1205"
+set srclower "abell1205"
+set date   "20110415"
+set gaincycle "8"
+set path "${toppath}/${source}/${date}${srclower}/gaincycle${gaincycle}"
+
+####################################################
+# Gains in every 5120-window
+####################################################
+#newwin 1 1
+graphicatt "xylimits=1250,1500,0,0.008"
+shell ls ${path} 
+shell ls ${path} | wc -l
+
+i0 = 0
+i1 = 23
+echo ${i0} ${i1}
+for i ${i0}:${i1}
+  echo ${path}/medfiltmtx${i}.fits
+  newwin 1 1
+  openfits ${path}/medfiltmtx${i}.fits
+  del g0 g1
+  objaoper /home/medfiltmtx${i} row 0 g0
+  objaoper /home/medfiltmtx${i} row 1 g1
+  plot2d g1 (n/8192)*250+1250 val n>0 "red cpts nsta notit"
+  plot2d g0 (n/8192)*250+1250 val n>0 "same blue cpts nsta notit"
+  settitle "Gain $source ${date} medfiltmtx${i} Ch 0 (blue) Ch 1 (red)"
+  setaxelabels "Freq. (MHz)" "I (a.u)"
+end
+
Index: /BAORadio/AmasNancay/trunk/etude_mergeAna.pic
===================================================================
--- /BAORadio/AmasNancay/trunk/etude_mergeAna.pic	(revision 610)
+++ /BAORadio/AmasNancay/trunk/etude_mergeAna.pic	(revision 611)
@@ -1,2 +1,4 @@
+
+set path "/sps/baoradio/AmasNancay/AST"
 
 set source  $1
@@ -9,13 +11,31 @@
 
 set fcalib 1410
-set f1420low 1420.2
-set f1420high 1420.6
-
-
+
+# Abell 85, 500 cycles
+if ( ${source} == "abell85" ) then
+  set f1420low 1420.2
+  set f1420high 1420.6
+  set packVal "1 10 25 50 100"
+endif
+
+# Abell 1205, 600 cycles
+if ( ${source} == "abell1205" ) then
+  set f1420low 1420.1
+  set f1420high 1420.6
+  set packVal "1 10 25 50 100 120"
+endif
+
+# Abell 2440, 210 cycles
+if ( ${source} == "abell2440" ) then
+  set f1420low 1420.4
+  set f1420high 1420.7
+  set packVal "1 10 25 42"
+endif
+
+echo "f1420low=${f1420low}, f1420high=${f1420high}"
+echo "Packing values="${packVal}
 
 nbins1420 = floor((${f1420high}-${f1420low})/250*8192)
-
 echo $nbins1420
-
 
 clearscript diffOnOff
@@ -26,4 +46,5 @@
 clearscript sigmaRaw1400a1420
 clearscript evolAt1410a1415OffOn
+
 ############################################################################
 defscript evolAtCalibFreq
@@ -90,5 +111,5 @@
 
 
-graphicatt "xylimits=0,500,-0.01,0.01"
+graphicatt "xylimits=0,${ncycles},-0.02,0.02"
 
 newwin 1 2
@@ -159,11 +180,8 @@
 line2vec vecCh1All $linCh1All
 
-#packing values only valid for 500 cycles...
-set packVal "1 10 25 50 100"
 set sigmaCh0 ""
 set errsigCh0 ""
 set sigmaCh1 ""
 set errsigCh1 ""
-
 
 foreach ipack ( $packVal )
@@ -236,6 +254,4 @@
 line2vec vecCh1All $linCh1All
 
-#packing values only valid for 500 cycles...
-set packVal "1 10 25 50 100"
 set sigmaCh0 ""
 set errsigCh0 ""
@@ -329,5 +345,5 @@
 
 
-graphicatt "xylimits=0,500,-0.01,0.01"
+graphicatt "xylimits=0,${ncycles},-0.01,0.01"
 
 newwin 1 2
@@ -394,5 +410,5 @@
 
 
-graphicatt "xylimits=0,500,-0.1,0.1"
+graphicatt "xylimits=0,${ncycles},-0.1,0.1"
 
 newwin 1 2
@@ -487,6 +503,4 @@
 setaxelabels "Freq. (MHz)" "I (a.u)" $axedefatt
 
-
-
 graphicatt "xylimits=1250,1500,-0.01,0.01"
 del snocal0 snocal1
@@ -499,21 +513,21 @@
 setaxelabels "Freq. (MHz)" "I (a.u)" $axedefatt
 
-del sruncal0 sruncal1
-objaoper meanPerRunCalib row 0 sruncal0
-objaoper meanPerRunCalib row 1 sruncal1
-newwin 1 1
-plot2d sruncal0 (n/8192)*250+1250 val n>0 "blue cpts notit nsta"
-plot2d sruncal1 (n/8192)*250+1250 val n>0 "red same cpts notit nsta"
-settitle "ON-OFF Calib Run  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
-setaxelabels "Freq. (MHz)" "I (a.u)" $axedefatt
-
-newwin 1 1
-del scyclecal0 scyclecal1
-objaoper meanPerCycleCalib row 0 scyclecal0
-objaoper meanPerCycleCalib row 1 scyclecal1
-plot2d scyclecal0 (n/8192)*250+1250 val n>0 "blue cpts notit nsta"
-plot2d scyclecal1 (n/8192)*250+1250 val n>0 "red same cpts notit nsta"
-settitle "ON-OFF Calib Cycle  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
-setaxelabels "Freq. (MHz)" "I (a.u)" $axedefatt
+#del sruncal0 sruncal1
+#objaoper meanPerRunCalib row 0 sruncal0
+#objaoper meanPerRunCalib row 1 sruncal1
+#newwin 1 1
+#plot2d sruncal0 (n/8192)*250+1250 val n>0 "blue cpts notit nsta"
+#plot2d sruncal1 (n/8192)*250+1250 val n>0 "red same cpts notit nsta"
+#settitle "ON-OFF Calib Run  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
+#setaxelabels "Freq. (MHz)" "I (a.u)" $axedefatt
+
+#newwin 1 1
+#del scyclecal0 scyclecal1
+#objaoper meanPerCycleCalib row 0 scyclecal0
+#objaoper meanPerCycleCalib row 1 scyclecal1
+#plot2d scyclecal0 (n/8192)*250+1250 val n>0 "blue cpts notit nsta"
+#plot2d scyclecal1 (n/8192)*250+1250 val n>0 "red same cpts notit nsta"
+#settitle "ON-OFF Calib Cycle  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles" ' ' $defatt
+#setaxelabels "Freq. (MHz)" "I (a.u)" $axedefatt
 
 
@@ -526,9 +540,9 @@
 #use minuscule for source label
 
-
-
-
-openppf onoffsurvey_${source}-${ncycles}Cycles.ppf
+openppf ${path}/onoffsurvey_${source}-${ncycles}Cycles.ppf
 print onoffevol
+
+#openppf ${path}/rawOnOffDiff_${source}-${ncycles}Cycles.ppf
+#ls
 
 set defatt "font=helvetica,bold,20 fixedfonsize"
@@ -546,2 +560,5 @@
 #evolAt1420SideFreq
 #IntAt1420
+#sigmaRaw1420Side
+#sigmaRaw1400a1420
+#evolAt1400a1420OffOn
Index: /BAORadio/AmasNancay/trunk/mergeAnaFiles.cc
===================================================================
--- /BAORadio/AmasNancay/trunk/mergeAnaFiles.cc	(revision 610)
+++ /BAORadio/AmasNancay/trunk/mergeAnaFiles.cc	(revision 611)
@@ -330,5 +330,5 @@
 
   //mean ON-OFF over the list of cycles
-  TMatrix<r_4> meanDiffONOFFovOFF_noCalib(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);          //set to 0 
+  TMatrix<r_4> meanDiffONOFFovOFF_noCalib(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);     //set to 0 
   TMatrix<r_4> meanDiffONOFF_noCalib(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);          //set to 0 
   TMatrix<r_4> meanDiffONOFF_perRunCalib(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);      //set to 0
@@ -397,6 +397,4 @@
     string srcLower = tokens2[0];
 
-
-    
     PInPersist fin(*iFile);
     vector<string> vec = fin.GetNameTags();
@@ -710,9 +708,9 @@
       //JEC 29/10/11 add ON-OFF/OFF
       TMatrix<r_4> diffOnOffOvOff_noCalib(diffOnOff_noCalib,false); //do not share data
-      TMatrix<r_4> aSpecOffFitltered(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
+      TMatrix<r_4> aSpecOffFiltered(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
       sa_size_t halfWidth = 35; //number of freq. bin for the 1/2 width of the filtering window
-      medianFiltering(aSpecOff,halfWidth,aSpecOffFitltered);
-      
-      diffOnOffOvOff_noCalib.Div(aSpecOffFitltered); //division in place
+      medianFiltering(aSpecOff,halfWidth,aSpecOffFiltered);
+      
+      diffOnOffOvOff_noCalib.Div(aSpecOffFiltered); //division in place
       meanDiffONOFFovOFF_noCalib += diffOnOffOvOff_noCalib;
 
@@ -723,6 +721,6 @@
       meanDiffONOFF_perCycleCalib += diffOnOff_perCycleCalib;
 
-      //
       totalNumberCycles++;
+
       //Fill NTuple
       xnt[0] = totalNumberCycles;
@@ -798,5 +796,5 @@
       //JEC 18/11/11 follow up the 1400-1420MHz OFF only
       TMatrix<r_4> aSpecOffovOff(aSpecOff,false);
-      aSpecOffovOff.Div(aSpecOffFitltered);
+      aSpecOffovOff.Div(aSpecOffFiltered);
 
       TVector<r_4> meanInRange_1410a1415Freq_OFF_noCalib(NUMBER_OF_CHANNELS);
@@ -808,5 +806,5 @@
 
       TMatrix<r_4> aSpecOnovOff(aSpecOn,false);
-      aSpecOnovOff.Div(aSpecOffFitltered);
+      aSpecOnovOff.Div(aSpecOffFiltered);
 
       TVector<r_4> meanInRange_1410a1415Freq_ON_noCalib(NUMBER_OF_CHANNELS);
@@ -886,5 +884,6 @@
     
     tag = "onoffevol";
-    fos << PPFNameTag(tag) << onoffevolution;    
+    fos << PPFNameTag(tag) << onoffevolution;
+ 
   }//end of save
 
@@ -912,5 +911,4 @@
   TMatrix<r_4> meanONovOFF_noCalib(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ); //  ON/Filtered_OFF
   TMatrix<r_4> meanOFFovOFF_noCalib(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ); // OFF/Filtered_OFF
-
   //Tuple only for RAW things to follow 
   static const int NINFO=11;
@@ -953,5 +951,17 @@
   for (iFile = listOfFiles.begin(); iFile != iFileEnd; ++iFile) {
     if (para.debuglev_>90){
-    }
+      cout << "load file <" << *iFile << ">" << endl;
+    }
+
+    vector<string> tokens;
+    split(*iFile,"_",tokens);
+    string dateOfRun = tokens[1];
+    if (para.debuglev_>90){
+      cout << "date <" << dateOfRun << ">" << endl;
+    }
+    vector<string> tokens2;
+    split(tokens[2],".",tokens2);
+    string srcLower = tokens2[0];
+
     PInPersist fin(*iFile);
     vector<string> vec = fin.GetNameTags();
@@ -983,5 +993,5 @@
 	regexp(iSpec->c_str(),matchstr.c_str(),&b,&e);
 	if (para.debuglev_>90){
-	  cout << " spactra <" << *iSpec << ">" << endl;
+	  cout << " spectra <" << *iSpec << ">" << endl;
 	  cout << " cycle " << iSpec->substr(b) << endl;
 	}
@@ -1011,4 +1021,22 @@
     for (list<int>::iterator ic=commonCycles.begin(); ic!=commonCycles.end(); ++ic){
       
+      // AST 28.11.11 remove non-calibrated cycles for Abell1205 and Abell2440
+      if ( *ic == 1 && srcLower == "abell1205" ) {
+	  if ( dateOfRun == "20110502" || dateOfRun == "20110607" || dateOfRun == "20110818" ) {
+	    cout << "Skipping non-calibrated cycle " << *ic << endl;
+	    continue;
+	  }
+      } else if ( *ic == 1 && srcLower == "abell2440" ) {
+	  if ( dateOfRun == "20110516" ) {
+	    cout << "Skipping non-calibrated cycle " << *ic << endl;
+	    continue;
+	  }
+      } else if ( *ic == 3 && srcLower == "abell1205" ) {
+	  if ( dateOfRun == "20110810" ) {
+	    cout << "Skipping non-calibrated cycle " << *ic << endl;
+	    continue;
+	  }
+      }
+
       string ppftag;
       //load ON phase
@@ -1026,32 +1054,30 @@
       //Perform the difference ON-OFF
       TMatrix<r_4> diffOnOff_noCalib = aSpecOn - aSpecOff;
+
       meanDiffONOFF_noCalib += diffOnOff_noCalib;
       
       //JEC 29/10/11 add ON-OFF/OFF
       TMatrix<r_4> diffOnOffOvOff_noCalib(diffOnOff_noCalib,false); //do not share data
-      TMatrix<r_4> aSpecOffFitltered(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
+      TMatrix<r_4> aSpecOffFiltered(NUMBER_OF_CHANNELS,NUMBER_OF_FREQ);
       sa_size_t halfWidth = 35; //number of freq. bin for the 1/2 width of the filtering window
-      medianFiltering(aSpecOff,halfWidth,aSpecOffFitltered);
-      
-      diffOnOffOvOff_noCalib.Div(aSpecOffFitltered); //division in place
+      medianFiltering(aSpecOff,halfWidth,aSpecOffFiltered);
+      
+      diffOnOffOvOff_noCalib.Div(aSpecOffFiltered); //division in place
       meanDiffONOFFovOFF_noCalib += diffOnOffOvOff_noCalib;
-
 
       //JEC 15/11/11 add ON/OFF and OFF/OFF
       TMatrix<r_4> onOvOff(aSpecOn,false);
-      onOvOff.Div(aSpecOffFitltered);
+      onOvOff.Div(aSpecOffFiltered);
       meanONovOFF_noCalib += onOvOff;
       
       TMatrix<r_4> offOvOff(aSpecOff,false);
-      offOvOff.Div(aSpecOffFitltered);
+      offOvOff.Div(aSpecOffFiltered);
       meanOFFovOFF_noCalib += offOvOff;
 
       totalNumberCycles++;
-
 
       //Fill NTuple
       xnt[0] = totalNumberCycles;
  
-
       //Follow up arround the 1420.4MHz Freq.
       TVector<r_4> meanInRange_1420Freq_noCalib(NUMBER_OF_CHANNELS);
@@ -1079,5 +1105,5 @@
       //JEC 18/11/11 follow up the 1400-1420MHz OFF only
       TMatrix<r_4> aSpecOffovOff(aSpecOff,false);
-      aSpecOffovOff.Div(aSpecOffFitltered);
+      aSpecOffovOff.Div(aSpecOffFiltered);
 
       TVector<r_4> meanInRange_1410a1415Freq_OFF_noCalib(NUMBER_OF_CHANNELS);
@@ -1088,5 +1114,5 @@
 
       TMatrix<r_4> aSpecOnovOff(aSpecOn,false);
-      aSpecOnovOff.Div(aSpecOffFitltered);
+      aSpecOnovOff.Div(aSpecOffFiltered);
 
       TVector<r_4> meanInRange_1410a1415Freq_ON_noCalib(NUMBER_OF_CHANNELS);
@@ -1136,5 +1162,5 @@
 
     tag = "onoffevol";
-    fos << PPFNameTag(tag) << onoffevolution;    
+    fos << PPFNameTag(tag) << onoffevolution;
 
   }//end save
Index: /BAORadio/AmasNancay/trunk/plotRawDiffOnOff.pic
===================================================================
--- /BAORadio/AmasNancay/trunk/plotRawDiffOnOff.pic	(revision 610)
+++ /BAORadio/AmasNancay/trunk/plotRawDiffOnOff.pic	(revision 611)
@@ -3,6 +3,6 @@
 set ncycles $2
 
-c++compile meanSigSum
-c++link    meanSigSum.so meanSigSum
+#c++compile meanSigSum
+#c++link    meanSigSum.so meanSigSum
 
 set defatt "font=helvetica,bold,20 fixedfonsize"
@@ -20,6 +20,6 @@
 nbins1420 = floor((${f1420high}-${f1420low})/250*8192)
 
-
-openppf rawOnOffDiff_${source}-${ncycles}Cycles.ppf
+set path "/sps/baoradio/AmasNancay/AST"
+openppf ${path}/rawOnOffDiff_${source}-${ncycles}Cycles.ppf
 
 
@@ -226,5 +226,5 @@
 n/pl onoffevol.(onRaw0f14101415-offRaw0f14101415)%cycle ! ! "blue cpts notit nsta"
 n/pl onoffevol.(onRaw1f14101415-offRaw1f14101415)%cycle ! ! "same red cpts notit nsta"
-settitle "Raw (OFF-ON)/OFF  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles " ' ' $defatt
+settitle "Raw (ON-OFF)/OFF  ${source} Ch 0 (blue) Ch 1 (red) ${ncycles}cycles " ' ' $defatt
 setaxelabels "cycle" "DI [1410,1415]MHz Raw (a.u)" $axedefatt
 
@@ -301,5 +301,5 @@
 plot2d s0 (n/8192)*250+1250 val n>0 "cpts blue notit nsta"
 plot2d s1 (n/8192)*250+1250 val n>0 "same cpts red notit nsta"
-settitle "Raw (ON-OFF)/OFF ${source} ${ncycles} cycles, Ch 0 (blue) Ch 1 (red)"
+settitle "plot Raw (ON-OFF)/OFF ${source} ${ncycles} cycles, Ch 0 (blue) Ch 1 (red)"
 setaxelabels "Freq. (MHz)" "I (a.u)"
 
Index: /BAORadio/AmasNancay/trunk/proc_specmfib.sh
===================================================================
--- /BAORadio/AmasNancay/trunk/proc_specmfib.sh	(revision 610)
+++ /BAORadio/AmasNancay/trunk/proc_specmfib.sh	(revision 611)
@@ -567,9 +567,9 @@
 
 #save results to Irods (use option -f ONLY to force override)
-    emptydir=`$FIND ${curDir}/${dirName} -maxdepth 1 -type f | $WC -l`
+    emptydir=`$FIND ${outDir} -maxdepth 1 -type f | $WC -l`
     if [ "<${emptydir}>" != "<0>" ]; then
       iput -v -K -r -f ${curDir}/${dirName} /baoradio/data/AmasNancay/${localpath}
     else
-      $ECHO "DEBUG (${scriptName}): directory ${curDir}/${dirName} is empty"
+      $ECHO "DEBUG (${scriptName}): directory ${outDir} is empty"
     fi
 #
