55 lines
1.7 KiB
Plaintext
55 lines
1.7 KiB
Plaintext
---
|
||
title: frequency_offset (v0.26)
|
||
description: API reference for qiskit.pulse.builder.frequency_offset in qiskit v0.26
|
||
in_page_toc_min_heading_level: 1
|
||
python_api_type: function
|
||
python_api_name: qiskit.pulse.builder.frequency_offset
|
||
---
|
||
|
||
<span id="qiskit-pulse-builder-frequency-offset" />
|
||
|
||
# qiskit.pulse.builder.frequency\_offset
|
||
|
||
<Function id="qiskit.pulse.builder.frequency_offset" isDedicatedPage={true} github="https://github.com/qiskit/qiskit/tree/stable/0.17/qiskit/pulse/builder.py" signature="frequency_offset(frequency, *channels, compensate_phase=False)">
|
||
Shift the frequency of inputs channels on entry into context and undo on exit.
|
||
|
||
Examples:
|
||
|
||
```python
|
||
from qiskit import pulse
|
||
|
||
d0 = pulse.DriveChannel(0)
|
||
|
||
with pulse.build(backend) as pulse_prog:
|
||
# shift frequency by 1GHz
|
||
with pulse.frequency_offset(1e9, d0):
|
||
pulse.play(pulse.Constant(10, 1.0), d0)
|
||
|
||
assert len(pulse_prog.instructions) == 3
|
||
|
||
with pulse.build(backend) as pulse_prog:
|
||
# Shift frequency by 1GHz.
|
||
# Undo accumulated phase in the shifted frequency frame
|
||
# when exiting the context.
|
||
with pulse.frequency_offset(1e9, d0, compensate_phase=True):
|
||
pulse.play(pulse.Constant(10, 1.0), d0)
|
||
|
||
assert len(pulse_prog.instructions) == 4
|
||
```
|
||
|
||
**Parameters**
|
||
|
||
* **frequency** (`float`) – Amount of frequency offset in Hz.
|
||
* **channels** ([`PulseChannel`](qiskit.pulse.channels#pulsechannel "qiskit.pulse.channels.PulseChannel")) – Channels to offset frequency of.
|
||
* **compensate\_phase** (`bool`) – Compensate for accumulated phase accumulated with respect to the channels’ frame at its initial frequency.
|
||
|
||
**Yields**
|
||
|
||
None
|
||
|
||
**Return type**
|
||
|
||
`AbstractContextManager`\[`None`]
|
||
</Function>
|
||
|