HstHistogram

HstHistogram — An object to histogram quantities

Synopsis

#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);


Object Hierarchy

  GObject
   +----HstFunction
         +----HstHistogram
               +----HstProfile
               +----HstTracer

Properties

  "ptr"                      gpointer              : Read / Write
  "stats"                    gint                  : Write
  "vmax"                     gdouble               : Read
  "vmin"                     gdouble               : Read

Signals

  "changed"                                        : Run First

Description

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.

Details

HstHistogram

typedef struct _HstHistogram HstHistogram;


HstHistogramClass

typedef struct {
    HstFunctionClass parent_class;

    /* Functions */
    void (*fill)(HstHistogram *,double val, double weight);
    void (*reset)(HstHistogram *);

    /* signals */
    void (*changed)(HstHistogram *);
} HstHistogramClass;


hst_histogram_new ()

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

hst_histogram_fill ()

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

hst_histogram_reset ()

void                hst_histogram_reset                 (HstHistogram *hst);

Resets to zero the contents of the histogram.

hst :

a HstHistogram

hst_histogram_update_stats ()

void                hst_histogram_update_stats          (HstHistogram *hst);

Recomputes the statistics of the histogram

hst :

a HstHistogram

hst_histogram_mean ()

double              hst_histogram_mean                  (HstHistogram *hst);

hst :

a HstHistogram

Returns :

the mean value

hst_histogram_rms ()

double              hst_histogram_rms                   (HstHistogram *hst);

hst :

a HstHistogram

Returns :

the RMS value

hst_histogram_stdev ()

double              hst_histogram_stdev                 (HstHistogram *hst);

hst :

a HstHistogram

Returns :

the standar deviation of the distribution in the histogram.

hst_histogram_n ()

double              hst_histogram_n                     (HstHistogram *hst);

hst :

a HstHistogram

Returns :

the number of entries

hst_histogram_xmin ()

double              hst_histogram_xmin                  (HstHistogram *hst);

hst :

a HstHistogram

Returns :

the lower value of the X axis

hst_histogram_xmax ()

double              hst_histogram_xmax                  (HstHistogram *hst);

hst :

a HstHistogram

Returns :

the the upper value of the x axis

hst_histogram_vmin ()

double              hst_histogram_vmin                  (HstHistogram *hst);

hst :

a HstHistogram

Returns :

the minimum bin content.

hst_histogram_vmax ()

double              hst_histogram_vmax                  (HstHistogram *hst);

hst :

a HstHistogram

Returns :

the maximum bin content.

hst_histogram_get_stats ()

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

hst_histogram_get_buffer ()

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

Property Details

The "ptr" property

  "ptr"                      gpointer              : Read / Write

Sets and retrieves the pointer of the array with the histogram contents.


The "stats" property

  "stats"                    gint                  : Write

Setting any value on this property will update the statistics of the histogram.

Allowed values: >= -2147483647

Default value: 0


The "vmax" property

  "vmax"                     gdouble               : Read

Maximum value of the histogram contents

Default value: 1


The "vmin" property

  "vmin"                     gdouble               : Read

Minimum value of hte histogram contents.

Default value: 0

Signal Details

The "changed" signal

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.