pept.scanners.ADACGeometricEfficiency#

class pept.scanners.ADACGeometricEfficiency(separation, xlim=[111.78, 491.78], ylim=[46.78, 556.78])[source]#

Bases: PEPTObject

Compute the geometric efficiency of a parallel screens PEPT detector at different 3D coordinates using Antonio Guida’s formula [1].

The default xlim and ylim values represent the active detector area of the ADAC Forte scanner used at the University of Birmingham, but can be changed to any parallel screens detector active area range.

This class assumes PEPT coordinates, with the Y and Z axes being swapped, such that Y points upwards and Z is perpendicular to the two detectors.

References

1

Guida A. Positron emission particle tracking applied to solid-liquid mixing in mechanically agitated vessels (Doctoral dissertation, University of Birmingham).

Examples

Simply instantiate the class with the head separation, then ‘call’ it with the (x, y, z) coordinates of the point at which to evaluate the geometric efficiency:

>>> import pept
>>> separation = 500
>>> geom = pept.scanners.ADACGeometricEfficiency(separation)
>>> eg = geom(250, 250, 250)

Alternatively, the separation may be specified using the both the starting and ending limits:

>>> separation = [-10, 510]
>>> geom = pept.scanners.ADACGeometricEfficiency(separation)
>>> eg = geom(250, 250, 250)

You can evaluate multiple points by using a list / array of values:

>>> geom([250, 260], 250, 250)
array([0.18669302, 0.19730517])

Compute the variation in geometric efficiency in the XY plane:

>>> separation = 500
>>> geom = pept.scanners.ADACGeometricEfficiency(separation)
>>> # Range of x, y values to evaluate the geometric efficiency at
>>> import numpy as np
>>> x = np.linspace(120, 480, 100)
>>> y = np.linspace(50, 550, 100)
>>> z = 250
>>> # Evaluate EG on a 2D grid of values at all combinations of x, y
>>> xx, yy = np.meshgrid(x, y)
>>> eg = geom(xx, yy, z)

The geometric efficiencies can be visualised using a Plotly heatmap or contour plot:

>>> import plotly.graph_objs as go
>>> fig = go.Figure()
>>> fig.add_trace(go.Contour(x = x, y = y, z = eg))
>>> fig.show()

For an interactive 3D volumetric / voxel plot, you can use PyVista:

>>> # Import necessary libraries; you may need to install PyVista
>>> import numpy as np
>>> import pept
>>> import pyvista as pv
>>> # Instantiate the ADACGeometricEfficiency class
>>> geom = pept.scanners.ADACGeometricEfficiency(500)
>>> # Lower and upper corners of the grid over which to compute the GE
>>> lower = np.array([115, 50, 5])
>>> upper = np.array([490, 550, 495])
>>> # Create 3D meshgrid of values and evaluate the GE at each point
>>> n = 40
>>> x = np.linspace(lower[0], upper[0], n)
>>> y = np.linspace(lower[1], upper[1], n)
>>> z = np.linspace(lower[2], upper[2], n)
>>> xx, yy, zz = np.meshgrid(x, y, z)
>>> eg = geom(xx, yy, zz)
>>> # Create PyVista grid of values
>>> grid = pv.UniformGrid()
>>> grid.dimensions = np.array(eg.shape) + 1
>>> grid.origin = lower
>>> grid.spacing = (upper - lower) / n
>>> grid.cell_arrays["values"] = eg.flatten(order="F")
>>> # Create PyVista volumetric / voxel plot with an interactive clipper
>>> p = pv.Plotter()
>>> p.add_mesh_clip_plane(grid)
>>> p.show()
Attributes
xlim(2,) np.ndarray, default [111.78, 491.78]

The limits of the active detector area in the x-dimension.

ylim(2,) np.ndarray, default [46.78, 556.78]

The limits of the active detector area in the y-dimension.

zlim(2,) np.ndarray

The limits of the active detector area in the z-dimension.

__init__(separation, xlim=[111.78, 491.78], ylim=[46.78, 556.78])[source]#

Methods

__init__(separation[, xlim, ylim])

copy([deep])

Create a deep copy of an instance of this class, including all inner attributes.

eg(x, y, z)

Return the geometric efficiency evaluated at a single point (x, y, z) in PEPT coordinates, i.e. Y points upwards.

load(filepath)

Load a saved / pickled PEPTObject object from filepath.

save(filepath)

Save a PEPTObject instance as a binary pickle object.

eg(x, y, z)[source]#

Return the geometric efficiency evaluated at a single point (x, y, z) in PEPT coordinates, i.e. Y points upwards.

copy(deep=True)#

Create a deep copy of an instance of this class, including all inner attributes.

static load(filepath)#

Load a saved / pickled PEPTObject object from filepath.

Most often the full object state was saved using the .save method.

Parameters
filepathfilename or file handle

If filepath is a path (rather than file handle), it is relative to where python is called.

Returns
pept.PEPTObject subclass instance

The loaded object.

Examples

Save a LineData instance, then load it back:

>>> lines = pept.LineData([[1, 2, 3, 4, 5, 6, 7]])
>>> lines.save("lines.pickle")
>>> lines_reloaded = pept.LineData.load("lines.pickle")
save(filepath)#

Save a PEPTObject instance as a binary pickle object.

Saves the full object state, including inner attributes, in a portable binary format. Load back the object using the load method.

Parameters
filepathfilename or file handle

If filepath is a path (rather than file handle), it is relative to where python is called.

Examples

Save a LineData instance, then load it back:

>>> lines = pept.LineData([[1, 2, 3, 4, 5, 6, 7]])
>>> lines.save("lines.pickle")
>>> lines_reloaded = pept.LineData.load("lines.pickle")