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

extract/lib/proc_extract.c

Go to the documentation of this file.
00001 /* === Doxygen Comment ======================================= */
00013 /* =========================================================== */
00014 
00015 #include <IFU_io.h>
00016 #include <IFU_math.h>
00017 #include <snifs.h>
00018 #include <extract.h>
00019 #include <gsl/gsl_sf_erf.h>
00020 
00021 #define ARCWIDTH 128 
00022 
00023 /* Global variables describing the convolved PSF */
00024 extern double ***glScs, ***glIcs;
00025 
00026 /* Global variables describing the geometric PSF */
00027 extern int glnggeo;
00028 extern double *glXgeo;
00029 
00030 /* Global variables describing the global PSF */
00031 extern int glngpsf;
00032 
00033 /* === Doxygen Comment ======================================= */
00041 /* =========================================================== */
00042 
00043 double Mpup_PSF(int no, float x) 
00044 {
00045   double val, qe, qs, xs, xe;
00046   int l, p;
00047 
00048   if (no < 0) return(0);                     /* No neighbour */
00049 
00050   xs = x - 0.5;
00051   xe = x + 0.5;
00052 
00053   val = 0.;
00054   for (l=0; l<glnggeo; l++) {                /* Loop on geom pupil */
00055     for (p=0; p<glngpsf; p++) {              /* Loop on PSF profile */
00056       qs = (xs - glXgeo[l])/glScs[no][l][p]/M_SQRT2;
00057       qe = (xe - glXgeo[l])/glScs[no][l][p]/M_SQRT2;
00058       val += glScs[no][l][p]*glIcs[no][l][p] * 
00059         ( gsl_sf_erf(qe) - gsl_sf_erf(qs) );
00060     }
00061   }
00062   return(val);
00063 }
00064 
00065 /* === Doxygen Comment ======================================= */
00075 /* =========================================================== */
00076 
00077 int good_neighbor(float *ylo, float *yup, int *neighbors, float y)
00078 {
00079   int up, lo;
00080   float trans;
00081 
00082   /* which neighbor is higher? */
00083   if ( (ylo[neighbors[0]]+yup[neighbors[0]]) > 
00084        (ylo[neighbors[1]]+yup[neighbors[1]]) ) { /* 0 is higher */
00085     up = neighbors[0];
00086     lo = neighbors[1];
00087   } 
00088   else {                                     /* 1 is higher */
00089     up = neighbors[1];
00090     lo = neighbors[0];
00091   }
00092   /* compute the transition in the dark zone between the two neighbors */
00093   trans = (yup[lo] + ylo[up])/2.;
00094   /* so, which one is the good one? */
00095   if (y < trans) return(lo);
00096   else           return(up);
00097 }
00098 

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