read_gradients#

mrinufft.io.read_gradients(grad_filename: str | Path, gamma: Gammas | float = Gammas.HYDROGEN) → tuple[NDArray, NDArray, dict[str, Any]][source]#

Read the gradient waveforms stored in a gradient file.

Unlike read_trajectory(), the waveforms are returned as stored, on the gradient raster, including the samples played outside of the ADC window (pre-phasors and spoilers, for version >= 5.1).

Parameters:
  • grad_filename (str | Path) – Gradient filename.

  • gamma (float, optional) – Gyromagnetic ratio in kHz/T, only used for versions < 4.1 which do not store it.

Returns:

  • gradients (NDArray) – Gradients in T/m. Shape (num_shots, num_samples_per_shot, dimension).

  • initial_positions (NDArray) – K-space positions at the start of the waveforms, in 1/m. Shape (num_shots, dimension).

  • params (dict) – Header of the file. gamma is in kHz/T, num_samples_per_shot counts all the stored samples, of which start_skip_samples and end_skip_samples are played outside of the ADC window.

Return type:

tuple[NDArray, NDArray, dict[str, Any]]