IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12047


Ignore:
Timestamp:
Feb 25, 2007, 4:22:22 PM (19 years ago)
Author:
eugene
Message:

adding pm / par fiting functions

Location:
branches/dvo-mods-2007-02/Ohana/src/relastro/src
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dvo-mods-2007-02/Ohana/src/relastro/src/UpdateObjects.c

    r12008 r12047  
    22
    33static int Nmax;
    4 static double *listR, *listD;
    5 static double *dlistR, *dlistD;
     4static double *listX, *dlistX;
     5static double *listY, *dlistY;
     6static double *listR, *dlistR;
     7static double *listD, *dlistD;
     8static double *listT, *dlistT;
    69
    710void initObjectData (Catalog *catalog, int Ncatalog) {
     
    2528  float chisq;
    2629  StatType statsR, statsD;
     30  Coords coords;
     31
     32  coords.crval1 = 0;
     33  coords.crval2 = 0;
     34  coords.crpix1 = 0;
     35  coords.crpix2 = 0;
     36  coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0;
     37  coords.pc1_1  = coords.pc2_2 = 1.0;
     38  coords.pc1_2  = coords.pc2_1 = 0.0;
     39  coords.Npolyterms = 1;
     40  strcpy (coords.ctype, "RA---SIN");
    2741
    2842  for (i = 0; i < Ncatalog; i++) {
     
    3953        listR[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
    4054        listD[N] = getMeanD (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*PhotNsec]);
     55        listT[N] = catalog[i].measure[m].t;
    4156
    4257        /* the astrometric errors are not being carried yet (but should be!) */
     
    4459        dlistR[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
    4560        dlistD[N] = MAX (catalog[i].measure[m].dM, MIN_ERROR);
     61        dlistT[N] = 1.0; /* XXX hard-wire this for now */
     62
    4663        N++;
    4764      }
     
    5269      }
    5370
     71      /* we need to do the fit in a locally linear space; choose a ref coordinate */
     72      coords.crval1 = listR[0];
     73      coords.crval2 = listD[0];
     74     
     75      /* project all of the R,D coordinates to a plane centered on this coordinate */
     76      /* calculate pR[i], pD[i] for each point */
     77      for (k = 0; k < N; k++) {
     78          RD_to_XY (&listX[k], &listY[k], listR[k], listD[k], &coords);
     79          ParFactor (&pX[k], &pY[k], listR[k], listD[k]);
     80      }   
     81
    5482      /* in here, we should be fitting the parallax and proper-motion components */
     83      /* XXX if I fit R,D,T as above, I will be getting the wrong answers near the pole */
     84      if (FitProperMotion) {
     85          fit = FitPM (listX, dlistX, listY, dlistY, listT, pR, pD, N);
     86      }
    5587
    56       liststats (listR, dlistR, N, &statsR);
    57       liststats (listR, dlistR, N, &statsD);
     88      if (AverageCoords) {
     89          liststats (listR, dlistR, N, &statsR);
     90          liststats (listD, dlistD, N, &statsD);
    5891
    59       catalog[i].average[j].R = statsR.mean;
    60       catalog[i].average[j].dR = statsR.sigma;
     92          catalog[i].average[j].R = statsR.mean;
     93          catalog[i].average[j].dR = statsR.sigma;
    6194
    62       catalog[i].average[j].D = statsD.mean;
    63       catalog[i].average[j].dD = statsD.sigma;
     95          catalog[i].average[j].D = statsD.mean;
     96          catalog[i].average[j].dD = statsD.sigma;
    6497
    65       chisq = 0.5*(statsR.chisq + statsD.chisq);
     98          chisq = 0.5*(statsR.chisq + statsD.chisq);
     99      }
     100
    66101      catalog[i].average[j].Xp = (statsR.Nmeas > 1) ? 100.0*log10(chisq) : NO_MAG;
    67 
    68102    }
    69103  }
     
    71105}
    72106
     107/* fitting proper-motion and parallax:
     108
     109 given a source at position r,d, at a time t, we need to calculate a vector (pr,pd)
     110
     111 let x,y be the coordinate in the linearized frame with y parallel to DEC lines
     112
     113 L,B are the ecliptic longitude and latitude of the object,
     114 dL and dB are the offsets in the L and B directions
     115
     116 dL = sin(t - topp)
     117 dB = cos(t - topp)*sin(B)
     118
     119 these need to be rotated to the R,D frame to yield pR,pD.  Then, the equation of motion
     120 for the source in the x,y frame is:
     121
     122 x = Ro + uR * (t - to) + p * pR
     123 y = Do + uD * (t - to) + p * pD
     124
     125 the unknowns in these equations are Ro, uR, Do, uD, and p
     126
     127 XXX think through the concepts for the pole a bit better.  all objects near the pole
     128 move the same way with the same phase.  choose a projection center and define dL,dB relative
     129 to that center point coordinate system?
     130
     131*/
Note: See TracChangeset for help on using the changeset viewer.