calculate_histogram_bins Subroutine

public subroutine calculate_histogram_bins(data, n_bins, normalize_density, bin_edges, bin_counts, range, weights, cumulative)

Calculate histogram bin edges and counts from data.

Supports optional range clipping, per-sample weights, density normalisation, and cumulative accumulation.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), contiguous :: data(:)
integer, intent(in) :: n_bins
logical, intent(in) :: normalize_density
real(kind=wp), intent(out), allocatable :: bin_edges(:)
real(kind=wp), intent(out), allocatable :: bin_counts(:)
real(kind=wp), intent(in), optional :: range(2)
real(kind=wp), intent(in), optional :: weights(:)
logical, intent(in), optional :: cumulative