Index: /trunk/Cosmo/RadioBeam/anapkn.pic
===================================================================
--- /trunk/Cosmo/RadioBeam/anapkn.pic	(revision 3768)
+++ /trunk/Cosmo/RadioBeam/anapkn.pic	(revision 3769)
@@ -9,5 +9,5 @@
 
 ##1 / On ouvre le fichier extrait d'un PPF fait par SimLSS (cmv) 
-delobjs *
+# delobjs *
 openppf cmvhpkz.ppf
 set gdz 1.
@@ -392,3 +392,12 @@
 dopk 'P(k), PNoise - mK^2 Mpc^3, Nancay-MultiBeam  z=0.5'  'Relative Sample Variance, z=0.5'
 
-endscript
+### Setup pour plpkn @ z=0.7
+setup5 
+scalewz 0.7 2500 100 1
+  y1 = 500*$cct21
+  y2 = 9e4*$cct21
+  xyl = "xylimits=0.01,0.5,$y1,$y2 logx logy minorticks"
+  n/plot hpkz.val*${cct21}%$kk ! ! "same notit nsta connectpoints blueviolet $xyl line=solid,2"
+
+endscript
+
Index: /trunk/Cosmo/RadioBeam/mdish.cc
===================================================================
--- /trunk/Cosmo/RadioBeam/mdish.cc	(revision 3768)
+++ /trunk/Cosmo/RadioBeam/mdish.cc	(revision 3769)
@@ -108,4 +108,5 @@
   : nx(0),ny(0),xmin(0),xmax(0),ymin(0),ymax(0),sumw0(0.)
 {
+  ixb0 = jyb0 = 0;
 }
 QHis2D::QHis2D(r_8 xMin,r_8 xMax,int_4 nxb,r_8 yMin,r_8 yMax,int_4 nyb)
@@ -123,4 +124,5 @@
   sa_size_t sz[5];  sz[0]=nx;  sz[1]=ny;
   aw.ReSize(2,sz);
+  SetZeroBin();
   sumw0=0.;
   return;
@@ -131,14 +133,36 @@
   sa_size_t jy = (sa_size_t)((y-ymin)/dyb);
   if ((ix<0)||(ix>=nx)||(jy<0)||(jy>=ny))  return 0.;
-  double rw = ((ix==0)&&(jy==0)) ? w : 0.;
+  double rw = ((ix==ixb0)&&(jy==jyb0)) ? w : 0.;
   sumw0 += rw; 
   if (fgfh) aw(ix,jy) += w;
   return rw;
 }
+void QHis2D::SetZeroBin(r_8 x, r_8 y)
+{
+  ixb0 = (sa_size_t)((x-xmin)/dxb);
+  jyb0 = (sa_size_t)((y-ymin)/dyb);
+}
 Histo2D QHis2D::Convert()
 {
+  int_4 imn,jmn,imx,jmx;
+  r_8 min = aw(0,0);
+  r_8 max = aw(0,0);
+  imn=jmn=imx=jmx=0;
   Histo2D h2(xmin,xmax,nx,ymin,ymax,ny);
   for(int_4 j=0; j<ny; j++) 
-    for(int_4 i=0; i<nx; i++)  h2(i,j) = aw(i,j);
+    for(int_4 i=0; i<nx; i++) {
+      h2(i,j) = aw(i,j);
+      if (aw(i,j)>max) {
+	imx=i;  jmx=j;  max=aw(i,j);
+      }
+      if (aw(i,j)<min) {
+	imn=i;  jmn=j;  min=aw(i,j);
+      }
+    }
+  cout << "QHis2D::Convert()/Info: Nx,Ny=" << nx << "," << ny << " SumW=" << sumw0 
+       << "\n ... Max:" << imx << "," << jmx << " ->" << max 
+       << " @" << imx*dxb+xmin << "," << jmx*dyb+ymin
+       << "\n ...Min:" << imn << "," << jmn << " ->" << min 
+       << " @" << imn*dxb+xmin << "," << jmn*dyb+ymin << endl;
   return h2;
 }
@@ -159,11 +183,10 @@
   cout << " MultiDish::GetResponse() - NDishes=" << dishes_.size() << " nx=" << nx_ << " ny=" << ny_ << endl;
   double kmx = 1.2*DeuxPI*dmax_/lambda_;
-  /*
-  h2w_= Histo2D(0.,kmx,nx_,0.,kmx,ny_);
-  h2cnt_= Histo2D(0.,kmx,nx_,0.,kmx,ny_);
-  h2w_.Zero();
-  h2cnt_.Zero();
-  */
-  h2w_.Define(0.,kmx,nx_,0.,kmx,ny_);
+  double dkmx = kmx/(double)nx_;
+  double dkmy = kmx/(double)ny_;
+  double kmxx = ((double)nx_+0.5)*dkmx;
+  double kmxy = ((double)ny_+0.5)*dkmy;
+  h2w_.Define(-kmxx,kmxx,2*nx_+1,-kmxy,kmxy,2*ny_+1);
+  h2w_.SetZeroBin(0.,0.);
 
   double dold = dishes_[0].D/lambda_;
@@ -184,72 +207,46 @@
       sumw += CumulResp(rd, (double)kt*dtet, (double)jp*dphi);
 
-  double kx0 = DeuxPI*fabs(dishes_[1].X-dishes_[0].X)/lambda_;
-  double ky0 = DeuxPI*fabs(dishes_[1].Y-dishes_[0].Y)/lambda_;
-  int_4 ib, jb;
+  double kx1 = DeuxPI*(dishes_[0].DiameterX())/lambda_;
+  double ky1 = DeuxPI*(dishes_[0].DiameterY())/lambda_;
+  int_4 ib,jb;
   //  h2w_ /= h2cnt_; 
   Histo2D h2 = h2w_.Convert();
-  h2.FindBin(kx0, ky0, ib, jb);
-  cout << " ---- MultiDish::GetResponse() VMin=" << h2.VMin() << " VMax= " << h2.VMax() 
-       << " h(0,0)=" << h2(0,0) << " h(" << ib <<"," << jb << ")=" << h2(ib,jb) <<endl;
+  h2.FindBin(kx1, ky1, ib, jb);
+  if ((kx1<0)||(ky1<0)||(kx1>=h2.NBinX())||(ky1>=h2.NBinY())) {
+    cout << " MultiDish::GetResponse[1]/ERROR kx1,ky1=" << kx1 <<","<< ky1 << " --> ib,jb=" << ib <<","<< jb << endl;
+    ib=jb=0;
+  }
+  double vmax=h2.VMax();
+  cout << " MultiDish::GetResponse[1] VMin=" << h2.VMin() << " VMax= " << vmax  
+       << " h(0,0)=" << h2(0,0) << " kx1,ky1->h(" << ib <<"," << jb << ")=" << h2(ib,jb) <<endl;
   //  double fnorm=sqrt((double)dishes_.size())/h2.VMax();
   double fnorm=1.;
-  if (h2.VMax() > sumw) {
+  if (vmax > sumw) {
     fnorm=(double)dishes_.size()/h2.VMax();
-    cout << " ---- MultiDish::GetResponse() NDishes=" << dishes_.size() << " sumw=" << sumw 
-	 << " Renormalizing x NDishes/sumw  " << fnorm << endl;
+    cout << " MultiDish::GetResponse[2]/Warning h2.VMax()=" << vmax << " >  sumw=" << sumw << endl;  
+    cout << "   ... NDishes=" << dishes_.size() << " sumw=" << sumw 
+	 << " Renormalizing x NDishes/VMax  " << fnorm << endl;
   }
   else {
-    fnorm=(double)dishes_.size()/h2.VMax();
-    cout << " ---- MultiDish::GetResponse() NDishes=" << dishes_.size() << " VMax=" << h2.VMax()  
-	 << " Renormalizing x NDishes/h2.VMax()   " << fnorm << endl;
+    fnorm=(double)dishes_.size()/sumw;
+    cout << " MultiDish::GetResponse[3] NDishes=" << dishes_.size() << " sumw=" << sumw  
+	 << " Renormalizing x NDishes/sumw   " << fnorm << endl;
   }
   h2 *= fnorm;
-  cout << " ---- MultiDish::GetResponse() APRES VMin=" << h2.VMin() << " VMax= " << h2.VMax() << " h(0,0)=" 
+  cout << " ---- MultiDish::GetResponse/[4] APRES VMin=" << h2.VMin() << " VMax= " << h2.VMax() << " h(0,0)=" 
        << h2(0,0) << endl;
   return h2;
 }
 
-/*
-double MultiDish::AddToHisto(double kx0, double ky0, double x, double y, double w, bool fgfh)
-{
-  double xxp = kx0+x;
-  double yyp = ky0+y;
-  double sumw=0.;
-  int_4 ib, jb;
-  h2w_.FindBin(xxp, yyp, ib, jb);
-  if ((ib==0)&&(jb==0))  sumw+=w;
-  if (fgfh) { 
-    h2w_.Add(xxp, yyp, w);
-    h2cnt_.Add(xxp, yyp, 1.);
-  }
-  double xxm=kx0-x;
-  double yym=ky0-y;
-  if (xxm>0.)  {
-    h2w_.FindBin(xxm, yyp, ib, jb);
-    if ((ib==0)&&(jb==0))  sumw+=w;
-    if (fgfh) {
-      h2w_.Add(xxm, yyp, w);
-      h2cnt_.Add(xxm, yyp, 1.);
-    }
-    if (yym>0.) { 
-      h2w_.FindBin(xxm, yym, ib, jb);
-      if ((ib==0)&&(jb==0))  sumw+=w;
-      if (fgfh) { 
-	h2w_.Add(xxm, yym, w);
-	h2cnt_.Add(xxm, yym, 1.);
-      }
-    }
-  }
-  if (yym>0.)  { 
-    h2w_.FindBin(xxp, yym, ib, jb);
-    if ((ib==0)&&(jb==0))  sumw+=w;
-    if (fgfh) {
-      h2w_.Add(xxp, yym, w);
-      h2cnt_.Add(xxp, yym, 1.);
-    }
-  }
-  return sumw; 
-}
-*/
+Histo2D MultiDish::PosDist(int nx, int ny, double dmax)
+{
+  if (dmax<1e-3)  dmax=nx*dishes_[0].Diameter();
+  double dd = dmax/nx/2.;
+  Histo2D hpos(-dd,dmax+dd,nx+1,-dd,dmax+dd,ny+1);
+  for(size_t i=0; i<NbDishes(); i++) {
+    hpos.Add(dishes_[i].X, dishes_[i].Y);
+  }
+  return hpos;
+}
 
 double MultiDish::AddToHisto(double kx0, double ky0, double x, double y, double w, bool fgfh)
@@ -261,9 +258,11 @@
   double xxm=kx0-x;
   double yym=ky0-y;
-  if (xxm>0.)  {
-    sumw += h2w_.Add(xxm, yyp, w, fgfh);
-    if (yym>0.)  sumw += h2w_.Add(xxm, yym, w, fgfh);
-  }
-  if (yym>0.)  sumw += h2w_.Add(xxp, yym, w, fgfh);
+  //  if (xxm>0.)  {
+  sumw += h2w_.Add(xxm, yyp, w, fgfh);
+  // if (yym>0.)  
+  sumw += h2w_.Add(xxm, yym, w, fgfh);
+  //  }
+  // if (yym>0.)  
+  sumw += h2w_.Add(xxp, yym, w, fgfh);
   return sumw; 
 }
@@ -275,6 +274,6 @@
   double dx = h2w_.WBinX()/5;
   double dy = h2w_.WBinY()/5;
-  int nbx = DeuxPI*rd.Dx()/dx;
-  int nby = DeuxPI*rd.Dy()/dy;
+  int nbx = DeuxPI*rd.Dx()/dx+1;
+  int nby = DeuxPI*rd.Dy()/dy+1;
   dx = DeuxPI*rd.Dx()/(double)nbx;
   dy = DeuxPI*rd.Dy()/(double)nby;
@@ -287,21 +286,39 @@
 
   for(size_t i=0; i<dishes_.size(); i++) {
-    for(size_t j=i; j<dishes_.size(); j++) {
-      double kx0 = DeuxPI*fabs(dishes_[i].X-dishes_[j].X)/lambda_;
-      double ky0 = DeuxPI*fabs(dishes_[i].Y-dishes_[j].Y)/lambda_;
+    for(size_t j=0; j<dishes_.size(); j++) {
+      double kx0 = DeuxPI*(dishes_[i].X-dishes_[j].X)/lambda_;
+      double ky0 = DeuxPI*(dishes_[i].Y-dishes_[j].Y)/lambda_;
       rot.Do(kx0, ky0);
-      if (kx0<0) kx0=-kx0;
-      if (ky0<0) ky0=-ky0;
+      //    if (kx0<0) kx0=-kx0;
+      //    if (ky0<0) ky0=-ky0;
       bool fgfh= (!fgnoauto_ || (dishes_[i].ReflectorId()!=dishes_[j].ReflectorId()));
       for(int ix=0; ix<nbx; ix++) 
 	for(int jy=0; jy<nby; jy++) { 
 	  double x = ix*dx;  
-	  double y = jy*dy;  
-	  sumw += AddToHisto(kx0, ky0, x, y, rd(x,y), fgfh);
+	  double y = jy*dy;
+	  if ((ix>0)&&(jy>0)) {
+	    sumw += AddToHisto(kx0, ky0, x, y, rd(x,y), fgfh);
+	  }
+	  else {
+	    if ((ix==0)&&(jy==0)) 
+	      sumw += h2w_.Add(kx0, ky0, rd(0.,0.), fgfh);
+	    else {
+	      double w = rd(x,y);
+	      if (ix==0) {
+		sumw += h2w_.Add(kx0, ky0+y, w, fgfh);
+		sumw += h2w_.Add(kx0, ky0-y, w, fgfh);
+	      }
+	      else {
+		sumw += h2w_.Add(kx0+x, ky0, w, fgfh);
+		sumw += h2w_.Add(kx0-x, ky0, w, fgfh);
+	      }
+	    }
+	    //	 
+	  }
 	}
-    }
     //    if (i%10==0) 
     //      cout << " MultiDish::CumulResp() done i=" << i << " / imax=" << dishes_.size() 
     //	   << " theta=" << theta << " phi=" << phi << endl;
+    }
   }
   return sumw;
Index: /trunk/Cosmo/RadioBeam/mdish.h
===================================================================
--- /trunk/Cosmo/RadioBeam/mdish.h	(revision 3768)
+++ /trunk/Cosmo/RadioBeam/mdish.h	(revision 3769)
@@ -60,12 +60,15 @@
   // Circular dish 
   Dish(int id, double x, double y, double diam)
-    :  id_(id), X(x), Y(y), D(diam), Dx(0.), Dy(0.), fgcirc_(true)   {   } 
+    :  id_(id), X(x), Y(y), D(diam), Dx(D), Dy(D), fgcirc_(true)   {   } 
   // Receiver with rectangular type answer in kx,ky plane 
   Dish(int id, double x, double y, double dx, double dy)
-    :  id_(id), X(x), Y(y), D(0.), Dx(dx), Dy(dy), fgcirc_(false)   {   } 
+    :  id_(id), X(x), Y(y), D(sqrt(dx*dy)), Dx(dx), Dy(dy), fgcirc_(false)   {   } 
   Dish(Dish const& a) 
     :  id_(a.id_), X(a.X), Y(a.Y), D(a.D), Dx(a.Dx), Dy(a.Dy), fgcirc_(a.fgcirc_)     {   } 
   inline bool isCircular() { return fgcirc_; }
   inline int ReflectorId() { return id_; }
+  inline double Diameter() { return D; }
+  inline double DiameterX() { return Dx; }
+  inline double DiameterY() { return Dx; }
 
   int id_;   // numero de reflecteur
@@ -83,4 +86,5 @@
   void Define(r_8 xMin,r_8 xMax,int_4 nxBin,r_8 yMin,r_8 yMax,int_4 nyBin);
   double Add(r_8 x, r_8 y, r_8 w, bool fgfh);
+  void SetZeroBin(r_8 x=0, r_8 y=0);
   inline double WBinX() { return dxb; }
   inline double WBinY() { return dyb; }
@@ -90,4 +94,5 @@
   r_8 dxb,dyb;
   sa_size_t nx,ny;
+  sa_size_t ixb0, jyb0;
   TArray<r_8> aw;
   double sumw0;
@@ -109,5 +114,9 @@
   double CumulResp(Four2DResponse& rd, double theta=0., double phi=0.);
   inline size_t NbDishes() { return dishes_.size(); }
+  inline Dish&  operator[](size_t k) { return dishes_[k]; }
 
+  virtual Histo2D PosDist(int nx=30, int ny=30, double dmax=0.);  
+
+protected:
   double AddToHisto(double kx0, double ky0, double x, double y, double w, bool fgfh);
 
Index: /trunk/Cosmo/RadioBeam/pknoise.cc
===================================================================
--- /trunk/Cosmo/RadioBeam/pknoise.cc	(revision 3768)
+++ /trunk/Cosmo/RadioBeam/pknoise.cc	(revision 3769)
@@ -55,4 +55,23 @@
 };
 
+//-----------------------------------------------------------------------------------
+//  Fonctions de creation de configuration d'interfero avec des dishs
+//-----------------------------------------------------------------------------------
+
+vector<Dish> CreateFilledSqConfig(int nd, double Ddish=5., double Eta=0.9);
+vector<Dish> CreateSemiFilledSqConfig(int nd, double Ddish=5., double Eta=0.9);
+vector<Dish> CreateConfigA(double Ddish=5., double Eta=0.9);
+vector<Dish> CreateConfigB(double Ddish=5., double Eta=0.9);
+vector<Dish> CreateConfigC(double Ddish=5., double Eta=0.9);
+vector<Dish> CreateConfigD(double Ddish=5., double Eta=0.9);
+
+
+vector<Dish> CreateFilledCylConfig(int ncyl,  int nRL, double cylW=10., double cylRL=0.5, 
+				   double etaW=0.9, double etaRL=0.9, bool fgscid=true);
+
+
+//-------------------------------------------------------------------------
+//      ------------------ MAIN PROGRAM ------------------------------
+//-------------------------------------------------------------------------
 int main(int narg, const char* arg[])
 {
@@ -115,57 +134,36 @@
     double Eta=0.95;
     int cnt=0;
-    vector<Dish> vdplein;
-    for(int i=0; i<20; i++) 
-      for(int j=0; j<20; j++) {
-	cnt++; 
-	vdplein.push_back(Dish(i*20+j+1, i*Ddish, j*Ddish, Eta*Ddish));
-      }
-    vector<Dish> vdsparse;
-    vector<Dish> vdsparseD7;
-
-    cnt=0;
-    for(int i=0; i<=18; i++) {
-      cnt++; vdsparse.push_back(Dish(cnt, i*Ddish,0.,Eta*Ddish));
-      vdsparseD7.push_back(Dish(cnt, i*Ddish2,0.,Eta*Ddish2));
-    }
-    for(int i=-18; i<=18; i++) {
-      if (i==0)  continue;
-      cnt++; vdsparse.push_back(Dish(cnt, 0.,i*Ddish,Eta*Ddish));
-      vdsparseD7.push_back(Dish(cnt, 0.,i*Ddish2,Eta*Ddish2));
-    }
-    for(int i=0; i<4; i++) {
-	cnt++;  vdsparse.push_back(Dish(cnt, (3+2*i)*Ddish,(3+2*i)*Ddish,Eta*Ddish));
-	vdsparseD7.push_back(Dish(cnt, (3+2*i)*Ddish2,(3+2*i)*Ddish2,Eta*Ddish2));
-	cnt++;	vdsparse.push_back(Dish(cnt, (3+2*i)*Ddish,-(3+2*i)*Ddish,Eta*Ddish));
-	vdsparseD7.push_back(Dish(cnt, (3+2*i)*Ddish2,-(3+2*i)*Ddish2,Eta*Ddish2));
-	/*
-	if ((i>0)||(j>0)) {
-	  cnt++;  vdsparse.push_back(Dish(cnt, (5+3*i)*Ddish,(3+2*j)*Ddish,Eta*Ddish));
-	  cnt++;  vdsparse.push_back(Dish(cnt, (5+3*i)*Ddish,-(3+2*j)*Ddish,Eta*Ddish));
-	}
-	*/
-      }
-
-
-    vector<Dish> vcylplein, vcylplP;
-    cnt=0;
+    vector<Dish> vdplein = CreateFilledSqConfig(20, Ddish, Eta);
+    vector<Dish> vdpl64 = CreateFilledSqConfig(8, Ddish, Eta);
+
+    vector<Dish> vdsparse = CreateConfigA(Ddish, Eta);
+    vector<Dish> vdsparseD7 = CreateConfigA(Ddish2, Eta);
+    //    vector<Dish> vdsparseB = CreateConfigB(Ddish, Eta);
+    vector<Dish> vdsparseB = CreateConfigB(Ddish, Eta);
+    vector<Dish> vdsparseC = CreateConfigC(Ddish, Eta);
+
+
     double cylW=12.;   // Largeur des cylindres 
     double cylRL=0.5;  // Longeur des elements de reception le long du cylindre
-    for(int i=0; i<8; i++) 
-      for(int j=0; j<192; j++) {
-	vcylplein.push_back(Dish(i+1, i*cylW, j*cylRL, 0.9*cylW, 0.9*cylRL));
-	cnt++; vcylplP.push_back(Dish(cnt, i*cylW, j*cylRL, 1.*cylW, 1.*cylRL));
-      }
-    vector<Dish> v2cyl, v2cylP;
-    cnt=0;
-    for(int i=0; i<2; i++) 
-      for(int j=0; j<32; j++) {
-	v2cyl.push_back(Dish(i+1, i*25, j*cylRL, 0.9*9., 0.9*cylRL));
-	cnt++; v2cylP.push_back(Dish(cnt, i*25, j*cylRL, 0.9*9., 1.*cylRL));
-      }
+    double etaW=0.95;   // Efficacite de couverture en largeur
+    double etaRL=0.9;   // Efficacite de couverture le long du cylindre
+    vector<Dish> vcylplein = CreateFilledCylConfig(8, 192, cylW, cylRL, etaW, etaRL, true);
+    vector<Dish> vcylplP = CreateFilledCylConfig(8, 192, cylW, cylRL, etaW, etaRL, false);
+
+    cylW=10.;
+    cylRL=0.5; 
+    vector<Dish> v3cyl = CreateFilledCylConfig(3, 128, cylW, cylRL, etaW, etaRL, true);
+    vector<Dish> v3cylP = CreateFilledCylConfig(3, 128, cylW, cylRL, etaW, etaRL, false);
+    cylW=25.;
+    cylRL=0.5; 
+    etaW=0.3;
+    etaRL=0.9;
+    vector<Dish> v2cyl = CreateFilledCylConfig(2, 32, cylW, cylRL, etaW, etaRL, true);
+    vector<Dish> v2cylP = CreateFilledCylConfig(2, 32, cylW, cylRL, etaW, etaRL, false);
+
     double LMAX = D;
     bool fgnoauto = true;
-    int NRX=160;
-    int NRY=160;
+    int NRX=100;
+    int NRY=100;
 
     MultiDish mdfill(lambda, LMAX, vdplein, fgnoauto);
@@ -174,15 +172,24 @@
     PrtTim("Apres mdfill.GetResponse()");
 
+    MultiDish mdfill64(lambda, LMAX, vdpl64, fgnoauto);
+    mdfill64.SetRespHisNBins(NRX,NRY);   
+    {
+      Histo2D hpos=mdfill64.PosDist(10,10,10.*Ddish);
+      po << PPFNameTag("posf64") << hpos;
+    }
+    Histo2D hrf64 = mdfill64.GetResponse();
+    PrtTim("Apres mdfill64.GetResponse()");
+
     MultiDish mdsparse(lambda, LMAX, vdsparse, fgnoauto); 
-    mdsparse.SetThetaPhiRange(M_PI/4.,16, M_PI/4., 16);
+    mdsparse.SetThetaPhiRange(M_PI/6.,12, M_PI/6., 12);
     mdsparse.SetRespHisNBins(NRX,NRY);
+    {
+      Histo2D hpos=mdsparse.PosDist(22,22,22.*Ddish);;
+      po << PPFNameTag("posspA") << hpos;
+    }
     Histo2D hrsp = mdsparse.GetResponse();
     PrtTim("Apres mdsparse.GetResponse()");
 
-    MultiDish mdsparsefp(lambda, LMAX, vdsparse, fgnoauto); 
-    mdsparsefp.SetRespHisNBins(NRX,NRY);
-    Histo2D hrspfp = mdsparsefp.GetResponse();
-    PrtTim("Apres mdsparsefp.GetResponse()");
-
+    /*
     MultiDish mdsparseD7(lambda, LMAX, vdsparseD7, fgnoauto); 
     mdsparseD7.SetThetaPhiRange(M_PI/4.,16, M_PI/4., 16);
@@ -190,5 +197,31 @@
     Histo2D hrspd7 = mdsparseD7.GetResponse();
     PrtTim("Apres mdsparseD7.GetResponse()");
-			     
+    */ 
+    MultiDish mdsparseB(lambda, LMAX, vdsparseB, fgnoauto); 
+    mdsparseB.SetThetaPhiRange(M_PI/6.,12, M_PI/6., 12);
+    mdsparseB.SetRespHisNBins(NRX,NRY);
+    {
+      Histo2D hpos=mdsparseB.PosDist(15,15,15.*Ddish);
+      po << PPFNameTag("posspB") << hpos;
+    }
+    Histo2D hrspB = mdsparseB.GetResponse();
+    PrtTim("Apres mdsparseB.GetResponse()");			    
+
+    MultiDish mdsparseC(lambda, LMAX, vdsparseC, fgnoauto); 
+    mdsparseC.SetThetaPhiRange(M_PI/6.,12, M_PI/6., 12);
+    mdsparseC.SetRespHisNBins(NRX,NRY);
+    {
+      Histo2D hpos=mdsparseC.PosDist(20,20,20.*Ddish);
+      po << PPFNameTag("posspC") << hpos;
+    }
+    Histo2D hrspC = mdsparseC.GetResponse();
+    PrtTim("Apres mdsparseC.GetResponse()");			    
+
+    MultiDish mdsparseBfp(lambda, LMAX, vdsparseB, fgnoauto); 
+    mdsparseBfp.SetRespHisNBins(NRX,NRY);
+    Histo2D hrspBfp = mdsparseBfp.GetResponse();
+    PrtTim("Apres mdsparseBfp.GetResponse()");			    
+
+
     MultiDish mcylfill(lambda, LMAX, vcylplein, fgnoauto);
     mcylfill.SetRespHisNBins(NRX,NRY);
@@ -198,19 +231,36 @@
     mcylfillP.SetRespHisNBins(NRX,NRY);
     Histo2D hfcylP = mcylfillP.GetResponse();
+    PrtTim("Apres mcylfillP.GetResponse()");
+
+    MultiDish md3cyl(lambda, LMAX, v3cyl, fgnoauto);
+    md3cyl.SetRespHisNBins(NRX,NRY);
+    Histo2D h3cyl = md3cyl.GetResponse();
+    PrtTim("Apres md3cyl.GetResponse()");
+    MultiDish md3cylP(lambda, LMAX, v3cylP, fgnoauto);
+    md3cylP.SetRespHisNBins(NRX,NRY);
+    Histo2D h3cylP = md3cylP.GetResponse();
+    PrtTim("Apres md3cylP.GetResponse()");
 
     MultiDish md2cyl(lambda, LMAX, v2cyl, fgnoauto);
     md2cyl.SetRespHisNBins(NRX,NRY);
     Histo2D h2cyl = md2cyl.GetResponse();
+    PrtTim("Apres md2cyl.GetResponse()");
     MultiDish md2cylP(lambda, LMAX, v2cylP, fgnoauto);
     md2cylP.SetRespHisNBins(NRX,NRY);
     Histo2D h2cylP = md2cylP.GetResponse();
+    PrtTim("Apres md2cylP.GetResponse()");
 
     po << PPFNameTag("mfill") << hrfill;
+    po << PPFNameTag("mfill64") << hrf64;
     po << PPFNameTag("mspars") << hrsp;
-    po << PPFNameTag("msparsfp") << hrspfp;
-    po << PPFNameTag("msparsd7") << hrspd7;
+    //    po << PPFNameTag("msparsd7") << hrspd7;
+    po << PPFNameTag("msparsB") << hrspB;
+    po << PPFNameTag("msparsC") << hrspC;
+    po << PPFNameTag("msparsBfp") << hrspBfp;
     po << PPFNameTag("mcylf") << hfcyl;
+    po << PPFNameTag("m3cyl") << h3cyl;
     po << PPFNameTag("m2cyl") << h2cyl;
     po << PPFNameTag("mcylfP") << hfcylP;
+    po << PPFNameTag("m3cylP") << h3cylP;
     po << PPFNameTag("m2cylP") << h2cylP;
 
@@ -219,11 +269,17 @@
 
     Four2DRespTable mdf(hrfill, Dol);
+    Four2DRespTable mdf64(hrf64, Dol);
     Four2DRespTable mds(hrsp,   Dol);
-    Four2DRespTable mdsfp(hrspfp,   Dol);
-    Four2DRespTable mdsd7(hrspd7,   Dol);
+    // Four2DRespTable mdsfp(hrspfp,   Dol);
+    //    Four2DRespTable mdsd7(hrspd7,   Dol);
+    Four2DRespTable mdsB(hrspB,   Dol);
+    Four2DRespTable mdsC(hrspC,   Dol);
+    Four2DRespTable mdsBfp(hrspBfp,   Dol);
 
     Four2DRespTable mcylf(hfcyl, Dol);
+    Four2DRespTable m3cyl(h3cyl, Dol);
     Four2DRespTable m2cyl(h2cyl, Dol);
     Four2DRespTable mcylfP(hfcylP, Dol);
+    Four2DRespTable m3cylP(h3cylP, Dol);
     Four2DRespTable m2cylP(h2cylP, Dol);
 
@@ -244,19 +300,27 @@
 
     cout << " 4/ Computing Noise P(k) using PkNoiseCalculator ..." << endl;
-#define NCONFIG 10
-    Four2DResponse* f2rep[NCONFIG]={&dish, &dish2, &mdf, &mds, &mdsfp, &mdsd7, &mcylf, &mcylfP, &m2cyl, &m2cylP};
-    const char* tits[NCONFIG]={"Dish100m", "Dish200m","F20x20Dish5m","S63Dish5m","S63Dish5mFP","S63Dish7m",
-			       "F8Cyl","F8CylP","BiCyl","BiCylP"};
-    const char* tags[NCONFIG]={"noiseD", "noiseD2","noisemdf","noisemds","noisemdsfp","noisemdsd7",
-			       "noisefcyl","noisefcylP","noise2cyl","noise2cylP"};
+#define NCONFIG 14
+    Four2DResponse* f2rep[NCONFIG]={&dish, &dish2, &mdf, &mdf64, &mds, &mdsB, &mdsC, &mdsBfp,
+				    &mcylf, &mcylfP, &m3cyl, &m3cylP, &m2cyl, &m2cylP};
+    const char* tits[NCONFIG]={"Dish100m", "Dish200m","F20x20Dish5m","F8x8Dish5m",
+			       "S68Dish5m","S72Dish5m","S129CDish5m","S72BDish5mFP",
+			       "F8Cyl","F8CylP","F3Cyl","F3CylP","BiCyl","BiCylP"};
+    const char* tags[NCONFIG]={"noiseD", "noiseD2","noisemdf","noisemdf64","noisemds",
+			       "noisemdsB","noisemdsC","noisemdsBfp",
+			       "noisefcyl","noisefcylP","noise3cyl","noise3cylP", "noise2cyl","noise2cylP"};
     vector<int> nbdishes;
     nbdishes.push_back(1);
     nbdishes.push_back(1);
     nbdishes.push_back(vdplein.size());
+    nbdishes.push_back(vdpl64.size());
     nbdishes.push_back(vdsparse.size());
-    nbdishes.push_back(vdsparse.size());
-    nbdishes.push_back(vdsparseD7.size());
+    // nbdishes.push_back(vdsparse.size());
+    nbdishes.push_back(vdsparseB.size());
+    nbdishes.push_back(vdsparseC.size());
+    nbdishes.push_back(vdsparseB.size());
     nbdishes.push_back(vcylplein.size());
     nbdishes.push_back(vcylplP.size());
+    nbdishes.push_back(v3cyl.size());
+    nbdishes.push_back(v3cylP.size());
     nbdishes.push_back(v2cyl.size());
     nbdishes.push_back(v2cylP.size());
@@ -288,2 +352,265 @@
 
 
+//-----------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------
+//  Fonctions de creation de configuration d'interfero avec des dishs
+//-----------------------------------------------------------------------------------
+/* --Fonction -- */
+vector<Dish> CreateFilledSqConfig(int nd, double Ddish, double Eta)
+{
+  vector<Dish>  vd;
+  int cnt=0;
+  for(int i=0; i<nd; i++) 
+    for(int j=0; j<nd; j++) {
+      cnt++; 
+      vd.push_back(Dish(cnt, i*Ddish, j*Ddish, Eta*Ddish));
+    }
+  cout << ">>>CreateFilledSqConfig(" << nd << "," << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
+  
+  return vd;
+}
+
+/* --Fonction -- */
+vector<Dish> CreateSemiFilledSqConfig(int nd, double Ddish, double Eta)
+{
+  vector<Dish>  vd;
+  int cnt=0;
+  int fgst=1;
+  for(int i=0; i<nd; i++) {
+    fgst = (fgst+1)%2;
+    for(int j=0; j<nd; j++) {
+      if (j%2==fgst)  continue;
+      cnt++; 
+      vd.push_back(Dish(cnt, i*Ddish, j*Ddish, Eta*Ddish));
+    }
+  }
+  cout << ">>>CreateSemiFilledSqConfig(" << nd << "," << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
+  
+  return vd;
+}
+
+/* --Fonction -- */
+vector<Dish> CreateConfigA(double Ddish, double Eta)
+{
+  vector<Dish>  vd;
+  int cnt=0;
+  for(int i=0; i<18; i++) {
+    cnt++; vd.push_back(Dish(cnt, i*Ddish,0.,Eta*Ddish));
+    cnt++; vd.push_back(Dish(cnt, i*Ddish, 17.*Ddish,Eta*Ddish));
+    if ((i>0)&&(i<17)) {
+      cnt++; vd.push_back(Dish(cnt,0.,i*Ddish,Eta*Ddish));
+      cnt++; vd.push_back(Dish(cnt,17.*Ddish,i*Ddish,Eta*Ddish));
+    }
+  }
+  cout << ">>>CreateConfigA(" << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
+  return vd;
+}
+
+/* --Fonction -- */
+vector<Dish> CreateConfigB(double Ddish, double Eta)
+{
+  vector<Dish>  vd;
+  int cnt=0;
+  /*
+  for(int i=0; i<13; i++) {
+    cnt++; vd.push_back(Dish(cnt, i*Ddish,0.,Eta*Ddish));
+    cnt++; vd.push_back(Dish(cnt, i*Ddish, 12.*Ddish,Eta*Ddish));
+    if ((i>0)&&(i<12)) {
+      cnt++; vd.push_back(Dish(cnt,0.,i*Ddish,Eta*Ddish));
+      cnt++; vd.push_back(Dish(cnt,12.*Ddish,i*Ddish,Eta*Ddish));
+    }
+  }
+  for(int i=0; i<5; i++) {
+    cnt++; vd.push_back(Dish(cnt, (i+4)*Ddish,4.*Ddish,Eta*Ddish));
+    cnt++; vd.push_back(Dish(cnt, (i+4)*Ddish, 8.*Ddish,Eta*Ddish));
+    if ((i>0)&&(i<4)) {
+      cnt++; vd.push_back(Dish(cnt,4.*Ddish,(i+4)*Ddish,Eta*Ddish));
+      cnt++; vd.push_back(Dish(cnt,8.*Ddish,(i+4)*Ddish,Eta*Ddish));
+    }
+  }
+  */
+  for(int i=0; i<11; i++) {
+    cnt++; vd.push_back(Dish(cnt, i*Ddish,0.,Eta*Ddish));
+    cnt++; vd.push_back(Dish(cnt, i*Ddish, 10.*Ddish,Eta*Ddish));
+    if ((i>0)&&(i<10)) {
+      cnt++; vd.push_back(Dish(cnt,0.,i*Ddish,Eta*Ddish));
+      cnt++; vd.push_back(Dish(cnt,10.*Ddish,i*Ddish,Eta*Ddish));
+    }
+  }
+  for(int i=0; i<7; i++) {
+    cnt++; vd.push_back(Dish(cnt, (i+2)*Ddish, 2.*Ddish,Eta*Ddish));
+    cnt++; vd.push_back(Dish(cnt, (i+2)*Ddish, 8.*Ddish,Eta*Ddish));
+    if ((i>0)&&(i<6)) {
+      cnt++; vd.push_back(Dish(cnt,2.*Ddish,(i+2)*Ddish,Eta*Ddish));
+      cnt++; vd.push_back(Dish(cnt,8.*Ddish,(i+2)*Ddish,Eta*Ddish));
+    }
+  }
+  for(int i=0; i<3; i++) {
+    cnt++; vd.push_back(Dish(cnt, (i+4)*Ddish, 4.*Ddish,Eta*Ddish));
+    cnt++; vd.push_back(Dish(cnt, (i+4)*Ddish, 6.*Ddish,Eta*Ddish));
+    if ((i>0)&&(i<2)) {
+      cnt++; vd.push_back(Dish(cnt,4.*Ddish,(i+4)*Ddish,Eta*Ddish));
+      cnt++; vd.push_back(Dish(cnt,6.*Ddish,(i+4)*Ddish,Eta*Ddish));
+    }
+  }
+
+
+  cout << ">>>CreateConfigB(" << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
+  return vd;
+}
+
+
+/* --Fonction -- */
+vector<Dish> CreateConfigC(double Ddish, double Eta)
+{
+  vector<int_4> lesx, lesy;
+  
+  int max = 16;
+  for(int i=0; i<4; i++) 
+    for(int j=0; j<4; j++) {
+      lesx.push_back(i); lesy.push_back(j);
+      lesx.push_back(max-i); lesy.push_back(max-j);
+      lesx.push_back(i); lesy.push_back(max-j);
+      lesx.push_back(max-i); lesy.push_back(j);
+    }
+  
+  for(int i=5; i<12; i+=2) {
+    lesx.push_back(i); lesy.push_back(0);
+    lesx.push_back(i); lesy.push_back(max);
+    lesx.push_back(0); lesy.push_back(i);
+    lesx.push_back(max); lesy.push_back(i);
+  }
+  
+  for(int i=4; i<=12; i+=2) 
+    for(int j=4; j<=12; j+=2) {
+      lesx.push_back(i); lesy.push_back(j);
+    }
+  
+  for(int i=5; i<=11; i+=2) {
+    lesx.push_back(i); lesy.push_back(4);
+    lesx.push_back(i); lesy.push_back(max-4);
+    lesx.push_back(4); lesy.push_back(i);
+    lesx.push_back(max-4); lesy.push_back(i);
+  }
+  
+  EnumeratedSequence esx,esy;
+  esx = 2,5;
+  esy = 5,2;
+  
+  for(int k=0; k<esx.Size(); k++) {
+    int_4 ix=esx.Value(k);
+    int_4 iy=esy.Value(k);
+    
+    lesx.push_back(ix); lesy.push_back(iy);
+    lesx.push_back(max-ix); lesy.push_back(iy);
+    lesx.push_back(ix); lesy.push_back(max-iy);
+    lesx.push_back(max-ix); lesy.push_back(max-iy);
+  }
+ cout << "CreateConfigC/Debug: -checkSize/lesx=" << lesx.size() << " -Check/lesy=" << lesy.size() << endl;
+ 
+ vector<Dish> vd;
+ int cnt=0;
+ for(size_t i=0; i<lesx.size(); i++) {
+   cnt++; vd.push_back(Dish(cnt, ((double)lesx[i])*Ddish,((double)lesy[i])*Ddish,Eta*Ddish));
+ }
+
+ cout << ">>>CreateConfigC(" << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
+
+ return vd;
+
+}
+/* --Fonction -- */
+vector<Dish> CreateConfigD(double Ddish, double Eta)
+{
+EnumeratedSequence es;
+es = 0,1,3,4,6,8,10,12,14,16,18,20,22,24,25,27,28;
+vector<int_4> lesx, lesy;
+for(int k=0; k<es.Size(); k++) {
+  lesx.push_back(es.Value(k));   lesy.push_back(0);
+  lesx.push_back(es.Value(k));   lesy.push_back(28);
+}
+for(int k=1; k<es.Size()-1; k++) {
+  lesy.push_back(es.Value(k));   lesx.push_back(0);
+  lesy.push_back(es.Value(k));   lesx.push_back(28);
+}
+for(int k=1; k<=5; k++) {
+  lesy.push_back(k);   lesx.push_back(5);
+  lesy.push_back(28-k);   lesx.push_back(28-5);
+  if (k!=5) { 
+    lesx.push_back(k);   lesy.push_back(5);
+    lesx.push_back(28-k);   lesy.push_back(28-5);
+  }
+
+  lesy.push_back(k);   lesx.push_back(28-5);
+  lesy.push_back(28-k);   lesx.push_back(5);
+  if (k!=5) { 
+    lesx.push_back(28-k);   lesy.push_back(5);
+    lesx.push_back(k);   lesy.push_back(28-5);
+  }
+}
+
+for(int k=6; k<=13; k++) {
+  lesy.push_back(k);   lesx.push_back(k);
+  lesy.push_back(28-k);   lesx.push_back(28-k);
+  lesy.push_back(k);   lesx.push_back(28-k);
+  lesy.push_back(28-k);   lesx.push_back(k);
+}
+
+
+lesx.push_back(14); lesy.push_back(14);
+
+EnumeratedSequence esx,esy;
+esx = 1,2,4;
+esy = 12,11,13;
+
+for(int k=0; k<esx.Size(); k++) {
+  int_4 ix=esx.Value(k);
+  int_4 iy=esy.Value(k);
+  lesx.push_back(ix); lesy.push_back(iy);
+  lesx.push_back(28-ix); lesy.push_back(iy);
+  lesx.push_back(ix); lesy.push_back(28-iy);
+  lesx.push_back(28-ix); lesy.push_back(28-iy);
+  
+  lesy.push_back(ix); lesx.push_back(iy);
+  lesy.push_back(28-ix); lesx.push_back(iy);
+  lesy.push_back(ix); lesx.push_back(28-iy);
+  lesy.push_back(28-ix); lesx.push_back(28-iy);
+ }  
+for(int k=5; k<=13; k+=2) {
+  lesy.push_back(k);   lesx.push_back(14);
+  lesy.push_back(28-k);   lesx.push_back(14);
+  lesy.push_back(14);   lesx.push_back(k);
+  lesy.push_back(14);   lesx.push_back(28-k);
+}
+
+ cout << "CreateConfigB/Debug: -checkSize/lesx=" << lesx.size() << " -Check/lesy=" << lesy.size() << endl;
+ 
+ vector<Dish> vd;
+ int cnt=0;
+ for(size_t i=0; i<lesx.size(); i++) {
+   cnt++; vd.push_back(Dish(cnt, ((double)lesx[i])*Ddish,((double)lesy[i])*Ddish,Eta*Ddish));
+ }
+
+ cout << ">>>CreateConfigD(" << Ddish << "," << Eta << ") ---> NDishes=" << vd.size() << endl;
+
+ return vd;
+}
+
+/* --Fonction -- */
+vector<Dish> CreateFilledCylConfig(int ncyl,  int nRL, double cylW, double cylRL, double etaW, double etaRL, bool fgscid)
+{
+  vector<Dish>  vd;
+  int cnt=0;
+
+  for(int i=0; i<ncyl; i++) 
+    for(int j=0; j<nRL; j++) {
+      cnt++;
+      int rid = (fgscid) ? i+1 : cnt; 
+      vd.push_back(Dish(rid, i*cylW, j*cylRL, etaW*cylW, etaRL*cylRL));
+    }
+  cout << ">>>CreateFilledCylConfig(" << ncyl << "," << nRL << "," << cylW << "," << cylRL << "," 
+       << etaW << "," << etaRL << "," << ((fgscid)?" RId=CylNum":"Cnt") 
+       << ") ---> NDishes=" << vd.size() << endl;
+
+  return vd;
+}
Index: /trunk/Cosmo/RadioBeam/plpkn.pic
===================================================================
--- /trunk/Cosmo/RadioBeam/plpkn.pic	(revision 3768)
+++ /trunk/Cosmo/RadioBeam/plpkn.pic	(revision 3769)
@@ -5,17 +5,25 @@
 ########################################################################
 
-openppf pknoise.ppf
+if ( $# < 1 ) then 
+  echo ' Usage: exec plpkn PPFName_pknoise'
+  return 
+endif
+
+echo "---> openppf $1 "
+openppf $1
+
+echo '----> Executing anapkn.pic'
+exec anapkn.pic
+setup5 
+scalewz 0.7 2500 100 1
+y1 = 500*$cct21
+y2 = 9e4*$cct21
+xyl = "xylimits=0.01,0.5,$y1,$y2 logx logy minorticks"
+defscript plpklss
+  n/plot hpkz.val*${cct21}%$kk ! ! "same notit nsta connectpoints black $xyl line=solid,2"
+  addtext 0.03 2000 '*** P(k)-LSS ***' 'font=helvetica,bolditalic,16 black'
+endscript  
 
 setaxesatt 'minorticks font=helvetica,bold,16 autofontsize'
-disp noiseD 'logy nsta' 
-disp noiseD2 'same grey nsta'
-disp noisemdf 'same orange nsta'
-disp noisemds 'same red nsta'
-disp noisemdsfp 'same yellow nsta'
-disp noisemdsd7 'same gold nsta'
-disp noisefcyl 'same blue nsta'
-disp noisefcylP 'same skyblue nsta'
-disp noise2cyl 'same forestgreen nsta'
-disp noise2cylP 'same green nsta'
 
 Rad2Deg = 180/3.141596
@@ -55,39 +63,64 @@
 endscript 
 
-Dx = 100
-Dy = 100
-calcul 
-plot2d noiseD x/$Da val*$PNOISE nb>10 'line=solid,2 logy logx xylimits=0.002,0.8,1,1e5 grid cpts nsta notit' 
-Dx = 200
-Dy = 200
-calcul 
-plot2d noiseD2 x/$Da val*$PNOISE nb>10 'same line=solid,2  cpts grey nsta notit' 
-Dx = 5*0.95
-Dy = 5*0.95
-calcul 
-plot2d noisemdf x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts orange nsta notit' 
-plot2d noisemds x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts red nsta notit'
-Dx = 7.55*0.95
-Dy = 7.5*0.95
-calcul 
-plot2d noisemdsd7 x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts siennared nsta notit' 
-Dx = 12*0.9
-Dy = 0.5*0.9
-calcul 
-plot2d noisefcyl x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts blue nsta notit' 
-plot2d noisefcylP x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts skyblue nsta notit' 
-Dx = 8*0.9
-Dy = 0.5*0.9
-calcul 
-plot2d noise2cyl x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts forestgreen nsta notit' 
-plot2d noise2cylP x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts green nsta notit' 
-
-set lines ( '100mDish' '200mDish' '400x5mDish' '63x5mDish' '63x7.5mDish'  '8Cyl12x96m' 'Perf8Cyl12x96m' )
-set lines ( $lines 'Pitts2Cyl' 'PerfPitts2Cyl' ) 
-set cols ( black grey  orange red siennared  blue skyblue forestgreen green )
-textdrawer lines cols 'frame font=helvetica,bold,16' 
-setaxelabels 'k (Mpc^-1) ' 'PNoise(k) mk^2 Mpc^3' 'font=helvetica,bolditalic,16' 
-
-
+defscript plnoisedish 
+  Dx = 100
+  Dy = 100
+  calcul 
+  plot2d noiseD x/$Da val*$PNOISE nb>10 'line=solid,2 logy logx xylimits=0.002,0.8,1,1e5 navyblue grid cpts nsta notit' 
+  Dx = 200
+  Dy = 200
+  calcul 
+  plot2d noiseD2 x/$Da val*$PNOISE nb>10 'same line=solid,2  cpts grey nsta notit' 
+  set lines ( '100mDish' '200mDish'  )
+  set cols ( navyblue grey  )
+  textdrawer lines cols 'frame font=helvetica,bold,16 inset=0.1,0.3,0.7,0.8' 
+  setaxelabels 'k (Mpc^-1) ' 'PNoise(k) mk^2 Mpc^3' 'font=helvetica,bolditalic,16' 
+endscript 
+
+defscript plnoiseA
+  Dx = 5*0.95
+  Dy = 5*0.95
+  calcul 
+  plot2d noisemdf64 x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts red nsta notit'
+#  plot2d noisemds x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts red nsta notit'
+  plot2d noisemdsB x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts siennared nsta notit'
+  plot2d noisemdsC x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts violetred nsta notit'
+  Dx = 25*0.3
+  Dy = 0.5*0.9
+  calcul 
+  plot2d noise2cyl x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts forestgreen nsta notit' 
+  plot2d noise2cylP x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts green nsta notit' 
+  set lines (  'FilledA:64x5mD' 'SparseB:72x5mD' 'SparseC:129x5mD' 'Pitts2Cyl(=64C)' 'PerfPitts2Cyl(=64C)' )
+  set cols ( red siennared magenta  forestgreen green )
+  textdrawer lines cols 'frame font=helvetica,bold,16  inset=0.1,0.3,0.15,0.35' 
+  settitle ' PNoise(k) : Dishes/Cylinders, 64/72/129 channels' ' ' 'font=helvetica,bold,16' 
+endscript 
+
+defscript plnoiseB
+  Dx = 5*0.95
+  Dy = 5*0.95
+  calcul 
+  plot2d noisemdsC x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts red nsta notit'
+  plot2d noisemdf x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts gold nsta notit' 
+  Dx = 10*0.95
+  Dy = 0.5*0.9
+  calcul 
+  plot2d noise3cyl x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts violet nsta notit' 
+  plot2d noise3cylP x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts magenta nsta notit' 
+
+  Dx = 12*0.95
+  Dy = 0.5*0.9
+  calcul 
+  plot2d noisefcyl x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts blue nsta notit' 
+  plot2d noisefcylP x/$Da val*$PNOISE nb>10 'same line=solid,2 cpts royalblue nsta notit' 
+
+  set lines ( 'SparseC:129x5mD' 'Filled400x5m' '3xCyl10x64m(=384C)' 'Perf3xCyl10x64m(=384C)' )
+  set lines ( $lines '8Cyl12x96m(=1536C)' 'Perf8Cyl12x96m(=1536C)' )
+  set cols ( red gold  violet magenta  blue royalblue )
+  textdrawer lines cols 'frame font=helvetica,bold,16 inset=0.25,0.55,0.6,0.95' 
+  settitle ' PNoise(k) : Dishes/Cylinders, 129/384/400/1536 channels' ' ' 'font=helvetica,bold,16'	
+endscript
+
+defscript xxx
 newwin
 disp mfill 'h2disp=img colbr128 notit'
@@ -122,2 +155,62 @@
 setaxelabels 'kx (Radian^-1)  k=1000 -> ~21 arcmin ' ' ky (Radian^-1) ' 'font=helvetica,bolditalic,16' 
 settitle ' u-v coverage , Perfect-Pitts. 2 Cyl 16mx8m , dist=25m ' ' ' 'font=helvetica,bold,16' 
+
+
+disp noiseD 'logy nsta' 
+disp noiseD2 'same grey nsta'
+disp noisemdf 'same cyan nsta'
+disp noisemdf64 'same brown nsta'
+disp noisemds 'same red nsta'
+disp noisemdsC 'same orange nsta'
+
+disp noisemdsB 'same yellow nsta'
+disp noisemdsfp 'same yellow nsta'
+# disp noisemdsd7 'same gold nsta'
+disp noisefcyl 'same blue nsta'
+disp noisefcylP 'same skyblue nsta'
+disp noise3cylP 'same magenta nsta'
+disp noise3cyl 'same violet nsta'
+disp noise2cyl 'same forestgreen nsta'
+disp noise2cylP 'same green nsta'
+
+endscript 
+
+defscript AA
+  plnoisedish
+  plpklss
+  plnoiseA
+endscript 
+
+defscript BB
+  plnoisedish
+  plpklss
+  plnoiseB
+endscript 
+
+defscript POSCOV
+  disp posspB red
+  setaxelabels ' X (meters) ' ' Y (meters) ' 'font=helvetica,bolditalic,16' 
+  settitle ' Config B dish positions - 72 dishes  ' ' ' 'font=helvetica,bold,16' 
+#  w2ps
+   
+  disp posspC red
+  setaxelabels ' X (meters) ' ' Y (meters) ' 'font=helvetica,bolditalic,16' 
+  settitle ' Config C dish positions - 129 dishes  ' ' ' 'font=helvetica,bold,16' 
+#  w2ps
+  disp mfill64 'h2disp=img colbr128 notit'
+  setaxelabels 'kx (Radian^-1)  k=1000 -> ~21 arcmin ' ' ky (Radian^-1) ' 'font=helvetica,bolditalic,16' 
+  settitle ' u-v coverage , Filled 8x8 - 64 x 5m Dishes' ' ' 'font=helvetica,bold,16' 
+#  w2ps
+  disp m3cyl 'h2disp=img colbr128 notit'
+  setaxelabels 'kx (Radian^-1)  k=1000 -> ~21 arcmin ' ' ky (Radian^-1) ' 'font=helvetica,bolditalic,16' 
+  settitle ' u-v coverage , 3 Cylinders 10mx64m ' ' ' 'font=helvetica,bold,16' 
+#  w2ps
+  disp mfill 'h2disp=img colbr128 notit'
+  setaxelabels 'kx (Radian^-1)  k=1000 -> ~21 arcmin ' ' ky (Radian^-1) ' 'font=helvetica,bolditalic,16' 
+  settitle ' u-v coverage , Filled 20x20 - 400 x 5m Dishes' ' ' 'font=helvetica,bold,16' 
+#  w2ps
+  disp msparsC 'h2disp=img colbr128 notit'
+  setaxelabels 'kx (Radian^-1)  k=1000 -> ~21 arcmin ' ' ky (Radian^-1) ' 'font=helvetica,bolditalic,16' 
+  settitle 'u-v coverage, Sparse-C: 129x5mD Over 80mx80m (Rot~Pi/4)' ' ' 'font=helvetica,bold,16' 
+  
+endscript  
Index: /trunk/Cosmo/RadioBeam/specpk.cc
===================================================================
--- /trunk/Cosmo/RadioBeam/specpk.cc	(revision 3768)
+++ /trunk/Cosmo/RadioBeam/specpk.cc	(revision 3769)
@@ -154,7 +154,7 @@
   // sa_size_t is large integer type  
   for(sa_size_t kz=0; kz<fourAmp.SizeZ(); kz++) {
-    kzz =  (kz>fourAmp.SizeZ()/2) ? (double)(fourAmp.SizeZ()-kz)*dkz_ : (double)kz*dkz_; 
+    kzz =  (kz>fourAmp.SizeZ()/2) ? -(double)(fourAmp.SizeZ()-kz)*dkz_ : (double)kz*dkz_; 
     for(sa_size_t ky=0; ky<fourAmp.SizeY(); ky++) {
-      kyy =  (ky>fourAmp.SizeY()/2) ? (double)(fourAmp.SizeY()-ky)*dky_ : (double)ky*dky_; 
+      kyy =  (ky>fourAmp.SizeY()/2) ? -(double)(fourAmp.SizeY()-ky)*dky_ : (double)ky*dky_; 
       for(sa_size_t kx=0; kx<fourAmp.SizeX(); kx++) {
 	double kxx=(double)kx*dkx_;
@@ -194,5 +194,5 @@
 // cells with amp^2=re^2+im^2>s2cut are ignored
 // Output : power spectrum (profile histogram)
-HProf Four3DPk::ComputePk(double s2cut, double kmin, double kmax, int nbin)
+HProf Four3DPk::ComputePk(double s2cut, int nbin, double kmin, double kmax)
 {
   // The second half of the array along Y (matrix rows) contain
@@ -202,4 +202,12 @@
   // as a function of wave-number k = sqrt((double)(kx*kx+ky*ky))
   //  if (nbin < 1) nbin = nbh/2;
+  if ((kmax<0.)||(kmax<kmin)) {
+    kmin=0.;
+    double maxx=fourAmp.SizeX()*dkx_;
+    double maxy=fourAmp.SizeY()*dky_/2;
+    double maxz=fourAmp.SizeZ()*dkz_/2;
+    kmax=sqrt(maxx*maxx+maxy*maxy+maxz*maxz);
+  }
+  if (nbin<2) nbin=128; 
   HProf hp(kmin, kmax, nbin);
   hp.SetErrOpt(false);
Index: /trunk/Cosmo/RadioBeam/specpk.h
===================================================================
--- /trunk/Cosmo/RadioBeam/specpk.h	(revision 3768)
+++ /trunk/Cosmo/RadioBeam/specpk.h	(revision 3769)
@@ -59,6 +59,5 @@
 
 // Return the reconstructed power spectrum as a profile histogram   
-//  HProf ComputePk(double s2cut=0., double kmin=-0.5*DeuxPI, double kmax=127.5*DeuxPI, int nbin=256);
-  HProf ComputePk(double s2cut=0., double kmin=-DeuxPI, double kmax=255*DeuxPI, int nbin=256);
+  HProf ComputePk(double s2cut=0., int nbin=256, double kmin=0., double kmax=-1.);
   void  ComputePkCumul(HProf& hp, double s2cut=0.);
 
