make_arbitrary_grad

make_arbitrary_grad#

pypulseqpp.make_arbitrary_grad()[source]#

Create a gradient from amplitudes sampled at raster centres.

Matches upstream’s fields and errors. 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 (str) – One of x, y, z.

  • waveform (numpy.ndarray) – Amplitudes at raster centres, Hz/m.

  • 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) – Seconds before the waveform starts.

  • max_grad (float, default=None) – Limits; system’s when omitted or zero.

  • max_slew (float, default=None) – 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.

Return type:

GradEvent

Raises:

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