IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3105


Ignore:
Timestamp:
Jan 28, 2005, 5:17:26 AM (21 years ago)
Author:
eugene
Message:

minor changes

Location:
trunk/Ohana/src/opihi
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/imfit.c

    r3030 r3105  
    246246  dchisq = ochisq;
    247247
    248   for (i = 0; (i < 50) && ((dchisq <= 0.0) || (dchisq > 0.001*(Npts - Npar))); i++) {
     248  for (i = 0; (i < 25) && ((dchisq <= 0.0) || (dchisq > 0.01*(Npts - Npar))); i++) {
    249249    chisq = mrq2dmin (x, y, z, dz, Npts, par, Npar, fitfunc, VERBOSE);
    250250    dchisq = ochisq - chisq;
    251251    ochisq = chisq;
    252252  } 
     253  set_int_variable ("Niter",  i);
     254 
    253255
    254256  if (ShapeVariation) {
     
    407409  set_variable ("ChiSq", chisq/(Npts - Npar));
    408410
    409   for (i = 0; i < Npar; i++) {
    410     fprintf (stderr, "%g ", par[i]);
    411   }
    412   fprintf (stderr, "\n");
     411  if (VERBOSE) {
     412    for (i = 0; i < Npar; i++) {
     413      fprintf (stderr, "%g ", par[i]);
     414    }
     415    fprintf (stderr, "\n");
     416  }
    413417
    414418  free (x);
  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r2843 r3105  
    7272$(SDIR)/peak.$(ARCH).o          \
    7373$(SDIR)/plot.$(ARCH).o          \
     74$(SDIR)/dot.$(ARCH).o           \
    7475$(SDIR)/point.$(ARCH).o         \
    7576$(SDIR)/ps.$(ARCH).o            \
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r2843 r3105  
    5353int peak             PROTO((int, char **));
    5454int plot             PROTO((int, char **));
     55int dot              PROTO((int, char **));
    5556int point            PROTO((int, char **));
    5657int pop              PROTO((int, char **));
     
    152153  {"peak",         peak,             "find vector peak in range"},
    153154  {"plot",         plot,             "plot a pair of vectors"},
     155  {"dot",          dot,              "plot a single point"},
    154156  {"point",        point,            "load overlay with single point"},
    155157  {"ps",           ps,               "define labels for plot"},
  • trunk/Ohana/src/opihi/cmd.data/plot.c

    r2843 r3105  
    123123
    124124}
    125 
    126 
  • trunk/Ohana/src/opihi/mana/fitcontour.c

    r3030 r3105  
    3636    r = hypot (x, y);
    3737
    38     /*
    39     t = 2*atan2(y,x);
    40     sn = sin(t);
    41     cs = cos(t);
    42     */
     38    /* calculate sin(2t), cos(2t) using 1/2 angle tri relationship above */
    4339    sn1 = y / r;
    4440    cs1 = x / r;
     
    6359  gaussj (C, NTERM, B, 1);
    6460 
     61  /** this is somewhat weak: if the object is too elongated, Rmin can be < 0 **/
    6562  dR = hypot (B[1][0], B[2][0]);
    6663  Rmaj = B[0][0] + dR;
     
    10198}
    10299
     100
     101/* this routine fits a single sine and cosine to the value of dr as a function of the angle around the central
     102 * point, theta.  this is NOT an exact fit, an is increasingly in error for more eccentric ellipses.  however,
     103 * it does a reasonable job of approximating the value of the major and minor axes, and it gets the angle of
     104 * orientation right at well.  We then assume the values of major and minor axis and angle are correct to get
     105 * the parameters for the elliptical gaussian fit:
     106 
     107 z = (x^2) / (2 Rx^2) + (y^2) / (2 Ry^2) + Rxy x y
     108
     109 the functions above give the correct relationship between these:
     110
     111   R1 = SQ(Rmaj) + SQ(Rmin);
     112   R2 = SQ(Rmaj) - SQ(Rmin);
     113   R3 = Rmaj*Rmin;
     114
     115   Rx = R3 / sqrt (R1 - R2*cs);
     116   Ry = R3 / sqrt (R1 + R2*cs);
     117   Rxy = -sn*R2 / SQ(R3);
     118
     119 to derive these relationships, write the equation for an ellipse with major axis in the x-dir and minor in
     120 the y-dir:
     121
     122 z = (x^2) / (2 Rmaj^2) + (y^2) / (2 Rmin^2)
     123
     124 apply the rotation matrix:
     125
     126 (x)' = (cos, -sin)(x,y)
     127 (y)' = (sin, +cos)(x,y)  (modulo the sign on the sine)
     128
     129 then group the x^2 terms, the y^2 terms, and the xy terms to find the three coeffs.
     130
     131 NOTE: I spent a while having trouble deriving this from the polar form of an ellipse:
     132
     133 x = Rmaj*cos(theta)
     134 y = Rmin*sin(theta)
     135
     136 it turns out that 'theta' above is NOT the angle (0,1)-(0,0)-(x,y). rather, it should be viewed as a
     137 paraterization of the ellipse. 
     138
     139*/
Note: See TracChangeset for help on using the changeset viewer.