diff --git a/.gitignore b/.gitignore
index da979b89d420b20b2ad363b5ccabaf7101ba1985..8531fbd55f33726807bb59e7319fadc9d1064988 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@
 *.a
 *.so
 *.so.*
+*.swp
 html/
 frida2-*/
 frida
diff --git a/pub/CHANGELOG b/pub/CHANGELOG
index 5ca2521ed89c1b398b63d568be109542373622db..23037e573131efc6c5a4e6b81d4d6d9f490dd1dd 100644
--- a/pub/CHANGELOG
+++ b/pub/CHANGELOG
@@ -1,4 +1,4 @@
-Release, comes with fridalibs-
+Release 2.1.7b of 18feb13, comes with fridalibs-130218:
 
 - bugfixes:
   - reenable external curves (nPar() becomes nP)
diff --git a/pub/configure b/pub/configure
index 0bb6005a11823d17515f6be4102e9ae76c52c79e..4076b58bd72397e108f8442acb574419c9d1cdac 100755
--- a/pub/configure
+++ b/pub/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for frida post-2.1.7a.
+# Generated by GNU Autoconf 2.69 for frida 2.1.7b.
 #
 # Report bugs to <j.wuttke@fz-juelich.de>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='frida'
 PACKAGE_TARNAME='frida'
-PACKAGE_VERSION='post-2.1.7a'
-PACKAGE_STRING='frida post-2.1.7a'
+PACKAGE_VERSION='2.1.7b'
+PACKAGE_STRING='frida 2.1.7b'
 PACKAGE_BUGREPORT='j.wuttke@fz-juelich.de'
 PACKAGE_URL=''
 
@@ -1284,7 +1284,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures frida post-2.1.7a to adapt to many kinds of systems.
+\`configure' configures frida 2.1.7b to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1350,7 +1350,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of frida post-2.1.7a:";;
+     short | recursive ) echo "Configuration of frida 2.1.7b:";;
    esac
   cat <<\_ACEOF
 
@@ -1446,7 +1446,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-frida configure post-2.1.7a
+frida configure 2.1.7b
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2120,7 +2120,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by frida $as_me post-2.1.7a, which was
+It was created by frida $as_me 2.1.7b, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2474,8 +2474,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 #                ^^^^^ delete "post-" for public releases
 # project name must be "frida"; this determines the installation directories
 
-#AC_PREREQ(2.65) # downgraded to 2.61
-
 ac_aux_dir=
 for ac_dir in build-aux "$srcdir"/build-aux; do
   if test -f "$ac_dir/install-sh"; then
@@ -2945,7 +2943,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='frida'
- VERSION='post-2.1.7a'
+ VERSION='2.1.7b'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -7641,7 +7639,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by frida $as_me post-2.1.7a, which was
+This file was extended by frida $as_me 2.1.7b, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7707,7 +7705,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-frida config.status post-2.1.7a
+frida config.status 2.1.7b
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/pub/configure.ac b/pub/configure.ac
index f4a5d1ebde15c459874637ab2e9515ba9a74d6b8..b53d7e0c0e84e61de159aa66d8a0adab539ab6bf 100644
--- a/pub/configure.ac
+++ b/pub/configure.ac
@@ -9,12 +9,10 @@
 ##  Generic initialization                                                   ##
 ###############################################################################
 
-AC_INIT([frida],[post-2.1.7a],[j.wuttke@fz-juelich.de])
+AC_INIT([frida],[post-2.1.7b],[j.wuttke@fz-juelich.de])
 #                ^^^^^ delete "post-" for public releases
 # project name must be "frida"; this determines the installation directories
 
-#AC_PREREQ(2.65) # downgraded to 2.61
-
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_SRCDIR([src/frida2.cpp]) # assure we have the right src dir
 AC_CONFIG_MACRO_DIR([m4])
diff --git a/pub/src/commands.cpp b/pub/src/commands.cpp
index 42b1a4bab06f3a1f2a9f84792ef227818f135e37..2b23e46e13000ce6396201d3f92738a5917b6751 100644
--- a/pub/src/commands.cpp
+++ b/pub/src/commands.cpp
@@ -121,6 +121,8 @@ bool fridaCommand( string cmd )
             "  cwc  weighing: constant\n"
             "  cwl  weighing: logarithmic\n"
             "  cwv  weighing: reciprocal variance (default)\n"
+            "  cg+  use plot grid from data reference file\n"
+            "  cg-  back to default grid\n"
             "Fit tuning parameters:\n"
             "  cs?  show parameters\n"
             "  csf  set gradient step factor\n"
@@ -163,7 +165,7 @@ bool fridaCommand( string cmd )
         NCurveFile::SetFixed( true );
     } else if (cmd == "cu") {
         NCurveFile::SetFixed( false );
-    } else if (cmd.substr(0,2) == "cw") {
+    } else if (cmd.substr(0,2) == "cw" || cmd.substr(0,2) == "cg") {
         NCurveFile::SetProperties( cmd.substr(1) );
 
     } else if (cmd == "c_cd") {
diff --git a/pub/src/curve.cpp b/pub/src/curve.cpp
index 141049d502cb547ef2a049083f1e129c47bfc765..ad69b2cb23e7edcd2f7e7f1e6afd6aedd38d22fd 100644
--- a/pub/src/curve.cpp
+++ b/pub/src/curve.cpp
@@ -45,8 +45,8 @@ using boost::format;
 namespace NCurveFile
 {
     // Local functions (wouldn't suffice "static" ??):
-    double NumericIntegral(
-        POlc fc, int k, int j, double low, double hig );
+    double NumericIntegral( POlc fc, int k, int j, double low, double hig );
+    double GridSum( POlc fc, int k, int j );
     // Parameters for numeric integration:
     double numint_bound_low=-INFINITY, numint_bound_hig=INFINITY;
     // Tuning parameters:
@@ -673,6 +673,10 @@ void NCurveFile::SetProperties( string which )
             fc->weighing = COlc::_LOG;
         else if (which=="wv")
             fc->weighing = COlc::_ERR;
+        else if (which=="g+")
+            fc->plot_to_grid = true;
+        else if (which=="g-")
+            fc->plot_to_grid = false;
         else
             throw "unknown property";
     }
@@ -1020,6 +1024,7 @@ void NCurveFile::IntegralProperty()
             "   0 | 1 | ...         extract curve parameters\n"
             "   q0 | q1 | q2        extract fit metrics\n"
             "   i                   numeric integral\n"
+            "   s                   integral as sum over data file grid\n"
             "   <list>              comma-separated list thereof\n"
             "   *                   extract all curve parameters\n"
             ;
@@ -1125,6 +1130,8 @@ void NCurveFile::IntegralProperty()
                 else if ( mode=="i" )
                     val = NumericIntegral( fin, fiter.k(), j,
                                            numint_bound_low, numint_bound_hig );
+                else if ( mode=="s" )
+                    val = GridSum( fin, fiter.k(), j );
                 else
                     throw "invalid mode " + mode;
 
@@ -1168,6 +1175,31 @@ double NCurveFile::NumericIntegral(
                             numint_mode, numint_epsabs, numint_epsrel );
 }
 
+//! Numeric integration of one curve, as a sum using the grid from data file kd.
+
+double NCurveFile::GridSum( POlc fc, int k, int j )
+{
+    if( fc->kd==-1 )
+        throw "data reference not set";
+    POld fd = NOlm::mem_get_D(fc->kd);
+    if( !fd )
+        throw "data reference not found";
+    if( j>=fd->nJ() )
+        throw "number of spectra does not match";
+    vector<double> *xc = &(fd->VS(j)->x);
+    int n = xc->size();
+    if( n<2 )
+        throw "not enough points in grid";
+    vector<double> yc;
+    fc->curve_val_vec( &yc, *xc, k, j );
+    double ret = 0;
+    ret  = ((*xc)[1]-(*xc)[0])/2*yc[0];
+    ret += ((*xc)[n-1]-(*xc)[n-2])/2*yc[n-1];
+    for ( uint i=1; i<n-1; ++i )
+        ret += ((*xc)[i+1]-(*xc)[i-1])/2*yc[i];
+    return ret;
+}
+
 
 //***************************************************************************//
 //* Calculate cumulative distribution (needed for SPHERES PST simulation)   *//
diff --git a/pub/src/func.cpp b/pub/src/func.cpp
index 9436b67cba50541739cf54a6313490056df5711e..c76f6a1f7b7c96322b79ff29cfa3a2b2c02b5ce5 100644
--- a/pub/src/func.cpp
+++ b/pub/src/func.cpp
@@ -194,6 +194,15 @@ double func_im_havneg (double v, double a, double g) {
     return pow( 1 + 2*pow(v,a)*cos(M_PI*a/2)+pow(v,2*a), -g/2 ) *
         sin( g*aux_phi_havneg( v, a ) ); }
 
+// EXPERIMENTAL
+double func_im_wz( double x, double y ){
+    return im_w_of_z( x, y );
+}
+double func_re_wz( double x, double y ){
+    return re_w_of_z( x, y );
+}
+
+
 //**************************************************************************//
 //*   Functions of three arguments                                         *//
 //**************************************************************************//
@@ -485,6 +494,10 @@ void NFunctions::initialize(void) {
     CFunc( "cauchy",  func_cauchy, 0, 0,
         "(x,w): the Cauchy-Lorentz function ?/(x^2+w^2)" ).register_me();
 
+    // EXPERIMENTAL
+    CFunc( "imw",    func_im_wz,   0, 0, "im[w(z)]" ).register_me();
+    CFunc( "rew",    func_re_wz,   0, 0, "re[w(z)]" ).register_me();
+
 // f(3 args)
     CFunc( "q4w",      func_q4w, 0, 0,
         "(x,y,z): ?" ).register_me();
diff --git a/pub/src/olf.h b/pub/src/olf.h
index b66b48714a892aaaa4071c901b9bc5280394bb45..d1cb7c5bf83c86b1b499015a1d618f08be04818f 100644
--- a/pub/src/olf.h
+++ b/pub/src/olf.h
@@ -92,10 +92,12 @@ class COlc : public COlo {
     uint           kd;    ///< Index of data file to be fitted.
     uint           kconv; ///< Index of resolution file to convolve with.
     enum TWgt { _LIN, _LOG, _ERR } weighing; ///< Weight mode for fitting.
+    bool           plot_to_grid; ///< Use grid from file 'kd' ?
     string range_expr;    ///< Restricts points to be fitted (input expression).
     PNode range_T;        ///< Restricts points to be fitted (parsed tree).
 
-    COlc() : kconv(-1), weighing( _ERR ), range_expr("") {};
+    COlc() :
+        kconv(-1), weighing( _ERR ), plot_to_grid( false ), range_expr("") {};
 
     // Trivially duplicated functions:
     PCurve VC( uint j ) const;
diff --git a/pub/src/plot.cpp b/pub/src/plot.cpp
index 8806fdd4f3683eb428e32e76d7a509e12eaf976a..c6d23349dcf6702844d3796f3b32e5fd612998f3 100644
--- a/pub/src/plot.cpp
+++ b/pub/src/plot.cpp
@@ -211,6 +211,32 @@ int plot_curve_convolved( CPlot* plot, POlc fc, uint k, uint j, int cstyle )
     return xo.size();
 }
 
+//! Plot scan j of curve file fc, using grid from file kd.
+
+int plot_curve_to_grid( CPlot* plot, POlc fc, uint k, uint j, int cstyle )
+{
+    if( fc->kd==-1 )
+        throw "data reference not set, incompatible with cg+";
+    POld fd = NOlm::mem_get_D(fc->kd);
+    if( !fd )
+        throw "data reference not found";
+    if( j>=fd->nJ() )
+        throw "number of spectra does not match";
+    vector<double> *xc = &(fd->VS(j)->x);
+    vector<double> novec, yc, xp, yp;
+    fc->curve_val_vec( &yc, *xc, k, j );
+    for ( uint i=0; i<xc->size(); ++i ) {
+        if ( plot->X.contains((*xc)[i]) && plot->Y.contains(yc[i]) ) {
+            xp.push_back( (*xc)[i] );
+            yp.push_back( yc[i] );
+        }
+    }
+    plot->addSpec( true, true, cstyle, xp, yp, novec, fc->V[j]->z,
+                   fc->xco.str_std(), fc->yco.str_std(),
+                   "curve file "+S(k)+" spectrum "+S(j) );
+    return xp.size();
+}
+
 //! Plot scan j of non-convolved curve file fc on equidistant grid;
 //! return number of points plotted.
 
@@ -469,6 +495,9 @@ void NPlot::Plot( class CPlot *plot, bool add, const string& mode )
                 if        ( fc->kconv!=-1 ) {
                     if ( !plot_curve_convolved( plot, fc, k, j, cstyle ) )
                         continue;
+                } else if ( fc->plot_to_grid ) {
+                    if ( !plot_curve_to_grid( plot, fc, k, j, cstyle ) )
+                        continue;
                 } else if ( !plot->refine ) {
                     if ( !plot_curve_equidist( plot, fc, k, j, cstyle ) )
                         continue;