IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13141


Ignore:
Timestamp:
May 2, 2007, 2:20:32 PM (19 years ago)
Author:
eugene
Message:

adding flexible output modes, allowing secfilt for calibration, better calibration output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/src/calibrate.c

    r12332 r13141  
    4242
    4343/* use the linked list to navigate the measures; safe for unsorted measures */
    44 void AddToCalibration (Average *average, Measure *measure, Measure *new, int *next, int Nstar) {
    45 
    46   int i, j, m, found0, found1, found2;
     44void AddToCalibration (Average *average, SecFilt *secfilt, Measure *measure, Measure *new, int *next, int Nstar) {
     45
     46  int i, j, m, Nsec, found0, found1, found2;
    4747  float CalM0, CalM1, CalM2, dCalM;
    48   float Mcal, color, factor;
     48  float Mcal, color, factor, Minst;
    4949  short CalC0, CalC1, CalC2;
    5050
     
    6666  if (InternalCal) {
    6767    CalC0 = incode[0].code;
     68    Nsec  = GetPhotcodeNsec (CalC0);
    6869  } else {
    6970    CalC0 = excode[0].code;
    70   }
     71    Nsec  = GetPhotcodeNsec (CalC0);
     72  }
     73  /* check if this reference code is an average magnitude */
     74  if (Nsec != -1) {
     75    CalM0 = secfilt[Nsec].M;
     76    dCalM = secfilt[Nsec].dM;
     77    found0 = TRUE;
     78  }
     79
    7180  CalC1 = mycode[0].c1;
     81  Nsec  = GetPhotcodeNsec (CalC1);
     82  if (Nsec != -1) {
     83    CalM1 = secfilt[Nsec].M;
     84    found1 = TRUE;
     85  }
     86
    7287  CalC2 = mycode[0].c2;
     88  Nsec  = GetPhotcodeNsec (CalC2);
     89  if (Nsec != -1) {
     90    CalM2 = secfilt[Nsec].M;
     91    found2 = TRUE;
     92  }
     93
     94  if (!CalC1 && !CalC2) {
     95    found1 = found2 = TRUE;
     96    CalM1 = CalM2 = 0.0;
     97  }
    7398
    7499  m = average[0].offset;
     
    99124      }
    100125      // if we want to apply a Mcal -> Mref color correction, we need the additional color term
    101       SaveCalibration (Mcal, new[0].dM, CalM0, dCalM, new[0].M - ZeroPt - new[0].dt, Nstar);
     126      Minst = new[0].M - ZeroPt - new[0].dt;
     127      SaveCalibration (Mcal, new[0].dM, CalM0, dCalM, Minst, Nstar);
     128      if ((DUMP != NULL) && !strcmp (DUMP, "cal")) {
     129        fprintf (stdout, "cal-match : %10.6f %10.6f : %7.4f %6.4f  %7.4f %6.4f   %7.4f : %7.4f %7.4f\n", average[0].R, average[0].D, Mcal, new[0].dM, CalM0, dCalM, Minst, airmass, color);
     130      }
    102131      return;
    103132    }
     
    186215    M2 = sqrt (fabs(M2/N - M1*M1));
    187216    Mw = W1 / W2;
    188     fprintf (stderr, "N: %.0f, mean: %f, wt mean: %f, stdev: %f, precision: %f\n", N, M1, Mw, M2, M2 / sqrt (N));
     217    fprintf (stdout, "STATUS: SUCCESS\n");
     218    fprintf (stdout, "ZERO_POINT_MEAN      = %7.4f\n", M1);
     219    fprintf (stdout, "ZERO_POINT_WTMEAN    = %7.4f\n", Mw);
     220    fprintf (stdout, "ZERO_POINT_STDEV     = %7.4f\n", M2);
     221    fprintf (stdout, "ZERO_POINT_PRECISION = %7.4f\n", M2 / sqrt (N));
     222    fprintf (stdout, "ZERO_POINT_NSTARS    =    %4.0f\n", N);
     223    // fprintf (stderr, "N: %.0f, mean: %f, wt mean: %f, stdev: %f, precision: %f\n", N, M1, Mw, M2, M2 / sqrt (N));
    189224    image[0].Mcal = M1;
    190225    image[0].dMcal = M2 / sqrt (N);
Note: See TracChangeset for help on using the changeset viewer.