![]() |
![]() |
![]() |
gtk-hst reference manual | ![]() |
---|---|---|---|---|
#include <gtk-hst/histogram.h> HstHistogram; HstHistogramClass; HstHistogram* hst_histogram_new (int n, double xmin, double xmax, gdouble *ptr); void hst_histogram_fill (HstHistogram *hst, double v, double w); void hst_histogram_reset (HstHistogram *hst); void hst_histogram_update_stats (HstHistogram *hst); double hst_histogram_mean (HstHistogram *hst); double hst_histogram_rms (HstHistogram *hst); double hst_histogram_stdev (HstHistogram *hst); double hst_histogram_n (HstHistogram *hst); double hst_histogram_xmin (HstHistogram *hst); double hst_histogram_xmax (HstHistogram *hst); double hst_histogram_vmin (HstHistogram *hst); double hst_histogram_vmax (HstHistogram *hst); int hst_histogram_get_stats (HstHistogram *hst, HstStats *s); void hst_histogram_get_buffer (HstHistogram *hst, int *sz, double **buffer);
"ptr" gpointer : Read / Write "stats" gint : Write "vmax" gdouble : Read "vmin" gdouble : Read
A histogram is used to store the number of times the value of a given quantity repeats. One fills this histogram by giving all the values that a quantity takes to the hst_histogram_fill function.
typedef struct { HstFunctionClass parent_class; /* Functions */ void (*fill)(HstHistogram *,double val, double weight); void (*reset)(HstHistogram *); /* signals */ void (*changed)(HstHistogram *); } HstHistogramClass;
HstHistogram* hst_histogram_new (int n, double xmin, double xmax, gdouble *ptr);
This is a convenience function to create a HstHistogram and setting its properties in one go.
n : |
number of bins in the histogram |
xmin : |
lower range of the X axis |
xmax : |
upper range of the X axis |
ptr : |
a pointer to an array of doubles. HstHistogram will use it internally as the contents of the histogram. It can be used to monitor a given array or to retrieve or fill the buffer with the contents of the histogram |
Returns : | a HstHistogram pointer |
void hst_histogram_fill (HstHistogram *hst, double v, double w);
Increments then contents of the bin including x by w
hst : |
a HstHistogram |
v : |
the value |
w : |
the weight |
void hst_histogram_reset (HstHistogram *hst);
Resets to zero the contents of the histogram.
hst : |
a HstHistogram |
void hst_histogram_update_stats (HstHistogram *hst);
Recomputes the statistics of the histogram
hst : |
a HstHistogram |
double hst_histogram_mean (HstHistogram *hst);
hst : |
a HstHistogram |
Returns : | the mean value |
double hst_histogram_rms (HstHistogram *hst);
hst : |
a HstHistogram |
Returns : | the RMS value |
double hst_histogram_stdev (HstHistogram *hst);
hst : |
a HstHistogram |
Returns : | the standar deviation of the distribution in the histogram. |
double hst_histogram_n (HstHistogram *hst);
hst : |
a HstHistogram |
Returns : | the number of entries |
double hst_histogram_xmin (HstHistogram *hst);
hst : |
a HstHistogram |
Returns : | the lower value of the X axis |
double hst_histogram_xmax (HstHistogram *hst);
hst : |
a HstHistogram |
Returns : | the the upper value of the x axis |
double hst_histogram_vmin (HstHistogram *hst);
hst : |
a HstHistogram |
Returns : | the minimum bin content. |
double hst_histogram_vmax (HstHistogram *hst);
hst : |
a HstHistogram |
Returns : | the maximum bin content. |
int hst_histogram_get_stats (HstHistogram *hst, HstStats *s);
Copies into s
the contents of the hst
stats
hst : |
a HstHistogram |
s : |
a pointer to a HstStats |
Returns : | an integer |
void hst_histogram_get_buffer (HstHistogram *hst, int *sz, double **buffer);
Function to get the histogram buffer and its size.
sz
and buffer
are set to zero if problems
hst : |
a HstHistogram |
sz : |
the address of an integer. It will contain, on exit, the length, of the buffer. |
buffer : |
the address of a double pointer. It will have on exit the address of the buffer |
ptr
" property"ptr" gpointer : Read / Write
Sets and retrieves the pointer of the array with the histogram contents.
stats
" property"stats" gint : Write
Setting any value on this property will update the statistics of the histogram.
Allowed values: >= -2147483647
Default value: 0
void user_function (HstHistogram *arg0, gpointer user_data) : Run first
The changed signal is emitted whenever the contents of the histogram are changed via the ::hst_histogram_fill or ::hst_histogram_reset functions.
user_data : |
user data set when the signal handler was connected. |