Changeset 2971


Ignore:
Timestamp:
May 25, 2006, 3:15:50 PM (18 years ago)
Author:
ole
Message:

More testing of histogram

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/utilities/test_numerical_tools.py

    r2778 r2971  
    217217        bins = [0,1.5,2,3]
    218218        assert allclose(histogram(a, bins), [8,0,3,4])
    219 
    220 
    221219        assert allclose(histogram(a, [0,3]), histogram(a, [-0.5,3]))
    222220
    223 
     221        # Check situation with #bins >= #datapoints
     222        a = [1.7]
     223        bins = [0,1.5,2,3]
     224        assert allclose(histogram(a, bins), [0,1,0,0])
     225
     226        a = [1.7]
     227        bins = [0]
     228        assert allclose(histogram(a, bins), [1])
     229
     230        a = [-1.7]
     231        bins = [0]
     232        assert allclose(histogram(a, bins), [0])
     233
     234        a = [-1.7]
     235        bins = [-1.7]
     236        assert allclose(histogram(a, bins), [1])
     237       
    224238       
    225239
Note: See TracChangeset for help on using the changeset viewer.