physicsnemo icon indicating copy to clipboard operation
physicsnemo copied to clipboard

📚[DOC]: Histogram documentation issues

Open jleinonen opened this issue 3 months ago • 0 comments

How would you describe the priority of this documentation request

Low (would be nice)

Is this for new documentation, or an update to existing docs?

Update

Describe the incorrect/future/missing documentation

There are some issues with the documentation of the functions in physicsnemo.metrics.general.histogram:

1: The linspace function is documented as returning: https://github.com/NVIDIA/physicsnemo/blob/7ee88fd2938d6246d765571314282e6f5d348a8d/physicsnemo/metrics/general/histogram.py#L46-L49 but in fact:

>>> from physicsnemo.metrics.general.histogram import linspace
>>> import torch
>>> linspace(torch.zeros(1), torch.ones(1), 10).shape
torch.Size([11, 1])

So the documentation should say [num+1, *start.shape] and note that this differs from the standard linspace in NumPy and PyTorch.

2: The function _count_bins and its helper functions _low_memory_bin_reduction_counts, _high_memory_bin_reduction_counts, _low_memory_bin_reduction_cdf and _low_memory_bin_reduction_cdf seem to count all values of inputs that are < bin_edges[0] to the first bin, and all values that are >= bin_edges[-1] to the last bin. This means that the values of bin_edges[0] and bin_edges[-1] are effectively ignored. This behavior should be clearly documented.

jleinonen avatar Sep 10 '25 17:09 jleinonen