Public Member Functions | Public Attributes | List of all members
o2scl::bin_size Class Reference

Determine bin size (CERNLIB) More...

#include <bin_size.h>

Public Member Functions

int calc_bin (double al, double ah, int na, double &bl, double &bh, int &nb, double &bwid)
 Compute bin size. More...
 

Public Attributes

bool cern_mode
 (default true)
 

Detailed Description

This is adapted from the KERNLIB routine binsiz.f written by F. James.

This class computes an appropriate set of histogram bins given the upper and lower limits of the data and the maximum number of bins. The bin width is always an integral power of ten times 1, 2, 2.5 or 5. The bin width may also be specified by the user, in which case the class only computes the appropriate limits.

Note
This class is not working yet.
Idea for Future:
Finish this.

Definition at line 48 of file bin_size.h.

Member Function Documentation

◆ calc_bin()

int o2scl::bin_size::calc_bin ( double  al,
double  ah,
int  na,
double &  bl,
double &  bh,
int &  nb,
double &  bwid 
)
  • al - Lower limit of data
  • ah - Upper limit of data
  • na - Maximum number of bins desired.
  • bl - Lower limit (BL<=AL)
  • bh - Upper limit (BH>=AH)
  • nb - Number of bins determined by BINSIZ (NA/2<NB<=NA)
  • bwid - Bin width (BH-BL)/NB

If na=0 or na=-1, this function always makes exactly one bin.

If na=1, this function takes bwid as input and determines only bl, hb, and nb. This is especially useful when it is desired to have the same bin width for several histograms (or for the two axes of a scatter-plot).

If al > ah, this function takes al to be the upper limit and ah to be the lower limit, so that in fact al and ah may appear in any order. They are not changed by calc_bin(). If al = ah, the lower limit is taken to be al, and the upper limit is set to al+1.

If cern_mode is true (which is the default) the starting guess for the number of bins is na-1. Otherwise, the starting guess for the number of bins is na.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).