IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 18, 2006, 5:26:07 PM (20 years ago)
Author:
eugene
Message:

added periodogram, tests, some minor bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r5945 r6642  
    99  double Mcat, Mrel;
    1010  float *RA, *DEC;
    11   int i, j, k, m, N, *N1, Nsec, NPTS;
     11  int i, j, k, m, N, *N1, Nsec, NPTS, QUIET;
    1212  int Nstars, found, GetMeasures, Nlo, Nhi;
    1313  int SaveVectors;
     
    1717  Catalog catalog;
    1818  PhotCode *code;
     19  int TimeFormat;
     20  time_t TimeReference;
    1921
    2022  if (!InitPhotcodes ()) return (FALSE);
    2123  Nsec = GetPhotcodeNsecfilt ();
     24
     25  QUIET = FALSE;
     26  if ((N = get_argument (argc, argv, "-q"))) {
     27    QUIET = TRUE;
     28    remove_argument (N, &argc, argv);
     29  }
    2230
    2331  NPTS = 0;
     
    4452  }
    4553 
     54  GetTimeFormat (&TimeReference, &TimeFormat);
     55
    4656  Ra = atof (argv[1]);
    4757  Dec = atof (argv[2]);
     
    127137    if (r < Radius2) {
    128138      k = N1[i];
    129       fprintf (GetOutfile(), "star: %d\n", k);
    130       fprintf (GetOutfile(), "%9.5f %9.5f %3d of %3d  %4.1f %5d\n", catalog.average[k].R_PS, catalog.average[k].D_PS,
    131                catalog.average[k].Nm, catalog.average[k].Nn + catalog.average[k].Nm,
    132                0.01*catalog.average[k].Xp, catalog.average[k].code);
     139      if (!QUIET) {
     140          fprintf (GetOutfile(), "star: %d\n", k);
     141          fprintf (GetOutfile(), "%9.5f %9.5f %3d of %3d  %4.1f %5d\n", catalog.average[k].R_PS, catalog.average[k].D_PS,
     142                   catalog.average[k].Nm, catalog.average[k].Nn + catalog.average[k].Nm,
     143                   0.01*catalog.average[k].Xp, catalog.average[k].code);
    133144     
    134       /* filter names -- primary code is 0 in this function */
    135       for (j = 0; j < Nsec + 1; j++) {
    136         code = GetPhotcodebyNsec (j);
    137         fprintf (GetOutfile (), "%s ", code[0].name);
     145          /* filter names -- primary code is 0 in this function */
     146          for (j = 0; j < Nsec + 1; j++) {
     147              code = GetPhotcodebyNsec (j);
     148              fprintf (GetOutfile (), "%s ", code[0].name);
     149          }
     150          fprintf (GetOutfile (), "\n");
     151
     152          /* average mags */
     153          print_value (GetOutfile(), catalog.average[k].M_PS, catalog.average[k].M_PS);
     154          for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].M_PS, catalog.secfilt[j + Nsec*k].M_PS);
     155          fprintf (GetOutfile(), "\n");
     156
     157          /* average mag errors */
     158          print_value (GetOutfile(), catalog.average[k].dM_PS, catalog.average[k].dM_PS);
     159          for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].dM_PS, catalog.secfilt[j + Nsec*k].dM_PS);
     160          fprintf (GetOutfile(), "\n");
     161
     162          /* average mag chisq */
     163          print_value (GetOutfile(), pow (10.0, 0.01*catalog.average[k].Xm), catalog.average[k].Xm);
     164          for (j = 0; j < Nsec; j++) print_value (GetOutfile(), pow (10.0, 0.01*catalog.secfilt[j + Nsec*k].Xm), catalog.secfilt[j + Nsec*k].Xm);
     165          fprintf (GetOutfile(), "\n");
    138166      }
    139       fprintf (GetOutfile (), "\n");
    140 
    141       /* average mags */
    142       print_value (GetOutfile(), catalog.average[k].M_PS, catalog.average[k].M_PS);
    143       for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].M_PS, catalog.secfilt[j + Nsec*k].M_PS);
    144       fprintf (GetOutfile(), "\n");
    145 
    146       /* average mag errors */
    147       print_value (GetOutfile(), catalog.average[k].dM_PS, catalog.average[k].dM_PS);
    148       for (j = 0; j < Nsec; j++) print_value (GetOutfile(), catalog.secfilt[j + Nsec*k].dM_PS, catalog.secfilt[j + Nsec*k].dM_PS);
    149       fprintf (GetOutfile(), "\n");
    150 
    151       /* average mag chisq */
    152       print_value (GetOutfile(), pow (10.0, 0.01*catalog.average[k].Xm), catalog.average[k].Xm);
    153       for (j = 0; j < Nsec; j++) print_value (GetOutfile(), pow (10.0, 0.01*catalog.secfilt[j + Nsec*k].Xm), catalog.secfilt[j + Nsec*k].Xm);
    154       fprintf (GetOutfile(), "\n");
    155167
    156168      if (GetMeasures || SaveVectors) {
     
    161173          Mrel = PhotRel (&catalog.measure[m], &catalog.average[k], &catalog.secfilt[k*Nsec]);
    162174
    163           if (GetMeasures) {
     175          if (GetMeasures && !QUIET) {
    164176            date = sec_to_date (catalog.measure[m].t);
    165177            fprintf (GetOutfile(), "%6.3f %6.3f %5.3f  %20s  %5.2f %5.2f %2d %3x %3d %-20s\n",
     
    173185          if (SaveVectors) {
    174186            vec1[0].elements[N] = Mcat;
    175             vec2[0].elements[N] = catalog.measure[m].t;
     187            vec2[0].elements[N] = TimeValue (catalog.measure[m].t, TimeReference, TimeFormat);
    176188            vec3[0].elements[N] = catalog.measure[m].airmass_PS;
    177189            vec4[0].elements[N] = catalog.measure[m].source;
Note: See TracChangeset for help on using the changeset viewer.