IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 16, 2006, 10:58:49 PM (20 years ago)
Author:
eugene
Message:

major updates to use gprint for buffered / threaded printing

File:
1 edited

Legend:

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

    r7680 r7917  
    11# include "dvoshell.h"
    22
    3 void print_value (FILE *f, double value, short int ival);
     3void print_value (double value, short int ival);
    44void initPhotcodeSequence (int Nsec);
    55void freePhotcodeSequence ();
     
    5050
    5151  if (argc != 4) {
    52     fprintf (stderr, "USAGE: gstar RA DEC Radius [-m]\n");
     52    gprint (GP_ERR, "USAGE: gstar RA DEC Radius [-m]\n");
    5353    return (FALSE);
    5454  }
     
    6868
    6969  if (skylist[0].Nregions > 1) {
    70     fprintf (stderr, "warning, radius overlaps region boundary, not yet implemented\n");
     70    gprint (GP_ERR, "warning, radius overlaps region boundary, not yet implemented\n");
    7171  }
    7272
     
    142142      k = N1[i];
    143143      if (!QUIET) {
    144         fprintf (GetOutfile(), "star: %d\n", k);
    145         fprintf (GetOutfile(), "%9.5f %9.5f %3d of %3d  %4.1f %5d\n", catalog.average[k].R, catalog.average[k].D,
     144        gprint (GP_LOG, "star: %d\n", k);
     145        gprint (GP_LOG, "%9.5f %9.5f %3d of %3d  %4.1f %5d\n", catalog.average[k].R, catalog.average[k].D,
    146146                 catalog.average[k].Nm, catalog.average[k].Nn + catalog.average[k].Nm,
    147147                 0.01*catalog.average[k].Xp, catalog.average[k].code);
     
    149149        /* filter names */
    150150        for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 3);
    151         fprintf (GetOutfile (), "\n");
     151        gprint (GP_LOG, "\n");
    152152
    153153        /* average mags */
    154154        for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 0);
    155         fprintf (GetOutfile(), "\n");
     155        gprint (GP_LOG, "\n");
    156156
    157157        /* average mag errors */
    158158        for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 1);
    159         fprintf (GetOutfile(), "\n");
     159        gprint (GP_LOG, "\n");
    160160
    161161        /* average mag chisq */
    162162        for (j = 0; j < Nsec + 1; j++) printPhotcodeSequence (&catalog.average[k], &catalog.secfilt[Nsec*k], j, 2);
    163         fprintf (GetOutfile(), "\n");
     163        gprint (GP_LOG, "\n");
    164164      }
    165165
     
    173173          if (GetMeasures && !QUIET) {
    174174            date = sec_to_date (catalog.measure[m].t);
    175             fprintf (GetOutfile(), "%6.3f %6.3f %5.3f  %20s  %5.2f %5.2f %2d %3x %3d %-20s\n",
     175            gprint (GP_LOG, "%6.3f %6.3f %5.3f  %20s  %5.2f %5.2f %2d %3x %3d %-20s\n",
    176176                     Mcat, Mrel, catalog.measure[m].dM_PS,
    177177                     date, catalog.measure[m].dR_PS, catalog.measure[m].dD_PS,
     
    219219}
    220220
    221 void print_value (FILE *f, double value, short int ival) {
     221void print_value (double value, short int ival) {
    222222  if (ival == NO_MAG)
    223     fprintf (f, "NaN    ");
     223    gprint (GP_LOG, "NaN    ");
    224224  else
    225     fprintf (f, "%6.3f ", value);
     225    gprint (GP_LOG, "%6.3f ", value);
    226226}
    227227
     
    265265    case 0: /* average mags */
    266266      if (seq == -1) {
    267         print_value (GetOutfile(), average[0].M, average[0].M);
     267        print_value (average[0].M, average[0].M);
    268268      } else {
    269         print_value (GetOutfile(), secfilt[seq].M_PS, secfilt[seq].M_PS);
     269        print_value (secfilt[seq].M_PS, secfilt[seq].M_PS);
    270270      }
    271271      break;
     
    273273    case 1: /* average mags errors */
    274274      if (seq == -1) {
    275         print_value (GetOutfile(), average[0].dM, average[0].dM);
     275        print_value (average[0].dM, average[0].dM);
    276276      } else {
    277         print_value (GetOutfile(), secfilt[seq].dM_PS, secfilt[seq].dM_PS);
     277        print_value (secfilt[seq].dM_PS, secfilt[seq].dM_PS);
    278278      }
    279279      break;
     
    281281    case 2: /* average mag chisq */
    282282      if (seq == -1) {
    283         print_value (GetOutfile(), pow (10.0, 0.01*average[0].Xm), average[0].Xm);
     283        print_value (pow (10.0, 0.01*average[0].Xm), average[0].Xm);
    284284      } else {
    285         print_value (GetOutfile(), pow (10.0, 0.01*secfilt[seq].Xm), secfilt[seq].Xm);
     285        print_value (pow (10.0, 0.01*secfilt[seq].Xm), secfilt[seq].Xm);
    286286      }
    287287      break;
     
    289289    case 3: /* filter names */
    290290      code = GetPhotcodebyNsec (seq + 1);
    291       fprintf (GetOutfile (), "%6s ", code[0].name);
    292       break;
    293   }
    294 }
     291      gprint (GP_LOG, "%6s ", code[0].name);
     292      break;
     293  }
     294}
Note: See TracChangeset for help on using the changeset viewer.