IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20191


Ignore:
Timestamp:
Oct 16, 2008, 9:19:23 AM (18 years ago)
Author:
eugene
Message:

use -noX for kapa if -plot is not selected; set output filenames based on a varargs format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relphot/src/plotstuff.c

    r14590 r20191  
    2525  sprintf (name, "gastro [%d]", N);
    2626
    27   // XXX need to allow for KapaOpenNamed socket instead
    28   Xgraph[N] = KapaOpen ("kapa", name);
     27  // if -plot is supplied, the plots are shown on the screen;
     28  // otherwise, only the final plots are generated and saved without display
     29  if (PLOTSTUFF) {
     30    Xgraph[N] = KapaOpen ("kapa", name);
     31  } else {
     32    Xgraph[N] = KapaOpen ("kapa -noX", name);
     33  }
    2934
    3035  if (Xgraph[N] < 0) {
     
    3843
    3944  if (Xgraph[N] == 0) return;
    40 
    4145  KapaBox (Xgraph[N], graphmode);
    4246  return;
     
    6670
    6771  KapaClearSections (Xgraph[N]);
     72
     73  KapaSetLimits (Xgraph[N], graphmode);
     74  KapaSetFont (Xgraph[N], "helvetica", 14);
     75  KapaBox (Xgraph[N], graphmode);
     76  // KapaSendLabel (Xgraph[N], "PSF Mag", KAPA_LABEL_XM);
     77  // KapaSendLabel (Xgraph[N], "Ap Mag - PSF Mag", KAPA_LABEL_YM);
    6878
    6979  KapaPrepPlot (Xgraph[N], Npts, graphmode);
     
    95105}
    96106
    97 void plot_list (Graphdata *graphdata, double *xlist, double *ylist, int N, char *label, char *file) {
     107// plot the vector pair to a file with name defined by the varargs format
     108void plot_list (Graphdata *graphdata, double *xlist, double *ylist, int N, char *label, char *format, ...) {
    98109
    99   int i;
     110  char tmp, *filename;
     111  int i, Nbyte;
    100112  StatType stats;
     113  va_list argp; 
     114
     115  va_start (argp, format);
     116  Nbyte = vsnprintf (&tmp, 0, format, argp);
     117  va_end (argp);
     118  if (!Nbyte) return;
     119  Nbyte ++;
     120
     121  ALLOCATE (filename, char, Nbyte);
     122  va_start (argp, format);
     123  vsnprintf (filename, Nbyte, format, argp);
     124  va_end (argp);
    101125 
    102126  stats.min = stats.max = xlist[0];
     
    122146  DonePlotting (graphdata, 0);
    123147
    124   if ((file != NULL) && SAVEPLOT) JpegPlot (graphdata, 0, file);
     148  if (SAVEPLOT) JpegPlot (graphdata, 0, filename);
    125149  if (PLOTDELAY > 500000) {
    126150    fprintf (stdout, "press return\n");
     
    129153    usleep (PLOTDELAY);
    130154  }
     155  free (filename);
    131156}
    132157
Note: See TracChangeset for help on using the changeset viewer.