pymchelper.page module¶
-
class
pymchelper.page.
Page
(estimator=None)[source]¶ Bases:
object
-
data
¶ 3-D view of page data.
Page data is stored originally in data_raw 1-D array. This property provides efficient view of data, suitable for numpy-like indexing.
>>> from pymchelper.estimator import Estimator >>> e = Estimator() >>> e.x = MeshAxis(n=2, min_val=0.0, max_val=10.0, name="X", unit="cm", binning=MeshAxis.BinningType.linear) >>> e.y = MeshAxis(n=3, min_val=0.0, max_val=150.0, name="Y", unit="cm", binning=MeshAxis.BinningType.linear) >>> e.z = MeshAxis(n=1, min_val=0.0, max_val=1.0, name="Z", unit="cm", binning=MeshAxis.BinningType.linear) >>> p = Page(estimator=e) >>> p.data_raw = np.arange(6) >>> tuple(int(n) for n in p.data.shape) (2, 3, 1, 1, 1) >>> p.data[1, 2, 0, 0, 0] 5
Returns: reshaped view of data_raw
-
dimension
¶ Let’s take again detector d with YZ scoring. >>> from pymchelper.estimator import Estimator >>> e = Estimator() >>> e.x = MeshAxis(n=1, min_val=0.0, max_val=1.0, name=”X”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> e.y = MeshAxis(n=3, min_val=0.0, max_val=150.0, name=”Y”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> e.z = MeshAxis(n=2, min_val=0.0, max_val=2.0, name=”Z”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> e.dimension 2 >>> p = Page(e) >>> p.diff_axis1 = MeshAxis(n=10, min_val=0.0, max_val=100.0, name=”E”, unit=”MeV”, … binning=MeshAxis.BinningType.linear) >>> p.dimension 3
Returns: number of page axes (including differential) which have more than one bin
-
error
¶ 3-D view of page error
For more details see
data
property. :return:
-
plot_axis
(id)[source]¶ Calculate new order of detector axis, axis with data (n>1) comes first Axes with constant value goes last.
Let’s take a detector d with YZ scoring. >>> from pymchelper.estimator import Estimator >>> e = Estimator() >>> e.x = MeshAxis(n=1, min_val=0.0, max_val=1.0, name=”X”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> e.y = MeshAxis(n=3, min_val=0.0, max_val=150.0, name=”Y”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> e.z = MeshAxis(n=2, min_val=0.0, max_val=2.0, name=”Z”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> p = Page(estimator=e) >>> e.add_page(page=p)
First axis for plotting will be Y (as X axis holds only one bin): >>> p.plot_axis(0) MeshAxis(n=3, min_val=0.0, max_val=150.0, name=’Y’, unit=’cm’, binning=<BinningType.linear: 0>)
Second axis for plotting will be Z (its the next after Y with n > 1 bins) >>> p.plot_axis(1) MeshAxis(n=2, min_val=0.0, max_val=2.0, name=’Z’, unit=’cm’, binning=<BinningType.linear: 0>)
Finally the third axis will be X, but it cannot be used for plotting as it has only one bin. >>> p.plot_axis(2) MeshAxis(n=1, min_val=0.0, max_val=1.0, name=’X’, unit=’cm’, binning=<BinningType.linear: 0>)
Parameters: id – axis number (0, 1, 2, 3 or 4) Returns: axis object
-