Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hist] remove default parameter in TH1::GetQuantiles, as is the case with TF1::GetQuantiles #16793

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ferdymercury
Copy link
Contributor

Fixes #16784

The currently default parameter of p = nullptr is a very weird use case, which calculates F-1(F(bin_edges)), ie it just returns the bin edges. So force user to really decide if he wants to pass that nullptr as argument.

Warning: this PR might break some preexisting scripts though relying on this weird feature.

…with TF1::GetQuantiles

Fixes root-project#16784

The currently default parameter of p = nullptr is a very weird use case, which calculates F-1(F(bin_edges)), ie it just returns the bin edges. So force user to really decide if he wants to pass that nullptr as argument.
@ferdymercury ferdymercury marked this pull request as draft October 31, 2024 08:38
@ferdymercury ferdymercury marked this pull request as ready for review October 31, 2024 08:40
Copy link

Test Results

    17 files      17 suites   3d 11h 52m 27s ⏱️
 2 663 tests  2 662 ✅ 0 💤 1 ❌
43 575 runs  43 574 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 900abcf.

Copy link
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
I am not sure if somebody is using that functionality. I agree is weird, but it is not returning the bin edge, because in case of empty bins at the begining (and end) of the axis, it returns the first (last) non-empty bin edges. It could be useful in some cases.
In case we drop, we should probably remove alltogether the functionality.

@@ -4552,7 +4552,7 @@ TVirtualHistPainter *TH1::GetPainter(Option_t *option)
///
/// \param[in] n maximum size of array xp and size of array p (if given)
/// \param[out] xp array to be filled with nq quantiles evaluated at (p). Memory has to be preallocated by caller.
/// If p is null (default value), then xp is actually set to the (first n) histogram bin edges
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is maybe not correct.
xp is always set to nbin+1 value, even if n is less than nbin+1

Copy link
Contributor Author

@ferdymercury ferdymercury Nov 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This simple tests shows the opposite: #16782 (comment)
xp is filled with the first 20 bin edges, even if there are 100 bins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove default value of p from TH1::GetQuantiles() as is the case with TF1::GetQuantiles
2 participants