irplib_wavecal.h

00001 /* $Id: irplib_wavecal.h,v 1.16 2009/10/21 14:49:42 llundin Exp $
00002  *
00003  * This file is part of the IRPLIB Pipeline
00004  * Copyright (C) 2002,2003 European Southern Observatory
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA
00019  */
00020 
00021 /*
00022  * $Author: llundin $
00023  * $Date: 2009/10/21 14:49:42 $
00024  * $Revision: 1.16 $
00025  * $Name: HEAD $
00026  */
00027 
00028 #ifndef IRPLIB_WAVECAL_H
00029 #define IRPLIB_WAVECAL_H
00030 
00031 /*-----------------------------------------------------------------------------
00032                                    Includes
00033  -----------------------------------------------------------------------------*/
00034 
00035 #include <cpl.h>
00036 
00037 
00038 /*-----------------------------------------------------------------------------
00039                                    Define
00040  -----------------------------------------------------------------------------*/
00041 
00042 #define IRPLIB_WAVECAL_MODEL_COEFFS       4
00043 /* The number of columns is 5 + IRPLIB_WAVECAL_MODEL_COEFFS */
00044 #define IRPLIB_WAVECAL_MODEL_COLS         9
00045 
00046 #define IRPLIB_WAVECAL_LAB_MODE           "SpecMode"
00047 #define IRPLIB_WAVECAL_LAB_RESID          "Residual"
00048 #define IRPLIB_WAVECAL_LAB_ORDER          "Fit_Order"
00049 #define IRPLIB_WAVECAL_LAB_XMIN           "XMin"
00050 #define IRPLIB_WAVECAL_LAB_XMAX           "XMax"
00051 #define IRPLIB_WAVECAL_LAB_C1             "C_1"
00052 #define IRPLIB_WAVECAL_LAB_C2             "C_2"
00053 #define IRPLIB_WAVECAL_LAB_C3             "C_3"
00054 #define IRPLIB_WAVECAL_LAB_C4             "C_4"
00055 
00056 #define IRPLIB_WAVECAL_LAB_WAVE           "WAVELENGTH"
00057 #define IRPLIB_WAVECAL_LAB_INTENS         "INTENSITY"
00058 
00059 
00060 /*-----------------------------------------------------------------------------
00061                                New Types
00062  -----------------------------------------------------------------------------*/
00063 
00064 /* Any spectrum model must have these members first! */
00065 typedef struct {
00066     unsigned             cost;    /* May be incremented for cost counting */
00067     unsigned             xcost;   /* Ditto (can exclude failed fills) */
00068     unsigned             ulines;  /* May be set to number of lines used */
00069 
00070 } irplib_base_spectrum_model;
00071 
00072 typedef struct {
00073     unsigned             cost;    /* May be incremented for cost counting */
00074     unsigned             xcost;   /* Ditto (can exclude failed fills) */
00075     unsigned             ulines;  /* May be set to number of lines used */
00076 
00077     double               wslit;  /* Slit Width */
00078     double               wfwhm;  /* FWHM of transfer function */
00079     double               xtrunc; /* Truncate transfer function beyond xtrunc,
00080                                     xtrunc > 0 */
00081     const cpl_bivector * lines;  /* Catalogue of intensities, with
00082                                     increasing X-vector elements */
00083     cpl_vector         * linepix;  /* Catalogue of line pixel positions
00084                                       - zero for uninitialized */
00085     cpl_vector         * erftmp;  /* Temporary storage for erf() values
00086                                       - zero for uninitialized */
00087 } irplib_line_spectrum_model;
00088 
00089 /*-----------------------------------------------------------------------------
00090                                    Function Prototypes
00091  -----------------------------------------------------------------------------*/
00092 
00093 cpl_error_code
00094 irplib_polynomial_find_1d_from_correlation_all(cpl_polynomial *,
00095                                                int,
00096                                                const cpl_vector *,
00097                                                int, int,
00098                                                irplib_base_spectrum_model *,
00099                                                cpl_error_code (*)
00100                                                (cpl_vector *,
00101                                                 const cpl_polynomial *,
00102                                                 irplib_base_spectrum_model *,
00103                                                 int),
00104                                                double,
00105                                                double,
00106                                                int,
00107                                                int,
00108                                                int,
00109                                                int,
00110                                                cpl_boolean,
00111                                                double *);
00112 
00113 cpl_error_code
00114 irplib_bivector_find_shift_from_correlation(cpl_bivector *,
00115                                             const cpl_polynomial *,
00116                                             const cpl_vector *,
00117                                             irplib_base_spectrum_model *,
00118                                             cpl_error_code (*)
00119                                             (cpl_vector *,
00120                                              const cpl_polynomial *,
00121                                              irplib_base_spectrum_model *, int),
00122                                             int,
00123                                             cpl_boolean,
00124                                             double *);
00125 
00126 cpl_error_code
00127 irplib_polynomial_shift_1d_from_correlation(cpl_polynomial *,
00128                                             const cpl_vector *,
00129                                             irplib_base_spectrum_model *,
00130                                             cpl_error_code (*)
00131                                             (cpl_vector *,
00132                                              const cpl_polynomial *,
00133                                              irplib_base_spectrum_model *, int),
00134                                             int, cpl_boolean, double *);
00135 
00136 cpl_error_code
00137 irplib_polynomial_find_1d_from_correlation(cpl_polynomial *, int,
00138                                            const cpl_vector *,
00139                                            irplib_base_spectrum_model *,
00140                                            cpl_error_code (*)
00141                                            (cpl_vector *,
00142                                             const cpl_polynomial *,
00143                                             irplib_base_spectrum_model *, int),
00144                                            double, double,
00145                                            int, int, double *);
00146 
00147 cpl_error_code irplib_vector_fill_line_spectrum(cpl_vector *,
00148                                                 const cpl_polynomial *,
00149                                                 irplib_base_spectrum_model *,
00150                                                 int);
00151 
00152 cpl_error_code irplib_vector_fill_logline_spectrum(cpl_vector *,
00153                                                    const cpl_polynomial *,
00154                                                    irplib_base_spectrum_model *,
00155                                                    int);
00156 
00157 cpl_error_code
00158 irplib_vector_fill_line_spectrum_fast(cpl_vector *,
00159                                       const cpl_polynomial *,
00160                                       irplib_base_spectrum_model *,
00161                                       int);
00162 
00163 cpl_error_code
00164 irplib_vector_fill_logline_spectrum_fast(cpl_vector *,
00165                                          const cpl_polynomial *,
00166                                          irplib_base_spectrum_model *,
00167                                          int);
00168 
00169 cpl_error_code irplib_plot_spectrum_and_model(const cpl_vector *,
00170                                               const cpl_polynomial *,
00171                                               irplib_base_spectrum_model *,
00172                                               cpl_error_code (*)
00173                                               (cpl_vector *,
00174                                                const cpl_polynomial *,
00175                                                irplib_base_spectrum_model *,
00176                                                int));
00177 
00178 cpl_error_code irplib_polynomial_fit_2d_dispersion(cpl_polynomial *,
00179                                                    const cpl_image *,
00180                                                    int, double *);
00181 
00182 int irplib_bivector_count_positive(const cpl_bivector *, double, double);
00183 
00184 #endif

Generated on 1 Mar 2011 for DETMON Pipeline Reference Manual by  doxygen 1.6.1