# Gamma Calculation¶

A range of functions for calculating gamma.

## Available Functions¶

>>> from pymedphys.gamma import (
...     gamma_shell, gamma_dcm, gamma_filter_numpy, gamma_filter_brute_force)


## API¶

pymedphys.gamma.gamma_shell(coords_reference, dose_reference, coords_evaluation, dose_evaluation, dose_percent_threshold, distance_mm_threshold, lower_percent_dose_cutoff=20, interp_fraction=10, max_gamma=inf, local_gamma=False, global_normalisation=None, skip_once_passed=False, mask_evaluation=False, random_subset=None, ram_available=None, quiet=False)[source]

Compare two dose grids with the gamma index.

Parameters: coords_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. coords_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. By default this is only applied to the reference grid. Set mask_evaluation to True to have this apply to the evaluation grid also. interp_fraction : float, optional The fraction which gamma distance threshold is divided into for interpolation. Defaults to 10 as recommended within . 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. mask_evaluation : bool Whether or not the lower_percent_dose_cutoff is applied to the evaluation grid as well as the reference grid. 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 Used to quiet informational printing during function usage. Defaults to False. gamma : np.ndarray The array of gamma values the same shape as that given by the reference coordinates and dose.