write_gradients#

mrinufft.io.nsp.write_gradients(gradients: ndarray, initial_positions: ndarray, grad_filename: str, img_size: tuple[int, ...], FOV: tuple[float, ...], TE_pos: float = 0.5, min_osf: int = 5, gamma: float = Gammas.HYDROGEN, version: float = 4.2, recon_tag: float = 1.1, timestamp: float | None = None, keep_txt_file: bool = False, final_positions: ndarray | None = None, start_skip_samples: int = 0, end_skip_samples: int = 0)[source]#

Create gradient file from gradients and initial positions.

Parameters:
  • gradients (np.ndarray) – Gradients. Shape (num_shots, num_samples_per_shot, dimension). in T/m.

  • initial_positions (np.ndarray) – Initial positions. Shape (num_shots, dimension).

  • grad_filename (str) – Gradient filename.

  • img_size (tuple[int, ...]) – Image size.

  • FOV (tuple[float, ...]) – Field of view.

  • TE_pos (float, optional) – The ratio of trajectory when TE occurs, with 0 as start of trajectory and 1 as end. By default 0.5, which is the center of the trajectory (in-out trajectory).

  • min_osf (int, optional) – Minimum oversampling factor needed at ADC, by default 5

  • gamma (float, optional) – Gyromagnetic ratio in kHz/T, by default 42.576e3

  • version (float, optional) – Trajectory versioning, by default 4.2

  • recon_tag (float, optional) – Reconstruction tag for online recon, by default 1.1

  • timestamp (float, optional) – Timestamp of trajectory, by default None

  • keep_txt_file (bool, optional) – Whether to keep the text file used temporarily which holds data pushed to binary file, by default False

  • final_positions (np.ndarray, optional) – Final positions. Shape (num_shots, dimension), by default None

  • start_skip_samples (int, optional) – Number of samples to skip in ADC at start of each shot, by default 0 This works only for version >= 5.1.

  • end_skip_samples (int, optional) – Number of samples to skip in ADC at end of each shot, by default 0 This works only for version >= 5.1.