Histograms

centers2edges

apav.core.histogram.centers2edges(data, bin_width)[source]

Convert the x values of a histogram from bin centers to edges. This increases the size of the domain by 1.

Parameters
  • data (ndarray) – histogram centers

  • bin_width (float) – width of the bins

Return type

ndarray

histogram2d

apav.core.histogram.histogram2d(x, y, extents, bins)[source]

Calculate two dimensional histograms by specifying the number of bins.

Parameters
  • x (ndarray) – Array 1

  • y (ndarray) – Array 2

  • extents ((<class 'tuple'>, <class 'tuple'>)) – (tuple, tuple) designating range to perform mass_histogram

  • bins – Number of bins

Return type

ndarray

histogram1d

apav.core.histogram.histogram1d(data, bin_width, rng)[source]

1d mass_histogram that returns array of counts and array of bin centers.

Parameters
  • data (ndarray) – data to compute the histogram on

  • bin_width (float) – bin width of the bins

  • rng (tuple) – boundaries of the histogram

Return type

Tuple[ndarray, ndarray]

histogram2d_binwidth

apav.core.histogram.histogram2d_binwidth(x, y, extents, bin_width=0.1)[source]

Calculate two dimensional histograms by bin width instead of number of bins.

Parameters
  • x (ndarray) – Array 1

  • y (ndarray) – Array 2

  • extents ((<class 'tuple'>, <class 'tuple'>)) – (tuple, tuple) designating range to perform mass_histogram

  • bin_width (float) – Width of the bins in Daltons

Return type

ndarray