Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QM driver for 0.2 #874

Closed
wants to merge 234 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
a84b20b
Inherit PulseSequence from list, remove redundant methods
alecandido Jan 15, 2024
f7b6951
Replace usage of removed methods in pulses module
alecandido Jan 16, 2024
3ae3e3f
Replace usage of removed methods everywhere
alecandido Jan 16, 2024
17ddaf9
Replace add with the standard append function
alecandido Jan 16, 2024
4644fc4
Fix sequence iteration in backends
alecandido Jan 16, 2024
fabb393
Fix compiler tests related to sequences
alecandido Jan 16, 2024
62c25b0
Fix tests directly targeted to pulses
alecandido Jan 16, 2024
2864467
Differentiate append from extend in dummies tests after add remotion
alecandido Jan 16, 2024
b3b0993
Wrap default copy, fix rfsoc tests
alecandido Jan 16, 2024
f617278
Add docstrings to wrapper methods
alecandido Jan 16, 2024
9ad0c12
Fix QM tests
alecandido Jan 16, 2024
4ebc32d
Fix doctests, first batch
alecandido Jan 16, 2024
9e741a5
Fix remaining doctests
alecandido Jan 16, 2024
ebe321d
Fix compiler tests related to sequences
alecandido Jan 16, 2024
48f5aae
Drop pulse.serial
alecandido Jan 12, 2024
3f23067
Replace even more instances of direct serial access
alecandido Jan 12, 2024
1cbef21
Fix some Pulse special methods
alecandido Jan 12, 2024
6d8b291
Fix hash and part of notebook
alecandido Jan 12, 2024
63c3b5a
Drop Waveform.serial, in base class and subclasses
alecandido Jan 17, 2024
8ac9c9a
Mock frozen dataclass hash for Pulse
alecandido Jan 17, 2024
2960d73
Fix some docstrings related warnings
alecandido Jan 17, 2024
6dff9a7
Fix dummy tests, avoid serial check
alecandido Jan 17, 2024
10bc33f
Fix pulses tests, mainly dropping those based on the string represent…
alecandido Jan 17, 2024
fd0c78c
Fix rfsoc test, mostly broken by programmatic replacements
alecandido Jan 17, 2024
4cee4d5
Replace waveform.serial with underlying data hash
alecandido Jan 17, 2024
0dfcae3
Add note about waveform hash (lacking) reliability
alecandido Jan 17, 2024
1e130c2
Fix QM issues by stringifying pulses ID
alecandido Jan 17, 2024
962245d
Drop serial from pulse subclasses
alecandido Jan 17, 2024
390e186
Remove duplicated hash method
alecandido Jan 17, 2024
eae6b96
Drop Pulse subclasses
alecandido Jan 18, 2024
e3c1367
Introduce alternative (simplified) constructor for flux pulses
alecandido Jan 18, 2024
4ba3275
Replace usage of pulse subclasses (import related)
alecandido Jan 18, 2024
c6ee230
Strip all imports of removed objects
alecandido Jan 18, 2024
3af5f4a
Fix backends test, remove explicit copy methods
alecandido Jan 18, 2024
de22bec
Fix compilers tests
alecandido Jan 18, 2024
ca626cf
Fix pulses tests
alecandido Jan 18, 2024
d0e85f0
Fix QM tests
alecandido Jan 18, 2024
c024bf6
Fix tests for dummy
alecandido Jan 18, 2024
6a2e5d5
Fix Zurich tests
alecandido Jan 18, 2024
b6cf92c
Remove leftover calls to pulse specific copy
alecandido Jan 18, 2024
d4fcc9c
Fix doctests
alecandido Jan 18, 2024
ff5f26b
Remove intermediate frequency from pulse
alecandido Jan 18, 2024
d1baf5c
Pass explicitly the if to modulated waveform tests
alecandido Jan 18, 2024
7e00d07
Propagate IF parameter to all modulated call
alecandido Jan 18, 2024
8721853
Start rearranging pulses into a subpackage
alecandido Jan 18, 2024
add88e6
Exports relevant objects from pulses subpackage, fix internal imports
alecandido Jan 18, 2024
105d86a
Remove pulse combination methods
alecandido Jan 18, 2024
bf27f9b
Move sequence plotting to dedicated module
alecandido Jan 18, 2024
b2a108a
Fix plotting tests, require explicit import
alecandido Jan 18, 2024
d09244d
Turn waveform into a bare array
alecandido Jan 19, 2024
f9b285c
Drop data access for waveforms
alecandido Jan 19, 2024
46233be
Drop type checks in tests involving waveforms
alecandido Jan 19, 2024
7fb39a0
Replace waveform hash, since NumPy array are unhashable (because muta…
alecandido Jan 19, 2024
19d0b9e
feat(nix): Export convenience env var
alecandido Jan 29, 2024
bdcb44e
fix: serial to id migration for fixed rfsoc tests
alecandido Jan 29, 2024
d04069f
chore: Drop pulses tutorial
alecandido Jan 29, 2024
21e29e9
test: Drop flux pulse test
alecandido Jan 30, 2024
0890e34
test: fix conflicts in tests
stavros11 Feb 21, 2024
6363926
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 21, 2024
7d60446
feat: Split software modulation out of the shape class
alecandido Jan 29, 2024
d4b33be
feat: Remove modulated waveforms access from pulses
alecandido Jan 29, 2024
95666ed
fix: Replace usage of software modulation in Qblox
alecandido Jan 29, 2024
8c024a3
feat: Replace demodulation defined in qblox with global one
alecandido Jan 29, 2024
0f9ef45
test: Move pulse tests into a folder, split sequence ones
alecandido Jan 29, 2024
112cc4b
test: Split shape-related tests into their own module
alecandido Jan 29, 2024
bfbc98e
test: Split also plotting tests on their own
alecandido Jan 29, 2024
be9c593
test: Remove tests on dropped methods
alecandido Jan 30, 2024
a91e6b2
fix: Use the new software modulation in plotting functions and relate…
alecandido Jan 30, 2024
82979ab
test: Add test for new-format software (de)modulation
alecandido Jan 30, 2024
688c88c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2024
156802c
Update src/qibolab/instruments/qblox/acquisition.py
alecandido Feb 2, 2024
51699c1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 22, 2024
3eacca5
test: Add regression test for software modulation
alecandido Feb 22, 2024
1712922
test: fix tests
stavros11 Mar 20, 2024
4091ab4
fix: wrong merge
stavros11 Mar 20, 2024
35f9b4f
fix: drop .data attribute from shape in ZI
stavros11 Mar 20, 2024
acc953b
Drop pulse.serial
alecandido Jan 12, 2024
e7c9bdd
Fix QM issues by stringifying pulses ID
alecandido Jan 17, 2024
a10caf8
Fix QM tests
alecandido Jan 18, 2024
2060804
Replace pulse.start with Delay object
stavros11 Jan 29, 2024
1d5e1fa
refactor: drop unused PulseSequence methods
stavros11 Jan 30, 2024
d78bd28
refactor: Simplify native.py
stavros11 Jan 30, 2024
5188f65
refactor: Remove pulse.start from platform and sweeper
stavros11 Jan 30, 2024
a267dc1
refactor: stop using create_* in default compiler
stavros11 Feb 23, 2024
a18d7b1
fix: remove pulse.start from compiler
stavros11 Feb 23, 2024
7d74296
fix: remove relative_start from dummy_qrc runcards
stavros11 Feb 23, 2024
0923e1c
fix: remove relative_start from dummy
stavros11 Feb 23, 2024
5e6859b
fix: pylint
stavros11 Feb 23, 2024
a609b6c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 30, 2024
2b9c697
chore: remove phase from dummy runcards
stavros11 Mar 1, 2024
71ed230
chore: remove phase from dummy platform
stavros11 Mar 1, 2024
9cf5dbe
chore: remove phase from dummy platform
stavros11 Mar 1, 2024
1fe88bb
test: first batch of fixing tests
stavros11 Mar 1, 2024
17f0040
test: fix pulse tests
stavros11 Mar 1, 2024
4119c5b
chore: fix pylint
stavros11 Mar 1, 2024
945b94d
docs: update and fix doctests
stavros11 Mar 1, 2024
b45f9cf
feat: Add VirtualZ pulse
stavros11 Mar 4, 2024
8f92ee7
fix: platform serialization test
stavros11 Mar 4, 2024
bc1726a
test: remove negative drag from test runcards (see #826)
stavros11 Mar 4, 2024
c332abc
fix: compiler and tests
stavros11 Mar 4, 2024
ad91f43
Fix Zurich tests
alecandido Jan 18, 2024
ae37590
test: fix conflicts in tests
stavros11 Feb 21, 2024
fc31abb
fix: tests after merging (compiler tests still failing)
stavros11 Mar 21, 2024
eff36f4
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 21, 2024
df94773
fix: compiler tests
stavros11 Mar 21, 2024
d6b4273
refactor: simplify compiler rules
stavros11 Mar 21, 2024
a933d3c
refactor: native two qubit to empty PulseSequence
stavros11 Mar 21, 2024
d7a52f8
fix: doctest
stavros11 Mar 21, 2024
8dd0752
refactor: remove clock from unrolling
stavros11 Mar 21, 2024
5f2afad
fix: remove FluxPulse
stavros11 Apr 15, 2024
d77372d
Remove leftover calls to pulse specific copy
alecandido Jan 18, 2024
f738c7e
Start rearranging pulses into a subpackage
alecandido Jan 18, 2024
9d1f433
test: fix tests
stavros11 Mar 20, 2024
d42b595
feat: Drop ShapeInitError in favor of pulse default value
alecandido Feb 23, 2024
11f2987
feat: Sketch the new Shape template
alecandido Feb 23, 2024
32360cf
feat: Trim the Rectangular pulse
alecandido Feb 23, 2024
434a6d3
feat: Add a Shapes enum, for sum-types deserialization
alecandido Feb 23, 2024
9f4259d
feat: Rework the Exponential shape
alecandido Feb 23, 2024
f59730e
feat!: Move Gaussian pulse to new shape
alecandido Feb 28, 2024
ec54648
feat: Add default implementation for shape components
alecandido Feb 28, 2024
cbff53b
feat!: Move GaussianSquare to new shape
alecandido Feb 28, 2024
b8ad489
feat!: Move DRAG to new shape
alecandido Feb 28, 2024
5554494
feat!: Move IIR to new shape
alecandido Feb 28, 2024
743fc98
feat!: Move SNZ to new shape
alecandido Feb 28, 2024
4efcb27
feat!: Move eCap to new shape
alecandido Feb 28, 2024
873dff6
feat!: Move Custom to new shape
alecandido Feb 28, 2024
7362e9e
feat!: Export only shapes container
alecandido Feb 28, 2024
981757f
refactor: Split software modulation and related tests
alecandido Feb 28, 2024
0a0f059
feat: rename Shape to Envelope
alecandido Mar 5, 2024
4226b9c
docs: Describe the expected times, restricting the original purpose
alecandido Mar 5, 2024
0698d1e
feat: Move Gaussian pulses back to their original variables
alecandido Mar 5, 2024
0eaf10a
feat: Propagate window to drag and iir
alecandido Mar 5, 2024
62fae85
feat: Propagate envelopes to Pulse
alecandido Mar 5, 2024
6d21532
feat: Keep the amplitude in the pulse, drop it in the shape
alecandido Mar 5, 2024
c9727f5
build: Exclude CC library in Nix shell for Linux
alecandido Mar 12, 2024
3d78b12
feat: Represent times as the parameters of linspace
alecandido Mar 12, 2024
db89498
test: Solve pytest collection errors for pulses tests
alecandido Mar 15, 2024
e0bb278
test: Fix remaining pytests collection errors
alecandido Mar 15, 2024
d2771dd
fix: Drop shape initialization in pulse post init
alecandido Mar 15, 2024
324e4c2
fix: Fully drop post-init in pulse
alecandido Mar 15, 2024
c55aa96
fix: Propagate envelopes to modulation tests
alecandido Mar 15, 2024
6265dec
test: Simplify modualtion tests, decouple from pulses
alecandido Mar 15, 2024
feba325
test: Fix errors in pulse
alecandido Mar 15, 2024
0379608
build: Upgrade Nix shell to use Poetry 1.8
alecandido Mar 18, 2024
516110a
build: Add linting deps to dev shell
alecandido Mar 18, 2024
c0628ee
feat!: Reintroduce sampling rate argument for pulse envelope retrieval
alecandido Mar 18, 2024
3734089
fix: Move default sampling rate to plots, drop from modulation
alecandido Mar 18, 2024
ef315e4
feat: Export explicitly all envelopes types
alecandido Mar 21, 2024
d9a7dd9
fix: Update envelope names
alecandido Mar 21, 2024
4cd9710
fix: Propagate shape to envelope update in zhinst
alecandido Mar 21, 2024
06f3eab
feat!: Start introducing pydantic
alecandido Mar 21, 2024
d74d294
fix: Propagate Pydantic models to Pulse
alecandido Mar 21, 2024
2e702db
fix: Propagate Pydantic models to Pulse-like classes
alecandido Mar 21, 2024
4dfc227
fix: Fix Pylint errors
alecandido Mar 21, 2024
7cb182b
feat: Add custom NumPy (de)serializer)
alecandido Mar 21, 2024
b72bed4
fix: Adopt qibolab global model in pydantic-aware classes
alecandido Mar 21, 2024
b928897
fix: Solve import-related issues in tests
alecandido Mar 21, 2024
399605b
fix: Solve all Pytest collection errors
alecandido Mar 21, 2024
ff6cc7e
fix: Partial dummy runcard update
alecandido Mar 22, 2024
b68af4d
build: Upgrade devenv version
alecandido Mar 22, 2024
0690280
feat: Tag pulse envelopes for more reliable discrimination during des…
alecandido Mar 22, 2024
3533e38
fix: Add defaults to discriminator, include them in dummy
alecandido Mar 23, 2024
a86c3e4
feat!: Move duration from pulse to envelope
alecandido Mar 23, 2024
10a547a
feat!: Move duration back to pulse
alecandido Mar 25, 2024
cdd9449
feat: Add model equality account for numpy arrays
alecandido Mar 27, 2024
fcf980c
test: Explicit keyword arguments for envelope tests
alecandido Mar 27, 2024
b197cb5
fix: Install custom equality for array dependent envelopes
alecandido Mar 27, 2024
71d2d91
test: Fix drag tests
alecandido Mar 27, 2024
092ac1c
test: Fix all envelope tests
alecandido Mar 27, 2024
cc16251
test: Fix plot tests
alecandido Mar 27, 2024
9782f15
test: Fix most pulse tests
alecandido Mar 27, 2024
4e58c03
test: Fix pulse sequences tests
alecandido Mar 28, 2024
d360b68
test: Use parent class BaseEnvelope for instance check, instead of th…
alecandido Mar 28, 2024
b62cb9e
feat: Make all pydantic models frozen
alecandido Mar 28, 2024
bb69e2a
feat: Propagate pydantic models to execution parameters, fix backend …
alecandido Mar 28, 2024
0198879
test: Fix default compiler tests
alecandido Mar 28, 2024
3856f78
test: Fix unrolling tests
alecandido Mar 28, 2024
367840c
test: Fix sweepers tests
alecandido Mar 28, 2024
e240f41
fix: Replace some further occurrences of shape, related to platform
alecandido Mar 28, 2024
73c555e
test: Fix dummy tests
alecandido Mar 29, 2024
4724429
test: Drop pickle test, not used any longer
alecandido Mar 29, 2024
bab716e
fix: Fix runcard dump
alecandido Mar 29, 2024
7a34a66
test: Fix the doctests
alecandido Mar 29, 2024
f0b297a
fix: Change exponential parameters units, from samples to duration
alecandido Mar 30, 2024
4758a16
chore: Fix rebase leftover
alecandido Apr 15, 2024
34dba9e
fix: Remove (again) duration from GaussianSquare envelope
alecandido Apr 15, 2024
33b733d
Improve envelopes' docstrings
alecandido Apr 16, 2024
3157b71
Drop pulse.serial
alecandido Jan 12, 2024
71983e1
Fix QM issues by stringifying pulses ID
alecandido Jan 17, 2024
ab9f25a
feat(nix): Export convenience env var
alecandido Jan 29, 2024
8482181
fix: tests after merging (compiler tests still failing)
stavros11 Mar 21, 2024
2c542d7
test: Fix remaining pytests collection errors
alecandido Mar 15, 2024
604abf1
fix: Propagate Pydantic models to Pulse
alecandido Mar 21, 2024
c9a8ce5
fix: Solve import-related issues in tests
alecandido Mar 21, 2024
697d3a0
fix: Use pydantic to parse pulses, instead of relying on manual ident…
alecandido Apr 8, 2024
6b9b8c6
fix: Subclass pulse for automated flux recognition
alecandido Apr 8, 2024
80f7f7f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2024
d614660
fix: Rebase leftover
alecandido Jun 25, 2024
af9bb18
chore: Poetry lock
alecandido Jun 25, 2024
ed4bdcd
chore: remove FluxPulse object and add frequency: 0 to flux pulses in…
stavros11 May 2, 2024
3a755d7
fix: Propagate some 0.2 updates to the emulator
alecandido Jun 25, 2024
4908763
build: Update Nix configuration
alecandido Jun 25, 2024
3ed320c
build: Unlock emulator dependencies
alecandido Jun 25, 2024
7cbafde
fix: Update qutip imports to new major
alecandido Jun 25, 2024
7b2d302
ci: Attempt to upgrade macos to ARM
alecandido Jun 26, 2024
da5b70c
fix: Fix qubit pair class construction, to account for new optional a…
alecandido Jun 26, 2024
1bb88e4
test: Temporarily ignore emulator tests
alecandido Jun 26, 2024
fe98b14
docs: Comment emulator doc test
alecandido Jun 26, 2024
1b80394
ci: Upgrade all workflows to macos arm
alecandido Jun 26, 2024
383d3c9
Merge pull request #870 from qiboteam/propagate-serialization
alecandido Jun 26, 2024
6213a02
Fix QM issues by stringifying pulses ID
alecandido Jan 17, 2024
cf5a583
Strip all imports of removed objects
alecandido Jan 18, 2024
17c05fa
Fix backends test, remove explicit copy methods
alecandido Jan 18, 2024
9124341
Start rearranging pulses into a subpackage
alecandido Jan 18, 2024
5030a7c
Turn waveform into a bare array
alecandido Jan 19, 2024
ed56d4e
fix: wrong merge
stavros11 Mar 20, 2024
8c8170f
Drop pulse.serial
alecandido Jan 12, 2024
37513b5
Fix QM issues by stringifying pulses ID
alecandido Jan 17, 2024
3b02702
fix: pylint
stavros11 Feb 23, 2024
9fc21b2
fix: compiler and tests
stavros11 Mar 4, 2024
abcaeb1
fix: tests after merging (compiler tests still failing)
stavros11 Mar 21, 2024
b1c4d1b
Start rearranging pulses into a subpackage
alecandido Jan 18, 2024
3f8eda7
test: Fix remaining pytests collection errors
alecandido Mar 15, 2024
8e1d05b
fix: Propagate Pydantic models to Pulse
alecandido Mar 21, 2024
64fcfc3
fix: Solve import-related issues in tests
alecandido Mar 21, 2024
69003c9
feat: Propagate pydantic models to execution parameters, fix backend …
alecandido Mar 28, 2024
b43517b
chore: Poetry lock
alecandido Apr 15, 2024
574c934
refactor: Drop QM specific sequences and pulses
stavros11 Apr 20, 2024
765a1a3
fix: single shot classification works
stavros11 Apr 20, 2024
4263426
refactor: drop old serialization and hash
stavros11 Apr 20, 2024
2772911
fix: duration sweeper
stavros11 Apr 22, 2024
62d8d48
fix: unrolling tested with single shot routine
stavros11 Apr 23, 2024
4959583
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 4, 2024
c3d9226
fix: rebasing gone wrong
stavros11 Jul 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
fi

nix_direnv_watch_file flake.nix
nix_direnv_watch_file flake.lock
watch_file flake.nix
watch_file flake.lock
if ! use flake . --impure; then
echo "devenv could not be built. The devenv environment was not loaded. Make the necessary changes to devenv.nix and hit enter to try again." >&2
fi
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
python-version: [3.9, '3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, "3.10", "3.11"]
uses: qiboteam/workflows/.github/workflows/deploy-pip-poetry.yml@main
with:
os: ${{ matrix.os }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
python-version: [3.9, '3.10', '3.11']
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, "3.10", "3.11"]
uses: qiboteam/workflows/.github/workflows/rules-poetry.yml@main
with:
os: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rustapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest, macos-13]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,36 @@ A simple example on how to connect to a platform and use it execute a pulse sequ

```python
from qibolab import create_platform, ExecutionParameters
from qibolab.pulses import DrivePulse, ReadoutPulse, PulseSequence
from qibolab.pulses import Pulse, Delay, PulseType

# Define PulseSequence
sequence = PulseSequence()
# Add some pulses to the pulse sequence
sequence.add(
DrivePulse(
start=0,
sequence.append(
Pulse(
amplitude=0.3,
duration=4000,
frequency=200_000_000,
relative_phase=0,
shape="Gaussian(5)", # Gaussian shape with std = duration / 5
type=PulseType.DRIVE,
channel=1,
)
)

sequence.add(
sequence.append(
Delay(
duration=4000,
channel=2,
)
)
sequence.append(
ReadoutPulse(
start=4004,
amplitude=0.9,
duration=2000,
frequency=20_000_000,
relative_phase=0,
shape="Rectangular",
type=PulseType.READOUT,
channel=2,
)
)
Expand Down
10 changes: 3 additions & 7 deletions doc/source/getting-started/experiment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,13 @@ And the we can define the runcard ``my_platform/parameters.json``:
"frequency": 5500000000,
"shape": "Gaussian(3)",
"type": "qd",
"start": 0,
"phase": 0
},
"MZ": {
"duration": 2000,
"amplitude": 0.02,
"frequency": 7370000000,
"shape": "Rectangular()",
"type": "ro",
"start": 0,
"phase": 0
}
}
},
Expand Down Expand Up @@ -193,8 +189,8 @@ We leave to the dedicated tutorial a full explanation of the experiment, but her

# define the pulse sequence
sequence = PulseSequence()
ro_pulse = platform.create_MZ_pulse(qubit=0, start=0)
sequence.add(ro_pulse)
ro_pulse = platform.create_MZ_pulse(qubit=0)
sequence.append(ro_pulse)

# define a sweeper for a frequency scan
sweeper = Sweeper(
Expand All @@ -215,7 +211,7 @@ We leave to the dedicated tutorial a full explanation of the experiment, but her
results = platform.sweep(sequence, options, sweeper)

# plot the results
amplitudes = results[ro_pulse.serial].magnitude
amplitudes = results[ro_pulse.id].magnitude
frequencies = np.arange(-2e8, +2e8, 1e6) + ro_pulse.frequency

plt.title("Resonator Spectroscopy")
Expand Down
113 changes: 51 additions & 62 deletions doc/source/main-documentation/qibolab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,13 @@ Now we can create a simple sequence (again, without explicitly giving any qubit

.. testcode:: python

from qibolab.pulses import PulseSequence
from qibolab.pulses import PulseSequence, Delay

ps = PulseSequence()
ps.add(platform.create_RX_pulse(qubit=0, start=0)) # start time is in ns
ps.add(platform.create_RX_pulse(qubit=0, start=100))
ps.add(platform.create_MZ_pulse(qubit=0, start=200))
ps.append(platform.create_RX_pulse(qubit=0))
ps.append(platform.create_RX_pulse(qubit=0))
ps.append(Delay(duration=200, channel=platform.qubits[0].readout.name))
ps.append(platform.create_MZ_pulse(qubit=0))

Now we can execute the sequence on hardware:

Expand Down Expand Up @@ -126,9 +127,9 @@ will create a dummy platform that also has coupler qubits.
Emulator platform
^^^^^^^^^^^^^^^^^

QiboLab supports the use of emulators to simulate the behavior of quantum devices. It uses :class:`qibolab.instruments.emulator.pulse_simulator.PulseSimulator`, which is a controller that utilizes a simulation engine to numerically solve the dynamics of the device in the presence of control pulse sequences specified by :class:`qibolab.pulses.PulseSequence`. The emulator platform for a specific device requires its own platform folder and can be initialized in the same way as any other real platforms:
QiboLab supports the use of emulators to simulate the behavior of quantum devices. It uses :class:`qibolab.instruments.emulator.pulse_simulator.PulseSimulator`, which is a controller that utilizes a simulation engine to numerically solve the dynamics of the device in the presence of control pulse sequences specified by :class:`qibolab.pulses.PulseSequence`. The emulator platform for a specific device requires its own platform folder and can be initialized in the same way as any other real platforms::

.. testcode:: python_emulator
# .. testcode:: python_emulator

import os
from pathlib import Path
Expand Down Expand Up @@ -275,12 +276,6 @@ Pulses
In Qibolab, an extensive API is available for working with pulses and pulse sequences, a fundamental aspect of quantum experiments.
At the heart of this API is the :class:`qibolab.pulses.Pulse` object, which empowers users to define and customize pulses with specific parameters.

The API provides specialized subclasses tailored to the main types of pulses typically used in quantum experiments:

- Readout Pulses (:class:`qibolab.pulses.ReadoutPulse`)
- Drive Pulses (:class:`qibolab.pulses.DrivePulse`)
- Flux Pulses (:class:`qibolab.pulses.FluxPulse`)

Each pulse is associated with a channel and a qubit.
Additionally, pulses are defined by a shape, represented by a subclass of :class:`qibolab.pulses.PulseShape`.
Qibolab offers a range of pre-defined pulse shapes:
Expand All @@ -301,31 +296,29 @@ To illustrate, here are some examples of single pulses using the Qibolab API:
from qibolab.pulses import Pulse, Rectangular

pulse = Pulse(
start=0, # Timing, always in nanoseconds (ns)
duration=40, # Pulse duration in ns
amplitude=0.5, # Amplitude relative to instrument range
frequency=1e8, # Frequency in Hz
relative_phase=0, # Phase in radians
shape=Rectangular(),
envelope=Rectangular(),
channel="channel",
type="qd", # Enum type: :class:`qibolab.pulses.PulseType`
qubit=0,
)

In this way, we defined a rectangular drive pulse using the generic Pulse object.
Alternatively, you can achieve the same result using the dedicated :class:`qibolab.pulses.DrivePulse` object:
Alternatively, you can achieve the same result using the dedicated :class:`qibolab.pulses.Pulse` object:

.. testcode:: python

from qibolab.pulses import DrivePulse, Rectangular
from qibolab.pulses import Pulse, Rectangular

pulse = DrivePulse(
start=0, # timing, in all qibolab, is expressed in ns
duration=40,
pulse = Pulse(
duration=40, # timing, in all qibolab, is expressed in ns
amplitude=0.5, # this amplitude is relative to the range of the instrument
frequency=1e8, # frequency are in Hz
relative_phase=0, # phases are in radians
shape=Rectangular(),
envelope=Rectangular(),
channel="channel",
qubit=0,
)
Expand All @@ -340,65 +333,58 @@ To organize pulses into sequences, Qibolab provides the :class:`qibolab.pulses.P

sequence = PulseSequence()

pulse1 = DrivePulse(
start=0, # timing, in all qibolab, is expressed in ns
duration=40,
pulse1 = Pulse(
duration=40, # timing, in all qibolab, is expressed in ns
amplitude=0.5, # this amplitude is relative to the range of the instrument
frequency=1e8, # frequency are in Hz
relative_phase=0, # phases are in radians
shape=Rectangular(),
envelope=Rectangular(),
channel="channel",
qubit=0,
)
pulse2 = DrivePulse(
start=0, # timing, in all qibolab, is expressed in ns
duration=40,
pulse2 = Pulse(
duration=40, # timing, in all qibolab, is expressed in ns
amplitude=0.5, # this amplitude is relative to the range of the instrument
frequency=1e8, # frequency are in Hz
relative_phase=0, # phases are in radians
shape=Rectangular(),
envelope=Rectangular(),
channel="channel",
qubit=0,
)
pulse3 = DrivePulse(
start=0, # timing, in all qibolab, is expressed in ns
duration=40,
pulse3 = Pulse(
duration=40, # timing, in all qibolab, is expressed in ns
amplitude=0.5, # this amplitude is relative to the range of the instrument
frequency=1e8, # frequency are in Hz
relative_phase=0, # phases are in radians
shape=Rectangular(),
envelope=Rectangular(),
channel="channel",
qubit=0,
)
pulse4 = DrivePulse(
start=0, # timing, in all qibolab, is expressed in ns
duration=40,
pulse4 = Pulse(
duration=40, # timing, in all qibolab, is expressed in ns
amplitude=0.5, # this amplitude is relative to the range of the instrument
frequency=1e8, # frequency are in Hz
relative_phase=0, # phases are in radians
shape=Rectangular(),
envelope=Rectangular(),
channel="channel",
qubit=0,
)
sequence.add(pulse1)
sequence.add(pulse2)
sequence.add(pulse3)
sequence.add(pulse4)
sequence.append(pulse1)
sequence.append(pulse2)
sequence.append(pulse3)
sequence.append(pulse4)

print(f"Total duration: {sequence.duration}")

sequence_ch1 = sequence.get_channel_pulses("channel1") # Selecting pulses on channel 1
print(f"We have {sequence_ch1.count} pulses on channel 1.")
print(f"We have {len(sequence_ch1)} pulses on channel 1.")

.. testoutput:: python
:hide:

Total duration: 40
Total duration: 160.0
We have 0 pulses on channel 1.

.. warning::

Pulses in PulseSequences are ordered automatically following the start time (and the channel if needed). Not by the definition order.

When conducting experiments on quantum hardware, pulse sequences are vital. Assuming you have already initialized a platform, executing an experiment is as simple as:

Expand All @@ -416,19 +402,18 @@ Typical experiments may include both pre-defined pulses and new ones:
from qibolab.pulses import Rectangular

sequence = PulseSequence()
sequence.add(platform.create_RX_pulse(0))
sequence.add(
DrivePulse(
start=0,
sequence.append(platform.create_RX_pulse(0))
sequence.append(
Pulse(
duration=10,
amplitude=0.5,
frequency=2500000000,
relative_phase=0,
shape=Rectangular(),
envelope=Rectangular(),
channel="0",
)
)
sequence.add(platform.create_MZ_pulse(0, start=0))
sequence.append(platform.create_MZ_pulse(0))

results = platform.execute_pulse_sequence(sequence, options=options)

Expand Down Expand Up @@ -500,9 +485,9 @@ A tipical resonator spectroscopy experiment could be defined with:
from qibolab.sweeper import Parameter, Sweeper, SweeperType

sequence = PulseSequence()
sequence.add(platform.create_MZ_pulse(0, start=0)) # readout pulse for qubit 0 at 4 GHz
sequence.add(platform.create_MZ_pulse(1, start=0)) # readout pulse for qubit 1 at 5 GHz
sequence.add(platform.create_MZ_pulse(2, start=0)) # readout pulse for qubit 2 at 6 GHz
sequence.append(platform.create_MZ_pulse(0)) # readout pulse for qubit 0 at 4 GHz
sequence.append(platform.create_MZ_pulse(1)) # readout pulse for qubit 1 at 5 GHz
sequence.append(platform.create_MZ_pulse(2)) # readout pulse for qubit 2 at 6 GHz

sweeper = Sweeper(
parameter=Parameter.frequency,
Expand Down Expand Up @@ -535,10 +520,15 @@ For example:

.. testcode:: python

from qibolab.pulses import PulseSequence, Delay

sequence = PulseSequence()

sequence.add(platform.create_RX_pulse(0))
sequence.add(platform.create_MZ_pulse(0, start=sequence[0].finish))
sequence.append(platform.create_RX_pulse(0))
sequence.append(
Delay(duration=sequence.duration, channel=platform.qubits[0].readout.name)
)
sequence.append(platform.create_MZ_pulse(0))

sweeper_freq = Sweeper(
parameter=Parameter.frequency,
Expand Down Expand Up @@ -631,12 +621,12 @@ Let's now delve into a typical use case for result objects within the qibolab fr

.. testcode:: python

drive_pulse_1 = platform.create_MZ_pulse(0, start=0)
measurement_pulse = platform.create_qubit_readout_pulse(0, start=0)
drive_pulse_1 = platform.create_RX_pulse(0)
measurement_pulse = platform.create_MZ_pulse(0)

sequence = PulseSequence()
sequence.add(drive_pulse_1)
sequence.add(measurement_pulse)
sequence.append(drive_pulse_1)
sequence.append(measurement_pulse)

options = ExecutionParameters(
nshots=1000,
Expand Down Expand Up @@ -709,7 +699,7 @@ If this set is universal any circuit can be transpiled and compiled to a pulse s
Every :class:`qibolab.qubits.Qubit` object contains a :class:`qibolab.native.SingleQubitNatives` object which holds the parameters of its native single-qubit gates,
while each :class:`qibolab.qubits.QubitPair` objects contains a :class:`qibolab.native.TwoQubitNatives` object which holds the parameters of the native two-qubit gates acting on the pair.

Each native gate is represented by a :class:`qibolab.native.NativePulse` or :class:`qibolab.native.NativeSequence` which contain all the calibrated parameters and can be converted to an actual :class:`qibolab.pulses.PulseSequence` that is then executed in the platform.
Each native gate is represented by a :class:`qibolab.pulses.Pulse` or :class:`qibolab.pulses.PulseSequence` which contain all the calibrated parameters.
Typical single-qubit native gates are the Pauli-X gate, implemented via a pi-pulse which is calibrated using Rabi oscillations and the measurement gate, implemented via a pulse sent in the readout line followed by an acquisition.
For a universal set of single-qubit gates, the RX90 (pi/2-pulse) gate is required, which is implemented by halving the amplitude of the calibrated pi-pulse.
U3, the most general single-qubit gate can be implemented using two RX90 pi-pulses and some virtual Z-phases which are included in the phase of later pulses.
Expand Down Expand Up @@ -766,7 +756,6 @@ The most important instruments are the controller, the following is a table of t
"RTS frequency", "yes","yes","yes","yes"
"RTS amplitude", "yes","yes","yes","yes"
"RTS duration", "yes","yes","yes","yes"
"RTS start", "yes","yes","yes","yes"
"RTS relative phase", "yes","yes","yes","yes"
"RTS 2D any combination", "yes","yes","yes","yes"
"Sequence unrolling", "dev","dev","dev","dev"
Expand Down
Loading
Loading