We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4ca471 commit 4f18bc1Copy full SHA for 4f18bc1
filter_functions/pulse_sequence.py
@@ -407,6 +407,21 @@ def __getitem__(self, key) -> 'PulseSequence':
407
d=self.d,
408
basis=self.basis
409
)
410
+
411
+ # An edge use case: key is a slice of the form slice(n), e.g.,
412
+ # pulse[:n], in which case the control matrix might already have
413
+ # been cached in the form of an intermediate
414
+ is_valid_slice = (
415
+ isinstance(key, slice)
416
+ and key.start in (None, 0)
417
+ and key.step in (None, 1)
418
+ )
419
+ if is_valid_slice and 'control_matrix_step_cumulative' in self._intermediates:
420
+ new.cache_control_matrix(
421
+ self.omega,
422
+ self._intermediates['control_matrix_step_cumulative'][key.stop]
423
424
425
return new
426
427
def __copy__(self) -> 'PulseSequence':
0 commit comments