Path: | rdoc/hist2d.rdoc |
Last Update: | Sun Nov 14 22:53:48 +0000 2010 |
Constructors.
>> h2 = GSL::Histogram2d.alloc(2, 3) # size 6 >> h2.xrange => GSL::Histogram::Range: [ 0.000e+00 1.000e+00 2.000e+00 ] >> h2.yrange => GSL::Histogram::Range: [ 0.000e+00 1.000e+00 2.000e+00 3.000e+00 ] >> h2.bin => GSL::Histogram::Bin: [ 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 ] >> h2.xrange.class.superclass => GSL::Vector::View::ReadOnly >> h2.bin.class.superclass => GSL::Vector::View::ReadOnly
>> h2 = Histogram2d.alloc([3, 6, 7], [2, 3, 8]) >> h2.xrange => GSL::Histogram::Range: [ 3.000e+00 6.000e+00 7.000e+00 ] >> h2.yrange => GSL::Histogram::Range: [ 2.000e+00 3.000e+00 8.000e+00 ] >> h2.bin => GSL::Histogram::Bin: [ 0.000e+00 0.000e+00 0.000e+00 0.000e+00 ]
>> h2 = Histogram2d.alloc(4, [0, 4], 3, [1, 5]) >> h2.xrange => GSL::Histogram::Range: [ 0.000e+00 1.000e+00 2.000e+00 3.000e+00 4.000e+00 ] >> h2.yrange => GSL::Histogram::Range: [ 1.000e+00 2.333e+00 3.667e+00 5.000e+00 ]
This sets the ranges of the existing histogram using two GSL::Vector objects or arrays.
This sets the ranges of the existing histogram self to cover the ranges xmin to xmax and ymin to ymax uniformly. The values of the histogram bins are reset to zero.
Returns a newly created histogram which is an exact copy of the histogram self.
These method update the histogram self by adding weight to the bin whose x and y ranges contain the coordinates (x,y). If (x,y) lies outside the limits of the histogram then none of the bins are modified.
These are similar to GSL::Histogram#increment/accumulate/fill, but when (x,y) lies outside the limits of the histogram then the edge bin is incremented.
Return the contents of the (i,j)-th bin of the histogram self.
These methods find the upper and lower range limits of the i-th and j-th bins in the x and y directions of the histogram self.
Ex:
>> h2 = Histogram2d.alloc(2, [0, 2], 3, [1, 4]) >> h2.get_xrange(1) => [1.0, 2.0] >> h2.get_yrange(1) => [2.0, 3.0]
These methods returns the range of histogram as Vector::View objects.
These methodss return the maximum upper and minimum lower range limits and the number of bins for the x and y directions of the histogram self.
Resets all the bins of the histogram self to zero.
Finds the indices i and j to the to the bin which covers the coordinates (x,y).
Returns the maximum value contained in the histogram bins.
Returns the indices (i,j) of the bin containing the maximum value in the histogram self.
Returns the minimum value contained in the histogram bins.
Returns the indices (i,j) of the bin containing the minimum value in the histogram self.
Returns the mean of the histogrammed x variable, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation.
Returns the standard deviation of the histogrammed x variable, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation.
Returns the mean of the histogrammed y variable, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation.
Returns the standard deviation of the histogrammed y variable, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation.
Returns the covariance of the histogrammed x and y variables, where the histogram is regarded as a probability distribution. Negative bin values are ignored for the purposes of this calculation.
Return the sum of all bin values. Negative bin values are included in the sum.
Creates a GSL::Histogram object by projecting the 2D histogram self onto the x-axis over the y-range from jstart to jend.
Creates a GSL::Histogram object by projecting the 2D histogram self onto the y-axis over the x-range from istart to iend.
Constructors
Initializer with a GSL::Histogram2d object h.
#!/usr/bin/env ruby require("gsl") N = 10000 BINS = 100 rng = Rng.new(2) h2 = Histogram2d.alloc(BINS, [-5, 5], BINS, [-8, 8]) sig1 = 1.0 sig2 = 2.0 for i in 0...N do r1 = rng.gaussian(sig1) r2 = rng.gaussian(sig2) h2.increment(r1, r2) end hx = h2.xproject hy = h2.yproject printf("%f %f %f %f\n", h2.xsigma, h2.ysigma, hx.sigma, hy.sigma) GSL::graph(hx, hy, "-T X -C -g 3")