File: irplib_wavecal.h

package info (click to toggle)
cpl-plugin-vimos 4.1.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 28,228 kB
  • sloc: ansic: 169,271; cpp: 16,177; sh: 4,344; python: 3,678; makefile: 1,138; perl: 10
file content (178 lines) | stat: -rw-r--r-- 8,425 bytes parent folder | download | duplicates (39)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/* $Id: irplib_wavecal.h,v 1.18 2012-08-03 21:05:33 llundin Exp $
 *
 * This file is part of the IRPLIB Pipeline
 * Copyright (C) 2002,2003 European Southern Observatory
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA
 */

/*
 * $Author: llundin $
 * $Date: 2012-08-03 21:05:33 $
 * $Revision: 1.18 $
 * $Name: not supported by cvs2svn $
 */

#ifndef IRPLIB_WAVECAL_H
#define IRPLIB_WAVECAL_H

/*-----------------------------------------------------------------------------
                                   Includes
 -----------------------------------------------------------------------------*/

#include <cpl.h>


/*-----------------------------------------------------------------------------
                                   Define
 -----------------------------------------------------------------------------*/

#define IRPLIB_WAVECAL_MODEL_COEFFS       4
/* The number of columns is 5 + IRPLIB_WAVECAL_MODEL_COEFFS */
#define IRPLIB_WAVECAL_MODEL_COLS         9

#define IRPLIB_WAVECAL_LAB_MODE           "SpecMode"
#define IRPLIB_WAVECAL_LAB_RESID          "Residual"
#define IRPLIB_WAVECAL_LAB_ORDER          "Fit_Order"
#define IRPLIB_WAVECAL_LAB_XMIN           "XMin"
#define IRPLIB_WAVECAL_LAB_XMAX           "XMax"
#define IRPLIB_WAVECAL_LAB_C1             "C_1"
#define IRPLIB_WAVECAL_LAB_C2             "C_2"
#define IRPLIB_WAVECAL_LAB_C3             "C_3"
#define IRPLIB_WAVECAL_LAB_C4             "C_4"

#define IRPLIB_WAVECAL_LAB_WAVE           "WAVELENGTH"
#define IRPLIB_WAVECAL_LAB_INTENS         "INTENSITY"


/*-----------------------------------------------------------------------------
                               New Types
 -----------------------------------------------------------------------------*/

/* Any spectrum model must have these members first! */
typedef struct {
    cpl_size             cost;    /* May be incremented for cost counting */
    cpl_size             xcost;   /* Ditto (can exclude failed fills) */
    cpl_size             ulines;  /* May be set to number of lines used */

} irplib_base_spectrum_model;

typedef struct {
    cpl_size             cost;    /* May be incremented for cost counting */
    cpl_size             xcost;   /* Ditto (can exclude failed fills) */
    cpl_size             ulines;  /* May be set to number of lines used */

    double               wslit;  /* Slit Width */
    double               wfwhm;  /* FWHM of transfer function */
    double               xtrunc; /* Truncate transfer function beyond xtrunc,
                                    xtrunc > 0 */
    const cpl_bivector * lines;  /* Catalogue of intensities, with
                                    increasing X-vector elements */
    cpl_vector         * linepix;  /* Catalogue of line pixel positions
                                      - zero for uninitialized */
    cpl_vector         * erftmp;  /* Temporary storage for erf() values
                                      - zero for uninitialized */
} irplib_line_spectrum_model;

/*-----------------------------------------------------------------------------
                                   Function Prototypes
 -----------------------------------------------------------------------------*/

cpl_error_code
irplib_polynomial_find_1d_from_correlation_all(cpl_polynomial *,
                                               int,
                                               const cpl_vector *,
                                               int, int,
                                               irplib_base_spectrum_model *,
                                               cpl_error_code (*)
                                               (cpl_vector *,
                                                const cpl_polynomial *,
                                                irplib_base_spectrum_model *),
                                               double,
                                               double,
                                               int,
                                               int,
                                               int,
                                               int,
                                               cpl_boolean,
                                               double *);

cpl_error_code
irplib_bivector_find_shift_from_correlation(cpl_bivector *,
                                            const cpl_polynomial *,
                                            const cpl_vector *,
                                            irplib_base_spectrum_model *,
                                            cpl_error_code (*)
                                            (cpl_vector *,
                                             const cpl_polynomial *,
                                             irplib_base_spectrum_model *),
                                            int,
                                            cpl_boolean,
                                            double *);

cpl_error_code
irplib_polynomial_shift_1d_from_correlation(cpl_polynomial *,
                                            const cpl_vector *,
                                            irplib_base_spectrum_model *,
                                            cpl_error_code (*)
                                            (cpl_vector *,
                                             const cpl_polynomial *,
                                             irplib_base_spectrum_model *),
                                            int, cpl_boolean, double *);

cpl_error_code
irplib_polynomial_find_1d_from_correlation(cpl_polynomial *, int,
                                           const cpl_vector *,
                                           irplib_base_spectrum_model *,
                                           cpl_error_code (*)
                                           (cpl_vector *,
                                            const cpl_polynomial *,
                                            irplib_base_spectrum_model *),
                                           double, double,
                                           int, int, double *);

cpl_error_code irplib_vector_fill_line_spectrum(cpl_vector *,
                                                const cpl_polynomial *,
                                                irplib_base_spectrum_model *);

cpl_error_code irplib_vector_fill_logline_spectrum(cpl_vector *,
                                                   const cpl_polynomial *,
                                                   irplib_base_spectrum_model *);

cpl_error_code
irplib_vector_fill_line_spectrum_fast(cpl_vector *,
                                      const cpl_polynomial *,
                                      irplib_base_spectrum_model *);

cpl_error_code
irplib_vector_fill_logline_spectrum_fast(cpl_vector *,
                                         const cpl_polynomial *,
                                         irplib_base_spectrum_model *);

cpl_error_code irplib_plot_spectrum_and_model(const cpl_vector *,
                                              const cpl_polynomial *,
                                              irplib_base_spectrum_model *,
                                              cpl_error_code (*)
                                              (cpl_vector *,
                                               const cpl_polynomial *,
                                               irplib_base_spectrum_model *));

cpl_error_code irplib_polynomial_fit_2d_dispersion(cpl_polynomial *,
                                                   const cpl_image *,
                                                   int, double *);

int irplib_bivector_count_positive(const cpl_bivector *, double, double);

#endif