@@ -562,11 +562,11 @@ def _compute_commonindex(self, index):
562562
563563 return indexes
564564
565- @inject_signature ("self, flow=False, *, dd=False, mode='numpy' " )
565+ @inject_signature ("self, flow=False, *, dd=False, view=False " )
566566 def to_numpy (self , flow = False , ** kwargs ):
567567 """
568- Convert to a Numpy style tuple of return arrays. Edges are converted
569- to exactly match NumPy standards, with upper edge inclusive, unlike
568+ Convert to a Numpy style tuple of return arrays. Edges are converted to
569+ match NumPy standards, with upper edge inclusive, unlike
570570 boost-histogram, where upper edge is exclusive.
571571
572572 Parameters
@@ -576,11 +576,11 @@ def to_numpy(self, flow=False, **kwargs):
576576 dd : bool = False
577577 Use the histogramdd return syntax, where the edges are in a tuple.
578578 Otherwise, this is the histogram/histogram2d return style.
579- mode : Literal["numpy", "view"] = "numpy"
580- The behavior for the return value. "numpy" will return the NumPy
579+ view : bool = False
580+ The behavior for the return value. By default, this will return
581581 array of the values only regardless of the storage (which is all
582- NumPy's histogram function can do). " view" will leave the
583- boost-histogram view of the storage untouched .
582+ NumPy's histogram function can do). view=True will return the
583+ boost-histogram view of the storage.
584584
585585 Return
586586 ------
@@ -592,18 +592,16 @@ def to_numpy(self, flow=False, **kwargs):
592592
593593 with KWArgs (kwargs ) as kw :
594594 dd = kw .optional ("dd" , False )
595- mode = kw .optional ("mode " , "numpy" )
595+ view = kw .optional ("view " , False )
596596
597597 # Python 3+ would be simpler
598598 return_tuple = self ._hist .to_numpy (flow )
599599 hist = return_tuple [0 ]
600600
601- if mode == "numpy" :
602- hist = self .values (flow = flow )
603- elif mode == "view" :
601+ if view :
604602 hist = self .view (flow = flow )
605603 else :
606- raise KeyError ( "Invalid mode" )
604+ hist = self . values ( flow = flow )
607605
608606 if dd :
609607 return hist , return_tuple [1 :]
0 commit comments