From b5debc55943f15d5315e6dbb5974f8f0caef3d6c Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (home)" <j.wuttke@fz-juelich.de>
Date: Thu, 21 Jan 2010 23:49:31 +0100
Subject: [PATCH] mdy-

---
 pub/src/frida2.cpp |  3 +++
 pub/src/manip.cpp  | 43 ++++++++++++++++++++++++++++++++-----------
 pub/src/manip.h    |  1 +
 3 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/pub/src/frida2.cpp b/pub/src/frida2.cpp
index 7f55958a..4e938cc5 100644
--- a/pub/src/frida2.cpp
+++ b/pub/src/frida2.cpp
@@ -349,6 +349,7 @@ int main()
                     "  mpq   average when x equal\n"
                     "  mpgw  group y2 according to y0, weighted with y1\n"
                     "  mpsym symmetrize: map -x -> x, then average\n"
+                    "  mdy-  delete error bars\n"
                     "Per scan:\n"
                     "  msd   delete\n"
                     "  msa   average\n"
@@ -394,6 +395,8 @@ int main()
                 NManip::PtsAvgeEq();
             } else if (cmd == "mpsym") {
                 NManip::PtsSymmetrize();
+            } else if (cmd == "mdy-") {
+                NManip::PtsErrorDelete();
             } else if (cmd == "msd") {
                 NManip::ScaSelect( "d" );
             } else if (cmd == "msr") {
diff --git a/pub/src/manip.cpp b/pub/src/manip.cpp
index 03965332..0fcbee24 100644
--- a/pub/src/manip.cpp
+++ b/pub/src/manip.cpp
@@ -536,7 +536,7 @@ void NManip::PtsSymmetrize()
     if (!NOlm::overwrite) NOlm::SelNew();
     const COld *fin; COld fout;
     const COlo *f;
-    const CScan *Sin; CScan Sout;
+    const CScan *sin; CScan Sout;
     uint k, n, i, il, ih, nl, nh;
     while((fin=fiter())) {
         k = fiter.SelNo();
@@ -546,34 +546,55 @@ void NManip::PtsSymmetrize()
         fout.lDoc.push_back("mpsym "+expr);
 
         for (uint j=0; j<fin->nScan(); j++) {
-            Sin = &(fin->VS[j]);
+            sin = &(fin->VS[j]);
             Sout.Clear();
-            if( mystd::sorted( Sin->x )!=1 )
+            if( mystd::sorted( sin->x )!=1 )
                 throw string( "not sorted" );
             double step;
-            if( !mystd::is_equidist( &step, Sin->x ) )
+            if( !mystd::is_equidist( &step, sin->x ) )
                 throw string( "not equidistant" );
             double centre;
             T->tree_point_val( &centre, k, j );
-            il = (int) ( (centre - Sin->x[0])/step );
+            il = (int) ( (centre - sin->x[0])/step );
             ih = il + 1;
-            n = Sin->size();
+            n = sin->size();
             nl = il + 1;
             nh = n - ih;
             if( nl<1 || nh<1 )
                 throw string( "nothing to symmetrize" );
             for (i=0; i<(nl<nh?nl:nh); ++i) {
-                Sout.push_xy( ( -Sin->x[il-i] + Sin->x[ih+i] ) / 2,
-                                ( Sin->y[il-i] + Sin->y[ih+i] ) / 2 );
+                Sout.push_xy( ( -sin->x[il-i] + sin->x[ih+i] ) / 2,
+                                ( sin->y[il-i] + sin->y[ih+i] ) / 2 );
             }
             if( nl<nh ){
                 for (i=nl; i<nh; ++i)
-                    Sout.push_xy(  Sin->x[ih+i], Sin->y[ih+i] );
+                    Sout.push_xy(  sin->x[ih+i], sin->y[ih+i] );
             } else {
                 for (i=nh; i<nl; ++i)
-                    Sout.push_xy( -Sin->x[il-i], Sin->y[il-i] );
+                    Sout.push_xy( -sin->x[il-i], sin->y[il-i] );
             }
-            Sout.z = Sin->z;
+            Sout.z = sin->z;
+            fout.VS.push_back(Sout);
+        }
+        NOlm::OloAdd(&fout);
+    }
+}
+
+//! Delete error bars.
+
+void NManip::PtsErrorDelete()
+{
+    NOlm::IterateD fiter;
+    if (!NOlm::overwrite) NOlm::SelNew();
+    const COld *fin; COld fout;
+    CScan Sout;
+    while((fin=fiter())) {
+        fout = *fin;
+        fout.VS.clear();
+        fout.lDoc.push_back("mdy-");
+        for ( uint j=0; j<fin->nScan(); j++ ) {
+            Sout = fin->VS[j];
+            Sout.dy.clear();
             fout.VS.push_back(Sout);
         }
         NOlm::OloAdd(&fout);
diff --git a/pub/src/manip.h b/pub/src/manip.h
index 98fba26f..cf33f2fd 100644
--- a/pub/src/manip.h
+++ b/pub/src/manip.h
@@ -8,6 +8,7 @@ namespace NManip {
     void PtsRetainEqui();
     void PtsGroupWeighted();
     void PtsSymmetrize();
+    void PtsErrorDelete();
     void ScaSelect( string del_or_ret );
     void ScaAvge();
     void ScaJoin();
-- 
GitLab