You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG: avoid scalar statistics for structured Monte Carlo results #1145
MonteCarlo.set_processed_results() passes every collected result to NumPy's scalar aggregation functions. This gives structured outputs two inconsistent behaviors:
equal-shaped lists and NumPy arrays are flattened and reported as one scalar distribution;
ragged lists and empty result sets raise ValueError or IndexError.
The raw values are already preserved correctly in MonteCarlo.results. The failure occurs while constructing processed_results.
At cb6106a717207dd8fc2dfe1446d80ff75022f21b, the result is:
(2.5, 2.5, 1.118033988749895, 1.075, 3.925)
A ragged value such as [[1], [2, 3]] instead raises:
ValueError: setting an array element with a sequence
An empty list reaches np.quantile and raises IndexError.
Expected behavior
Summary statistics should only be calculated when every observation is a real-valued scalar. Strings, lists, dictionaries, arrays, mixed values, booleans, and empty results should remain available in results, while the existing five-element processed_results entry should be:
(None, None, None, None, None)
This keeps the public tuple shape unchanged.
Proposed fix
Classify each result series before calling NumPy. Aggregate real scalars and skip scalar statistics for structured or non-numeric observations. Add regression cases for scalar NumPy values, strings, equal and ragged lists, dictionaries, arrays, mixed values, booleans, and empty results.
Environment
Base SHA: cb6106a717207dd8fc2dfe1446d80ff75022f21b
Activity
BUG: skip scalar statistics for structured Monte Carlo results (#1145) (
Gui-FernandesBR commentedon Nov 2, 2026
Reopened: the fix is merged on
developand will close when v1.14.0 is released tomaster.