Input validation for pyhf.pdf.Model.expected_data
#1459
Labels
user request
Request coming form a pyhf user
pyhf.pdf.Model.expected_data
#1459
Question
What do you think about checking the length of the input to
pyhf.pdf.Model.expected_data
? That function feels like a high-level entry point (thoughmodel.main_model.expected_data
may also be needed as entry point for some users, see #1031). Currently anIndexError
is raised if the argument has too few parameters, and arguments with too many parameters will cause no errors or warnings, but interpret the firstmodel.config.npars
parameters as those to use for the calcultion.Example:
Output:
The trace to the
IndexError
is maybe not extremely readable, but might be clear enough to find the reason for it quickly. This behavior could possibly be caught inpyhf.pdf.Model.expected_data
with an error message?The current handling of arguments with too many parameters could be convenient for some cases. What do you think about adding a warning? When removing a single parameter from a model, that parameter is not necessarily the last one. If the user forgets to update the input to
expected_data
, they get no feedback about the mismatch and possibly end up calculating the wrong thing.Relevant Issues and Pull Requests
only marginally related: #1031
The text was updated successfully, but these errors were encountered: