qiskit-documentation/docs/api/qiskit/0.24/qiskit.pulse.instructions.S...

357 lines
17 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Snapshot
description: API reference for qiskit.pulse.instructions.Snapshot
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.pulse.instructions.Snapshot
---
<span id="qiskit-pulse-instructions-snapshot" />
# qiskit.pulse.instructions.Snapshot
<Class id="qiskit.pulse.instructions.Snapshot" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.16/qiskit/pulse/instructions/snapshot.py" signature="Snapshot(label, snapshot_type='statevector', name=None)" modifiers="class">
An instruction targeted for simulators, to capture a moment in the simulation.
Create new snapshot.
**Parameters**
* **label** (`str`) Snapshot label which is used to identify the snapshot in the output.
* **snapshot\_type** (`str`) Type of snapshot, e.g., “state” (take a snapshot of the quantum state). The types of snapshots offered are defined by the simulator used.
* **name** (`Optional`\[`str`]) Snapshot name which defaults to `label`. This parameter is only for display purposes and is not taken into account during comparison.
**Raises**
[**PulseError**](qiskit.pulse.PulseError "qiskit.pulse.PulseError") If snapshot label is invalid.
### \_\_init\_\_
<Function id="qiskit.pulse.instructions.Snapshot.__init__" signature="__init__(label, snapshot_type='statevector', name=None)">
Create new snapshot.
**Parameters**
* **label** (`str`) Snapshot label which is used to identify the snapshot in the output.
* **snapshot\_type** (`str`) Type of snapshot, e.g., “state” (take a snapshot of the quantum state). The types of snapshots offered are defined by the simulator used.
* **name** (`Optional`\[`str`]) Snapshot name which defaults to `label`. This parameter is only for display purposes and is not taken into account during comparison.
**Raises**
[**PulseError**](qiskit.pulse.PulseError "qiskit.pulse.PulseError") If snapshot label is invalid.
</Function>
## Methods
| | |
| ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`__init__`](#qiskit.pulse.instructions.Snapshot.__init__ "qiskit.pulse.instructions.Snapshot.__init__")(label\[, snapshot\_type, name]) | Create new snapshot. |
| [`append`](#qiskit.pulse.instructions.Snapshot.append "qiskit.pulse.instructions.Snapshot.append")(schedule\[, name]) | Return a new [`Schedule`](qiskit.pulse.Schedule "qiskit.pulse.Schedule") with `schedule` inserted at the maximum time over all channels shared between `self` and `schedule`. |
| [`assign_parameters`](#qiskit.pulse.instructions.Snapshot.assign_parameters "qiskit.pulse.instructions.Snapshot.assign_parameters")(value\_dict) | Modify and return self with parameters assigned according to the input. |
| [`ch_duration`](#qiskit.pulse.instructions.Snapshot.ch_duration "qiskit.pulse.instructions.Snapshot.ch_duration")(\*channels) | Return duration of the supplied channels in this Instruction. |
| [`ch_start_time`](#qiskit.pulse.instructions.Snapshot.ch_start_time "qiskit.pulse.instructions.Snapshot.ch_start_time")(\*channels) | Return minimum start time for supplied channels. |
| [`ch_stop_time`](#qiskit.pulse.instructions.Snapshot.ch_stop_time "qiskit.pulse.instructions.Snapshot.ch_stop_time")(\*channels) | Return maximum start time for supplied channels. |
| [`draw`](#qiskit.pulse.instructions.Snapshot.draw "qiskit.pulse.instructions.Snapshot.draw")(\[dt, style, filename, interp\_method, …]) | Plot the instruction. |
| [`flatten`](#qiskit.pulse.instructions.Snapshot.flatten "qiskit.pulse.instructions.Snapshot.flatten")() | Return itself as already single instruction. |
| [`insert`](#qiskit.pulse.instructions.Snapshot.insert "qiskit.pulse.instructions.Snapshot.insert")(start\_time, schedule\[, name]) | Return a new [`Schedule`](qiskit.pulse.Schedule "qiskit.pulse.Schedule") with `schedule` inserted within `self` at `start_time`. |
| [`shift`](#qiskit.pulse.instructions.Snapshot.shift "qiskit.pulse.instructions.Snapshot.shift")(time\[, name]) | Return a new schedule shifted forward by time. |
## Attributes
| | |
| -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`channel`](#qiskit.pulse.instructions.Snapshot.channel "qiskit.pulse.instructions.Snapshot.channel") | Return the [`Channel`](qiskit.pulse.channels#channel "qiskit.pulse.channels.Channel") that this instruction is scheduled on; trivially, a `SnapshotChannel`. |
| [`channels`](#qiskit.pulse.instructions.Snapshot.channels "qiskit.pulse.instructions.Snapshot.channels") | Returns channels that this schedule uses. |
| [`command`](#qiskit.pulse.instructions.Snapshot.command "qiskit.pulse.instructions.Snapshot.command") | The associated command. |
| [`duration`](#qiskit.pulse.instructions.Snapshot.duration "qiskit.pulse.instructions.Snapshot.duration") | Duration of this instruction. |
| [`id`](#qiskit.pulse.instructions.Snapshot.id "qiskit.pulse.instructions.Snapshot.id") | Unique identifier for this instruction. |
| [`instructions`](#qiskit.pulse.instructions.Snapshot.instructions "qiskit.pulse.instructions.Snapshot.instructions") | Iterable for getting instructions from Schedule tree. |
| [`label`](#qiskit.pulse.instructions.Snapshot.label "qiskit.pulse.instructions.Snapshot.label") | Label of snapshot. |
| [`name`](#qiskit.pulse.instructions.Snapshot.name "qiskit.pulse.instructions.Snapshot.name") | Name of this instruction. |
| [`operands`](#qiskit.pulse.instructions.Snapshot.operands "qiskit.pulse.instructions.Snapshot.operands") | Return instruction operands. |
| [`start_time`](#qiskit.pulse.instructions.Snapshot.start_time "qiskit.pulse.instructions.Snapshot.start_time") | Relative begin time of this instruction. |
| [`stop_time`](#qiskit.pulse.instructions.Snapshot.stop_time "qiskit.pulse.instructions.Snapshot.stop_time") | Relative end time of this instruction. |
| [`timeslots`](#qiskit.pulse.instructions.Snapshot.timeslots "qiskit.pulse.instructions.Snapshot.timeslots") | Occupied time slots by this instruction. |
| [`type`](#qiskit.pulse.instructions.Snapshot.type "qiskit.pulse.instructions.Snapshot.type") | Type of snapshot. |
### append
<Function id="qiskit.pulse.instructions.Snapshot.append" signature="append(schedule, name=None)">
Return a new [`Schedule`](qiskit.pulse.Schedule "qiskit.pulse.Schedule") with `schedule` inserted at the maximum time over all channels shared between `self` and `schedule`.
**Parameters**
* **schedule** (`ScheduleComponent`) schedule to be appended
* **name** (`Optional`\[`str`]) Name of the new schedule. Defaults to name of self
**Return type**
`Schedule`
</Function>
### assign\_parameters
<Function id="qiskit.pulse.instructions.Snapshot.assign_parameters" signature="assign_parameters(value_dict)">
Modify and return self with parameters assigned according to the input.
**Parameters**
**value\_dict** (`Dict`\[`ParameterExpression`, `Union`\[`ParameterExpression`, `float`, `int`]]) A mapping from Parameters to either numeric values or another Parameter expression.
**Return type**
`Instruction`
**Returns**
Self with updated parameters.
</Function>
### ch\_duration
<Function id="qiskit.pulse.instructions.Snapshot.ch_duration" signature="ch_duration(*channels)">
Return duration of the supplied channels in this Instruction.
**Parameters**
**\*channels** Supplied channels
**Return type**
`int`
</Function>
### ch\_start\_time
<Function id="qiskit.pulse.instructions.Snapshot.ch_start_time" signature="ch_start_time(*channels)">
Return minimum start time for supplied channels.
**Parameters**
**\*channels** Supplied channels
**Return type**
`int`
</Function>
### ch\_stop\_time
<Function id="qiskit.pulse.instructions.Snapshot.ch_stop_time" signature="ch_stop_time(*channels)">
Return maximum start time for supplied channels.
**Parameters**
**\*channels** Supplied channels
**Return type**
`int`
</Function>
### channel
<Attribute id="qiskit.pulse.instructions.Snapshot.channel">
Return the [`Channel`](qiskit.pulse.channels#channel "qiskit.pulse.channels.Channel") that this instruction is scheduled on; trivially, a `SnapshotChannel`.
**Return type**
[`SnapshotChannel`](qiskit.pulse.channels#snapshotchannel "qiskit.pulse.channels.SnapshotChannel")
</Attribute>
### channels
<Attribute id="qiskit.pulse.instructions.Snapshot.channels">
Returns channels that this schedule uses.
**Return type**
`Tuple`\[[`Channel`](qiskit.pulse.channels#channel "qiskit.pulse.channels.Channel")]
</Attribute>
### command
<Attribute id="qiskit.pulse.instructions.Snapshot.command">
The associated command. Commands are deprecated, so this method will be deprecated shortly.
**Returns**
The deprecated command if available.
**Return type**
[Command](qiskit.providers.models.Command "qiskit.providers.models.Command")
</Attribute>
### draw
<Function id="qiskit.pulse.instructions.Snapshot.draw" signature="draw(dt=1, style=None, filename=None, interp_method=None, scale=1, plot_all=False, plot_range=None, interactive=False, table=True, label=False, framechange=True, channels=None)">
Plot the instruction.
**Parameters**
* **dt** (`float`) Time interval of samples
* **style** (*Optional\[*[*SchedStyle*](qiskit.visualization.pulse.qcstyle#schedstyle "qiskit.visualization.pulse.qcstyle.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** (`float`) Relative visual scaling of waveform amplitudes
* **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 instructions
* **label** (`bool`) Label individual instructions
* **framechange** (`bool`) Add framechange indicators
* **channels** (`Optional`\[`List`\[[`Channel`](qiskit.pulse.channels#channel "qiskit.pulse.channels.Channel")]]) A list of channel names to plot
**Returns**
A matplotlib figure object of the pulse schedule
**Return type**
matplotlib.figure
</Function>
### duration
<Attribute id="qiskit.pulse.instructions.Snapshot.duration">
Duration of this instruction.
**Return type**
`int`
</Attribute>
### flatten
<Function id="qiskit.pulse.instructions.Snapshot.flatten" signature="flatten()">
Return itself as already single instruction.
**Return type**
`Instruction`
</Function>
### id
<Attribute id="qiskit.pulse.instructions.Snapshot.id">
Unique identifier for this instruction.
**Return type**
`int`
</Attribute>
### insert
<Function id="qiskit.pulse.instructions.Snapshot.insert" signature="insert(start_time, schedule, name=None)">
Return a new [`Schedule`](qiskit.pulse.Schedule "qiskit.pulse.Schedule") with `schedule` inserted within `self` at `start_time`.
**Parameters**
* **start\_time** (`int`) Time to insert the schedule schedule
* **schedule** (`ScheduleComponent`) Schedule to insert
* **name** (`Optional`\[`str`]) Name of the new schedule. Defaults to name of self
**Return type**
`Schedule`
</Function>
### instructions
<Attribute id="qiskit.pulse.instructions.Snapshot.instructions">
Iterable for getting instructions from Schedule tree.
**Return type**
`Tuple`\[`Tuple`\[`int`, `Instruction`]]
</Attribute>
### label
<Attribute id="qiskit.pulse.instructions.Snapshot.label">
Label of snapshot.
**Return type**
`str`
</Attribute>
### name
<Attribute id="qiskit.pulse.instructions.Snapshot.name">
Name of this instruction.
**Return type**
`str`
</Attribute>
### operands
<Attribute id="qiskit.pulse.instructions.Snapshot.operands">
Return instruction operands.
**Return type**
`Tuple`
</Attribute>
### shift
<Function id="qiskit.pulse.instructions.Snapshot.shift" signature="shift(time, name=None)">
Return a new schedule shifted forward by time.
**Parameters**
* **time** (`int`) Time to shift by
* **name** (`Optional`\[`str`]) Name of the new schedule. Defaults to name of self
**Return type**
`Schedule`
</Function>
### start\_time
<Attribute id="qiskit.pulse.instructions.Snapshot.start_time">
Relative begin time of this instruction.
**Return type**
`int`
</Attribute>
### stop\_time
<Attribute id="qiskit.pulse.instructions.Snapshot.stop_time">
Relative end time of this instruction.
**Return type**
`int`
</Attribute>
### timeslots
<Attribute id="qiskit.pulse.instructions.Snapshot.timeslots">
Occupied time slots by this instruction.
**Return type**
`Dict`\[[`Channel`](qiskit.pulse.channels#channel "qiskit.pulse.channels.Channel"), `List`\[`Tuple`\[`int`, `int`]]]
</Attribute>
### type
<Attribute id="qiskit.pulse.instructions.Snapshot.type">
Type of snapshot.
**Return type**
`str`
</Attribute>
</Class>