gradient_stretch

gradient_stretch#

pulserver.ir.gradient_stretch()[source]#

Return the gradients of one of a subsequence’s stretches.

The C library’s choice (pulseg_get_gradient_stretch). A stretch is the run of whole segment instances from one instance’s start until they last the subsequence’s hyper-repetition (hyper_us of the summary’s tr_timing), or 10 s (PULSEG_STRETCH_US) where that is shorter, or to the subsequence’s end where it comes first, each block at its played duration. "heaviest" is, of those lasting that long, the one over which the squared gradient summed over the axes integrates to the most, the earliest on a tie, and the whole subsequence where none does. "heaviest_repetition" starts at the instance holding the start of the repetition of most gradient energy, of the repetitions the execution stream holds from its first block. A scanner evaluates its gradient-heating model on both, each as if played without end.

Parameters:
  • seq_path (Path | str) – The first file of the chain; the cache is the file beside it.

  • subsequence (int, default=0) – Index of the subsequence, in chain order.

  • stretch ({'heaviest', 'heaviest_repetition'}, default='heaviest') – Which stretch.

  • raster_us (float, default=None) – Gradient raster in µs for samples_hz_per_m; None omits it.

  • cache_ext (str, default='.pseg') – Extension of the cache, dot included.

Returns:

  • first_position, num_positions: execution-stream position of its first block, and the positions it spans;

  • duration_us: its played duration, in µs;

  • energy: that integral, in (Hz/m)² s;

  • time_us, gradient_hz_per_m: (points,) and (points, 3), its corner points from its start, along the logical axes, linear in between; from zero at 0 where no gradient plays there, to zero at its end where none plays up to it;

  • with raster_us, samples_hz_per_m: (3, samples), the gradient at the centres of the raster intervals that cover it.

Return type:

dict of str to Any

Raises:

ValueError – If the cache cannot be loaded, holds no such subsequence, or stretch is neither name.