Index: /trunk/Ohana/src/opihi/cmd.data/init.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/init.c	(revision 16118)
+++ /trunk/Ohana/src/opihi/cmd.data/init.c	(revision 16119)
@@ -87,6 +87,6 @@
 int shift            PROTO((int, char **));
 int sort_vectors     PROTO((int, char **));
-int spline_apply     PROTO((int, char **));
-int spline_construct PROTO((int, char **));
+int spline_apply_cmd PROTO((int, char **));
+int spline_construct_cmd PROTO((int, char **));
 int stats            PROTO((int, char **));
 int style            PROTO((int, char **));
@@ -208,6 +208,6 @@
   {"shift",	   shift,	     "shift data in an image"},
   {"sort",    	   sort_vectors,     "sort list of vectors"},
-  {"spline.apply", spline_apply,     "apply spline fit to generate an image"},
-  {"spline.const", spline_construct, "create spline 2nd deriv. terms"},
+  {"spline.apply", spline_apply_cmd, "apply spline fit to generate an image"},
+  {"spline.const", spline_construct_cmd, "create spline 2nd deriv. terms"},
   {"stats",   	   stats,	     "give statistics on a portion of a buffer"},
   {"style",   	   style,	     "set the style for graph plots"},
Index: /trunk/Ohana/src/opihi/cmd.data/spline_apply.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/spline_apply.c	(revision 16118)
+++ /trunk/Ohana/src/opihi/cmd.data/spline_apply.c	(revision 16119)
@@ -1,8 +1,6 @@
 # include "data.h"
 
-void spline (float *x, float *y, int N, float *y2);
-float splint (float *x, float *y, float *y2, int N, float X);
-
-int spline_apply (int argc, char **argv) {
+// need to rename this as an image function
+int spline_apply_cmd (int argc, char **argv) {
   
   int i, j, I, J;
@@ -77,12 +75,12 @@
 	Ty2[j] = *V2;
       }
-      Tx1[i] = splint (Tyc, Ty1, Ty2, Ny, y);
+      Tx1[i] = spline_apply (Tyc, Ty1, Ty2, Ny, y);
     }
-    spline (Txc, Tx1, Nx, Tx2);
+    spline_construct (Txc, Tx1, Nx, Tx2);
 
     /* apply x-dir spline to new image */
     for (I = 0; I < nx; I++, V++) {
       x = I * rx;
-      *V = splint (Txc, Tx1, Tx2, Nx, x);
+      *V = spline_apply (Txc, Tx1, Tx2, Nx, x);
     }
   }
Index: /trunk/Ohana/src/opihi/cmd.data/spline_construct.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/spline_construct.c	(revision 16118)
+++ /trunk/Ohana/src/opihi/cmd.data/spline_construct.c	(revision 16119)
@@ -1,5 +1,6 @@
 # include "data.h"
 
-int spline_construct (int argc, char **argv) {
+// need to rename this as an image function
+int spline_construct_cmd (int argc, char **argv) {
   
   int i, j, Nx, Ny, xdir;
@@ -54,5 +55,5 @@
     }
   
-    spline (Tx, Ty, Ny, Ty2);
+    spline_construct (Tx, Ty, Ny, Ty2);
   
     /* copy derivatives to output buffer */
Index: /trunk/Ohana/src/opihi/include/data.h
===================================================================
--- /trunk/Ohana/src/opihi/include/data.h	(revision 16118)
+++ /trunk/Ohana/src/opihi/include/data.h	(revision 16119)
@@ -73,14 +73,4 @@
 int PrintQueue (Queue *queue);
 
-/* in sort.c */
-void sort (double *value, int N);
-void fsort (float *value, int N);
-void sortpair (double *value1, double *value2, int N);
-void fsortpair (float *X, float *Y, int N);
-void sortthree (float *X, float *Y, float *Z, int N);
-void sort_lists (float *X, float *Y, int *S, int N);
-void dsort_lists (double *X, double *Y, int *S, int N);
-void isort_pair (int *X, int *Y, int N);
-
 /* in fft.c */
 void fft1D (float *dataRe, float *dataIm, int N, int Nbit, int forward);
@@ -88,14 +78,10 @@
 int IsBinary (int N, int *Nbit);
 
-/* in gaussj.c */
-int gaussj (double **a, int n, double **b, int m);
-int fgaussj (float **a, int n, float **b, int m);
+/* in spline.c */
+void spline_construct (float *x, float *y, int N, float *y2);
+float spline_apply (float *x, float *y, float *y2, int N, float X);
 
 /* in svdcmp.c */
 int svdcmp (float *a, float *w, float *v, int Nx, int Ny);
-
-/* in spline.c */
-void spline (float *x, float *y, int N, float *y2);
-float splint (float *x, float *y, float *y2, int N, float X);
 
 /* mrqmin.c */
@@ -139,7 +125,4 @@
 void mrq2dfree (int Npar);
 
-/* powell.c */
-void powell (float *p, int Npar, float (func)() );
-
 /* gaussian.c */
 double gaussian (double x, double mean, double sigma);
Index: unk/Ohana/src/opihi/lib.data/powell.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.data/powell.c	(revision 16118)
+++ 	(revision )
@@ -1,126 +1,0 @@
-# include "data.h"
-
-# define FTOL 0.001
-# define ITMAX 200
-
-void linmin (float *p, float *xi, int n, float *fret, float (*func)());
-
-/*** not well tested yet !! ***/
-
-void powell (float *p, int Npar, float (func)() ) {
-  
-  int i, ibig, j, Niter;
-  float t, fptt, fp, del;
-  float *pt, *ptt, *xit, **xi;
-  float ftemp;
-
-  ALLOCATE (pt, float, Npar);
-  ALLOCATE (ptt, float, Npar);
-
-  ALLOCATE (xi, float *, Npar);
-  for (i = 0; i < Npar; i++) {
-    ALLOCATE (xi[i], float, Npar);
-    bzero (xi[i], Npar * sizeof (float));
-    xi[i][i] = 1;
-  }
-  ALLOCATE (xit, float, Npar);
-  
-  ftemp = func (p);
-
-  for (j = 0; j < Npar; j++) pt[j] = p[j];
-
-  for (Niter = 0; Niter < ITMAX; Niter++) {
-    fp = ftemp;
-    ibig = 0;
-    del = 0.0;
-
-    for (i = 0; i < Npar; i++) {
-      for (j = 0; j < Npar; j++) xit[j] = xi[j][i];
-
-      fptt = ftemp;
-      linmin (p, xit, Npar, &ftemp, func);
-
-      if (fabs (fptt - ftemp) > del) {
-	del = fabs (fptt - ftemp);
-	ibig = i;
-      }
-    }
-
-    if (fabs (fp - ftemp) <= 0.5*FTOL*(fabs(fp) + fabs(ftemp))) {
-      free (xit);
-      free (ptt);
-      free (pt);
-      for (i = 0; i < Npar; i++) free (xi[i]);
-      free (xi);
-      return;
-    }
-
-    for (j = 0; j < Npar; j++) {
-      ptt[j] = 2.0*p[j] - pt[j];
-      xit[j] = p[j] - pt[j];
-      pt[j]  = p[j];
-    }
-
-    fptt = func (ptt);
-
-    if (fptt < fp) {
-      t = 2.0*(fp - 2.0*ftemp + fptt) * SQ(fp - ftemp - del) - del * SQ(fp - fptt);
-      if (t < 0.0) {
-	linmin (p, xit, Npar, &ftemp, func);
-	for (j = 0; j < Npar; j++) xi[j][ibig] = xit[j];
-      }
-    }
-  }
-
-  if (Niter == ITMAX) {
-    gprint (GP_ERR, "Too many iterations in routine POWELL\n");
-    return;
-  }
-
-}
-
-#undef ITMAX
-
-/* 
-   function has N parameters
-   p is the initial guess for the N parameters 
-   xi are the N unit vectors - x[i][j] = delta(i,j)
-   Npar = N parameters
-   
-   FTOL - ending tolerance
-*/
-   
-#define TOL 2.0e-4
-
-int ncom=0;	/* defining declarations */
-float *pcom=0,*xicom=0,(*nrfunc)();
-
-void linmin (float *p, float *xi, int n, float *fret, float (*func)()) {
-
-	int j;
-	float xx,xmin,fx,fb,fa,bx,ax;
-	float brent(),f1dim(),*vector();
-	void mnbrak(),free_vector();
-
-	ncom=n;
-	pcom=vector(1,n);
-	xicom=vector(1,n);
-	nrfunc=func;
-	for (j=1;j<=n;j++) {
-		pcom[j]=p[j];
-		xicom[j]=xi[j];
-	}
-	ax=0.0;
-	xx=1.0;
-	bx=2.0;
-	mnbrak(&ax,&xx,&bx,&fa,&fx,&fb,f1dim);
-	*fret=brent(ax,xx,bx,f1dim,TOL,&xmin);
-	for (j=1;j<=n;j++) {
-		xi[j] *= xmin;
-		p[j] += xi[j];
-	}
-	free_vector(xicom,1,n);
-	free_vector(pcom,1,n);
-}
-
-#undef TOL
Index: /trunk/Ohana/src/opihi/lib.data/spline.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.data/spline.c	(revision 16118)
+++ /trunk/Ohana/src/opihi/lib.data/spline.c	(revision 16119)
@@ -2,5 +2,5 @@
 
 /* construct the natural spline for x, y in y2 */
-void spline (float *x, float *y, int N, float *y2) {
+void spline_construct (float *x, float *y, int N, float *y2) {
 
   int i;
@@ -27,5 +27,5 @@
 
 /* evaluate spline for x, y, y2 at X */
-float splint (float *x, float *y, float *y2, int N, float X) {
+float spline_apply (float *x, float *y, float *y2, int N, float X) {
 
   int i, lo, hi;
@@ -36,9 +36,10 @@
   hi = N-1;
   while (hi - lo > 1) {
-    i = (hi+lo) >> 1;
-    if (x[i] > X) 
+    i = 0.5*(hi+lo);
+    if (x[i] > X) {
       hi = i;
-    else 
+    } else {
       lo = i;
+    }
   }
 
