>  Docs Center  >  Libraries  >  JBIU  >  HISTOGRAM_WEIGHT
Libraries

HISTOGRAM_WEIGHT

HISTOGRAM_WEIGHT

Name


    HISTOGRAM_WEIGHT

Purpose


    Wrapper to the built-in HISTOGRAM function that calculates a
    weighted histogram.

Category


    Math

Calling Sequence


    Result = HISTOGRAM_WEIGHT(Data)

Inputs


    Data: Values whose histogram is to be taken.

Keyword Parameters


    WEIGHT: A vector of the same length as Data with the weights
                  for each data value.
    BIN: Bin width. Passed through to HISTOGRAM.
    UNWEIGHTED: Outputs the unweighted histogram.
    REVERSE_INDICES: Outputs the reverse index array.
    _REF_EXTRA: All extra keywords are passed through to HISTOGRAM.

Outputs


    The function returns a histogram where each Data value has been
    weighted by its WEIGHT value. The return type is the same type
    as WEIGHT.

Example


    IDL> values = 0.1*FINDGEN(40)
    IDL> PRINT, HISTOGRAM_WEIGHT(values, WEIGHT=VALUES, UNWEIGHTED=plainhist)
          4.50000 14.5000 24.5000 34.5000
    IDL> PRINT, plainhist
              10 10 10 10
 

Modification History


    Written by: Jeremy Bailin
    12 June 2008 Public release in JBIU
    11 April 2009 Bug fix
    8 November 2009 Bug fux for bins with no entries



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us