pymchelper.estimator module¶
-
class
pymchelper.estimator.
ErrorEstimate
[source]¶ Bases:
enum.IntEnum
When averaging data multiple files we could estimate statistical error of scored quantity. Such error can be calculated as: none (error information missing), standard error or standard deviation.
-
none
= 0¶
-
stddev
= 2¶
-
stderr
= 1¶
-
-
class
pymchelper.estimator.
Estimator
[source]¶ Bases:
object
Estimator data including scoring mesh description.
This class handles in universal way data generated with MC code. It includes data (
data
anddata_raw
fields) and optional errors (error
anderror_raw
). Estimator holds also up to 3 binning axis (x
,y
andz
fields). Scored quantity can be assigned aname
(i.e. dose) andunit
(i.e. Gy). Several other fields are also used:- nstat: number of simulated histories
- counter: number of files read to construct detector object
- corename: common core part of input files defining a name of detector
- error_type: none, stderr or stddev - error type
Estimator data can be either read from the file (see
fromfile
method ininput_output
module or constructed directly:>>> d = Estimator() >>> d.x = MeshAxis(n=2, min_val=0.0, max_val=10.0, name="X", unit="cm", binning=MeshAxis.BinningType.linear) >>> d.x.data array([ 2.5, 7.5]) >>> d.y = MeshAxis(n=3, min_val=0.0, max_val=150.0, name="Y", unit="cm", binning=MeshAxis.BinningType.linear) >>> d.y.data array([ 25., 75., 125.]) >>> d.z = MeshAxis(n=1, min_val=0.0, max_val=1.0, name="Z", unit="cm", binning=MeshAxis.BinningType.linear) >>> d.z.data array([ 0.5])
-
add_page
(page)[source]¶ Add a page to the estimator object. New copy of page is made and page estimator pointer is set to the estimator object holding this page. :param page: :return: None
-
axis
(axis_id)[source]¶ Mesh axis selector method based on integer id’s.
Instead of getting mesh axis data by calling d.x, d.y or d.z (assuming d an object of Detector class) we can get that data by calling d.axis(0), d.axis(1) or d.axis(2). See for example: >>> d = Estimator() >>> d.x = MeshAxis(n=2, min_val=0.0, max_val=10.0, name=”X”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> d.y = MeshAxis(n=3, min_val=0.0, max_val=150.0, name=”Y”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> d.z = MeshAxis(n=1, min_val=0.0, max_val=1.0, name=”Z”, unit=”cm”, binning=MeshAxis.BinningType.linear) >>> d.axis(1) MeshAxis(n=3, min_val=0.0, max_val=150.0, name=’Y’, unit=’cm’, binning=<BinningType.linear: 0>)
Parameters: axis_id – axis id (0, 1 or 2) Returns: MeshAxis object
-
dimension
¶ Let’s take again detector d with YZ scoring. >>> 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
Returns: number of axes (among X,Y,Z) which have more than one bin