Sequence.gradient_statistics

Sequence.gradient_statistics#

Sequence.gradient_statistics()[source]#

Return statistics of each gradient event’s waveform, along its channel axis.

Entry i is gradient id i + 1, for trapezoids and arbitrary gradients alike. Each statistic is exact for the piecewise-linear waveform the event plays, through the corners waveforms_and_times() draws, and is taken over the intervals between corners that last longer than a nanosecond, so an instantaneous step contributes no slew rate. A block’s rotation does not enter.

Returns:

peak_slew, the steepest slew rate in Hz/m/s; energy, the integral of the squared gradient in (Hz/m)^2 s; and slew_energy, the integral of the squared slew rate in (Hz/m/s)^2 s; each (g,).

Return type:

GradientStatistics

Examples

>>> import pypulseqpp as pp
>>> seq = pp.Sequence(pp.Opts())
>>> gx = pp.make_trapezoid("x", amplitude=1e5, rise_time=1e-4, flat_time=1e-3)
>>> _ = seq.add_block(gx)
>>> stats = seq.gradient_statistics()
>>> float(stats.peak_slew[0])
1000000000.0
>>> round(float(stats.energy[0]), 3)  # amplitude^2 * (flat + 2 rise / 3)
10666666.667