- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
Ohana/src/relastro/src/FitPMandPar.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/Ohana/src/relastro/src/FitPMandPar.c
r16060 r33415 2 2 3 3 /* do we want an init function which does the alloc and a clear function to free? */ 4 int FitPMandPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, double *pR, double *pD, int Npts ) {4 int FitPMandPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, double *pR, double *pD, int Npts, int XVERB) { 5 5 6 6 int i; … … 9 9 double wx, wy, Wx, Wy, Tx, Ty, Tx2, Ty2, Xs, Ys, XT, YT; 10 10 double PR, PD, PRT, PDT, PRX, PDY, PR2, PD2; 11 double chisq, Xf, Yf; 11 12 12 13 A = array_init (5, 5); … … 95 96 /* get the chisq from the matrix values */ 96 97 98 // add up the chi square for the fit 99 chisq = 0.0; 100 for (i = 0; i < Npts; i++) { 101 Xf = fit[0].Ro + fit[0].uR*T[i] + fit[0].p*pR[i]; 102 Yf = fit[0].Do + fit[0].uD*T[i] + fit[0].p*pD[i]; 103 chisq += SQ(X[i] - Xf) / SQ(dX[i]); 104 chisq += SQ(Y[i] - Yf) / SQ(dY[i]); 105 if (XVERB) fprintf (stderr, "chisq contrib : %f %f : %f %f : %f %f : %f %f : %f\n", Xf, Yf, X[i] - Xf, Y[i] - Yf, dX[i], dY[i], (X[i] - Xf) / dX[i], (Y[i] - Yf) / dY[i], chisq); 106 107 } 108 fit[0].Nfit = Npts; 109 110 // the reduced chisq is divided by (Ndof = 2*Npts - 5) 111 fit[0].chisq = chisq / (2.0*Npts - 5.0); 97 112 return (TRUE); 98 113 }
Note:
See TracChangeset
for help on using the changeset viewer.
