@@ -19,7 +19,7 @@ implements UHI.
1919Access:
2020^^^^^^^
2121
22- .. code :: python
22+ .. code :: python3
2323
2424 v = h[b] # Returns bin contents, indexed by bin number
2525 v = h[loc(b)] # Returns the bin containing the value
@@ -29,7 +29,7 @@ Access:
2929 Slicing:
3030^^^^^^^^
3131
32- .. code :: python
32+ .. code :: python3
3333
3434 h == h[:] # Slice over everything
3535 h2 = h[a:b] # Slice of histogram (includes flow bins)
@@ -46,7 +46,7 @@ Slicing:
4646 Setting
4747^^^^^^^
4848
49- .. code :: python
49+ .. code :: python3
5050
5151 # Single values
5252 h[b] = v # Returns bin contents, indexed by bin number
@@ -75,7 +75,7 @@ to run on an axis or a few axes out of many. For this use case, you can pass a
7575dictionary to the index, and that has the syntax ``{axis:action} ``. The actions
7676are slices, and follow the rules listed above. This looks like:
7777
78- .. code :: python
78+ .. code :: python3
7979
8080 h[{0: slice(None, None, bh.rebin(2))}] # rebin axis 0 by two
8181 h[{1: slice(0, bh.loc(3.5))}] # slice axis 1 from 0 to the data coordinate 3.5
@@ -85,7 +85,7 @@ are slices, and follow the rules listed above. This looks like:
8585 If you don't like manually building slices, you can use the `Slicer() ` utility
8686to recover the original slicing syntax inside the dict:
8787
88- .. code :: python
88+ .. code :: python3
8989
9090 s = bh.tag.Slicer()
9191
@@ -98,7 +98,7 @@ to recover the original slicing syntax inside the dict:
9898 Invalid syntax:
9999^^^^^^^^^^^^^^^
100100
101- .. code :: python
101+ .. code :: python3
102102
103103 h[1.0] # Floats are not allowed, just like numpy
104104 h[::2] # Skipping is not (currently) supported
@@ -107,7 +107,7 @@ Invalid syntax:
107107 Rejected proposals or proposals for future consideration, maybe ``hist ``-only:
108108^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
109109
110- .. code :: python
110+ .. code :: python3
111111
112112 h2 = h[1.0j:2.5j + 1] # Adding a j suffix to a number could be used in place of `loc(x)`
113113 h2 = h[1.0] # Floats in place of `loc(x)`: too easy to make a mistake
@@ -118,7 +118,7 @@ Examples
118118
119119For a histogram, the slice should be thought of like this:
120120
121- .. code :: python
121+ .. code :: python3
122122
123123 histogram[start:stop:action]
124124
@@ -145,7 +145,7 @@ axis 3 should be summed over. You have a 4D histogram.
145145
146146Solution:
147147
148- .. code :: python
148+ .. code :: python3
149149
150150 ans = h[:20, bh.loc(-.5):bh.loc(1.5), ::bh.rebin(2), ::bh.sum]
151151
@@ -157,7 +157,7 @@ histogram.
157157
158158Solution:
159159
160- .. code :: python
160+ .. code :: python3
161161
162162 h[bh.loc(4.0):] = 0
163163
@@ -166,7 +166,7 @@ length as the range you give, or the same length as the range +
166166under/overflows if the range is open ended (no limit given). For
167167example:
168168
169- .. code :: python
169+ .. code :: python3
170170
171171 h = bh.Histogram(bh.axis.Regular(10, 0, 1))
172172 h[:] = np.ones(10) # underflow/overflow still 0
@@ -184,7 +184,7 @@ leaving all other axes alone. You have an ND histogram, with N >= 2.
184184
185185Solution:
186186
187- .. code :: python
187+ .. code :: python3
188188
189189 ans = h[:, :bh.loc(2.4):bh.sum, ...]
190190
@@ -193,7 +193,7 @@ this case, was large or programmatically defined. In these cases, you
193193can pass a dictionary of ``{axis:slice} `` into the indexing operation. A
194194shortcut to quickly generate slices is provided, as well:
195195
196- .. code :: python
196+ .. code :: python3
197197
198198 ans = h[{1: slice(None,bh.loc(2.4),bh.sum)}]
199199
@@ -208,7 +208,7 @@ You want the underflow bin of a 1D histogram.
208208
209209Solution:
210210
211- .. code :: python
211+ .. code :: python3
212212
213213 val = h1[bh.underflow]
214214
@@ -245,7 +245,7 @@ without the operators.
245245
246246Basic implementation (WIP):
247247
248- .. code :: python
248+ .. code :: python3
249249
250250 class loc:
251251 "When used in the start or stop of a Histogram's slice, x is taken to be the position in data coordinates."
0 commit comments