patch_center_anomaly

patch_center_anomaly#

mrinufft.trajectories.gradients.patch_center_anomaly(shot_or_params, update_shot=None, update_parameters=None, in_out=False, learning_rate=0.1)[source]#

Re-position samples to avoid center anomalies.

Some trajectories behave slightly differently from expected when approaching definition bounds, most often the k-space center as for spirals in some cases.

This function enforces non-strictly increasing monoticity of sample distances from the center, effectively reducing slew rates and smoothing gradient transitions locally.

Shots can be updated with provided functions to keep fitting their strict definition, or it can be smoothed using cubic spline approximations.

Parameters:
  • shot_or_params (np.array, list) – Either a single shot of shape (Ns, Nd), or a list of arbitrary arguments used by update_shot to initialize a single shot.

  • update_shot (function, optional) – Function used to initialize a single shot based on parameters provided by update_parameters. If None, cubic splines are used as an approximation instead, by default None

  • update_parameters (function, optional) – Function used to update shot parameters when provided in shot_or_params from an updated shot and parameters. If None, cubic spline parameterization is used instead, by default None

  • in_out (bool, optional) – Whether the shot is going in-and-out or start from the center, by default False

  • learning_rate (float, optional) – Learning rate used in the iterative optimization process, by default 1e-1

Returns:

  • array_like – N-D trajectory based on shot_or_params if a shot or update_shot otherwise.

  • list – Updated parameters either in the shot_or_params format if params, or cubic spline parameterization as an array of floats between 0 and 1 otherwise.