Sequence.remove_duplicates

Sequence.remove_duplicates#

Sequence.remove_duplicates()[source]#

Merge identical library rows and renumber the references to them.

Parameters:

in_place (bool, default=False) – Collapse this sequence. Otherwise a copy is collapsed and this one is left as it is.

Returns:

The collapsed sequence: this one, or the copy.

Return type:

Sequence

Examples

>>> import pypulseqpp as pp
>>> seq = pp.Sequence(pp.Opts())
>>> for _ in range(2):
...     _ = seq.add_block(pp.make_trapezoid("x", area=1000, duration=2e-3))
>>> print(seq.remove_duplicates())
Sequence:
blocks: 2
rf_library: 0
grad_library: 1
...