@@ -723,6 +723,7 @@ def test_num_bins(self):
723
723
hist3 = hg .SparselyBin (origin = 0.0 , binWidth = 1.0 , quantity = unit ('A' ))
724
724
hist4 = hg .Bin (num = 20 , low = 0.0 , high = 20. , quantity = unit ('A' ))
725
725
hist5 = hg .Bin (num = 20 , low = 0.0 , high = 20. , quantity = unit ('A' ))
726
+ hist6 = hg .Bin (num = 201 , low = 0.0 , high = 1.005 )
726
727
727
728
# fill them
728
729
hist2 .fill .numpy (df1 )
@@ -734,16 +735,19 @@ def test_num_bins(self):
734
735
assert hist3 .num_bins () == 18
735
736
assert hist4 .num_bins () == 20
736
737
assert hist5 .num_bins () == 20
738
+ assert hist6 .num_bins () == 201
737
739
738
740
assert hist2 .num_bins (low = 10 , high = 25 ) == 15
739
741
assert hist3 .num_bins (low = 10 , high = 25 ) == 15
740
742
assert hist4 .num_bins (low = 10 , high = 25 ) == 10
741
743
assert hist5 .num_bins (low = 10 , high = 25 ) == 10
744
+ assert hist6 .num_bins (low = 0.2089 , high = 0.9333 ) == 146
742
745
743
746
assert hist2 .num_bins (low = - 10 , high = 28 ) == 38
744
747
assert hist3 .num_bins (low = - 10 , high = 28 ) == 38
745
748
assert hist4 .num_bins (low = - 10 , high = 28 ) == 20
746
749
assert hist5 .num_bins (low = - 10 , high = 28 ) == 20
750
+ assert hist6 .num_bins (low = 0.205 , high = 0.935 ) == 146
747
751
748
752
def test_most_probable_value (self ):
749
753
""" Test getting most probable value or label from histogram
@@ -917,6 +921,7 @@ def test_bin_edges(self):
917
921
hist3 = hg .SparselyBin (origin = 0.0 , binWidth = 1.0 , quantity = unit ('A' ))
918
922
hist4 = hg .Bin (num = 10 , low = 0.0 , high = 10. , quantity = unit ('A' ))
919
923
hist5 = hg .Bin (num = 10 , low = 0.0 , high = 10. , quantity = unit ('A' ))
924
+ hist6 = hg .Bin (num = 201 , low = 0.0 , high = 1.005 )
920
925
921
926
# fill them
922
927
hist2 .fill .numpy (df1 )
@@ -937,6 +942,10 @@ def test_bin_edges(self):
937
942
2. , 3. , 4. , 5. , 6. , 7. , 8. , 9. , 10. ])
938
943
np .testing .assert_array_equal (hist5 .bin_edges (low = 1.1 , high = 5.4 ), [1. , 2. , 3. , 4. , 5. , 6. ])
939
944
945
+ assert len (hist6 .bin_edges ()) == 202
946
+ assert len (hist6 .bin_edges (low = 0.2089 , high = 0.9333 )) == 147
947
+ assert len (hist6 .bin_edges (low = 0.205 , high = 0.935 )) == 147
948
+
940
949
def test_bin_width (self ):
941
950
""" Test getting the bin width of bin and sparselybin histograms
942
951
"""
0 commit comments