Korean
언어
English
Japanese
German
Korean
Shortcuts

qiskit.pulse.Schedule

class Schedule(*schedules, name=None)[소스]

A quantum program schedule with exact time constraints for its instructions, operating over all input signal channels and supporting special syntaxes for building.

Create an empty schedule.

매개변수
  • *schedules – Child Schedules of this parent Schedule. May either be passed as the list of schedules, or a list of (start_time, schedule) pairs.

  • name (Optional[str]) – Name of this schedule. Defaults to an autogenerated string if not provided.

__init__(*schedules, name=None)[소스]

Create an empty schedule.

매개변수
  • *schedules – Child Schedules of this parent Schedule. May either be passed as the list of schedules, or a list of (start_time, schedule) pairs.

  • name (Optional[str]) – Name of this schedule. Defaults to an autogenerated string if not provided.

Methods

__init__(*schedules[, name])

Create an empty schedule.

append(schedule[, name, inplace])

Return a new schedule with schedule inserted at the maximum time over all channels shared between self and schedule.

assign_parameters(value_dict)

Assign the parameters in this schedule according to the input.

ch_duration(*channels)

Return the time of the end of the last instruction over the supplied channels.

ch_start_time(*channels)

Return the time of the start of the first instruction over the supplied channels.

ch_stop_time(*channels)

Return maximum start time over supplied channels.

draw([dt, style, filename, interp_method, …])

Plot the schedule.

exclude(*filter_funcs[, channels, …])

Return a Schedule with only the instructions from this Schedule failing at least one of the provided filters. This method is the complement of self.filter, so that::.

filter(*filter_funcs[, channels, …])

Return a new Schedule with only the instructions from this Schedule which pass though the provided filters; i.e. an instruction will be retained iff every function in filter_funcs returns True, the instruction occurs on a channel type contained in channels, the instruction type is contained in instruction_types, and the period over which the instruction operates is fully contained in one specified in time_ranges or intervals.

flatten()

Return a new schedule which is the flattened schedule contained all instructions.

insert(start_time, schedule[, name, inplace])

Return a new schedule with schedule inserted into self at start_time.

replace(old, new[, inplace])

Return a schedule with the old instruction replaced with a new instruction.

shift(time[, name, inplace])

Return a schedule shifted forward by time.

Attributes

channels

Returns channels that this schedule uses.

duration

Duration of this schedule component.

instances_counter

instructions

Get the time-ordered instructions from self.

name

Name of ScheduleComponent.

prefix

start_time

Starting time of this schedule component.

stop_time

Stopping time of this schedule component.

timeslots

Time keeping attribute.

append(schedule, name=None, inplace=False)[소스]

Return a new schedule with schedule inserted at the maximum time over all channels shared between self and schedule.

\[t = \textrm{max}(\texttt{x.stop_time} |\texttt{x} \in \texttt{self.channels} \cap \texttt{schedule.channels})\]
매개변수
  • schedule (ScheduleComponent) – Schedule to be appended.

  • name (Optional[str]) – Name of the new Schedule. Defaults to name of self.

  • inplace (bool) – Perform operation inplace on this schedule. Otherwise return a new Schedule.

반환 형식

Schedule

assign_parameters(value_dict)[소스]

Assign the parameters in this schedule according to the input.

매개변수

value_dict (Dict[ParameterExpression, Union[ParameterExpression, float, int]]) – A mapping from Parameters to either numeric values or another Parameter expression.

반환 형식

Schedule

반환값

Schedule with updated parameters (a new one if not inplace, otherwise self).

ch_duration(*channels)[소스]

Return the time of the end of the last instruction over the supplied channels.

매개변수

*channels – Channels within self to include.

반환 형식

int

ch_start_time(*channels)[소스]

Return the time of the start of the first instruction over the supplied channels.

매개변수

*channels – Channels within self to include.

반환 형식

int

ch_stop_time(*channels)[소스]

Return maximum start time over supplied channels.

매개변수

*channels – Channels within self to include.

반환 형식

int

property channels

Returns channels that this schedule uses.

반환 형식

Tuple[Channel]

draw(dt=1, style=None, filename=None, interp_method=None, scale=None, channel_scales=None, plot_all=False, plot_range=None, interactive=False, table=False, label=False, framechange=True, channels=None, show_framechange_channels=True)[소스]

Plot the schedule.

매개변수
  • dt (float) – Time interval of samples.

  • style (Optional[SchedStyle]) – A style sheet to configure plot appearance.

  • filename (Optional[str]) – Name required to save pulse image.

  • interp_method (Optional[Callable]) – A function for interpolation.

  • scale (Optional[float]) – Relative visual scaling of waveform amplitudes, see Additional Information.

  • channel_scales (Optional[Dict[Channel, float]]) – Channel independent scaling as a dictionary of Channel object.

  • plot_all (bool) – Plot empty channels.

  • plot_range (Optional[Tuple[float]]) – A tuple of time range to plot.

  • interactive (bool) – When set true show the circuit in a new window (this depends on the matplotlib backend being used supporting this).

  • table (bool) – Draw event table for supported commands.

  • label (bool) – Label individual instructions.

  • framechange (bool) – Add framechange indicators.

  • channels (Optional[List[Channel]]) – A list of Channels to plot.

  • show_framechange_channels (bool) – Plot channels with only framechanges.

Additional Information:

If you want to manually rescale the waveform amplitude of channels one by one, you can set channel_scales argument instead of scale. The channel_scales should be given as a python dictionary:

channel_scales = {pulse.DriveChannels(0): 10.0,
                  pulse.MeasureChannels(0): 5.0}

When the channel to plot is not included in the channel_scales dictionary, scaling factor of that channel is overwritten by the value of scale argument. In default, waveform amplitude is normalized by the maximum amplitude of the channel. The scaling factor is displayed under the channel name alias.

반환값

A matplotlib figure object of the pulse schedule.

반환 형식

matplotlib.Figure

property duration

Duration of this schedule component.

반환 형식

int

exclude(*filter_funcs, channels=None, instruction_types=None, time_ranges=None, intervals=None)[소스]

Return a Schedule with only the instructions from this Schedule failing at least one of the provided filters. This method is the complement of self.filter, so that:

self.filter(args) | self.exclude(args) == self
매개변수
  • filter_funcs (List[Callable]) – A list of Callables which take a (int, ScheduleComponent) tuple and return a bool.

  • channels (Optional[Iterable[Channel]]) – For example, [DriveChannel(0), AcquireChannel(0)].

  • instruction_types (Optional[Iterable[Type[qiskit.pulse.Instruction]]]) – For example, [PulseInstruction, AcquireInstruction].

  • time_ranges (Optional[Iterable[Tuple[int, int]]]) – For example, [(0, 5), (6, 10)].

  • intervals (Optional[Iterable[Tuple[int, int]]]) – For example, [(0, 5), (6, 10)].

반환 형식

Schedule

filter(*filter_funcs, channels=None, instruction_types=None, time_ranges=None, intervals=None)[소스]

Return a new Schedule with only the instructions from this Schedule which pass though the provided filters; i.e. an instruction will be retained iff every function in filter_funcs returns True, the instruction occurs on a channel type contained in channels, the instruction type is contained in instruction_types, and the period over which the instruction operates is fully contained in one specified in time_ranges or intervals.

If no arguments are provided, self is returned.

매개변수
  • filter_funcs (List[Callable]) – A list of Callables which take a (int, ScheduleComponent) tuple and return a bool.

  • channels (Optional[Iterable[Channel]]) – For example, [DriveChannel(0), AcquireChannel(0)].

  • instruction_types (Optional[Iterable[Type[qiskit.pulse.Instruction]]]) – For example, [PulseInstruction, AcquireInstruction].

  • time_ranges (Optional[Iterable[Tuple[int, int]]]) – For example, [(0, 5), (6, 10)].

  • intervals (Optional[Iterable[Tuple[int, int]]]) – For example, [(0, 5), (6, 10)].

반환 형식

Schedule

flatten()[소스]

Return a new schedule which is the flattened schedule contained all instructions.

반환 형식

Schedule

insert(start_time, schedule, name=None, inplace=False)[소스]

Return a new schedule with schedule inserted into self at start_time.

매개변수
  • start_time (int) – Time to insert the schedule.

  • schedule (ScheduleComponent) – Schedule to insert.

  • name (Optional[str]) – Name of the new schedule. Defaults to the name of self.

  • inplace (bool) – Perform operation inplace on this schedule. Otherwise return a new Schedule.

반환 형식

Schedule

property instructions

Get the time-ordered instructions from self.

ReturnType:

Tuple[Tuple[int, Instruction], …]

property name

Name of ScheduleComponent.

반환 형식

str

replace(old, new, inplace=False)[소스]

Return a schedule with the old instruction replaced with a new instruction.

The replacment matching is based on an instruction equality check.

from qiskit import pulse

d0 = pulse.DriveChannel(0)

sched = pulse.Schedule()

old = pulse.Play(pulse.Constant(100, 1.0), d0)
new = pulse.Play(pulse.Constant(100, 0.1), d0)

sched += old

sched = sched.replace(old, new)

assert sched == pulse.Schedule(new)

Only matches at the top-level of the schedule tree. If you wish to perform this replacement over all instructions in the schedule tree. Flatten the schedule prior to running:

.. jupyter-execute::

sched = pulse.Schedule()

sched += pulse.Schedule(old)

sched = sched.flatten()

sched = sched.replace(old, new)

assert sched == pulse.Schedule(new)

매개변수
  • old (ScheduleComponent) – Instruction to replace.

  • new (ScheduleComponent) – Instruction to replace with.

  • inplace (bool) – Replace instruction by mutably modifying this Schedule.

반환 형식

Schedule

반환값

The modified schedule with old replaced by new.

예외

PulseError – If the Schedule after replacements will has a timing overlap.

shift(time, name=None, inplace=False)[소스]

Return a schedule shifted forward by time.

매개변수
  • time (int) – Time to shift by.

  • name (Optional[str]) – Name of the new schedule. Defaults to the name of self.

  • inplace (bool) – Perform operation inplace on this schedule. Otherwise return a new Schedule.

반환 형식

Schedule

property start_time

Starting time of this schedule component.

반환 형식

int

property stop_time

Stopping time of this schedule component.

반환 형식

int

property timeslots

Time keeping attribute.

반환 형식

Dict[Channel, List[Tuple[int, int]]]