make_arbitrary_grad

make_arbitrary_grad#

pypulseqpp.make_arbitrary_grad()[source]#

Construct an arbitrary gradient event from amplitudes sampled at raster centres.

Fields and errors match upstream’s. A 1-D array of at least two samples is built and checked in one compiled call unless PyPulseq tracing is on; other inputs take upstream’s path and are converted.

Parameters:
  • channel ({'x', 'y', 'z'}) – Gradient channel.

  • waveform (numpy.ndarray) – Amplitudes at gradient raster centres (Hz/m); at half-raster spacing with oversampling.

  • first (float, default=None) – Amplitudes at the waveform’s outer edges (Hz/m); linearly extrapolated from the two end samples when omitted.

  • last (float, default=None) – Amplitudes at the waveform’s outer edges (Hz/m); linearly extrapolated from the two end samples when omitted.

  • delay (float, default=0.0) – Delay of the event within its block (s).

  • max_grad (float, default=None) – Amplitude (Hz/m) and slew-rate (Hz/m/s) limits; system’s when omitted or zero.

  • max_slew (float, default=None) – Amplitude (Hz/m) and slew-rate (Hz/m/s) limits; system’s when omitted or zero.

  • system (Opts, default=None) – Opts.default when omitted.

  • oversampling (bool, default=False) – The waveform samples a grid twice as fine; its length must be odd.

Returns:

The compiled arbitrary gradient event.

Return type:

GradEvent

Raises:

ValueError – On an invalid channel, an amplitude or slew violation, or an even oversampled length.