stdlib: Add SparseHist to PyStats
This is inclusive of tests to ensure they have implemented correctly. Change-Id: I5c84d5ffdb7b914936cfd86ca012a7b141eeaf42
This commit is contained in:
@@ -78,6 +78,7 @@ cast_stat_info(const statistics::Info *info)
|
||||
TRY_CAST(statistics::VectorInfo);
|
||||
TRY_CAST(statistics::Vector2dInfo);
|
||||
TRY_CAST(statistics::DistInfo);
|
||||
TRY_CAST(statistics::SparseHistInfo);
|
||||
|
||||
return py::cast(info);
|
||||
|
||||
@@ -195,6 +196,15 @@ pybind_init_stats(py::module_ &m_native)
|
||||
.def_readonly("value", &statistics::Vector2dInfo::cvec)
|
||||
;
|
||||
|
||||
py::class_<statistics::SparseHistInfo, statistics::Info,
|
||||
std::unique_ptr<statistics::SparseHistInfo, py::nodelete>>(
|
||||
m, "SparseHistInfo")
|
||||
.def_property_readonly("values", //A Dict[float, int] of sample & count
|
||||
[](const statistics::SparseHistInfo &info) {
|
||||
return info.data.cmap;
|
||||
})
|
||||
;
|
||||
|
||||
py::class_<statistics::FormulaInfo, statistics::VectorInfo,
|
||||
std::unique_ptr<statistics::FormulaInfo, py::nodelete>>(
|
||||
m, "FormulaInfo")
|
||||
|
||||
Reference in New Issue
Block a user