Gamma#

API#

pymedphys.gamma(axes_reference, dose_reference, axes_evaluation, dose_evaluation, dose_percent_threshold, distance_mm_threshold, lower_percent_dose_cutoff=20, interp_fraction=10, max_gamma=None, local_gamma=False, global_normalisation=None, skip_once_passed=False, random_subset=None, ram_available=1610612736, quiet=None)#

Compare two dose grids with the gamma index.

It computes 1, 2, or 3 dimensional gamma with arbitrary gird sizes while interpolating on the fly. This function makes use of some of the ideas presented within <http://dx.doi.org/10.1118/1.2721657>.

Parameters:
  • axes_reference (tuple) – The reference coordinates.

  • dose_reference (np.array) – The reference dose grid. Each point in the reference grid becomes the centre of a Gamma ellipsoid. For each point of the reference, nearby evaluation points are searched at increasing distances.

  • axes_evaluation (tuple) – The evaluation coordinates.

  • dose_evaluation (np.array) – The evaluation dose grid. Evaluation here is defined as the grid which is interpolated and searched over at increasing distances away from each reference point.

  • dose_percent_threshold (float) – The percent dose threshold

  • distance_mm_threshold (float) – The gamma distance threshold. Units must match of the coordinates given.

  • lower_percent_dose_cutoff (float, optional) – The percent lower dose cutoff below which gamma will not be calculated. This is only applied to the reference grid.

  • interp_fraction (float, optional) – The fraction which gamma distance threshold is divided into for interpolation. Defaults to 10 as recommended within <http://dx.doi.org/10.1118/1.2721657>. If a 3 mm distance threshold is chosen this default value would mean that the evaluation grid is interpolated at a step size of 0.3 mm.

  • max_gamma (float, optional) – The maximum gamma searched for. This can be used to speed up calculation, once a search distance is reached that would give gamma values larger than this parameter, the search stops. Defaults to np.inf

  • local_gamma – Designates local gamma should be used instead of global. Defaults to False.

  • global_normalisation (float, optional) – The dose normalisation value that the percent inputs calculate from. Defaults to the maximum value of dose_reference.

  • random_subset (int, optional) – Used to only calculate a random subset of the reference grid. The number chosen is how many random points to calculate.

  • ram_available (int, optional) – The number of bytes of RAM available for use by this function. Defaults to 0.8 times your total RAM as determined by psutil.

  • quiet (bool, optional) – Deprecated but maintained for now for backwards compatibility. pymedphys.gamma now utilises the logging module. You can set your desired verbosity by setting the corresponding logging level. Basic information is given for the info level. Additional information using for benchmarking or troubleshooting performance is provided for the debug level.

Returns:

The array of gamma values the same shape as that given by the reference coordinates and dose.

Return type:

gamma