Bragg Peak Analyse
A class for a Bragg peak analysis.
- class fredtools.braggPeak(pos, vec, accuracy=0.01, offset=0, interpolation='spline', splineOrder=3, bortCut=0.6)
Class for Bragg curve analysis.
This class is holding methods for a Bragg peak (BP) analysis and properties of the analysis results. The analysis of a Bragg curve is made based on two methods: a simple interpolation with a given method (linear, nearest or spline) and/or a fit of the Bortfeld equation taken from [1] (eq. 27). For each method, it is possible to obtain such parameters as a range of the BP at a given percent of the maximum of the distal fall-off, the value of the signal (for instance dose) at a given depth, distal fall-off and width of the BP at a given percent of the maximum.
- Parameters:
pos (iterable) – Vector of positions of the Bragg curve points.
vec (iterable) – Vector of values (signal) of the Bragg curve points.
accuracy (float, optional) – Accuracy of the spline and Bortfeld profiles interpolations. (def. 0.01)
offset (float, optional) – Distance offset of the Bragg curve points. (def. 0)
interpolation ({'spline', 'linear', 'nearest'}, optional) – Interpolation method. (def. ‘spline’)
splineOrder (int, optional) – Order of spline interpolation. Must be in range 0-5. (def. 3)
bortCut (float, optional) – The range of the data that the Bortfeld fit will be performed on. It is defined as the range of the BP in the proximal region at the percent of the maximum of the spline interpolation. The Bortfeld fit will be performed for the input data in the distal of this range. (def. 0.6)
Examples
See example jupyter notebook at [2]
References
- property accuracy
Accuracy of the spline and Bortfeld profiles interpolations.
- Type:
float
- property bortCut
The range of the data to perform Bortfeld fit on.
- Type:
float
- property bortfeldFit
Result from the Model of the Bortfeld fit.
- Type:
lmfit.model.ModelResult
- property bortfeldFitParam
Physical parameters of the calculated based on the Bortfeld fit.
- Type:
dict
- property bp
Original Bragg curve loaded by pos and vec.
- Type:
list of arrays
- property bpBort
List of arrays describing pos and vec of the Bortfeld fit profile.
- Type:
list of arrays
- property bpInterp
List of arrays describing pos and vec of the interpolated profile.
- Type:
list of arrays
- property displayInfo
Display information about the Bragg peak analysis.
- getDBort(R)
Get the signal value at a given range/depth based on Bortfeld fit.
The function calculates the signal value (for instance dose) at a given range (for instance depth) using the Bortfeld fit.
- Parameters:
R (float) – Range/depth at which the signal value will be calculated.
- Returns:
Signal value at a given range.
- Return type:
float
Examples
Get the maximum value of the Bortfeld fit.
>>> braggPeak.getDBort(R=braggPeak.getRBort(D=1))
- getDFOBort(Dup, Dlow, percentD=True)
Calculate the width of the distal fall-off of the BP at a given signal level based on Bortfeld fit.
The function calculates the width of the distal fall-off of the BP at the absolute or relative signal values using the Bortfeld fit. The relative value is calculated to the maximum value of the Bortfeld fit.
- Parameters:
Dup (float) – Absolute or relative upper signal level.
Dlow (float) – Absolute or relative lower signal level.
percentD (bool, optional) – Determine if the signal level is relative (True) to the maximum or absolute (False). (def. True)
- Returns:
Width of the distal fall-off at signal level.
- Return type:
float
Examples
Get width of the distal fall-off between 80 and 20 percent of the maximum value of the Bortfeld fit.
>>> braggPeak.getDFOBort(Dup=0.8, Dlow=0.2)
This is equivalent to the code.
>>> braggPeak.getRBort(D=0.2, side='D') - braggPeak.getRBort(D=0.8, side='D')
- getDFOInterp(Dup, Dlow, percentD=True)
Calculate the width of the distal fall-off of the BP at a given signal level based on profile interpolation.
The function calculates the width of the distal fall-off of the BP at the absolute or relative signal values using the profile interpolation defined with interpolation and splineOrder. The relative value is calculated to the maximum value of the profile interpolation.
- Parameters:
Dup (float) – Absolute or relative upper signal level.
Dlow (float) – Absolute or relative lower signal level.
percentD (bool, optional) – Determine if the signal level is relative (True) to the maximum or absolute (False). (def. True)
- Returns:
Width of the distal fall-off at signal level.
- Return type:
float
Examples
Get width of the distal fall-off between 80 and 20 percent of the maximum value of the interpolation.
>>> braggPeak.getDFOInterp(Dup=0.8, Dlow=0.2)
This is equivalent to the code.
>>> braggPeak.getRInterp(D=0.2, side='D') - braggPeak.getRInterp(D=0.8, side='D')
- getDInterp(R)
Get signal value at given range/depth based on profile interpolation.
The function calculates the signal value (for instance dose) at a given range (for instance depth) using the profile interpolation defined with interpolation and splineOrder.
- Parameters:
R (float) – Range/depth at which the signal value will be calculated.
- Returns:
Signal value at a given range.
- Return type:
float
Examples
Get the maximum value of the interpolation method.
>>> braggPeak.getDInterp(R=braggPeak.getRInterp(D=1))
- getRBort(D, side='distal', percentD=True)
Calculate the range/depth at a given signal level based on Bortfeld fit.
The function calculates the range (depth) at the distal or proximal part, at the absolute or relative signal value using the Bortfeld fit. The relative value is calculated to the maximum value of the Bortfeld fit.
- Parameters:
D (float) – Absolute or relative signal level.
side ({'proximal'|'P', 'distal'|'D'}, optional) – Determine the side, proximal or distal to the maximum range, of the BP to calculate the range. (def. ‘distal’)
percentD (bool, optional) – Determine if the signal level is relative (True) to the maximum or absolute (False). (def. True)
- Returns:
Range at signal level.
- Return type:
float
Examples
Get a range at 80 percent of the maximum value of the Bortfeld fit at the distal fall-off of the BP.
>>> braggPeak.getRBort(D=0.8)
Get a range at 50 percent of the maximum value of the Bortfeld fit in the proximal region.
>>> braggPeak.getRBort(D=0.5, side='P')
- getRInterp(D, side='distal', percentD=True)
Calculate the range/depth at a given signal level based on profile interpolation.
The function calculates range (depth) at the distal or proximal part, at the absolute or relative signal value using the profile interpolation defined with interpolation and splineOrder. The relative value is calculated to the maximum value of the profile interpolation.
- Parameters:
D (float) – Absolute or relative signal level.
side ({'proximal'|'P', 'distal'|'D'}, optional) – Determine the side, proximal or distal to the maximum range, of the BP to calculate the range. (def. ‘distal’)
percentD (bool, optional) – Determine if the signal level is relative (True) to the maximum or absolute (False). (def. True)
- Returns:
Range at signal level.
- Return type:
float
Examples
Get range at 80 percent of the maximum value of the interpolation at the distal fall-off of the BP.
>>> braggPeak.getRInterp(D=0.8)
Get range at 50 percent of the maximum value of the interpolation in the proximal region.
>>> braggPeak.getRInterp(D=0.5, side='P')
- getWBort(D, percentD=True)
Calculate the width of the BP at a given signal level based on Bortfeld fit.
The function calculates the width of the BP at the absolute or relative signal value using the Bortfeld fit. The relative value is calculated to the maximum value of the Bortfeld fit.
- Parameters:
D (float) – Absolute or relative signal level.
percentD (bool, optional) – Determine if the signal level is relative (True) to the maximum or absolute (False). (def. True)
- Returns:
Width at signal level.
- Return type:
float
Examples
Get width at 50 percent of the maximum value of the Bortfeld fit.
>>> braggPeak.getWBort(D=0.5)
This is equivalent to the code.
>>> braggPeak.getWBort(D=0.5, side='D') - braggPeak.getWBort(D=0.5, side='P')
- getWInterp(D, percentD=True)
Calculate the width of the BP at a given signal level based on profile interpolation.
The function calculates the width of the BP at the absolute or relative signal value using the profile interpolation defined with interpolation and splineOrder. The relative value is calculated to the maximum value of the profile interpolation.
- Parameters:
D (float) – Absolute or relative signal level.
percentD (bool, optional) – Determine if the signal level is relative (True) to the maximum or absolute (False). (def. True)
- Returns:
Width at signal level.
- Return type:
float
Examples
Get width at 50 percent of the maximum value of the interpolation.
>>> braggPeak.getWInterp(D=0.5)
This is equivalent to the code.
>>> braggPeak.getRInterp(D=0.5, side='D') - braggPeak.getRInterp(D=0.5, side='P')
- property interpolation
Interpolation method. Available are ‘linear’, ‘nearest’ or ‘spline’.
- Type:
str
- property offset
Distance offset of the Bragg curve points.
- Type:
float
- property plot
Simple plot of the Bragg peak and analysis methods.
- property splineOrder
Order of the spline interpolation. Must be in range 0-5.
- Type:
int