Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Function pick

boost::histogram::algorithm::pick — Pick command to be used in reduce.

Synopsis

// In header: <boost/histogram/algorithm/reduce.hpp>


reduce_command 
pick(unsigned iaxis, std::vector< axis::index_type > indices, 
     slice_mode mode = slice_mode::shrink);

Description

Command is applied to axis with given index.

Picking selects an arbitrary subset of bins by index. The new axis consists of the picked bins in the order in which the indices are given, which may differ from their order in the original axis. In contrast to slice, the picked bins do not have to be adjacent. Each index must be valid and may only appear once.

Picking only works on axes that are not ordered, like the category axis, since removing an arbitrary subset of bins from an ordered axis would create gaps in the axis range. The counts in bins that were not picked are added to the overflow bin, if it is present. If it is not present, the counts are discarded. In crop mode, the counts in unpicked bins and in the original overflow bin are always discarded.

Parameters:

iaxis

which axis to operate on.

indices

indices of the bins to keep, must be unique.

mode

whether to behave like shrink orcrop regarding removed bins.


PrevUpHomeNext