OPERA  1.0
Open source echelle spectrograph reduction pipeline
operaFit.h
Go to the documentation of this file.
00001 #ifndef OPERAFIT_H
00002 #define OPERAFIT_H
00003 
00004 /*******************************************************************
00005  ****                LIBRARY FOR OPERA v1.0                     ****
00006  *******************************************************************
00007  Library name: operaFit
00008  Version: 1.0
00009  Description: This C library implements LM curve fitting for commonly 
00010  used functions such as polynomials, gaussians, etc.  
00011  Author(s): CFHT OPERA team
00012  Affiliation: Canada France Hawaii Telescope 
00013  Location: Hawaii USA
00014  Date: Aug/2011
00015  Contact: eder@cfht.hawaii.edu
00016  
00017  Copyright (C) 2011  Opera Pipeline team, Canada France Hawaii Telescope
00018  
00019  This program is free software: you can redistribute it and/or modify
00020  it under the terms of the GNU General Public License as published by
00021  the Free Software Foundation, either version 3 of the License, or
00022  (at your option) any later version.
00023  
00024  This program is distributed in the hope that it will be useful,
00025  but WITHOUT ANY WARRANTY; without even the implied warranty of
00026  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00027  GNU General Public License for more details.
00028  
00029  You should have received a copy of the GNU General Public License
00030  along with this program.  If not, see:
00031  http://software.cfht.hawaii.edu/licenses
00032  -or-
00033  http://www.gnu.org/licenses/gpl-3.0.html
00034  ********************************************************************/
00035 
00036 // $Date$
00037 // $Id$
00038 // $Revision$
00039 // $Locker$
00040 // $Log$
00041 
00042 
00043 /*
00044  * The functions below uses operaLMFit library (LMFIT)
00045  */
00046 void operaLMFitPolynomial(unsigned m_dat, double *x, double *y, int n_par, double par[], double *chi2, int verbose);
00047 void operaLMFitGaussian(unsigned m_dat, double *x, double *y, double *a, double *x0, double *sig, double *chi2, int verbose);
00048 void operaLMFit2DPolynomial(unsigned m_dat, double *x, double *y, double *fxy, int n_par, double par[], double *chi2, int verbose);
00049 void operaLMFit2DGaussian(unsigned m_dat, double *x, double *y, double *fxy, double *a, double *x0, double *y0, double *sigx, double *sigy, double *chi2, int verbose);
00050 
00051 /*
00052  * The functions below uses nr library, although all necessary functions to make them work are in operaFit.c
00053  */
00054 // spline and 2D-spline interpolation and related functions
00055 void operaFitSpline(unsigned nin, float *xin,float *yin, unsigned nout, float *xout, float *yout);
00056 void operaFit2DSpline(unsigned nxin, float *xin, unsigned nyin, float *yin,double *fxyin, unsigned nxout, float *xout, unsigned nyout, float *yout, float *fxyout);
00057 void spline(float x[], float y[], int n, float yp1, float ypn, float y2[]);
00058 void splint(float xa[], float ya[], float y2a[], int n, float x, float *y);
00059 void splin2(float x1a[], float x2a[], float **ya, float **y2a, int m, int n,float x1, float x2, float *y);
00060 void splie2(float x1a[], float x2a[], float **ya, int m, int n, float **y2a);
00061 
00062 // medfit and related functions
00063 void operaMedfit(float xin[], float yin[], int ndata, float *a, float *b, float *abdev);
00064 float rofunc(float b);
00065 float select_nr(unsigned long k, unsigned long n, float arr[]);
00066 
00067 // common functions to spline and medfit
00068 float **matrix(long nrl, long nrh, long ncl, long nch);
00069 void free_matrix(float **m, long nrl, long nrh, long ncl, long nch);
00070 float *vector(long nl, long nh);
00071 void free_vector(float *v, long nl, long nh);
00072 void nrerror(char error_text[]);
00073 
00074 #endif