IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35341


Ignore:
Timestamp:
Apr 2, 2013, 1:53:46 PM (13 years ago)
Author:
eugene
Message:

add test output blocks, commented out

Location:
branches/eam_branches/ipp-20130307
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130307/psModules/src/astrom/pmAstrometryUtils.c

    r24096 r35341  
    2323#include "pmAstrometryUtils.h"
    2424
     25// this is used by the test output block
     26static int Nout = 0;
     27
    2528// given a 2D transformation -- L(x,y),M(x,y) -- find the coordinates x,y
    2629// for which L,M = 0,0. tol is the allowed error on x,y.
     
    3336    double Xo = (trans->y->coeff[0][0]*trans->x->coeff[0][1] - trans->x->coeff[0][0]*trans->y->coeff[0][1])/R;
    3437    double Yo = (trans->x->coeff[0][0]*trans->y->coeff[1][0] - trans->y->coeff[0][0]*trans->x->coeff[1][0])/R;
     38
     39    if (0) {
     40      // this is a test output block, not used in normal operations
     41      char filename[64];
     42      snprintf (filename, 64, "trans.%03d.md", Nout);
     43      FILE *f = fopen (filename, "w");
     44
     45      psMetadata *md = psMetadataAlloc();
     46
     47      psPolynomial2DtoMetadata (md, trans->x, "X");
     48      psPolynomial2DtoMetadata (md, trans->y, "Y");
     49      psMetadataConfigPrint (f, md);
     50      psFree (md);
     51      fclose (f);
     52      Nout ++;
     53    }
    3554
    3655    // iterate to actual solution: requires small non-linear terms
     
    5372            // NOTE: order for Alpha is: [y][x]
    5473            Alpha->data.F32[0][0] = psPolynomial2DEval (XdX, Xo, Yo);
    55             Alpha->data.F32[1][0] = psPolynomial2DEval (XdY, Xo, Yo);
    56             Alpha->data.F32[0][1] = psPolynomial2DEval (YdX, Xo, Yo);
     74            Alpha->data.F32[0][1] = psPolynomial2DEval (XdY, Xo, Yo);
     75            Alpha->data.F32[1][0] = psPolynomial2DEval (YdX, Xo, Yo);
    5776            Alpha->data.F32[1][1] = psPolynomial2DEval (YdY, Xo, Yo);
    5877
    59             Beta->data.F32[0] = psPolynomial2DEval (trans->x, Xo, Yo);
    60             Beta->data.F32[1] = psPolynomial2DEval (trans->y, Xo, Yo);
     78            Beta->data.F32[0] = -1.0 * psPolynomial2DEval (trans->x, Xo, Yo);
     79            Beta->data.F32[1] = -1.0 * psPolynomial2DEval (trans->y, Xo, Yo);
    6180
    6281            if (!psMatrixGJSolve (Alpha, Beta)) {
     
    7190            }
    7291
    73             Xo -= Beta->data.F32[0];
    74             Yo -= Beta->data.F32[1];
     92            Xo += Beta->data.F32[0];
     93            Yo += Beta->data.F32[1];
    7594            dPos = hypot(Beta->data.F32[0], Beta->data.F32[1]);
    76 
     95            psTrace ("psastro", 5, "i: %d, Xo,Yo : %f %f  dX, dY: %f %f dPos: %f\n", i, Xo, Yo, Beta->data.F32[0], Beta->data.F32[1], dPos);
    7796        }
    7897        psFree (Alpha);
  • branches/eam_branches/ipp-20130307/psastro/src/psastroChipAstrom.c

    r31333 r35341  
    7575                if (refstars == NULL) { continue; }
    7676
     77# if (0)
     78                static int Nchip = 0;
     79                if (1) {
     80                  // XXX test
     81                  char filename[64];
     82                  snprintf (filename, 64, "refstars.%02d.dat", Nchip);
     83                  FILE *outfile = fopen (filename, "w");
     84                  assert (outfile);
     85                  for (int nn = 0; nn < refstars->n; nn++) {
     86                    pmAstromObj *ref = refstars->data[nn];
     87                    fprintf (outfile, "%lf %lf  %lf %lf  %lf %lf  %lf %lf\n",
     88                             ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD,
     89                             ref->TP->x, ref->TP->y,
     90                             ref->FP->x, ref->FP->y,
     91                             ref->chip->x, ref->chip->y);
     92                  }
     93                  fclose (outfile);
     94                }
     95                if (1) {
     96                  // XXX test
     97                  char filename[64];
     98                  snprintf (filename, 64, "rawstars.%02d.dat", Nchip);
     99                  FILE *outfile = fopen (filename, "w");
     100                  assert (outfile);
     101                  for (int nn = 0; nn < gridrawstars->n; nn++) {
     102                    pmAstromObj *ref = gridrawstars->data[nn];
     103                    fprintf (outfile, "%lf %lf  %lf %lf  %lf %lf  %lf %lf\n",
     104                             ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD,
     105                             ref->TP->x, ref->TP->y,
     106                             ref->FP->x, ref->FP->y,
     107                             ref->chip->x, ref->chip->y);
     108                  }
     109                  fclose (outfile);
     110                  Nchip ++;
     111                }
     112# endif
     113
    77114                // the absolute minimum number of stars is 4 (for order = 1)
    78115                if ((rawstars->n < 4) || (refstars->n < 4)) {
  • branches/eam_branches/ipp-20130307/psastro/src/psastroChooseRefstars.c

    r35050 r35341  
    107107
    108108                    if (ref->Mag < clampMagMin) {
    109                         psWarning("Skipping refstar with abusrd magnintude %f ra: %f dec: %f\n",
     109                        psWarning("Skipping refstar with abusrd magnitude %f ra: %f dec: %f\n",
    110110                            ref->Mag, RAD_TO_DEG(ref->sky->r), RAD_TO_DEG(ref->sky->d));
    111111                        goto skip;
     
    131131
    132132# if (0)
    133                 // XXX test
    134                 FILE *outfile = fopen ("refstars.dat", "w");
    135                 assert (outfile);
    136                 for (int nn = 0; nn < refstars->n; nn++) {
    137                           pmAstromObj *ref = refstars->data[nn];
    138                           fprintf (outfile, "%lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD);
     133                if (1) {
     134                  // test output block, not used in normal ops
     135                  char filename[64];
     136                  snprintf (filename, 64, "refstars.%02d.dat", Nchip);
     137                  FILE *outfile = fopen (filename, "w");
     138                  assert (outfile);
     139                  for (int nn = 0; nn < refstars->n; nn++) {
     140                    pmAstromObj *ref = refstars->data[nn];
     141                    fprintf (outfile, "%lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD);
     142                  }
     143                  fclose (outfile);
    139144                }
    140                 fclose (outfile);
     145                if (1) {
     146                  // test output block, not used in normal ops
     147                  char filename[64];
     148                  snprintf (filename, 64, "refstars.%02d.dat", Nchip);
     149                  FILE *outfile = fopen (filename, "w");
     150                  assert (outfile);
     151                  for (int nn = 0; nn < refstars->n; nn++) {
     152                    pmAstromObj *ref = refstars->data[nn];
     153                    fprintf (outfile, "%lf %lf  %lf %lf  %lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD, );
     154                  }
     155                  fclose (outfile);
     156                }
    141157# endif
    142158
Note: See TracChangeset for help on using the changeset viewer.