Index: pr_inversion/c_extensions/Cinvertor.c
===================================================================
--- pr_inversion/c_extensions/Cinvertor.c	(revision 2d06beb109031c888260d5a73af0ae5e57628b01)
+++ pr_inversion/c_extensions/Cinvertor.c	(revision abad6208fe45c6681444277d552c115fabe5ff9d)
@@ -319,4 +319,6 @@
 	double regterm = 0.0;
 	double tmp = 0.0;
+	// Number of slices in regularization term estimate
+	int nslice = 25;
 	
 	PyObject *data_obj;
@@ -331,5 +333,5 @@
     residuals = PyList_New(self->params.npoints);
 
-    regterm = reg_term(pars, self->params.d_max, npars);
+    regterm = reg_term(pars, self->params.d_max, npars, nslice);
     
     for(i=0; i<self->params.npoints; i++) {
@@ -367,4 +369,6 @@
 	double regterm = 0.0;
 	double tmp = 0.0;
+	// Number of slices in regularization term estimate
+	int nslice = 25;
 	
 	PyObject *data_obj;
@@ -378,5 +382,5 @@
     residuals = PyList_New(self->params.npoints);
 
-    regterm = reg_term(pars, self->params.d_max, npars);
+    regterm = reg_term(pars, self->params.d_max, npars, nslice);
 
     
@@ -465,4 +469,19 @@
 	if (!PyArg_ParseTuple(args, "did", &d_max, &n, &q)) return NULL;
 	return Py_BuildValue("f", ortho_transformed(d_max, n, q));	
+	
+}
+
+static PyObject * oscillations(Cinvertor *self, PyObject *args) {
+	double *pars;
+	PyObject *data_obj;
+	Py_ssize_t npars;
+	double oscill, norm;
+	
+	if (!PyArg_ParseTuple(args, "O", &data_obj)) return NULL;
+	OUTVECTOR(data_obj,pars,npars);
+	
+	oscill = reg_term(pars, self->params.d_max, npars, 100);
+	norm   = int_p2(pars, self->params.d_max, npars, 100);
+	return Py_BuildValue("f", sqrt(oscill/norm)/acos(-1.0)*self->params.d_max );	
 	
 }
@@ -489,4 +508,5 @@
 		   {"is_valid", (PyCFunction)is_valid, METH_VARARGS, ""},
 		   {"basefunc_ft", (PyCFunction)basefunc_ft, METH_VARARGS, ""},
+		   {"oscillations", (PyCFunction)oscillations, METH_VARARGS, ""},
    
    {NULL}
Index: pr_inversion/c_extensions/invertor.c
===================================================================
--- pr_inversion/c_extensions/invertor.c	(revision 2d06beb109031c888260d5a73af0ae5e57628b01)
+++ pr_inversion/c_extensions/invertor.c	(revision abad6208fe45c6681444277d552c115fabe5ff9d)
@@ -1,4 +1,7 @@
 #include <math.h>
 #include "invertor.h"
+#include <memory.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 double pi = 3.1416;
@@ -120,15 +123,31 @@
  * regularization term calculated from the expansion.
  */
-double reg_term(double *pars, double d_max, int n_c) {
+double reg_term(double *pars, double d_max, int n_c, int nslice) {
     double sum = 0.0; 
     double r;
     double deriv;
 	int i;
-    for (i=0; i<25; i++) {
-    	r = d_max/25.0*i;
+    for (i=0; i<nslice; i++) {
+    	r = d_max/(1.0*nslice)*i;
     	deriv = dprdr(pars, d_max, n_c, r);
         sum += deriv*deriv;
     }
-    return sum/25.0*d_max;
+    return sum/(1.0*nslice)*d_max;
 }
 
+/**
+ * regularization term calculated from the expansion.
+ */
+double int_p2(double *pars, double d_max, int n_c, int nslice) {
+    double sum = 0.0; 
+    double r; 
+    double value;
+	int i;
+    for (i=0; i<nslice; i++) {
+    	r = d_max/(1.0*nslice)*i;
+    	value = pr(pars, d_max, n_c, r);
+        sum += value*value;
+    }
+    return sum/(1.0*nslice)*d_max;
+}
+
Index: pr_inversion/c_extensions/invertor.h
===================================================================
--- pr_inversion/c_extensions/invertor.h	(revision 2d06beb109031c888260d5a73af0ae5e57628b01)
+++ pr_inversion/c_extensions/invertor.h	(revision abad6208fe45c6681444277d552c115fabe5ff9d)
@@ -26,5 +26,6 @@
 double pr(double *c, double d_max, int n_c, double r);
 double dprdr(double *pars, double d_max, int n_c, double r);
-double reg_term(double *pars, double d_max, int n_c);
+double reg_term(double *pars, double d_max, int n_c, int nslice);
+double int_p2(double *pars, double d_max, int n_c, int nslice);
 void pr_err(double *pars, double *err, double d_max, int n_c, 
 		double r, double *pr_value, double *pr_value_err);
