mirror of
https://github.com/boostorg/histogram.git
synced 2025-05-11 21:24:14 +00:00
27 lines
536 B
Python
27 lines
536 B
Python
from __future__ import print_function
|
|
import sys
|
|
import os
|
|
sys.path.append(os.getcwd())
|
|
|
|
#[ guide_mixed_cpp_python_part_py
|
|
import histogram as bh
|
|
import cpp_filler
|
|
|
|
h = bh.histogram(bh.axis.regular(4, 0, 1),
|
|
bh.axis.integer(0, 4))
|
|
|
|
cpp_filler.process(h) # histogram is filled with input values in C++
|
|
|
|
for iy, y in enumerate(h.axis(1)):
|
|
for ix, x in enumerate(h.axis(0)):
|
|
print(h.at(ix, iy).value, end=' ')
|
|
print()
|
|
|
|
# prints:
|
|
# 1.0 0.0 0.0 0.0
|
|
# 0.0 1.0 0.0 0.0
|
|
# 0.0 0.0 1.0 0.0
|
|
# 0.0 0.0 0.0 1.0
|
|
|
|
#]
|