@@ -34,7 +34,7 @@ def _temporarily_disable_add_directory():
3434 ROOT .TH1 .AddDirectory (old_status )
3535
3636
37- def _process_index_for_axis (self , index , axis , include_flow_bins = False , is_slice_stop = False ):
37+ def _process_index_for_axis (self , index , axis , is_slice_stop = False ):
3838 """Process an index for a histogram axis handling callables and index shifting."""
3939 if callable (index ):
4040 # If the index is a `loc`, `underflow`, `overflow`, or `len`
@@ -56,7 +56,7 @@ def _process_index_for_axis(self, index, axis, include_flow_bins=False, is_slice
5656 raise index
5757
5858
59- def _compute_uhi_index (self , index , axis , include_flow_bins = True ):
59+ def _compute_uhi_index (self , index , axis , flow = True ):
6060 """Convert tag functors to valid bin indices."""
6161 if isinstance (index , _rebin ) or index is _sum :
6262 index = slice (None , None , index )
@@ -65,13 +65,13 @@ def _compute_uhi_index(self, index, axis, include_flow_bins=True):
6565 return _process_index_for_axis (self , index , axis )
6666
6767 if isinstance (index , slice ):
68- start , stop = _resolve_slice_indices (self , index , axis , include_flow_bins )
68+ start , stop = _resolve_slice_indices (self , index , axis , flow )
6969 return slice (start , stop , index .step )
7070
7171 raise TypeError (f"Unsupported index type: { type (index ).__name__ } " )
7272
7373
74- def _compute_common_index (self , index , include_flow_bins = True ):
74+ def _compute_common_index (self , index , flow = True ):
7575 """Normalize and expand the index to match the histogram dimension."""
7676 dim = self .GetDimension ()
7777 if isinstance (index , dict ):
@@ -93,26 +93,26 @@ def _compute_common_index(self, index, include_flow_bins=True):
9393 if len (index ) != dim :
9494 raise IndexError (f"Expected { dim } indices, got { len (index )} " )
9595
96- return [_compute_uhi_index (self , idx , axis , include_flow_bins ) for axis , idx in enumerate (index )]
96+ return [_compute_uhi_index (self , idx , axis , flow ) for axis , idx in enumerate (index )]
9797
9898
9999def _setbin (self , index , value ):
100100 """Set the bin content for a specific bin index"""
101101 self .SetBinContent (index , value )
102102
103103
104- def _resolve_slice_indices (self , index , axis , include_flow_bins = True ):
104+ def _resolve_slice_indices (self , index , axis , flow = True ):
105105 """Resolve slice start and stop indices for a given axis"""
106106 start , stop = index .start , index .stop
107107 start = (
108- _process_index_for_axis (self , start , axis , include_flow_bins )
108+ _process_index_for_axis (self , start , axis , flow )
109109 if start is not None
110- else _underflow (self , axis ) + (0 if include_flow_bins else 1 )
110+ else _underflow (self , axis ) + (0 if flow else 1 )
111111 )
112112 stop = (
113- _process_index_for_axis (self , stop , axis , include_flow_bins , is_slice_stop = True )
113+ _process_index_for_axis (self , stop , axis , flow , is_slice_stop = True )
114114 if stop is not None
115- else _overflow (self , axis ) + (1 if include_flow_bins else 0 )
115+ else _overflow (self , axis ) + (1 if flow else 0 )
116116 )
117117 if start < _underflow (self , axis ) or stop > (_overflow (self , axis ) + 1 ) or start > stop :
118118 raise IndexError (
@@ -205,14 +205,14 @@ def _slice_set(self, index, unprocessed_index, value):
205205 # Depending on the shape of the array provided, we can set or not the flow bins
206206 # Setting with a scalar does not set the flow bins
207207 # broadcasting an array to the shape of the slice does not set the flow bins neither
208- include_flow_bins = False
208+ flow = False
209209 if isinstance (value , np .ndarray ):
210210 processed_slices , _ = _get_processed_slices (self , index )
211211 slice_shape = tuple (stop - start for start , stop in processed_slices )
212- include_flow_bins = value .size == np .prod (slice_shape )
212+ flow = value .size == np .prod (slice_shape )
213213
214- if not include_flow_bins :
215- index = _compute_common_index (self , unprocessed_index , include_flow_bins = False )
214+ if not flow :
215+ index = _compute_common_index (self , unprocessed_index , flow = False )
216216
217217 processed_slices , actions = _get_processed_slices (self , index )
218218 slice_shape = tuple (stop - start for start , stop in processed_slices )
@@ -252,6 +252,6 @@ def _setitem(self, index, value):
252252
253253
254254def _iter (self ):
255- array = _values_by_copy (self , include_flow_bins = True )
255+ array = _values_by_copy (self , flow = True )
256256 for val in array .flat :
257257 yield val .item ()
0 commit comments