ERIS Pipeline Reference Manual 1.8.15
sc_mpfit.h
Go to the documentation of this file.
1/*
2 * This file is part of the SKYCORR software package.
3 * Copyright (C) 2009-2013 European Southern Observatory
4 *
5 * This programme is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This programme is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this programme. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/*****************************************************************************
41 * INCLUDES *
42 ****************************************************************************/
43
44/* Config header */
45
46#ifdef HAVE_CONFIG_H
47#include <config.h>
48#endif
49
50/* Sky correction headers */
51
52#include <sc_basic.h>
53#include <sc_modsky.h>
54
55/*****************************************************************************
56 * DEFINES *
57 ****************************************************************************/
58
59#ifndef SC_MPFIT_H
60#define SC_MPFIT_H
61
62/* Definition of constants */
63
65#define SC_DEFERRVAL 9.99
67#define SC_CORRFAC_MIN 0.01
69#define SC_CORRFAC_MAX 100.
71#define SC_MINNLIN 3
74#define SC_MAXRELFAC 2.
77#define SC_MAXPARERR 0.5
78
79/*****************************************************************************
80 * GLOBALS *
81 ****************************************************************************/
82
83/* Declaration of global variables */
84
86extern int nfev;
88extern cpl_boolean lastcall;
89
90/*****************************************************************************
91 * TYPEDEF *
92 ****************************************************************************/
93
94/* Definition of structures */
95
106typedef struct _scvars_ {
107 cpl_table *scispec;
108 cpl_table *skyspec;
109 cpl_table *fitpar;
110 cpl_vector *sinc;
111 const cpl_parameterlist *parlist;
113
122typedef struct _scpars_ {
123 int n;
124 double *p;
125 mp_par *pars;
127
128/*****************************************************************************
129 * PROTOTYPES *
130 ****************************************************************************/
131
132/* Declaration of functions */
133
134cpl_error_code sc_mpfit(mp_result *result, cpl_table *scispec,
135 cpl_table *skyspec, cpl_table *fitpar,
136 const cpl_parameterlist *parlist);
137int sc_mpfit_calcdev(int m, int n, double *p, double *dy, double **dvec,
138 void *vars);
139cpl_error_code sc_mpfit_modinitpar(cpl_table *fitpar,
140 cpl_table *scispec,
141 cpl_table *skyspec,
142 const cpl_parameterlist *parlist);
143cpl_error_code sc_mpfit_setpar(scpars *fitpars,
144 const cpl_table *fitpar, const char fittype);
145cpl_error_code sc_mpfit_allocmempar(scpars *fitpars, const int npar);
146cpl_error_code sc_mpfit_freemempar(scpars *fitpars);
147cpl_error_code sc_mpfit_allocmemresult(mp_result *result, const int m,
148 const int n);
149cpl_error_code sc_mpfit_initresult(mp_result *result, const int m,
150 const int n);
151cpl_error_code sc_mpfit_copyresult(mp_result *outresult,
152 const mp_result *inresult);
153cpl_error_code sc_mpfit_freememresult(mp_result *result);
154cpl_error_code sc_mpfit_substbadfitpar(cpl_table *fitpar,
155 const cpl_table *initfitpar,
156 const cpl_parameterlist *parlist);
157//cpl_error_code sc_mpfit_writeresults(const mp_result *result,
158// const cpl_table *scispec,
159// const cpl_table *fitpar,
160// const cpl_parameterlist *parlist,
161// const int calls, const double runtime);
162
163#endif /* SC_MPFIT_H */
164
165#ifdef __cplusplus
166}
167#endif
168
cpl_error_code sc_mpfit_allocmempar(scpars *fitpars, const int npar)
Definition: sc_mpfit.c:1264
cpl_error_code sc_mpfit_substbadfitpar(cpl_table *fitpar, const cpl_table *initfitpar, const cpl_parameterlist *parlist)
Definition: sc_mpfit.c:1537
cpl_error_code sc_mpfit(mp_result *result, cpl_table *scispec, cpl_table *skyspec, cpl_table *fitpar, const cpl_parameterlist *parlist)
Definition: sc_mpfit.c:60
cpl_error_code sc_mpfit_setpar(scpars *fitpars, const cpl_table *fitpar, const char fittype)
Definition: sc_mpfit.c:1186
int nfev
Definition: sc_mpfit.c:51
cpl_error_code sc_mpfit_allocmemresult(mp_result *result, const int m, const int n)
Definition: sc_mpfit.c:1373
cpl_error_code sc_mpfit_freememresult(mp_result *result)
Definition: sc_mpfit.c:1502
cpl_error_code sc_mpfit_freemempar(scpars *fitpars)
Definition: sc_mpfit.c:1333
struct _scpars_ scpars
cpl_error_code sc_mpfit_initresult(mp_result *result, const int m, const int n)
Definition: sc_mpfit.c:1420
cpl_error_code sc_mpfit_modinitpar(cpl_table *fitpar, cpl_table *scispec, cpl_table *skyspec, const cpl_parameterlist *parlist)
Definition: sc_mpfit.c:577
cpl_boolean lastcall
Definition: sc_mpfit.c:53
int sc_mpfit_calcdev(int m, int n, double *p, double *dy, double **dvec, void *vars)
Definition: sc_mpfit.c:517
struct _scvars_ scvars
cpl_error_code sc_mpfit_copyresult(mp_result *outresult, const mp_result *inresult)
Definition: sc_mpfit.c:1461