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

calib/lib/proc_extinct.c

Go to the documentation of this file.
00001 /* === Doxygen Comment ======================================= */
00016 /* =========================================================== */
00017 
00018 #include<IFU_io.h>
00019 #include<IFU_math.h>
00020 #include<gsl/gsl_spline.h>
00021 
00022 #ifdef UNDER
00023 #define e01bef e01bef_
00024 #define e01bff e01bff_
00025 #endif
00026  
00027 /* === Doxygen Comment ======================================= */
00036 /* =========================================================== */
00037 
00038 float compute_default_extinction(float lambda) {
00039   /* Default extinction coefficient for Mauna Kea (mag/airmass) */
00040 
00041   /* Oasis-6.1 was using:
00042      double kext[11] = {0.277, 0.186, 0.134, 0.115, 
00043                         0.100, 0.091, 0.081, 0.076,
00044                         0.069, 0.067, 0.064};
00045      double lbda[11] = {4000,  4500,  5000,  5500,  
00046                         6000,  6500,  7000,  7500,
00047                         8000,  8500, 10000};
00048   */
00049 
00050   /* CFHT Bulletin, number 19, p. 16 (1988)
00051      (http://www.gemini.edu/sciops/ObsProcess/obsConstraints/ocTransparency.html)
00052   */
00053 
00054   int npts = 24;
00055   double lbda[24] = {3000, 3100, 3200, 3300, 3400, 
00056                      3500, 3600, 3700, 3800, 3900, 
00057                      4000, 4250, 4500, 4750, 5000, 
00058                      5250, 5500, 5750, 6000, 6500, 
00059                      7000, 8000, 9000, 10000};
00060 
00061   double kext[24] = {4.90, 1.37, 0.82, 0.57, 0.51, 
00062                      0.42, 0.37, 0.33, 0.30, 0.27, 
00063                      0.25, 0.21, 0.17, 0.14, 0.13, 
00064                      0.12, 0.12, 0.12, 0.11, 0.11, 
00065                      0.10, 0.07, 0.05, 0.04};
00066   double D[24];
00067 
00068   int m=1, ifail=0;
00069 
00070   double extinction, dlambda=lambda;
00071 
00072   void  e01bef(), e01bff();
00073   
00074   e01bef(&npts, lbda, kext, D, &ifail);
00075   if (ifail) return(0);
00076 
00077   e01bff(&npts, lbda, kext, D, &m, &dlambda, &extinction, &ifail); 
00078   if (ifail) return(0);
00079 
00080   return(extinction);
00081 }
00082 
00083 /* === Doxygen Comment ======================================= */
00097 /* =========================================================== */
00098 
00099 double compute_extinction(double lbda[],double kext[], int n, float lambda)
00100 {
00101   long npts=n, m=1, ifail=0;
00102   double *D, extinction, dlambda=lambda;
00103 
00104   void  e01bef(), e01bff();
00105 
00106   D = (double *)malloc(npts*sizeof(double));
00107 
00108   e01bef(&npts, lbda, kext, D, &ifail);
00109   if (ifail) {
00110     free(D);
00111     return(0.);
00112   }
00113   
00114   e01bff(&npts, lbda, kext, D, &m, &dlambda, &extinction, &ifail);
00115   if (ifail) {
00116     free(D);
00117     return(0);
00118   }
00119 
00120   free(D);
00121   return(extinction);
00122 }

Generated on Wed Oct 26 23:59:38 2005 for Snifs by doxygen 1.3.5