geirs2Panic
Richard J. Mathar
Fits header keyword batch editor
|
#include <Histo.h>
Public Member Functions | |
Histo () | |
Constructor. More... | |
Histo (const valarray< float > &arr, const int Nbin, const double range[], string &nam) | |
Histo (const valarray< float > &arr, const int Nbin, string &nam) | |
Constructor. More... | |
Histo (const valarray< float > &arr, string &nam) | |
Constructor. More... | |
void | dumpFil (const char *fname) |
Create the bins in xy gnuplot format. For each number in the histogram, a short horizontal line is produced, such that concatenation of these horizontal lines with straight line segments produces a step function along the x axis. More... | |
Static Public Member Functions | |
static int | valRange (const valarray< float > &arr, double mimax[2]) |
Determine smallest and largest value in all elements of the array. More... | |
Public Attributes | |
vector< int > | cts |
The counts on a per-bin basis. More... | |
vector< int > | cumCts |
The cumulative counts on a per-bin basis. More... | |
double | strt |
The smallest range of the first bin. More... | |
double | stride |
The width of each bin. More... | |
double | perc [7] |
Percentile abscissas. More... | |
double | mimax [3] |
Minimum and maximum value and arithmetic mean. More... | |
string | name |
Some kind of file name or tag attached to this statistics. More... | |
Private Member Functions | |
void | init (const valarray< float > &arr, const int Nbin, const double range[]) |
Principal part of the constructor. More... | |
Histo::Histo | ( | ) |
Constructor.
Empty histogram. The main purpose of this construction is to allow allocations of vectors of histograms.
Histo::Histo | ( | const valarray< float > & | arr, |
const int | Nbin, | ||
const double | range[], | ||
string & | nam | ||
) |
Histo::Histo | ( | const valarray< float > & | arr, |
const int | Nbin, | ||
string & | nam | ||
) |
Constructor.
The range of the bins is automatically set to reach out to the smallest and largest value in the array.
arr | The array of values to be binned. |
Nbin | The number of bins into which the values are split. |
Histo::Histo | ( | const valarray< float > & | arr, |
string & | nam | ||
) |
Constructor.
The number of bins is set equal to the square root of the number of values in the array. The range of the bins is automatically set to reach out to the smallest and largest value in the array.
arr | The array of values to be binned. |
|
static |
Determine smallest and largest value in all elements of the array.
NaN-values are not taken into account (ignored). In that sense, this function is an improvement relative to the undefined result if min() or max() of the array are taken as defined in the STL.
[in] | arr | The array to be scanned. |
[out] | mimax | The minimum in [0], the maximum in [1]. If the array does not contain values that are not NaN's, both values are unchanged. |
void Histo::dumpFil | ( | const char * | fname | ) |
Create the bins in xy gnuplot format. For each number in the histogram, a short horizontal line is produced, such that concatenation of these horizontal lines with straight line segments produces a step function along the x axis.
[in] | fname | The file to be generated. |
|
private |
Principal part of the constructor.
The statistics (minimum and maximum and the percentiles) is computed over the entire range of the arr-values that are not NaN's, not only over the values within the interval specified by the range argument.
arr | The array of values to be binned. |
Nbin | The number of bins into which the values are split. |
range | The minimum and maximum value in the first and last bin. |
vector<int> Histo::cts |
The counts on a per-bin basis.
Provides by its length an explicit count of the bins.
vector<int> Histo::cumCts |
The cumulative counts on a per-bin basis.
cumCts[i] contains sum_{k=0..n} cts[k].
double Histo::strt |
The smallest range of the first bin.
double Histo::stride |
The width of each bin.
double Histo::perc[7] |
Percentile abscissas.
[0] the 3 sigma level (left), [1] the 2 sigm left, [2] the 1 sigma left, [3] the median, [4] the 1 sigma right, [5] the 2 sigma right, [6] the 3 sigma right.
double Histo::mimax[3] |
Minimum and maximum value and arithmetic mean.
string Histo::name |
Some kind of file name or tag attached to this statistics.