Index: /trunk/ArchTOIPipe/Kernel/fitsringwtr.cc
===================================================================
--- /trunk/ArchTOIPipe/Kernel/fitsringwtr.cc	(revision 2328)
+++ /trunk/ArchTOIPipe/Kernel/fitsringwtr.cc	(revision 2329)
@@ -4,5 +4,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: fitsringwtr.cc,v 1.2 2003-02-11 14:26:40 cecile Exp $
+// $Id: fitsringwtr.cc,v 1.3 2003-02-24 14:14:51 cecile Exp $
 
 #include "fitsringwtr.h"
@@ -70,8 +70,8 @@
     strcpy(buf, "RINGDATA");
     fits_write_key(fptr, TSTRING, "PDMTYPE",  &buf, "Planck Data Model Type", &fstatus);
-    double theta = getData(0, ring);//*nSamples);
+    double theta = getData(0, ring*nSamples);
     fits_write_key(fptr, TDOUBLE, "CIRTHETA", &theta, "Theta angle in radians", &fstatus);
-    double phi = getData(1, ring);//*nSamples);
-    wontNeedBefore(ring);//*nSamples);
+    double phi = getData(1, ring*nSamples);
+    wontNeedBefore(ring*nSamples);
     fits_write_key(fptr, TDOUBLE, "CIRPHI", &phi, "Phi angle in radians", &fstatus);
     fits_write_key(fptr, TDOUBLE, "CIRAPER", &aperture, "Aperture angle in radians", &fstatus);
@@ -81,5 +81,4 @@
     for (int i=0; i<nSamples; i++) {
       double data = getData(2, ring*nSamples+i);
-      wontNeedBefore(ring*nSamples+i);
       fits_lock();
       fits_write_col(fptr, TDOUBLE, 1,i,1,1, &data, &fstatus);
Index: /trunk/ArchTOIPipe/Kernel/toimanager.cc
===================================================================
--- /trunk/ArchTOIPipe/Kernel/toimanager.cc	(revision 2328)
+++ /trunk/ArchTOIPipe/Kernel/toimanager.cc	(revision 2329)
@@ -3,5 +3,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toimanager.cc,v 1.19 2002-10-23 21:05:18 aubourg Exp $
+// $Id: toimanager.cc,v 1.20 2003-02-24 14:14:51 cecile Exp $
 
 #include "toimanager.h"
@@ -60,4 +60,6 @@
   checkSamplesLimits(2);
   checkSamplesLimits(3);
+  cout<<"Fin checks"<<endl;
+  
    
   // debogage affichage des limites apres calcul
Index: /trunk/ArchTOIPipe/ProcWSophya/toi2ring.cc
===================================================================
--- /trunk/ArchTOIPipe/ProcWSophya/toi2ring.cc	(revision 2328)
+++ /trunk/ArchTOIPipe/ProcWSophya/toi2ring.cc	(revision 2329)
@@ -3,5 +3,5 @@
 //                               Christophe Magneville
 //                               Reza Ansari
-// $Id: toi2ring.cc,v 1.2 2003-01-30 17:19:25 cecile Exp $
+// $Id: toi2ring.cc,v 1.3 2003-02-24 14:14:51 cecile Exp $
 
 #include "toimanager.h"
@@ -68,4 +68,5 @@
 
  
+ cout << "loop " << snb << " " << sne << endl;
  
 for(int k=snb;k<=sne;k++) {
@@ -82,16 +83,15 @@
   wr[i]++;
 
-  cout << phi << " " << phi_prec << " " << Nrings <<endl;
+  cout << k << " " << phi << " " << phi_prec << " " << Nrings <<endl;
   
-  if(phi < phi_prec){
+  if(phi < phi_prec || k == sne){
     
-    putData(0,Nrings,ctheta);
-    putData(1,Nrings,cphi);
-
     for(i=0;i<Nsamples;i++) {
       if(wr[i] == 0) r[i] = -999999.;
-      cout << i << " " << Nrings << " " << Nsamples << " " << ctheta << " " << cphi << " " << r[i]<< endl;
+      else r[i] /= wr[i];
+      cout << "PUT " << i << " " << Nrings << " " << Nsamples << " " << ctheta << " " << cphi << " " << r[i]<< endl;
+      putData(0,Nrings*Nsamples+i,ctheta);
+      putData(1,Nrings*Nsamples+i,cphi);
       putData(2,Nrings*Nsamples+i,r[i]);
-      //      putData(1,Nrings*Nsamples+i,wr[i]);
       wr[i]=0;
       r[i]=0.;
@@ -99,4 +99,6 @@
     
     Nrings++;
+    return;
+    
   }
   
Index: /trunk/ArchTOIPipe/TestPipes/tsttoi2ring.cc
===================================================================
--- /trunk/ArchTOIPipe/TestPipes/tsttoi2ring.cc	(revision 2328)
+++ /trunk/ArchTOIPipe/TestPipes/tsttoi2ring.cc	(revision 2329)
@@ -22,5 +22,6 @@
 void usage(void);
 void usage(void) {
- cout<<"tsttoi2ring fitsin_phase fitsin_value fitsout_value fitsout_weight Nsamples"<<endl;
+  cout<<"tsttoi2ring fitsin_phase fitsin_value fitsout_value fitsout_weight ";
+   cout<<" Nsamples SN_begin SN_last (all -f SN_last<SN_begin)"<<endl;
  return;
 }
@@ -38,5 +39,5 @@
 bool snimplicit = false;
 
-if(narg != 6) {usage(); exit(2);}
+if(narg != 8) {usage(); exit(2);}
 char * fitsin_phase    = arg[1];
 char * fitsin_value    = arg[2];
@@ -44,4 +45,8 @@
 char * fitsout_weight  = arg[4];
 int    Nsamples        = atoi(arg[5]);
+ int_8 sdeb               = atoi(arg[6]);
+ int_8 sfin              = atoi(arg[7]);
+    cout<<"Requested Samples from "<<sdeb<<" , "<<sfin<<endl;
+ 
 
 cout<<">>>> tsttoi2ring:"<<endl
@@ -67,4 +72,6 @@
  FITSTOIReader rfitsp(fitsin_phase);
  if(snimplicit) rfitsp.setImplicitSN();
+ if(sfin>=sdeb) rfitsp.setRequestedSample(sdeb,sfin);
+
  FITSTOIReader rfitsv(fitsin_value);
  if(snimplicit) rfitsv.setImplicitSN();
@@ -79,4 +86,8 @@
  wfits.setNSamples(Nsamples);
  wwfits.setNSamples(Nsamples);
+ wfits.setNRings(1);
+ wwfits.setNRings(1);
+ 
+
 
  cout << "fits writer created"<<endl;
@@ -86,4 +97,6 @@
  Toi2RING m2ring(Nsamples);
  cout<<"Toi2RING created"<<endl;
+
+ if(sfin>=sdeb) m2ring.setRequestedSample(sdeb,sfin);
 
  // Definition des tuyaux
Index: /trunk/ArchTOIPipe/files_kernel
===================================================================
--- /trunk/ArchTOIPipe/files_kernel	(revision 2328)
+++ /trunk/ArchTOIPipe/files_kernel	(revision 2329)
@@ -13,2 +13,4 @@
 toisegment.cc
 toisegment.h
+fitsringwtr.cc
+fitsringwtr.h
Index: /trunk/ArchTOIPipe/files_pipes
===================================================================
--- /trunk/ArchTOIPipe/files_pipes	(revision 2328)
+++ /trunk/ArchTOIPipe/files_pipes	(revision 2329)
@@ -22,2 +22,3 @@
 gph425_ring.cc
 sp.cc
+tsttoi2ring.cc
Index: /trunk/ArchTOIPipe/files_sophya
===================================================================
--- /trunk/ArchTOIPipe/files_sophya	(revision 2328)
+++ /trunk/ArchTOIPipe/files_sophya	(revision 2329)
@@ -21,3 +21,5 @@
 Bolos2ring.cc
 ring33.h
-ring33.cc                                                                                                                                                       
+ring33.cc
+toi2ring.h
+toi2ring.cc                        
