~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to gui/XAlice/libsrc/fit.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*===========================================================================
 
2
  Copyright (C) 1995-2009 European Southern Observatory (ESO)
 
3
 
 
4
  This program is free software; you can redistribute it and/or 
 
5
  modify it under the terms of the GNU General Public License as 
 
6
  published by the Free Software Foundation; either version 2 of 
 
7
  the License, or (at your option) any later version.
 
8
 
 
9
  This program is distributed in the hope that it will be useful,
 
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
  GNU General Public License for more details.
 
13
 
 
14
  You should have received a copy of the GNU General Public 
 
15
  License along with this program; if not, write to the Free 
 
16
  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, 
 
17
  MA 02139, USA.
 
18
 
 
19
  Correspondence concerning ESO-MIDAS should be addressed as follows:
 
20
        Internet e-mail: midas@eso.org
 
21
        Postal address: European Southern Observatory
 
22
                        Data Management Division 
 
23
                        Karl-Schwarzschild-Strasse 2
 
24
                        D 85748 Garching bei Muenchen 
 
25
                        GERMANY
 
26
===========================================================================*/
 
27
 
 
28
/* .VERSION 
 
29
 
 
30
   090420       last modif      
 
31
*/
 
32
 
 
33
 
 
34
#include <stdio.h>
 
35
#include <alice_global.h>
 
36
#include <alice_util.h>
 
37
 
 
38
double avex,avey,adevx,adevy,sdevx,sdevy,svarx,svary,skew,curt,xm,ym;
 
39
 
 
40
void poly_fit(xv,yv,npt,n)
 
41
double xv[],yv[];
 
42
int npt,n;
 
43
{
 
44
 int *lista;
 
45
 int i;
 
46
 double chisq,*a,*sig,**covar,*powx;
 
47
 void fpoly(), Alfit();
 
48
 
 
49
 
 
50
 lista = ivector(1,n);
 
51
 a     = dvector(1,n);
 
52
 sig   = dvector(1,npt);
 
53
 covar = dmatrix(1,n,1,n);
 
54
 powx  = dvector(1,n);
 
55
 for(i=1;i<=npt;i++)
 
56
  sig[i]= 1.0;
 
57
 for(i=1;i<=n;i++)
 
58
  lista[i]=i;
 
59
 Alfit(xv,yv,sig,npt,a,n,lista,n,covar,&chisq,fpoly);
 
60
 for(i=1;i<= n ;i++)
 
61
  fitPolyValues[i-1] = a[i];
 
62
 free_dvector(powx,1,n);
 
63
 free_dmatrix(covar,1,n,1,n);
 
64
 free_dvector(sig,1,npt);
 
65
 free_ivector(lista,1,n);
 
66
 free_dvector(a,1,n);
 
67
}