Index: trunk/Cosmo/RadioBeam/README
===================================================================
--- trunk/Cosmo/RadioBeam/README	(revision 3791)
+++ trunk/Cosmo/RadioBeam/README	(revision 3792)
@@ -13,5 +13,5 @@
 
 A.1/ (u-v) plane coverage and Noise-P(k) computation for different interferometer configuration
-  - pknoise.cc : main program for Noise-P(k) computation
+  - pknoise.cc , repicon.cc : main program for Noise-P(k) computation and interferometer response computation
   - plpkn.pic : spiapp script for plotting pknoise.cc program output 
 A.2/ power spectrum computation and foreground/radio source 
@@ -28,4 +28,5 @@
   - lobe.h lobe.cc : 2D (k_alpha, k_delta) beam effect on 3D sky cubes
   - specpk.h specpk.cc : 3D power spectrum computation classes  
+  - interfconfigs.h interfconfigs.c : functions creating different dish arrays / cylinder configuration 
   - mdish.h mdish.cc : Classes for representing Multi-Dish interferometer configurations 
   - radutil.h radutil.cc : utilitaire de conversion a 21 cm
Index: trunk/Cosmo/RadioBeam/applobe.cc
===================================================================
--- trunk/Cosmo/RadioBeam/applobe.cc	(revision 3791)
+++ trunk/Cosmo/RadioBeam/applobe.cc	(revision 3792)
@@ -3,5 +3,5 @@
     R. Ansari , C. Magneville - Juin 2010 
 
-  Usage: applobe In3DPPFName Out3DPPFName [ResmapleFactor=0.5,0.333...] [TargetBeamArcmin]
+  Usage: applobe In3DPPFName Out3DPPFName [ResmapleFactor=0.5,0.333...] [TargetBeamDoL]
 ---------------------------------------------------------------  */
 
@@ -50,5 +50,5 @@
 
   if (narg < 3) {
-    cout << "Usage: applobe In3DPPFName Out3DPPFName [ResmapleFactor=0.5,0.333...] [TargetBeamArcmin]\n" << endl;
+    cout << "Usage: applobe In3DPPFName Out3DPPFName [ResmapleFactor=0.5,0.333...] [TargetBeamDoL]\n" << endl;
     return 1;
   }
@@ -64,13 +64,13 @@
   }
   bool fgcorrbeam=false;
-  double tbeamarcmin=15.;
+  double tbeamDoL=135;
   if (narg>4) {
-    tbeamarcmin=atof(arg[4]);
-    if (tbeamarcmin>1.e-3)  fgcorrbeam=true;
+    tbeamDoL=atof(arg[4]);
+    if (tbeamDoL>1)  fgcorrbeam=true;
   }
 
   int rc = 91;
 
-  cout << " ====== applobe :   Input NVSS catalog name= " << inname << " OutName=" << outname;
+  cout << " ====== applobe :   Input skycube  name= " << inname << " OutName=" << outname;
   bool fginmap=true;
   try {
@@ -105,8 +105,9 @@
 
     if (fgcorrbeam) {
-      double DoL = 1.22/ArcminToRadian(tbeamarcmin);
+      double DoL = tbeamDoL;
+      double tbeamarcmin = RadianToDegree(1.22/DoL)*60.;
       Four2DResponse tbeam(2, DoL, DoL );
-      cout << "applobe[3]: calling Correct2RefLobe() with target beam:" << tbeamarcmin 
-	   << " arcmin -> D/Lambda=" << DoL << endl;
+      cout << "applobe[3]: calling Correct2RefLobe() with target beam D/Lambda=" << DoL  
+	   << " -> arcmin " << tbeamarcmin << endl;
       beam.Correct2RefLobe(tbeam, incube, dx, dy, Freq0MHz, dfreq);
     }
Index: trunk/Cosmo/RadioBeam/calcpk2.cc
===================================================================
--- trunk/Cosmo/RadioBeam/calcpk2.cc	(revision 3791)
+++ trunk/Cosmo/RadioBeam/calcpk2.cc	(revision 3792)
@@ -65,8 +65,8 @@
     
     bool fgcorrbeam=true;
-    double tbeamarcmin=15.;
+    double tbeamDoL=135;
     if (narg>7) {
-      tbeamarcmin=atof(arg[7]);
-      if (tbeamarcmin<1.e-6)  fgcorrbeam=false;
+      tbeamDoL=atof(arg[7]);
+      if (tbeamDoL<1.)  fgcorrbeam=false;
     }
     bool fgclnsrc=true;
@@ -120,10 +120,11 @@
     double lambda = conv.getLambda();
     Four2DResponse arep(2, InterfArrayDiametre/lambda, InterfArrayDiametre/lambda, lambda);
-    double DoL = 1.22/ArcminToRadian(tbeamarcmin);
+    double DoL = tbeamDoL;
+    double tbeamarcmin = RadianToDegree(1.22/DoL)*60.;
     Four2DResponse tbeam(2, DoL, DoL );
     ForegroundCleaner  cleaner(arep, tbeam, skycube); 
     if (fgcorrbeam) {
-      cout << "calcpk2[3.a] : calling cleaner.BeamCorrections() for target beam (" << tbeamarcmin << " arcmin)" 
-	   << " Diam/Lambda=" << DoL << endl;
+      cout << "calcpk2[3.a] : calling cleaner.BeamCorrections() for target beam D/Lambda=" << DoL 
+	   << "  -> arcmin " << tbeamarcmin << endl;
       cleaner.BeamCorrections();
     }
Index: trunk/Cosmo/RadioBeam/interfconfigs.cc
===================================================================
--- trunk/Cosmo/RadioBeam/interfconfigs.cc	(revision 3792)
+++ trunk/Cosmo/RadioBeam/interfconfigs.cc	(revision 3792)
@@ -0,0 +1,266 @@
+#include "interfconfigs.h"
+
+
+//-----------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------
+//  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/interfconfigs.h
===================================================================
--- trunk/Cosmo/RadioBeam/interfconfigs.h	(revision 3792)
+++ trunk/Cosmo/RadioBeam/interfconfigs.h	(revision 3792)
@@ -0,0 +1,31 @@
+/*  ------------------------ Projet BAORadio -------------------- 
+    Differentes configurations de l'interferometre 
+    R. Ansari , C. Magneville - Juin 2010 
+---------------------------------------------------------------  */
+
+#ifndef INTERFCONFIGS_SEEN
+#define INTERFCONFIGS_SEEN
+
+#include "mdish.h"      
+#include <vector>
+#include <string> 
+
+
+//-----------------------------------------------------------------------------------
+//  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);
+
+
+
+#endif
Index: trunk/Cosmo/RadioBeam/makefile
===================================================================
--- trunk/Cosmo/RadioBeam/makefile	(revision 3791)
+++ trunk/Cosmo/RadioBeam/makefile	(revision 3792)
@@ -6,15 +6,18 @@
 include $(SOPHYABASE)/include/sophyamake.inc
 
-all : pknoise calcpk calcpk2 syncube srcat2cube tjyk applobe
+all : pknoise repicon calcpk calcpk2 syncube srcat2cube tjyk applobe 
 
 clean : 
 	rm Objs/* 
 
-PKGOLIST =  Objs/fgndsub.o Objs/lobe.o Objs/specpk.o Objs/mdish.o Objs/qhist.o Objs/radutil.o 
-PKGHLIST =  fgndsub.h lobe.h specpk.h mdish.h qhist.h radutil.h cubedef.h 
+PKGOLIST =  Objs/fgndsub.o Objs/lobe.o Objs/specpk.o Objs/mdish.o Objs/interfconfigs.o Objs/qhist.o Objs/radutil.o 
+PKGHLIST =  fgndsub.h lobe.h specpk.h mdish.h interfconfigs.h qhist.h radutil.h cubedef.h 
 
 ### les executables 
 pknoise : Objs/pknoise
 	echo 'makefile : pknoise made'
+
+repicon : Objs/repicon
+	echo 'makefile : repicon made'
 
 calcpk : Objs/calcpk
@@ -42,4 +45,11 @@
 Objs/pknoise.o : pknoise.cc $(PKGHLIST)
 	$(CXXCOMPILE) -o Objs/pknoise.o pknoise.cc
+
+### programme repicon  (calcul et sauvegarde de la reponse de l'interferometre dans le plan (u,v)
+Objs/repicon : Objs/repicon.o $(PKGOLIST)
+	$(CXXLINK) -o Objs/repicon Objs/repicon.o $(PKGOLIST)  $(SOPHYAEXTSLBLIST)
+
+Objs/repicon.o : repicon.cc $(PKGHLIST)
+	$(CXXCOMPILE) -o Objs/repicon.o repicon.cc
 
 ### programme calcpk
@@ -96,4 +106,7 @@
 	$(CXXCOMPILE) -o Objs/mdish.o mdish.cc
 
+Objs/interfconfigs.o : interfconfigs.cc $(PKGHLIST)
+	$(CXXCOMPILE) -o Objs/interfconfigs.o interfconfigs.cc
+
 Objs/lobe.o : lobe.cc $(PKGHLIST)
 	$(CXXCOMPILE) -o Objs/lobe.o lobe.cc
Index: trunk/Cosmo/RadioBeam/mdish.cc
===================================================================
--- trunk/Cosmo/RadioBeam/mdish.cc	(revision 3791)
+++ trunk/Cosmo/RadioBeam/mdish.cc	(revision 3792)
@@ -59,6 +59,11 @@
 // -- Four2DRespTable : Reponse tabulee instrumentale ds le plan k_x,k_y (angles theta,phi) 
 //---------------------------------------------------------------
-Four2DRespTable::Four2DRespTable(Histo2D const & hrep, double d)
-  : Four2DResponse(0,d,d) , hrep_(hrep)
+Four2DRespTable::Four2DRespTable()
+  : Four2DResponse(0,1.,1.)
+{
+}
+
+Four2DRespTable::Four2DRespTable(Histo2D const & hrep, double d, double lambda)
+  : Four2DResponse(0,d,d,lambda) , hrep_(hrep)
 {
 }
@@ -75,4 +80,28 @@
 }
 
+void Four2DRespTable::writeToPPF(string flnm)
+{
+  DVList dvinfo;
+  dvinfo["DoL"] = dx_;
+  dvinfo["LambdaRef"] = lambdaref_;
+  dvinfo["Lambda"] = lambda_;
+  POutPersist po(flnm);
+  po << hrep_;
+  po << dvinfo;
+}
+
+void Four2DRespTable::readFromPPF(string flnm)
+{
+  PInPersist pin(flnm);
+  DVList dvinfo;
+  pin >> hrep_;
+  pin >> dvinfo;
+  dx_ = dy_ = dvinfo["DoL"];
+  setLambdaRef((double)dvinfo["LambdaRef"]);
+  setLambda((double)dvinfo["Lambda"]); 
+}
+
+
+
 //---------------------------------------------------------------
 // -- Four2DRespRatio : rapport de la reponse entre deux objets Four2DResponse
@@ -87,8 +116,9 @@
   double ra = a_.Value(kx,ky);
   double rb = b_.Value(kx,ky);
-  if (rb<divzthr_) {
-    if (ra<rb)  return 0.;
-    else rb=divzthr_;
-  }
+  if (ra<rb) {
+    if (rb>1.e-39)  return(ra/rb);  
+    else return 0.;
+  }
+  if (rb<divzthr_)  rb=divzthr_;
   return (ra/rb);
 }
Index: trunk/Cosmo/RadioBeam/mdish.h
===================================================================
--- trunk/Cosmo/RadioBeam/mdish.h	(revision 3791)
+++ trunk/Cosmo/RadioBeam/mdish.h	(revision 3792)
@@ -61,8 +61,14 @@
 class Four2DRespTable : public  Four2DResponse {
 public:
+  // Constructeur sans argument, utilise pour lire depuis un fichier 
+  Four2DRespTable();
   // On donne dx=D/lambda=Dx/lambda , dy=Dy/lambda 
-  Four2DRespTable(Histo2D const & hrep, double d);
+  Four2DRespTable(Histo2D const & hrep, double d, double lambda=1.);
   // Return the 2D response for wave vector (kx,ky)
   virtual double Value(double kx, double ky); 
+
+  void writeToPPF(string flnm);
+  void readFromPPF(string flnm);
+
   Histo2D hrep_;
 };
Index: trunk/Cosmo/RadioBeam/pknoise.cc
===================================================================
--- trunk/Cosmo/RadioBeam/pknoise.cc	(revision 3791)
+++ trunk/Cosmo/RadioBeam/pknoise.cc	(revision 3792)
@@ -9,4 +9,6 @@
 #include "mdish.h"
 #include "specpk.h"
+#include "interfconfigs.h"
+
 #include "histinit.h"
 // #include "fiosinit.h"
@@ -55,18 +57,4 @@
 };
 
-//-----------------------------------------------------------------------------------
-//  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);
 
 
@@ -352,265 +340,2 @@
 
 
-//-----------------------------------------------------------------------------------
-//-----------------------------------------------------------------------------------
-//  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/repicon.cc
===================================================================
--- trunk/Cosmo/RadioBeam/repicon.cc	(revision 3792)
+++ trunk/Cosmo/RadioBeam/repicon.cc	(revision 3792)
@@ -0,0 +1,160 @@
+#include "machdefs.h"
+#include "sopnamsp.h"
+#include <iostream>
+#include <string>
+#include <math.h>
+
+#include <typeinfo>
+
+#include "mdish.h"
+#include "specpk.h"
+#include "interfconfigs.h"
+
+#include "histinit.h"
+// #include "fiosinit.h"
+// #include "fitsioserver.h"
+
+#include "randr48.h"      
+
+#include "timing.h"
+#include "ctimer.h"
+
+typedef DR48RandGen RandomGenerator ;
+
+// ---------------------------------------------------------------------
+// Test main program for computing interferometer response un (u,v) plane
+// R. Ansari  - Avril-Juin 2010 
+// ---------------------------------------------------------------------
+
+
+
+
+//-------------------------------------------------------------------------
+//      ------------------ MAIN PROGRAM ------------------------------
+//-------------------------------------------------------------------------
+int main(int narg, const char* arg[])
+{
+  if (((narg>1)&&(strcmp(arg[1],"-h")==0))||(narg<3))  {
+    cout << " Usage: repicon configId OutPPFName [Lambda] " 
+	 << " configs: f4x4 , f8x8 , f20x20 Filled array of nxn dishes \n" 
+	 << "          confA , confB, confC : semi-filled array of dishes \n"
+	 << "          f3cyl, f8cyl , f3cylp, f8cylp : filled array of non perfect/perfect of n cylinders " << endl; 
+    return 1;
+  }
+  cout << " ==== repicon.cc program , (u,v) plane response ==== " << endl;
+  // make sure SOPHYA modules are initialized 
+  SophyaInit();  
+  //  FitsIOServerInit();
+  InitTim();
+  //--- decoding command line arguments 
+  string config = "f8x8" ;
+  if (narg>1) config = arg[1];
+  string outfile = "repicon.ppf";  
+  if (narg>2) outfile = arg[2];
+  if (outfile==".")  outfile = "repicon.ppf";
+  double LAMBDA=0.357 ;  // 21 cm at z=0.7 
+  if (narg>3) LAMBDA = atof(arg[2]);
+
+  //-- end command line arguments
+  
+  int rc = 1;  
+  try {  // exception handling try bloc at top level
+
+    cout << " 2.c/ Creating MultiDish Filled Array " << endl;
+    double Ddish = 5.;
+    double Ddish2 = 7.5;
+    double Eta=0.95;
+    double cylW=12.;   // Largeur des cylindres 
+    double cylRL=0.5;  // Longeur des elements de reception le long du cylindre
+    double etaW=0.95;   // Efficacite de couverture en largeur
+    double etaRL=0.9;   // Efficacite de couverture le long du cylindre
+    int cnt=0;
+
+    vector<Dish> vdishes;
+    cout << " repicon[1] : creating dish vector/ MultiDish for configuration: " << config << endl;
+
+    bool fgpoint=false;
+    if (config=="f4x4") {
+      vdishes=CreateFilledSqConfig(4,Ddish, Eta);
+    }
+    else if (config=="f8x8") {
+      vdishes=CreateFilledSqConfig(8,Ddish, Eta);
+    }
+    else if (config=="f20x20") {
+      vdishes=CreateFilledSqConfig(20,Ddish, Eta);
+    }
+    else if (config=="f3cyl") {
+      cylW=10.;   cylRL=0.5; 
+      vdishes=CreateFilledCylConfig(3, 128, cylW, cylRL, etaW, etaRL, true);
+    }
+    else if (config=="f3cylp") {
+      cylW=10.;   cylRL=0.5; 
+      vdishes=CreateFilledCylConfig(3, 128, cylW, cylRL, etaW, etaRL, false);
+    }
+    else if (config=="f8cyl") {
+      cylW=12.;   cylRL=0.5; 
+      vdishes=CreateFilledCylConfig(8, 192, cylW, cylRL, etaW, etaRL, true);
+    }
+    else if (config=="f8cylp") {
+      cylW=12.;   cylRL=0.5; 
+      vdishes=CreateFilledCylConfig(8, 192, cylW, cylRL, etaW, etaRL, false);
+    }
+    else if (config=="confA") {
+      fgpoint=true;
+      vdishes=CreateConfigA(Ddish, Eta);
+    }
+    else if (config=="confB") {
+      fgpoint=true;
+      vdishes=CreateConfigB(Ddish, Eta);
+    }
+    else if (config=="confC") {
+      fgpoint=true;
+      vdishes=CreateConfigC(Ddish, Eta);
+    }
+    else {
+      cout << " NON valid configuration option -> exit" << endl;
+      return 99;
+    }
+
+    double D = 100.;
+    double Dol = D/LAMBDA;
+
+    double LMAX = D;
+    bool fgnoauto = true;
+    int NRX=100;
+    int NRY=100;
+
+    MultiDish mdish(LAMBDA, LMAX, vdishes, fgnoauto);
+    mdish.SetRespHisNBins(NRX,NRY); 
+    if (fgpoint) 
+      mdish.SetThetaPhiRange(M_PI/6.,12, M_PI/6., 12);
+    cout << " repicon[2] : calling mdish.GetResponse() ..."<< endl;
+
+    Histo2D hrep = mdish.GetResponse();
+    PrtTim("Apres mdish.GetResponse()");
+
+    cout << " repicon[3] : saving Four2DRespTable for config " << config << " to PPF file " << outfile << endl;
+    Four2DRespTable mdresp(hrep, Dol, LAMBDA);
+    mdresp.writeToPPF(outfile);
+
+    rc = 0;
+  }  // End of try bloc 
+  catch (PThrowable & exc) {  // catching SOPHYA exceptions
+    cerr << " repicon.cc: Catched Exception (PThrowable)" << (string)typeid(exc).name() 
+         << "\n...exc.Msg= " << exc.Msg() << endl;
+    rc = 99;
+  }
+  catch (std::exception & e) {  // catching standard C++ exceptions
+    cerr << " repicon.cc: Catched std::exception "  << " - what()= " << e.what() << endl;
+    rc = 98;
+  }
+  catch (...) {  // catching other exceptions
+    cerr << " repicon.cc: some other exception (...) was caught ! " << endl;
+    rc = 97;
+  }
+  PrtTim("End-repicon");
+  cout << " ==== End of repicon.cc program  Rc= " << rc << endl;
+  return rc;	
+}
+
+
