concatenate_gradients#
- pypulseqpp.concatenate_gradients()[source]#
Concatenate gradients on one channel without modifying the inputs.
Skip None entries. The first gradient keeps its delay; subsequent gradients start when the preceding gradient ends.
- Parameters:
*grads (GradEvent or TrapEvent or None) – Gradients on the same channel, in play order.
Noneis skipped.system (pypulseqpp.Opts, default=None) – System limits.
- Returns:
The gradients concatenated into a single event, or the sole gradient unchanged when only one is given.
- Return type:
GradEvent
- Raises:
ValueError – If no gradient is given, or they are not all on one channel.
Examples
>>> import pypulseqpp as pp >>> system = pp.Opts() >>> select = pp.make_trapezoid("z", area=200.0, duration=2e-3, system=system) >>> rephase = pp.make_trapezoid("z", area=-100.0, duration=1e-3, system=system) >>> merged = pp.concatenate_gradients(select, rephase, system=system) >>> round(pp.calc_duration(merged), 6) == round( ... pp.calc_duration(select) + pp.calc_duration(rephase), 6 ... ) True
The inputs keep their own delays:
>>> float(rephase.delay) 0.0