Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

calib/lib/stats.c

Go to the documentation of this file.
00001 /* === Doxygen Comment ======================================= */
00013 /* =========================================================== */
00014 
00015 #include <IFU_io.h>
00016 #include <IFU_math.h>
00017 
00018 /* === Doxygen Comment ======================================= */
00027 /* =========================================================== */
00028 
00029 void filter_med_array(float array[], int npts, int radius, float f_array[])
00030 {
00031   int *work;
00032   int i,j,k,jmin,jmax,npw;
00033   double *window;
00034 
00035   npw = 2*radius+1;                          /* Filtering window full-width */
00036   window = (double*)malloc(npw*sizeof(double));
00037   work   =    (int*)malloc(npw*sizeof(int));
00038 
00039   for (i=0; i<npts; i++) {                   /* Median filtering */
00040     jmin = MAX(0,i-radius);
00041     jmax = MIN(npts-1, i+radius);            /* npts-1 because j<=jmax */
00042     for (k=0,j=jmin; j<=jmax; j++,k++) window[k] = array[j];
00043     f_array[i] = median(window,k,work);
00044   }
00045 
00046   free(window); free(work);
00047 }
00048 

Generated on Tue Nov 23 18:04:18 2004 for Snifs by doxygen 1.3.3