BGlib.be.translators.df_utils.histogram.build_histogram

BGlib.be.translators.df_utils.histogram.build_histogram(x_hist, data_mat, N_x_bins, N_y_bins, weighting_vec=1, min_resp=None, max_resp=None, func=None, debug=False, *args, **kwargs)[source]

Creates histogram for a single block of pixels

Parameters:
  • x_hist (1D numpy array) – bins for x-axis of 2d histogram

  • data_mat (numpy array) – data to be binned for y-axis of 2d histogram

  • weighting_vec (1D numpy array or float) – weights. If setting all to one value, can be a scalar

  • N_x_bins (integer) – number of bins in the x-direction

  • N_y_bins (integer) – number of bins in the y-direction

  • min_resp (float) – minimum value for y binning

  • max_resp (float) – maximum value for y binning

  • func (function) – function to be used to bin data_vec. All functions should take as input data_vec. Arguments should be passed properly to func. This has not been heavily tested.

  • debug (bool, optional) – If True, extra debugging statements are printed. Default False

Returns:

  • pixel_hist (2D numpy array) – contains the histogram of the input data

  • Apply func to input data, convert to 1D array, and normalize