Interpolation Methods

Interpolate between calibration source positions and energies.

class x_ray_imager_bagriff.response_interpolation._interpolate.Interpolation

Generic base to interpolate x-ray detector response and validate it.

This is intended to produce the best estimate of what the mean response from the imager would be for a given x-ray position and energy. Specific implementation is left for inherited classes.

__init__(energies, positions, responses, input_diagnostic=None, output_diagnostic=None, error_diagnostic=None)

Initialize the interpolation.

Parameters:
  • energy – Array of energies used for the calibration points. Shape is (n_energies).

  • positions (ArrayLike) – Array of the x and y position for each calibration point. It’s expected that the same points are used for each energy. Shape should be (2, n_x_positions, n_y_positions)

  • responses (ArrayLike) – Array of expected response for each x-ray energy and position used in calibration. Shape should be (n_energies, n_x_positions, n_y_positions, n_detectors)

  • input_diagnostic (GenericResponseDiagnostic | None) – Diagnostic plot of the calibration responses.

  • output_diagnostic (GenericResponseDiagnostic | None) – Diagnostic plot to use for the predicted output at each calibration point and the specified energy.

  • error_diagnostic (GenericResponseDiagnostic | None) – Diagnostic plot of the difference between responses from calibration and the prediction.

  • energies (ArrayLike)

Return type:

None

values(energy, x, y)

Estimate the response for an energy and position.

Implementation is left for the specific subclass. It should be able to tolarate any array shape, provided it’s the same for all three variables.

Parameters:
  • energy (ArrayLike) – Array of energies for each response to predict.

  • x (ArrayLike) – Array of x position coordinate for each response to predict.

  • y (ArrayLike) – Array of y position coordinate for each response to predict.

Return type:

NDArray[float64]

validate(energy, positions, responses, output_diagnostic=None, error_diagnostic=None)

Check the predictions against calibration and plot diagnostics.

Parameters:
  • energy (float) – Energy of the calibration source.

  • positions (NDArray[float64]) – Array of calibration points.

  • responses (NDArray[float64]) – Array of detector outputs for each calibration point.

  • output_diagnostic (GenericResponseDiagnostic | None) – Diagnostic plot to use for the predicted output at each calibration point and the specified energy.

  • error_diagnostic (GenericResponseDiagnostic | None) – Diagnostic plot of the difference between responses from calibration and the prediction.

Returns:

Tuple of the maximum and mean error between the calibration responses and the predicted output for the same energies and positions.

Return type:

tuple[float, float]

class x_ray_imager_bagriff.response_interpolation._interpolate.CubicInterpolation
__init__(energies, positions, centers, **kwargs)

Initialize the interpolation.

Parameters:
  • energy – Array of energies used for the calibration points. Shape is (n_energies).

  • positions – Array of the x and y position for each calibration point. It’s expected that the same points are used for each energy. Shape should be (2, n_x_positions, n_y_positions)

  • responses – Array of expected response for each x-ray energy and position used in calibration. Shape should be (n_energies, n_x_positions, n_y_positions, n_detectors)

  • input_diagnostic – Diagnostic plot of the calibration responses.

  • output_diagnostic – Diagnostic plot to use for the predicted output at each calibration point and the specified energy.

  • error_diagnostic – Diagnostic plot of the difference between responses from calibration and the prediction.

values(energy, x, y)

Estimate the response for an energy and position.

Implementation is left for the specific subclass. It should be able to tolarate any array shape, provided it’s the same for all three variables.

Parameters:
  • energy – Array of energies for each response to predict.

  • x – Array of x position coordinate for each response to predict.

  • y – Array of y position coordinate for each response to predict.

class x_ray_imager_bagriff.response_interpolation._interpolate.PCACleanedInterpolation
__init__(energies, positions, centers, basis)

Initialize the interpolation.

Parameters:
  • energy – Array of energies used for the calibration points. Shape is (n_energies).

  • positions – Array of the x and y position for each calibration point. It’s expected that the same points are used for each energy. Shape should be (2, n_x_positions, n_y_positions)

  • responses – Array of expected response for each x-ray energy and position used in calibration. Shape should be (n_energies, n_x_positions, n_y_positions, n_detectors)

  • input_diagnostic – Diagnostic plot of the calibration responses.

  • output_diagnostic – Diagnostic plot to use for the predicted output at each calibration point and the specified energy.

  • error_diagnostic – Diagnostic plot of the difference between responses from calibration and the prediction.

class x_ray_imager_bagriff.response_interpolation._interpolate.PCAEnergyInterpolation
__init__(energies, positions, centers, basis)

Initialize the interpolation.

Parameters:
  • energy – Array of energies used for the calibration points. Shape is (n_energies).

  • positions – Array of the x and y position for each calibration point. It’s expected that the same points are used for each energy. Shape should be (2, n_x_positions, n_y_positions)

  • responses – Array of expected response for each x-ray energy and position used in calibration. Shape should be (n_energies, n_x_positions, n_y_positions, n_detectors)

  • input_diagnostic – Diagnostic plot of the calibration responses.

  • output_diagnostic – Diagnostic plot to use for the predicted output at each calibration point and the specified energy.

  • error_diagnostic – Diagnostic plot of the difference between responses from calibration and the prediction.

values(energy, x, y)

Estimate the response for an energy and position.

Implementation is left for the specific subclass. It should be able to tolarate any array shape, provided it’s the same for all three variables.

Parameters:
  • energy – Array of energies for each response to predict.

  • x – Array of x position coordinate for each response to predict.

  • y – Array of y position coordinate for each response to predict.

class x_ray_imager_bagriff.response_interpolation._interpolate.PCADepthInterpolation
__init__(energies, positions, centers, basis, mu_interpolator=None)

Initialize the interpolation.

Parameters:
  • energy – Array of energies used for the calibration points. Shape is (n_energies).

  • positions – Array of the x and y position for each calibration point. It’s expected that the same points are used for each energy. Shape should be (2, n_x_positions, n_y_positions)

  • responses – Array of expected response for each x-ray energy and position used in calibration. Shape should be (n_energies, n_x_positions, n_y_positions, n_detectors)

  • input_diagnostic – Diagnostic plot of the calibration responses.

  • output_diagnostic – Diagnostic plot to use for the predicted output at each calibration point and the specified energy.

  • error_diagnostic – Diagnostic plot of the difference between responses from calibration and the prediction.