00001 /* 00002 * This file is part of the ESO UVES Pipeline 00003 * Copyright (C) 2004,2005 European Southern Observatory 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA 00018 */ 00019 00020 /* 00021 * $Author: amodigli $ 00022 * $Date: 2007/06/06 08:17:33 $ 00023 * $Revision: 1.2 $ 00024 * $Name: uves-3_3_1 $ 00025 * $Log: uves_extract_profile.h,v $ 00026 * Revision 1.2 2007/06/06 08:17:33 amodigli 00027 * replace tab with 4 spaces 00028 * 00029 * Revision 1.1 2007/05/02 13:42:23 jmlarsen 00030 * Added header 00031 * 00032 * Revision 1.28 2007/04/24 12:50:29 jmlarsen 00033 * Replaced cpl_propertylist -> uves_propertylist which is much faster 00034 * 00035 * Revision 1.27 2006/11/15 14:04:08 jmlarsen 00036 * Removed non-const version of parameterlist_get_first/last/next which is already 00037 * in CPL, added const-safe wrapper, unwrapper and deallocator functions 00038 * 00039 * Revision 1.26 2006/09/19 07:15:35 jmlarsen 00040 * Added chip to argument list of uves_extract() 00041 * 00042 * Revision 1.25 2006/08/17 13:56:53 jmlarsen 00043 * Reduced max line length 00044 * 00045 * Revision 1.24 2006/05/16 12:13:07 amodigli 00046 * added QC log 00047 * 00048 * Revision 1.23 2006/05/12 15:04:13 jmlarsen 00049 * Changed gauss/moffat/virtual profile measuring methods to use 00050 * global polynomials (rather than one polynomial per order) 00051 * 00052 * Revision 1.22 2006/04/24 09:21:18 jmlarsen 00053 * Implemented virtual resampling algorithm 00054 * 00055 * Revision 1.21 2006/02/28 09:15:22 jmlarsen 00056 * Minor update 00057 * 00058 * Revision 1.20 2005/12/19 16:17:56 jmlarsen 00059 * Replaced bool -> int 00060 * 00061 */ 00062 #ifndef UVES_EXTRACT_PROFILE_H 00063 #define UVES_EXTRACT_PROFILE_H 00064 00065 #include <uves_extract_iterate.h> 00066 00067 typedef struct _uves_extract_profile uves_extract_profile; 00068 00069 uves_extract_profile *uves_extract_profile_new( 00070 int (*f) (const double x[], const double a[], double *result), 00071 int (*dfda)(const double x[], const double a[], double result[]), 00072 int M, 00073 double slit_length, 00074 int sampling_factor); 00075 00076 uves_extract_profile * 00077 uves_extract_profile_new_constant(double slit_length); 00078 00079 void uves_extract_profile_delete(uves_extract_profile **p); 00080 00081 double 00082 uves_extract_profile_evaluate(const uves_extract_profile *profile, 00083 const uves_iterate_position *pos); 00084 00085 void uves_extract_profile_set(const uves_extract_profile *p, 00086 uves_iterate_position *pos, 00087 int *warnings); 00088 inline double 00089 uves_extract_profile_get_y(uves_iterate_position *pos, 00090 double bin, 00091 int sampling_factor); 00092 00093 inline double 00094 uves_extract_profile_get_bin(const uves_iterate_position *pos, 00095 int sampling_factor); 00096 00097 int uves_extract_profile_get_nbins(double slit_length, int sampling_factor); 00098 00099 00100 00101 00102 /* This should be defined to 0, and is used only for testing. 00103 * If set to 1 the profile is measured order by order (like the MIDAS algorithm 00104 * which is less robust) 00105 */ 00106 #define ORDER_PER_ORDER 0 00107 00108 /* The spatial profile @cond 00109 fixme: avoid exporting this definition, 00110 currently needed for uves_extract module 00111 */ 00112 struct _uves_extract_profile 00113 { 00114 /* There are three types of profiles. 00115 * 00116 * If constant == true 00117 * assume a constant spatial profile 00118 * only the member current_area is used 00119 * else if f != NULL (zero resampling) 00120 * y0(x,m) and sigma(x,m) are the parameters 00121 * of the assumed profile (gaussian/moffat) 00122 * red_chisq(x,m) is the smoothed reduced 00123 * chi^2 of the fits 00124 * 00125 * else if f == NULL (virtual resampling) 00126 * dy is an array of polynomials. 00127 * dy_i(x,m) is the profile of the i'th 00128 * spatial bin. 00129 */ 00130 00131 bool constant; 00132 00133 int (*f) (const double x[], const double a[], double *result); 00134 int (*dfda)(const double x[], const double a[], double result[]); 00135 int M; 00136 00137 #if ORDER_PER_ORDER 00138 polynomial **y0; /* Polynomial for each order */ 00139 polynomial **sigma; 00140 polynomial **red_chisq; 00141 #else 00142 polynomial *y0; 00143 polynomial *sigma; 00144 polynomial *red_chisq; 00145 #endif 00146 00147 double current_y0; /* This is for a "performance hack", */ 00148 double current_sigma; /* so that we don't have to evaluate the */ 00149 double current_area; /* polynomials too often. See also 00150 uves_extract_profile_set(). */ 00151 00152 /* Virtual resampling */ 00153 int spatial_bins; 00154 double slit_length; 00155 int sampling_factor; 00156 00157 00158 bool *is_zero_degree; /* For efficiency: use polynomials or simple doubles 00159 as necessary */ 00160 polynomial **dy_poly; /* Polynomial for each position along slit */ 00161 double *dy_double; 00162 00163 double *current_profile; /* Array with profile at current x */ 00164 double *current_ypos; /* Array with y-positions where profile is known, 00165 at current x */ 00166 double *current_interpolated; /* Interpolated profile at current x */ 00167 00168 }; 00169 /* @endcond */ 00170 00171 #endif
1.4.6