00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef IRPLIB_WAVECAL_H
00029 #define IRPLIB_WAVECAL_H
00030
00031
00032
00033
00034
00035 #include <cpl.h>
00036
00037
00038
00039
00040
00041
00042 #define IRPLIB_WAVECAL_MODEL_COEFFS 4
00043
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
00062
00063
00064
00065 typedef struct {
00066 cpl_size cost;
00067 cpl_size xcost;
00068 cpl_size ulines;
00069
00070 } irplib_base_spectrum_model;
00071
00072 typedef struct {
00073 cpl_size cost;
00074 cpl_size xcost;
00075 cpl_size ulines;
00076
00077 double wslit;
00078 double wfwhm;
00079 double xtrunc;
00080
00081 const cpl_bivector * lines;
00082
00083 cpl_vector * linepix;
00084
00085 cpl_vector * erftmp;
00086
00087 } irplib_line_spectrum_model;
00088
00089
00090
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 double,
00104 double,
00105 int,
00106 int,
00107 int,
00108 int,
00109 cpl_boolean,
00110 double *);
00111
00112 cpl_error_code
00113 irplib_bivector_find_shift_from_correlation(cpl_bivector *,
00114 const cpl_polynomial *,
00115 const cpl_vector *,
00116 irplib_base_spectrum_model *,
00117 cpl_error_code (*)
00118 (cpl_vector *,
00119 const cpl_polynomial *,
00120 irplib_base_spectrum_model *),
00121 int,
00122 cpl_boolean,
00123 double *);
00124
00125 cpl_error_code
00126 irplib_polynomial_shift_1d_from_correlation(cpl_polynomial *,
00127 const cpl_vector *,
00128 irplib_base_spectrum_model *,
00129 cpl_error_code (*)
00130 (cpl_vector *,
00131 const cpl_polynomial *,
00132 irplib_base_spectrum_model *),
00133 int, cpl_boolean, double *);
00134
00135 cpl_error_code
00136 irplib_polynomial_find_1d_from_correlation(cpl_polynomial *, int,
00137 const cpl_vector *,
00138 irplib_base_spectrum_model *,
00139 cpl_error_code (*)
00140 (cpl_vector *,
00141 const cpl_polynomial *,
00142 irplib_base_spectrum_model *),
00143 double, double,
00144 int, int, double *);
00145
00146 cpl_error_code irplib_vector_fill_line_spectrum(cpl_vector *,
00147 const cpl_polynomial *,
00148 irplib_base_spectrum_model *);
00149
00150 cpl_error_code irplib_vector_fill_logline_spectrum(cpl_vector *,
00151 const cpl_polynomial *,
00152 irplib_base_spectrum_model *);
00153
00154 cpl_error_code
00155 irplib_vector_fill_line_spectrum_fast(cpl_vector *,
00156 const cpl_polynomial *,
00157 irplib_base_spectrum_model *);
00158
00159 cpl_error_code
00160 irplib_vector_fill_logline_spectrum_fast(cpl_vector *,
00161 const cpl_polynomial *,
00162 irplib_base_spectrum_model *);
00163
00164 cpl_error_code irplib_plot_spectrum_and_model(const cpl_vector *,
00165 const cpl_polynomial *,
00166 irplib_base_spectrum_model *,
00167 cpl_error_code (*)
00168 (cpl_vector *,
00169 const cpl_polynomial *,
00170 irplib_base_spectrum_model *));
00171
00172 cpl_error_code irplib_polynomial_fit_2d_dispersion(cpl_polynomial *,
00173 const cpl_image *,
00174 int, double *);
00175
00176 int irplib_bivector_count_positive(const cpl_bivector *, double, double);
00177
00178 #endif