Gamma Sources

SourceParams class to manage calibration source energy and features.

x_ray_imager_bagriff.identify_lines._sources.check_gain_range(gain=None, gain_range=None)

Validate a gain or gain_range.

Parameters:
  • gain (float | None) – The max and min gain (dector response / energy).

  • gain_range (tuple[float, float] | None)

Returns:

Tuple of the either gain_range or gain twice,ordered (smallest, largest).

Raises:

ValueErrorgain_range is invalid. Also if too many or too few arguments are provided.

Return type:

tuple[float, float]

class x_ray_imager_bagriff.identify_lines._sources.SourceParams

Collection of all lines for a gamma source.

__init__(energies, name=None)

Initialize the source with its energy.

Parameters:
  • energies (ArrayLike) – Array of source lines in keV

  • name (str | None) – Name of source. For example, ‘Ba133’. No form is required, but the [Element Abbreviation][Isotope] is used for all provided sources.

Return type:

None

get_filter(points, gain=None, gain_range=None, bumper=1.3)

Create a boolean array to remove points away from target energies.

Parameters:
  • points (ArrayLike) – Array of detector values for a set of events.

  • gain (float | None) – Detector gain in (points units) / keV.

  • gain_range (tuple[float, float] | None) – Expand the filters to cover this entire gain range.

  • bumper (float | None)

Returns:

Boolean array, true for all points near an energy for this source.

Raises:

ValueError – An invalid gain/gain range is provided.

Return type:

NDArray[bool]

classmethod get_source(name)

For a named isotope, return its SourceParams if created.

Parameters:

name (str) – Name of source used at creation.

Return type:

Self