test: log tests for summary stats in binning
This commit is contained in:
parent
a20f0c2069
commit
402f6bd275
@ -34,6 +34,40 @@
|
||||
),
|
||||
])
|
||||
# ---
|
||||
# name: test_group_x_bins_mean_log
|
||||
list([
|
||||
tuple(
|
||||
0.0423015,
|
||||
dict({
|
||||
'basic_lorentzian': 0.15817799999999999,
|
||||
}),
|
||||
),
|
||||
tuple(
|
||||
0.593058,
|
||||
dict({
|
||||
'basic_lorentzian': 0.09491108333333335,
|
||||
}),
|
||||
),
|
||||
tuple(
|
||||
4.0870750000000005,
|
||||
dict({
|
||||
'basic_lorentzian': 0.004363105,
|
||||
}),
|
||||
),
|
||||
tuple(
|
||||
24.196866666666665,
|
||||
dict({
|
||||
'basic_lorentzian': 0.0001410066333333333,
|
||||
}),
|
||||
),
|
||||
tuple(
|
||||
394.723,
|
||||
dict({
|
||||
'basic_lorentzian': 1.364947e-06,
|
||||
}),
|
||||
),
|
||||
])
|
||||
# ---
|
||||
# name: test_group_x_bins_summary
|
||||
list([
|
||||
BinSummary(mean_x=3.9333333333333336, summary_values={'identity_plus_one': BinSummaryValue(mean_y=5.933333333333334, stdev_y=3.635014901390823)}),
|
||||
@ -41,3 +75,12 @@
|
||||
BinSummary(mean_x=20.177500000000002, summary_values={'identity_plus_one': BinSummaryValue(mean_y=22.177500000000002, stdev_y=2.884329789280923)}),
|
||||
])
|
||||
# ---
|
||||
# name: test_group_x_bins_summary_log
|
||||
list([
|
||||
BinSummary(mean_x=0.0423015, summary_values={'basic_lorentzian': BinSummaryValue(mean_y=0.15817799999999999, stdev_y=0.001275436787927965)}),
|
||||
BinSummary(mean_x=0.593058, summary_values={'basic_lorentzian': BinSummaryValue(mean_y=0.09491108333333335, stdev_y=0.05205159393153745)}),
|
||||
BinSummary(mean_x=4.0870750000000005, summary_values={'basic_lorentzian': BinSummaryValue(mean_y=0.004363105, stdev_y=0.0025964466030423193)}),
|
||||
BinSummary(mean_x=24.196866666666665, summary_values={'basic_lorentzian': BinSummaryValue(mean_y=0.0001410066333333333, stdev_y=0.00010167601686387665)}),
|
||||
BinSummary(mean_x=394.723, summary_values={'basic_lorentzian': BinSummaryValue(mean_y=1.364947e-06, stdev_y=1.7011900210905307e-06)}),
|
||||
])
|
||||
# ---
|
||||
|
@ -206,14 +206,52 @@ def test_group_x_bins_log(snapshot):
|
||||
|
||||
|
||||
def test_group_x_bins_mean_log(snapshot):
|
||||
x_list = numpy.array([0.0158489, 0.0316228, 0.0794328, 0.158489, 0.17378, 0.316228, 0.944061, 0.977237, 0.988553, 3.16228, 5.01187, 15.8489, 25.1189, 31.6228, 158.489, 630.957])
|
||||
x_list = numpy.array(
|
||||
[
|
||||
0.0158489,
|
||||
0.0316228,
|
||||
0.0794328,
|
||||
0.158489,
|
||||
0.17378,
|
||||
0.316228,
|
||||
0.944061,
|
||||
0.977237,
|
||||
0.988553,
|
||||
3.16228,
|
||||
5.01187,
|
||||
15.8489,
|
||||
25.1189,
|
||||
31.6228,
|
||||
158.489,
|
||||
630.957,
|
||||
]
|
||||
)
|
||||
y_dict = {
|
||||
"basic_lorentzian": (
|
||||
numpy.array([0.159056, 0.158763, 0.156715, 0.149866, 0.148118, 0.127657, 0.0497503, 0.0474191, 0.0466561, 0.00619907, 0.00252714, 0.000256378, 0.000102165, 0.0000644769, 2.56787e-6, 1.62024e-7])
|
||||
numpy.array(
|
||||
[
|
||||
0.159056,
|
||||
0.158763,
|
||||
0.156715,
|
||||
0.149866,
|
||||
0.148118,
|
||||
0.127657,
|
||||
0.0497503,
|
||||
0.0474191,
|
||||
0.0466561,
|
||||
0.00619907,
|
||||
0.00252714,
|
||||
0.000256378,
|
||||
0.000102165,
|
||||
0.0000644769,
|
||||
2.56787e-6,
|
||||
1.62024e-7,
|
||||
]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
bin_config = binning.BinConfig(log_scale=True, bin_width=1, bin_min=-2)
|
||||
bin_config = binning.BinConfig(log_scale=True, bin_width=1, bin_min=1e-2)
|
||||
# expected_bins = numpy.array([1, 9, 17, 25, 33])
|
||||
|
||||
binned = binning.bin_lists(x_list, y_dict, bin_config)
|
||||
@ -222,18 +260,55 @@ def test_group_x_bins_mean_log(snapshot):
|
||||
assert mean_binned == snapshot
|
||||
|
||||
|
||||
# def test_group_x_bins_summary(snapshot):
|
||||
# x_list = numpy.array([1, 2.8, 8, 12.2, 13.6, 17, 19.71, 20, 24, 33])
|
||||
# y_dict = {
|
||||
# "identity_plus_one": (
|
||||
# numpy.array([1, 2.8, 8, 12.2, 13.6, 17, 19.71, 20, 24, 33]) + 2
|
||||
# )
|
||||
# }
|
||||
def test_group_x_bins_summary_log(snapshot):
|
||||
x_list = numpy.array(
|
||||
[
|
||||
0.0158489,
|
||||
0.0316228,
|
||||
0.0794328,
|
||||
0.158489,
|
||||
0.17378,
|
||||
0.316228,
|
||||
0.944061,
|
||||
0.977237,
|
||||
0.988553,
|
||||
3.16228,
|
||||
5.01187,
|
||||
15.8489,
|
||||
25.1189,
|
||||
31.6228,
|
||||
158.489,
|
||||
630.957,
|
||||
]
|
||||
)
|
||||
y_dict = {
|
||||
"basic_lorentzian": (
|
||||
numpy.array(
|
||||
[
|
||||
0.159056,
|
||||
0.158763,
|
||||
0.156715,
|
||||
0.149866,
|
||||
0.148118,
|
||||
0.127657,
|
||||
0.0497503,
|
||||
0.0474191,
|
||||
0.0466561,
|
||||
0.00619907,
|
||||
0.00252714,
|
||||
0.000256378,
|
||||
0.000102165,
|
||||
0.0000644769,
|
||||
2.56787e-6,
|
||||
1.62024e-7,
|
||||
]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
# bin_config = binning.BinConfig(log_scale=False, bin_width=8)
|
||||
# # expected_bins = numpy.array([1, 9, 17, 25, 33])
|
||||
bin_config = binning.BinConfig(log_scale=True, bin_width=1, bin_min=1e-2)
|
||||
|
||||
# binned = binning.bin_lists(x_list, y_dict, bin_config)
|
||||
# summary = [bin.summary_point() for bin in binned]
|
||||
binned = binning.bin_lists(x_list, y_dict, bin_config)
|
||||
summary = [bin.summary_point() for bin in binned]
|
||||
|
||||
# assert summary == snapshot
|
||||
assert summary == snapshot
|
||||
|
Loading…
x
Reference in New Issue
Block a user