IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39808


Ignore:
Timestamp:
Nov 12, 2016, 8:25:40 PM (10 years ago)
Author:
eugene
Message:

save the residual vectors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20160809/Ohana/src/opihi/cmd.astro/fitplx_irls.c

    r39610 r39808  
    218218  // fprintf (stderr, "%f +/- %f | %f %f\n", fit.p, fit.dp, fit.uR, fit.uD);
    219219
    220 /*
    221   FILE *f = fopen ("test.pf.dat", "w");
     220  Vector *dRresPMP, *dDresPMP, *dRresPLX, *dDresPLX;
     221
     222  // save fit residuals (with only pm removed, and pm and plx removed)
     223  if ((dRresPMP = SelectVector ("dRresPMP", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dRresPMP");
     224  if ((dDresPMP = SelectVector ("dDresPMP", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPMP");
     225  if ((dRresPLX = SelectVector ("dRresPLX", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dRresPLX");
     226  if ((dDresPLX = SelectVector ("dDresPLX", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPLX");
     227   
     228  ResetVector (dRresPMP, OPIHI_FLT, Ntotal);
     229  ResetVector (dDresPMP, OPIHI_FLT, Ntotal);
     230  ResetVector (dRresPLX, OPIHI_FLT, Ntotal);
     231  ResetVector (dDresPLX, OPIHI_FLT, Ntotal);
     232 
    222233  for (i = 0; i < Ntotal; i++) {
    223     double Xf = fit.Ro + fit.uR*fitdata.t[i] + fit.p*fitdata.pX[i];
    224     double Yf = fit.Do + fit.uD*fitdata.t[i] + fit.p*fitdata.pY[i];
    225     fprintf (f, "%f : %f %f : %f %f : %f : %f %f : %f %f\n", T[i], R[i], D[i], Xf, Yf, fitdata.t[i], fitdata.X[i], fitdata.Y[i], fitdata.pX[i], fitdata.pY[i]);
    226   }
    227   fclose (f);
    228 */
     234   
     235    double x0, y0;
     236    RD_to_XY (&x0, &y0, R[i], D[i], &coords);
     237
     238    double pX0, pY0;
     239    ParFactor (&pX0, &pY0, R[i], D[i], T[i]);
     240
     241    double t0 = (T[i] - Tmean)/365.25;
     242
     243    double Xpmp = fit.Ro + fit.uR*t0 + fit.p*pX0;
     244    double Ypmp = fit.Do + fit.uD*t0 + fit.p*pY0;
     245    double Xplx = fit.Ro + fit.uR*t0;
     246    double Yplx = fit.Do + fit.uD*t0;
     247
     248    dRresPMP->elements.Flt[i] = x0 - Xpmp;
     249    dDresPMP->elements.Flt[i] = y0 - Ypmp;
     250    dRresPLX->elements.Flt[i] = x0 - Xplx;
     251    dDresPLX->elements.Flt[i] = y0 - Yplx;
     252  }
    229253
    230254  // fprintf (stderr, "Roff, Doff: %f, %f; dRo, dDo: %f, %f\n", fit.Ro, fit.Do, fit.dRo, fit.dDo);
Note: See TracChangeset for help on using the changeset viewer.