Parse bin specifications from split list of arguments ARGS.
NDIM is 1 or 2, and AXIS is 0 or 1, for the x or y axis.
Examples:
>>> from PyAnalysisUtils import pydraw
>>> pydraw._globals = globals()
>>> import ROOT
>>> ROOT.gPad.Range(0, 1,2,3)
>>> b = _get_bins (["50", "10", "100"], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 10.0 100.0 0
>>> b = _get_bins ([], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 0 1 1
>>> b = _get_bins (["!", "10"], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 10.0 11.0 1
>>> b = _get_bins (["!", "!", "10"], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 0 10.0 0
>>> scale = 10
>>> b = _get_bins (["50", "0", "2*scale"], 1, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 0.0 20.0 0
>>> b = _get_bins ([], 2, 0)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 0.0 2.0 1
>>> b = _get_bins ([], 2, 1)
>>> print (b.nbins, b.lo, b.hi, b.rebin)
50 1.0 3.0 1
>>> b = _get_bins ([], 2, 2)
Traceback (most recent call last):
...
AssertionError
Definition at line 1004 of file pydraw.py.
1005 """Parse bin specifications from split list of arguments ARGS.
1006 NDIM is 1 or 2, and AXIS is 0 or 1, for the x or y axis.
1009 >>> from PyAnalysisUtils import pydraw
1010 >>> pydraw._globals = globals()
1012 >>> ROOT.gPad.Range(0, 1,2,3)
1013 >>> b = _get_bins (["50", "10", "100"], 1, 0)
1014 >>> print (b.nbins, b.lo, b.hi, b.rebin)
1016 >>> b = _get_bins ([], 1, 0)
1017 >>> print (b.nbins, b.lo, b.hi, b.rebin)
1019 >>> b = _get_bins (["!", "10"], 1, 0)
1020 >>> print (b.nbins, b.lo, b.hi, b.rebin)
1022 >>> b = _get_bins (["!", "!", "10"], 1, 0)
1023 >>> print (b.nbins, b.lo, b.hi, b.rebin)
1026 >>> b = _get_bins (["50", "0", "2*scale"], 1, 0)
1027 >>> print (b.nbins, b.lo, b.hi, b.rebin)
1029 >>> b = _get_bins ([], 2, 0)
1030 >>> print (b.nbins, b.lo, b.hi, b.rebin)
1032 >>> b = _get_bins ([], 2, 1)
1033 >>> print (b.nbins, b.lo, b.hi, b.rebin)
1035 >>> b = _get_bins ([], 2, 2)
1036 Traceback (most recent call last):
1041 g = copy.copy (_globals)
1046 if len(args) >= 1
and args[0] !=
'!' and len(args[0]) > 0:
1047 bins.nbins = int (eval (args[0], g))
1052 if len(args) >= 2
and args[1] !=
'!' and len(args[1]) > 0:
1053 bins.lo = float (eval (args[1], g))
1056 if len(args) >= 3
and args[2] !=
'!' and len(args[2]) > 0:
1057 bins.hi = float (eval (args[2], g))
1060 if bins.hi <= bins.lo:
1063 bins.hi = bins.lo + 1
1065 bins.lo = ROOT.gPad.GetUxmin()
1066 bins.hi = ROOT.gPad.GetUxmax()
1068 bins.lo = ROOT.gPad.GetUymin()
1069 bins.hi = ROOT.gPad.GetUymax()