EvenlyInterpolate#

class petpal.kinetic_modeling.tac_interpolation.EvenlyInterpolate(tac_times: numpy.ndarray, tac_values: numpy.ndarray, delta_time: float)#

A class for basic evenly interpolating TACs with respect to time

When performing convolutions with respect to time, care needs to be taken to account for the time-step between samples. One way to circumvent this problem is to resample data evenly with respect to the independent variable, or time.

Uses scipy.interpolate.interp1d to perform linear interpolation.

Variables:
  • interp_func (scipy.interpolate.interp1d) – Interpolation function given the provided TAC.

  • resample_times (np.ndarray) – Array containing evenly spaced TAC times.

  • resample_vals (np.ndarray) – Interpolated activities at the calculated resample times.

Initializes an instance of the EvenlyInterpolate class for TAC interpolation.

The constructor takes the Time-Activity Curve (TAC) times and values as inputs, along with a delta time value. It utilizes the SciPy function scipy.interpolate.interp1d to perform a linear interpolation of the provided TAC.

After initializing, it generates an interpolation function based on the TAC times and values. It uses this function to calculate interpolated activities for a new array of evenly spaced times. These times start at the start time of the original TAC and end at the end time, with steps of delta time.

Parameters:
  • tac_times (np.ndarray) – The time-points at which the original TAC activities were sampled. It should be a 1D numpy array with increasing float values.

  • tac_values (np.ndarray) – The corresponding activity values of the provided TAC sampled at tac_times. It should be a 1D numpy array of float values.

  • delta_time (float) – The time-step to use for the creation of evenly spaced resample times. It should be a positive float value.

get_resampled_tac() numpy.ndarray#

Returns the resampled times and values of the Time-Activity Curve (TAC).

The function combines the resampled times and values into a single numpy array.

Returns:

(np.ndarray) – An array containing two numpy arrays. The first array corresponds to the resampled times and the second array corresponds to the resampled activity values of the TAC.