next up previous contents
Next: Histogram Manipulation Up: Programmer Graphics Support Previous: Infrastructure Graphics   Contents

Histogramming, Storage and Output

The following routines exist for 1D and 2D histogram allocation and for resetting entries.

shistogram *hbook1(int id, char *title,float xmin,float xmax,int xbins)

shistogram *hbook2(int id,char *title,float xmin,float xmax,int xbins,
                                      float ymin,float ymax,int ybins)
void hreset(shistogram *ph)

The data structure $shistogram$ has the following structure

typedef struct shistogram
{
     Ts_id;
     int id;
     char *title;
     int type;
     double (*super)(int, double*, float);
     double *par;
     int npar;
     float xmin;
     float xmax;
     float ymin;
     float ymax;
     double mean;
     double mean2;
     int xbins;
     int ybins;
     float xincr;
     float yincr;
     int entries;
     float contents;
     float under;
     float over;
     float above;
     float below;
     float **array;

} shistogram;

The following routines exist for filling of 1D and 2D histograms.

float hfill1(shistogram *ph,float x,float w)

float hfill2(shistogram *ph,float x,float y,float w)
Where $x y w$ are the ordinates and entry weights respectively and the returned value is the current contents of the selected bin.

The following routines exist for histogram output

void hprint(FILE *fp,shistogram *ph)

void hpxprint(FILE *fp, shistogram *ph)

void hpyprint(FILE *fp, shistogram *ph)

void histdo(FILE *fp)

void hstore(FILE *fp,shistogram *ph)

void hfetch(FILE *fp)

void hsuper(shistogram *ph,int n,double (*func)(int, double*, float),double *a)
Standard 1D histogram output (with superimposed fit) looks like the following:
 h id 0 left stereo


   0.00 xxxxxxx*
   1.00 xxxxxxx*
   2.00 xxxxxxx *
   3.00 xxxxxxxxx*
   4.00 xxxxxxxxxxx*
   5.00 xxxxxxxxxxxxx*
   6.00 xxxxxxxxxxxxxxx*
   7.00 xxxxxxxxxxxxxxxxx*
   8.00 xxxxxxxxxxxxxxxxxxx*
   9.00 xxxxxxxxxxxxxxxxxxxxx*
  10.00 xxxxxxxxxxxxxxxxxxxxxxx*
  11.00 xxxxxxxxxxxxxxxxxxxxxxxxx*
  12.00 xxxxxxxxxxxxxxxxxxxxxxxxxx*
  13.00 xxxxxxxxxxxxxxxxxxxxxxxxxxxx*
  14.00 xxxxxxxxxxxxxxxxxxxxxxxxxxxx*

 h id 0 entries 15 contents 528.049 underflows 0.000 overflows 0.000
 h id 0 mean value  9.368 variance(**0.5) 3.908 scale factor  2.000
Standard 2D histogram output looks like the following:
 h id 25 KNN classification matrix

  14.00      1 1 4   3       5       D
  13.00  8   1   1     1         2 F
  12.00  2             2   1   1 C 1 1
  11.00
  10.00
   9.00  1                 9
   8.00
   7.00                      1
   6.00          2   4               1
   5.00
   4.00        3 A   1       1     2 2
   3.00                            1
   2.00
   1.00                      1   3
   0.00  A 1 2         1           2 1
        0 1 2 3 4 5 6 7 8 9 1 1 1 1 1
        . . . . . . . . . . 0 1 2 3 4
        0 0 0 0 0 0 0 0 0 0 . . . . .
        0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

 Key: .<1.0,  A<15.0,  B<20.0,  C<30.0,  D<45.0,
      E<65.0  F<100.0, G<150.0, H<200.0, *<Infty.
 entries 224 contents 224.00
 under  0.00 over   0.00 above   0.00 below   0.00


next up previous contents
Next: Histogram Manipulation Up: Programmer Graphics Support Previous: Infrastructure Graphics   Contents
root 2017-11-18