xtensor
 
Loading...
Searching...
No Matches
Histogram functions

Helpers for computing histograms and histogram bin edges. More...

Enumerations

enum class  xt::histogram_algorithm { automatic , linspace , logspace , uniform }
 Defines different algorithms to be used in "histogram_bin_edges". More...
 

Functions

template<class R = double, class E1, class E2, class E3>
auto xt::histogram (E1 &&data, E2 &&bin_edges, E3 &&weights, bool density=false)
 Compute the histogram of a set of data.
 
template<class R = double, class E1, class E2>
auto xt::histogram (E1 &&data, E2 &&bin_edges, bool density=false)
 Compute the histogram of a set of data.
 
template<class R = double, class E1>
auto xt::histogram (E1 &&data, std::size_t bins=10, bool density=false)
 Compute the histogram of a set of data.
 
template<class R = double, class E1, class E2>
auto xt::histogram (E1 &&data, std::size_t bins, E2 left, E2 right, bool density=false)
 Compute the histogram of a set of data.
 
template<class R = double, class E1, class E2>
auto xt::histogram (E1 &&data, std::size_t bins, E2 &&weights, bool density=false)
 Compute the histogram of a set of data.
 
template<class R = double, class E1, class E2, class E3>
auto xt::histogram (E1 &&data, std::size_t bins, E2 &&weights, E3 left, E3 right, bool density=false)
 Compute the histogram of a set of data.
 
template<class E1, class E2, class E3>
auto xt::histogram_bin_edges (E1 &&data, E2 &&weights, E3 left, E3 right, std::size_t bins=10, histogram_algorithm mode=histogram_algorithm::automatic)
 Compute the bin-edges of a histogram of a set of data using different algorithms.
 
template<class E1, class E2>
auto xt::histogram_bin_edges (E1 &&data, E2 &&weights, std::size_t bins=10, histogram_algorithm mode=histogram_algorithm::automatic)
 Compute the bin-edges of a histogram of a set of data using different algorithms.
 
template<class E1>
auto xt::histogram_bin_edges (E1 &&data, std::size_t bins=10, histogram_algorithm mode=histogram_algorithm::automatic)
 Compute the bin-edges of a histogram of a set of data using different algorithms.
 
template<class E1, class E2>
auto xt::histogram_bin_edges (E1 &&data, E2 left, E2 right, std::size_t bins=10, histogram_algorithm mode=histogram_algorithm::automatic)
 Compute the bin-edges of a histogram of a set of data using different algorithms.
 

Detailed Description

Helpers for computing histograms and histogram bin edges.

Enumeration Type Documentation

◆ histogram_algorithm

enum class xt::histogram_algorithm
strong

Defines different algorithms to be used in "histogram_bin_edges".

Definition at line 290 of file xhistogram.hpp.

Function Documentation

◆ histogram() [1/6]

template<class R = double, class E1, class E2>
auto xt::histogram ( E1 && data,
E2 && bin_edges,
bool density = false )
inline

Compute the histogram of a set of data.

Parameters
dataThe data.
bin_edgesThe bin-edges.
densityIf true the resulting integral is normalized to 1. [default: false]
Returns
An one-dimensional xarray<double>, length: bin_edges.size()-1.

Definition at line 173 of file xhistogram.hpp.

◆ histogram() [2/6]

template<class R = double, class E1, class E2, class E3>
auto xt::histogram ( E1 && data,
E2 && bin_edges,
E3 && weights,
bool density = false )
inline

Compute the histogram of a set of data.

Parameters
dataThe data.
bin_edgesThe bin-edges. It has to be 1-dimensional and monotonic.
weightsWeight factors corresponding to each data-point.
densityIf true the resulting integral is normalized to 1. [default: false]
Returns
An one-dimensional xarray<double>, length: bin_edges.size()-1.

Definition at line 152 of file xhistogram.hpp.

◆ histogram() [3/6]

template<class R = double, class E1, class E2>
auto xt::histogram ( E1 && data,
std::size_t bins,
E2 && weights,
bool density = false )
inline

Compute the histogram of a set of data.

Parameters
dataThe data.
binsThe number of bins.
weightsWeight factors corresponding to each data-point.
densityIf true the resulting integral is normalized to 1. [default: false]
Returns
An one-dimensional xarray<double>, length: bin_edges.size()-1.

Definition at line 251 of file xhistogram.hpp.

◆ histogram() [4/6]

template<class R = double, class E1, class E2, class E3>
auto xt::histogram ( E1 && data,
std::size_t bins,
E2 && weights,
E3 left,
E3 right,
bool density = false )
inline

Compute the histogram of a set of data.

Parameters
dataThe data.
binsThe number of bins.
leftThe lower-most edge.
rightThe upper-most edge.
weightsWeight factors corresponding to each data-point.
densityIf true the resulting integral is normalized to 1. [default: false]
Returns
An one-dimensional xarray<double>, length: bin_edges.size()-1.

Definition at line 275 of file xhistogram.hpp.

◆ histogram() [5/6]

template<class R = double, class E1, class E2>
auto xt::histogram ( E1 && data,
std::size_t bins,
E2 left,
E2 right,
bool density = false )
inline

Compute the histogram of a set of data.

Parameters
dataThe data.
binsThe number of bins.
leftThe lower-most edge.
rightThe upper-most edge.
densityIf true the resulting integral is normalized to 1. [default: false]
Returns
An one-dimensional xarray<double>, length: bin_edges.size()-1.

Definition at line 225 of file xhistogram.hpp.

◆ histogram() [6/6]

template<class R = double, class E1>
auto xt::histogram ( E1 && data,
std::size_t bins = 10,
bool density = false )
inline

Compute the histogram of a set of data.

Parameters
dataThe data.
binsThe number of bins. [default: 10]
densityIf true the resulting integral is normalized to 1. [default: false]
Returns
An one-dimensional xarray<double>, length: bin_edges.size()-1.

Definition at line 198 of file xhistogram.hpp.

◆ histogram_bin_edges() [1/4]

template<class E1, class E2, class E3>
auto xt::histogram_bin_edges ( E1 && data,
E2 && weights,
E3 left,
E3 right,
std::size_t bins = 10,
histogram_algorithm mode = histogram_algorithm::automatic )
inline

Compute the bin-edges of a histogram of a set of data using different algorithms.

Parameters
dataThe data.
weightsWeight factors corresponding to each data-point.
leftThe lower-most edge.
rightThe upper-most edge.
binsThe number of bins. [default: 10]
modeThe type of algorithm to use. [default: "auto"]
Returns
An one-dimensional xarray<double>, length: bins+1.

Definition at line 311 of file xhistogram.hpp.

◆ histogram_bin_edges() [2/4]

template<class E1, class E2>
auto xt::histogram_bin_edges ( E1 && data,
E2 && weights,
std::size_t bins = 10,
histogram_algorithm mode = histogram_algorithm::automatic )
inline

Compute the bin-edges of a histogram of a set of data using different algorithms.

Parameters
dataThe data.
weightsWeight factors corresponding to each data-point.
binsThe number of bins. [default: 10]
modeThe type of algorithm to use. [default: "auto"]
Returns
An one-dimensional xarray<double>, length: bins+1.

Definition at line 428 of file xhistogram.hpp.

◆ histogram_bin_edges() [3/4]

template<class E1, class E2>
auto xt::histogram_bin_edges ( E1 && data,
E2 left,
E2 right,
std::size_t bins = 10,
histogram_algorithm mode = histogram_algorithm::automatic )
inline

Compute the bin-edges of a histogram of a set of data using different algorithms.

Parameters
dataThe data.
leftThe lower-most edge.
rightThe upper-most edge.
binsThe number of bins. [default: 10]
modeThe type of algorithm to use. [default: "auto"]
Returns
An one-dimensional xarray<double>, length: bins+1.

Definition at line 490 of file xhistogram.hpp.

◆ histogram_bin_edges() [4/4]

template<class E1>
auto xt::histogram_bin_edges ( E1 && data,
std::size_t bins = 10,
histogram_algorithm mode = histogram_algorithm::automatic )
inline

Compute the bin-edges of a histogram of a set of data using different algorithms.

Parameters
dataThe data.
binsThe number of bins. [default: 10]
modeThe type of algorithm to use. [default: "auto"]
Returns
An one-dimensional xarray<double>, length: bins+1.

Definition at line 460 of file xhistogram.hpp.