Sequence.get_gradients

Sequence.get_gradients#

Sequence.get_gradients()[source]#

Return the gradient splines after each block’s rotation, in Hz/m over seconds.

Parameters:
  • trajectory_delay (float | Sequence[float], default=0) – Timing correction in seconds, one value for all axes or one per axis; positive values advance the gradients.

  • gradient_offset (float | Sequence[float], default=0) – A background gradient in Hz/m, one value for all axes or one per axis.

  • time_range (Sequence[float], default=None) – Two times in seconds; only the blocks they touch are expanded.

  • block_range (Sequence[int], default=None) – Two 1-based block indices. Not with time_range.

Returns:

One spline per axis, None where an axis plays nothing and has no offset.

Return type:

list[scipy.interpolate.PPoly | None]

Warns:

UserWarning – When trajectory_delay exceeds 100 us on any axis.

Examples

>>> import pypulseqpp as pp
>>> seq = pp.Sequence(pp.Opts())
>>> seq.add_block(pp.make_trapezoid("x", flat_area=1000, flat_time=3.2e-3))
1
>>> gx, gy, gz = seq.get_gradients()
>>> round(float(gx(2e-3))), gy
(312500, None)