-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support instruction filtering method in ScheduleBlock class (#9971)
* activate filter method in ScheduleBlock class * use functools.singledispatch * add tests for filter method in ScheduleBlock class * filter out empty schedule_blocks * update doc * rm logical_and * add catch-TypeError functions decorated with singledispatch * use pulse builder in test * make another test function for nested block * add a release note * Rm optional args Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * add warning Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * update the release note Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com> * activate exclude method in ScheduleBlock class --------- Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
- Loading branch information
1 parent
218c773
commit 2d8300c
Showing
4 changed files
with
401 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
releasenotes/notes/filter-schedule-block-29d392ca351f1fb1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
features: | ||
- | | ||
The method :meth:`~qiskit.pulse.schedule.ScheduleBlock.filter` is activated | ||
in the :class:`~qiskit.pulse.schedule.ScheduleBlock` class. | ||
This method enables users to retain only :class:`~qiskit.pulse.Instruction` | ||
objects which pass through all the provided filters. | ||
As builtin filter conditions, pulse :class:`~qiskit.pulse.channels.Channel` | ||
subclass instance and :class:`~qiskit.pulse.instructions.Instruction` | ||
subclass type can be specified. | ||
User-defined callbacks taking :class:`~qiskit.pulse.instructions.Instruction` instance | ||
can be added to the filters, too. | ||
- | | ||
The method :meth:`~qiskit.pulse.schedule.ScheduleBlock.exclude` is activated | ||
in the :class:`~qiskit.pulse.schedule.ScheduleBlock` class. | ||
This method enables users to retain only :class:`~qiskit.pulse.Instruction` | ||
objects which do not pass at least one of all the provided filters. | ||
As builtin filter conditions, pulse :class:`~qiskit.pulse.channels.Channel` | ||
subclass instance and :class:`~qiskit.pulse.instructions.Instruction` | ||
subclass type can be specified. | ||
User-defined callbacks taking :class:`~qiskit.pulse.instructions.Instruction` instance | ||
can be added to the filters, too. | ||
This method is the complement of :meth:`~qiskit.pulse.schedule.ScheduleBlock.filter`, so | ||
the following condition is always satisfied: | ||
``block.filter(*filters) + block.exclude(*filters) == block`` in terms of | ||
instructions included, where ``block`` is a :class:`~qiskit.pulse.schedule.ScheduleBlock` | ||
instance. |
Oops, something went wrong.