Changeset 2976 for inundation/utilities
- Timestamp:
- May 25, 2006, 5:22:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/utilities/numerical_tools.py
r2972 r2976 204 204 205 205 206 def histogram(a, bins ):206 def histogram(a, bins, relative=False): 207 207 """Standard histogram straight from the Numeric manual 208 209 If relative is True, values will be normalised againts the total and 210 thus represent frequencies rather than counts. 208 211 """ 209 212 210 213 n = searchsorted(sort(a), bins) 211 214 n = concatenate( [n, [len(a)]] ) 212 return n[1:]-n[:-1] 215 216 hist = n[1:]-n[:-1] 217 218 if relative is True: 219 hist = hist/float(sum(hist)) 220 221 return hist 213 222 214 223 def create_bins(data, number_of_bins = None):
Note: See TracChangeset
for help on using the changeset viewer.