| 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.
|
number of bins in the histogram |
|
lower range of the X axis |
|
upper range of the X axis |
|
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
|
a HstHistogram |
|
the value |
|
the weight |
void hst_histogram_reset (HstHistogram *hst);
Resets to zero the contents of the histogram.
|
a HstHistogram |
void hst_histogram_update_stats (HstHistogram *hst);
Recomputes the statistics of the histogram
|
a HstHistogram |
double hst_histogram_mean (HstHistogram *hst);
|
a HstHistogram |
Returns : |
the mean value |
double hst_histogram_rms (HstHistogram *hst);
|
a HstHistogram |
Returns : |
the RMS value |
double hst_histogram_stdev (HstHistogram *hst);
|
a HstHistogram |
Returns : |
the standar deviation of the distribution in the histogram. |
double hst_histogram_n (HstHistogram *hst);
|
a HstHistogram |
Returns : |
the number of entries |
double hst_histogram_xmin (HstHistogram *hst);
|
a HstHistogram |
Returns : |
the lower value of the X axis |
double hst_histogram_xmax (HstHistogram *hst);
|
a HstHistogram |
Returns : |
the the upper value of the x axis |
double hst_histogram_vmin (HstHistogram *hst);
|
a HstHistogram |
Returns : |
the minimum bin content. |
double hst_histogram_vmax (HstHistogram *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
|
a HstHistogram |
|
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
|
a HstHistogram |
|
the address of an integer. It will contain, on exit, the length, of the 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
"changed" signalvoid 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 set when the signal handler was connected. |