@@ -552,11 +552,11 @@ def _compute_commonindex(self, index):
552552
553553 return indexes
554554
555- @inject_signature ("self, flow=False, *, dd=False, mode='numpy' " )
555+ @inject_signature ("self, flow=False, *, dd=False, view=False " )
556556 def to_numpy (self , flow = False , ** kwargs ):
557557 """
558- Convert to a Numpy style tuple of return arrays. Edges are converted
559- to exactly match NumPy standards, with upper edge inclusive, unlike
558+ Convert to a Numpy style tuple of return arrays. Edges are converted to
559+ match NumPy standards, with upper edge inclusive, unlike
560560 boost-histogram, where upper edge is exclusive.
561561
562562 Parameters
@@ -566,11 +566,11 @@ def to_numpy(self, flow=False, **kwargs):
566566 dd : bool = False
567567 Use the histogramdd return syntax, where the edges are in a tuple.
568568 Otherwise, this is the histogram/histogram2d return style.
569- mode : Literal["numpy", "view"] = "numpy"
570- The behavior for the return value. "numpy" will return the NumPy
569+ view : bool = False
570+ The behavior for the return value. By default, this will return
571571 array of the values only regardless of the storage (which is all
572- NumPy's histogram function can do). " view" will leave the
573- boost-histogram view of the storage untouched .
572+ NumPy's histogram function can do). view=True will return the
573+ boost-histogram view of the storage.
574574
575575 Return
576576 ------
@@ -582,18 +582,16 @@ def to_numpy(self, flow=False, **kwargs):
582582
583583 with KWArgs (kwargs ) as kw :
584584 dd = kw .optional ("dd" , False )
585- mode = kw .optional ("mode " , "numpy" )
585+ view = kw .optional ("view " , False )
586586
587587 # Python 3+ would be simpler
588588 return_tuple = self ._hist .to_numpy (flow )
589589 hist = return_tuple [0 ]
590590
591- if mode == "numpy" :
592- hist = self .values (flow = flow )
593- elif mode == "view" :
591+ if view :
594592 hist = self .view (flow = flow )
595593 else :
596- raise KeyError ( "Invalid mode" )
594+ hist = self . values ( flow = flow )
597595
598596 if dd :
599597 return hist , return_tuple [1 :]
0 commit comments