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

Qblox #1088

Draft
wants to merge 200 commits into
base: parse-q1asm
Choose a base branch
from
Draft

Qblox #1088

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
609b5a2
build: Restore flake to main
alecandido Apr 4, 2024
d1c0ef5
fix: Start laying out the sequence structure
alecandido Nov 1, 2024
e34e912
fix: Add further array serialization
alecandido Nov 1, 2024
904668c
test: Test array serialization as lists
alecandido Nov 1, 2024
c262d09
fix: Complete sequence serialization format
alecandido Nov 1, 2024
c82ef6e
fix: Add controller boilerplote
alecandido Nov 1, 2024
19d704d
refactor: Add exports to all qblox modules
alecandido Nov 1, 2024
d086ce2
fix: Ensure floating point samples in waveforms
alecandido Nov 1, 2024
edd6c09
feat: Expose qblox drivers within the public API
alecandido Nov 3, 2024
c4e7e6d
feat: Add defaults for all optional parameters in the common channels
alecandido Nov 3, 2024
f18026b
fix: Migrate channel mapper from iqm5q platform
alecandido Nov 3, 2024
5696c0f
fix: Scaffold address resolution and sequence processing
alecandido Nov 3, 2024
c9af5cf
build: Upgrade Qblox version to v0.14
alecandido Nov 15, 2024
f2bd842
feat: Handle cluster connection and expose modules
alecandido Nov 15, 2024
83e0271
feat: Lay out execution workflow
alecandido Nov 16, 2024
fc63ce3
fix: Avoid reconnections
alecandido Nov 16, 2024
cfe23de
feat: Add qblox channels, to expose attenuation
alecandido Dec 2, 2024
45d71ef
refactor: Rearrange sequence preparation
alecandido Dec 3, 2024
c997e5f
fix: Attempt removing couplers hardcoding in qblox platform extractor
alecandido Dec 4, 2024
5d50c10
fix: Drop dedicated channel config
alecandido Dec 5, 2024
bbc00d1
fix: Ignore multiple newlines in q1asm snippets
alecandido Dec 5, 2024
ac3767e
fix: Accept program structure, bypassing validation
alecandido Dec 5, 2024
3cf8318
fix: Temporarily qblox cluster connection
alecandido Dec 5, 2024
c32c30b
feat: Introduce waveforms extraction
alecandido Dec 6, 2024
17ba46b
test: Add failing test for value deserialization
alecandido Dec 6, 2024
5fd352c
test: Add failing test for immediate deserialization
alecandido Dec 6, 2024
58117a4
fix: Allow direct load of python integers as immediate
alecandido Dec 6, 2024
760035a
test: Extend immediate loading test
alecandido Dec 6, 2024
09388bc
feat: Begin program generation
alecandido Dec 6, 2024
a4b6a53
fix: Split waveforms, collect index
alecandido Dec 6, 2024
8b2a7e1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 6, 2024
2ac620f
fix: Transmute error type in validation
alecandido Dec 7, 2024
347f3b8
fix: Ignore both inline and block whitespaces
alecandido Dec 9, 2024
7389c2f
fix: Label instructions serialization with the related keyword
alecandido Dec 9, 2024
a365ef8
fix: Tag q1asm instruction on serialization and validation
alecandido Dec 9, 2024
42b3ce4
build: Stop generating LD_LIBRARY_PATH manually, trim unused definitions
alecandido Dec 10, 2024
1a3d8bc
test: Add q1asm serialization integration tests
alecandido Dec 10, 2024
084b93f
fix: Replace default mutable value
alecandido Dec 10, 2024
ddad256
feat: Add configuration for logging
alecandido Dec 10, 2024
07a0ad1
feat: Allow configs update to introduce entire new elements
alecandido Dec 10, 2024
41e1f3f
feat: Log qblox modules input
alecandido Dec 10, 2024
1401522
fix: Restore update error for genuinely wrong updates
alecandido Dec 10, 2024
d041623
fix: Allow direct initialization of registers and references
alecandido Dec 10, 2024
d8a6331
feat: Introduce primitive loops support
alecandido Dec 10, 2024
d587803
fix: Expose log config
alecandido Dec 10, 2024
bf07c2c
feat: Kickstart sweepers implementation
alecandido Dec 10, 2024
a9aa0f2
feat: Add constructor shortcut for simple lines
alecandido Dec 11, 2024
c337bc6
feat: Add support for delay and virtual z ops
alecandido Dec 11, 2024
b2dccbc
fix: Start designing sweepers implementation
alecandido Dec 11, 2024
3716844
fix: Filter unsupported events
alecandido Dec 11, 2024
9e6b265
feat: Introduce qblox acquisitions
alecandido Dec 12, 2024
ae57e72
feat: Split bin counts, to reuse in acquisition
alecandido Dec 12, 2024
7a5c563
feat: Expose the sequence class
alecandido Dec 12, 2024
590c853
fix: Pass registers around instead of their numbers
alecandido Dec 12, 2024
a229df8
fix: Disambiguate acquisition pulse-like event
alecandido Dec 12, 2024
a605446
fix: Split readout channels into probe and acquisition
alecandido Dec 12, 2024
fb750f8
feat: Internally expose sweepers conventions over their length
alecandido Dec 12, 2024
988a373
fix: Implement nested loops
alecandido Dec 12, 2024
814513a
fix: Properly implement nested loops
alecandido Dec 12, 2024
8c86bac
fix: Fix limit case for comments printout in q1asm
alecandido Dec 12, 2024
2e03ee3
fix: Initialize and increment bin counter
alecandido Dec 12, 2024
20dd5a7
fix: Add bin reset counter
alecandido Dec 13, 2024
b479ec9
fix: Split loops implementation over multiple functions
alecandido Dec 13, 2024
b9f78f9
fix: Complete the shots bin counter algorithm
alecandido Dec 13, 2024
ba696a8
fix: Propagate singleshot, fix shots condition, document looping inst…
alecandido Dec 13, 2024
80a83b6
refactor: Reorganize pulse processing in a more Pythonic way
alecandido Dec 13, 2024
dcf30d4
fix: Amend bug in qblox channels definition helper
alecandido Dec 13, 2024
b17e893
fix: Implement channels grouping by module
alecandido Dec 13, 2024
aa8680a
refactor: Scope grouping helper as property
alecandido Dec 13, 2024
3f22c1e
fix: Split logging code out of cluster
alecandido Dec 19, 2024
d5492ba
fix: Split configs settings out of cluster
alecandido Dec 19, 2024
1cc56a5
fix: Move sequence compilation to its subpackage
alecandido Dec 19, 2024
33fe3f0
fix: Rebase leftover
alecandido Dec 19, 2024
4c4b9c8
fix: Extend module and sequencer configurations
alecandido Dec 19, 2024
1406f2a
fix: Wait for the duration of the experiment before attempting retrieval
alecandido Dec 19, 2024
70e2d4d
fix: Describe acquired data structure
alecandido Dec 19, 2024
94038a6
fix: Progress on acquisitions handling
alecandido Dec 19, 2024
563210a
fix: Deduplicate cluster connection check
alecandido Dec 19, 2024
3608069
fix: Move leftover import
alecandido Jan 6, 2025
b56997c
feat: Start mocking for testing purpose
alecandido Jan 6, 2025
518b356
fix: Reenable qblox cluster connection
alecandido Jan 6, 2025
6e5a376
fix: Add required cluster methods for mock one
alecandido Jan 6, 2025
28749b0
fix: Mock modules as well, since strictly required
alecandido Jan 6, 2025
0520c2b
chore: Poetry lock
alecandido Jan 18, 2025
0e0bf52
fix: Mock sequencers as well
alecandido Jan 20, 2025
e6005e2
fix: Provide empty sequences for inactive channels
alecandido Jan 20, 2025
ab7d957
fix: Record all calls to mock sequencers
alecandido Jan 20, 2025
b840745
fix: Add mock sequencers ancestors access
alecandido Jan 20, 2025
2593fd3
fix: Record all calls to mock module
alecandido Jan 20, 2025
20e0703
fix: Implement a snapshot mechanism for mock cluster
alecandido Jan 20, 2025
d8b6ff6
fix: Complete mocking and recording mechanism
alecandido Jan 20, 2025
3f2dbd7
fix: Extend snapshotting capabilities
alecandido Jan 21, 2025
d98b60f
fix: Expose program type
alecandido Jan 21, 2025
4bff80b
fix: Better tune unnecessarily tight bound
alecandido Jan 21, 2025
8abdc8c
refactor: Make sequences property adhere its name
alecandido Jan 22, 2025
19df954
feat: Extract configurations values from parameters
alecandido Jan 23, 2025
a45ed24
feat: Set NCO frequency
alecandido Jan 23, 2025
4ee164f
feat: Set LO frequency
alecandido Jan 23, 2025
2f096ac
refactor: Slightly rearrange import structure, clarify scope
alecandido Jan 24, 2025
72e3635
feat: Compute integration lengths inferrable from weights
alecandido Jan 24, 2025
a537d13
feat: Ensure integration lengths availability
alecandido Jan 24, 2025
10d2f03
refactor: Move non-sequence-related acquisition code
alecandido Jan 24, 2025
c1d93b7
feat: Extract results from qblox acqusitions structure
alecandido Jan 24, 2025
ee1272c
feat: Store scope acquisitions
alecandido Jan 28, 2025
154c788
feat: Extract scope and classification
alecandido Jan 28, 2025
a9159c6
refactor: Scope q1asm-related modules
alecandido Jan 28, 2025
4acc395
build: Drop old packages include, distribute lark grammar
alecandido Jan 28, 2025
192c6bd
refactor: Rename q1 sequence
alecandido Jan 28, 2025
3724ed2
test: Fix q1asm imports
alecandido Jan 28, 2025
2bf1f35
refactor: Turn dict to mapping to make the resulting type covariant i…
alecandido Jan 29, 2025
0fbb359
fix: Fix leftover imports
alecandido Jan 29, 2025
03c3bce
fix: Expand sequencer status mock retrieval
alecandido Jan 29, 2025
62ef52a
fix: Fix tiny bugs detected during mock execution
alecandido Jan 29, 2025
7a8682d
feat: Expose function to infer converted los configs' names
alecandido Jan 29, 2025
6c5f8a4
feat: Add a guaranteed (possibly inferred) range to sweepers
alecandido Jan 31, 2025
990c05c
docs: Document the role of loop counters extraction
alecandido Jan 31, 2025
acc4232
feat: Start extracting sweeper parameters
alecandido Jan 31, 2025
d9bf286
refactor: Start sequence rearrangement, to host update instructions
alecandido Jan 31, 2025
ece72d5
fix: Implement sweeper params conversions to integers
alecandido Jan 31, 2025
39e5b06
refactor: Rearrange loops counters and parameters
alecandido Jan 31, 2025
d1ea95a
refactor: Drop older attempt to implement sweepers' updates
alecandido Jan 31, 2025
7461ead
fix: Propagate sweeper parameters to loop machinery and pulses' execu…
alecandido Jan 31, 2025
b28df0c
feat: Reintroduce parameters' updaters, extend param definition
alecandido Feb 3, 2025
40e7d7a
fix: Set duration step to 2
alecandido Feb 3, 2025
d162f53
feat: Introduce channels' parameters set up
alecandido Feb 3, 2025
91e6c47
feat: Update channel sweepers params at the end of the execution block
alecandido Feb 3, 2025
15b177e
refactor: Turn lengthy tuple to data class
alecandido Feb 4, 2025
ec828b6
fix: Filter channel sweep updates for the current channel
alecandido Feb 4, 2025
1de3a77
refactor: Reorganize updates to allow missing reset instructions
alecandido Feb 4, 2025
6a044b2
feat: Split play instruction generation for duration swept pulses
alecandido Feb 4, 2025
751c462
feat: Add pulse sweep update and reset
alecandido Feb 4, 2025
edaef63
fix: Reset gain always to 1 for amplitude sweeps
alecandido Feb 4, 2025
61e0a39
fix: Add swept registers to all possible instructions
alecandido Feb 4, 2025
a9f241e
fix: Prevent delay duration sweep conversion hijack
alecandido Feb 4, 2025
3e7b62d
fix: Propagate acquisition duration to instruction generation
alecandido Feb 4, 2025
e0303d7
fix: Propagate pulse duration to instruction generation
alecandido Feb 4, 2025
69c386d
feat: Decompose long waits into wait loops
alecandido Feb 4, 2025
56c9692
fix: Avoid shadowing parameter with ABCMeta method
alecandido Feb 5, 2025
01bb095
refactor: Start reorganizing program over multiple modules
alecandido Feb 5, 2025
ac20456
refactor: Complete program split over multiple modules
alecandido Feb 5, 2025
82afec2
refactor: Standardize line generation practice
alecandido Feb 5, 2025
4122921
refactor: Split loop machinery (partially)
alecandido Feb 6, 2025
9d0dd3e
docs: Document experiment conclusion instructions
alecandido Feb 6, 2025
67a1c8b
refactor: Factorize and document loops machinery
alecandido Feb 6, 2025
9d354b2
fix: Assign fixed register to long wait loops
alecandido Feb 6, 2025
d3ed0d2
fix: Filter initial channel parameter setting for the current channel
alecandido Feb 6, 2025
6e35536
fix: Filter probe channels
alecandido Feb 7, 2025
0cb37ec
fix: Ensure probe channels exclusion
alecandido Feb 7, 2025
f7fb3c9
fix: Rectify unintentional shadowing
alecandido Feb 7, 2025
fdd4938
docs: Document cluster public interface
alecandido Feb 7, 2025
973069f
refactor: Lift channels and readouts sequence splitting
alecandido Feb 7, 2025
a07f715
fix: Drop readout splitting for Qblox
alecandido Feb 7, 2025
6cff112
fix: Compile readout operations into subsequent acquisition and pulse
alecandido Feb 7, 2025
c40691b
fix: Ensure json validation, fixing comment validation
alecandido Feb 7, 2025
6c2db2b
fix: Consume sampling rate top-level
alecandido Feb 10, 2025
e58fb5e
refactor: Deduplicate integer conversion
alecandido Feb 10, 2025
1e7b81a
fix: Handle negative numbers in registers
alecandido Feb 13, 2025
716d74f
fix: port numbering starts from 0
stavros11 Feb 5, 2025
846a61b
chore: better name for function
stavros11 Feb 5, 2025
e37c06c
chore: use np.degrees
stavros11 Feb 8, 2025
f32a588
fix: drop print
stavros11 Feb 8, 2025
5f1ae28
fix: change port.local_address to out
stavros11 Feb 11, 2025
f086193
fix: non-qrm sequences do not have integration_length_acq
stavros11 Feb 11, 2025
5463921
fix: calculate integration length from waveforms
stavros11 Feb 11, 2025
dcf4852
fix: drop print
stavros11 Feb 11, 2025
c368877
build: Temporarily downgrade qblox dep
alecandido Feb 11, 2025
bffddca
fix: Filter inactive sequencers from execution
alecandido Feb 13, 2025
9936d6a
fix: Only upload sequence and synch active sequencers
alecandido Feb 13, 2025
7fb43a1
build: Upgrade Python version in flake to 3.12
alecandido Feb 14, 2025
da3d4de
fix: Observe parallel sweepers semantics in time estimate
alecandido Feb 14, 2025
6666d21
fix: Reintroduce channel directions
alecandido Feb 14, 2025
c91b44f
fix: Disconnect inputs on QRM modules
alecandido Feb 14, 2025
387be26
fix: Assert for values exceeding bounds
alecandido Feb 17, 2025
fa5eacb
fix: Normalize amplitude swept pulses
alecandido Feb 17, 2025
8f5cbb0
refactor: Lift los retrieval
alecandido Feb 18, 2025
8c6ebca
feat: Add sweeper methods to simplify value shifts
alecandido Feb 18, 2025
6adab08
fix: Subtract lo frequency from channel frequency sweepers
alecandido Feb 18, 2025
14a552b
feat!: Turn generated pulse id into uuid attributes
alecandido Feb 18, 2025
600341c
fix: Filter out parameters initialization and update for inactive ones
alecandido Feb 18, 2025
1d8c04d
fix: Identify duration swept pulses
alecandido Feb 19, 2025
097e137
refactor: Return sweepers in association with swept pulses
alecandido Feb 19, 2025
d806946
feat: Introduce stretched waveforms generation
alecandido Feb 19, 2025
0db512a
fix: Limit duration swept pulses to those on the channel
alecandido Feb 19, 2025
618632c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 19, 2025
2409787
fix: Use duration in waveforms generation
alecandido Feb 19, 2025
cd74829
fix: Comment sweepers with their type as well
alecandido Feb 19, 2025
7f5ff13
fix: Replace uuid1 with uuid4 for pulse identifiers
alecandido Feb 19, 2025
d3fa2e1
refactor: Improve sweepers q1asm comments
alecandido Feb 19, 2025
00597fd
fix: Propagate usage of uuids through the qblox driver
alecandido Feb 20, 2025
4123715
fix: Amend external types declaration, and trailing ones
alecandido Feb 20, 2025
4c6bcb2
chore: Poetry lock
alecandido Feb 20, 2025
ee911a7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 20, 2025
c9be1e9
fix: Introduce results final reshape
alecandido Feb 21, 2025
c2703e9
fix: Force cluster disconnection
alecandido Feb 21, 2025
776f89f
feat: Validate waveform memory constraints
alecandido Feb 24, 2025
29c50ba
fix: Make sure to enable lo in rf modules
alecandido Feb 24, 2025
99e23cc
fix: Set input/output attenuation
alecandido Feb 24, 2025
cc5389b
fix: Force integers in qcodes configuration
alecandido Feb 24, 2025
264edd2
fix: Add default values for marker override
alecandido Feb 24, 2025
fdc454e
fix: Take into account unused sequencers and modules differences
alecandido Feb 24, 2025
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
7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@

env = {
QIBOLAB_PLATFORMS = (dirOf config.env.DEVENV_ROOT) + "/qibolab_platforms_qrc";
LD_LIBRARY_PATH = builtins.concatStringsSep ":" (map (p: "${p}/lib") (with pkgs; [
stdenv.cc.cc.lib
zlib
]));
};

languages.python = {
enable = true;
libraries = with pkgs; [zlib];
version = "3.11";
version = "3.12";
poetry = {
enable = true;
install = {
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ classifiers = [
"Topic :: Scientific/Engineering :: Physics",
]
packages = [{ include = "qibolab", from = "src" }]
include = ["*.out", "*.yml"]
include = ["src/*.lark"]

[tool.poetry.dependencies]
python = ">=3.9,<3.13"
qibo = "^0.2.8"
numpy = "^1.26.4"
scipy = "^1.13.0"
pydantic = "^2.6.4"
qblox-instruments = { version = "0.12.0", optional = true }
qblox-instruments = { version = "^0.12.0", optional = true }
lark = { version = "^1.1.9", optional = true }
qcodes = { version = "^0.37.0", optional = true }
qcodes_contrib_drivers = { version = "0.18.0", optional = true }
Expand Down Expand Up @@ -58,7 +58,7 @@ nbsphinx = "^0.9.1"
ipython = "^8.12.0"
sphinx-copybutton = "^0.5.1"
# extras
qblox-instruments = "0.12.0"
qblox-instruments = "^0.12.0"
qcodes = "^0.37.0"
qcodes_contrib_drivers = "0.18.0"
qibosoq = { version = "^0.1.2", python = "<3.12" }
Expand Down
23 changes: 20 additions & 3 deletions src/qibolab/_core/components/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ class Channel(Model):
def port(self) -> int:
return int(self.path)

def iqout(self, id_: ChannelId) -> Optional[ChannelId]:
"""Extract associated IQ output channel.

This is the identity for each IQ output channel identifier, while it retrieves the
associated probe channel for acquisition ones, and :obj:`None` for any other one
(essentially, non-RF channels).

The argument is the identifier of the present channel, since it is not stored within
the objec itself, as it is only relevant to address it in a collection (and so,
out of the scope of the object itself).
"""
return (
id_
if isinstance(self, IqChannel)
else (self.probe if isinstance(self, AcquisitionChannel) else None)
)


class DcChannel(Channel):
"""Channel that can be used to send DC pulses."""
Expand All @@ -46,21 +63,21 @@ class DcChannel(Channel):
class IqChannel(Channel):
"""Channel that can be used to send IQ pulses."""

mixer: Optional[str]
mixer: Optional[str] = None
"""Name of the IQ mixer component corresponding to this channel.

None, if the channel does not have a mixer, or it does not need
configuration.
"""
lo: Optional[str]
lo: Optional[str] = None
"""Name of the local oscillator component corresponding to this channel.

None, if the channel does not have an LO, or it is not configurable.
"""


class AcquisitionChannel(Channel):
twpa_pump: Optional[str]
twpa_pump: Optional[str] = None
"""Name of the TWPA pump component.

None, if there is no TWPA, or it is not configurable.
Expand Down
17 changes: 16 additions & 1 deletion src/qibolab/_core/components/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
configuration defined by these classes.
"""

from pathlib import Path
from typing import Annotated, Literal, Optional, Union

from pydantic import Field
Expand All @@ -20,14 +21,20 @@
"IqMixerConfig",
"OscillatorConfig",
"Config",
"Configs",
"ChannelConfig",
"LogConfig",
]


class Config(Model):
"""Configuration values depot."""


Configs = dict[str, Config]
"""Configuration database."""


class DcConfig(Config):
"""Configuration for a channel that can be used to send DC pulses (i.e.
just envelopes without modulation)."""
Expand Down Expand Up @@ -120,6 +127,14 @@ def __eq__(self, other) -> bool:
)


class LogConfig(Config):
"""Configuration for logging."""

kind: Literal["log"] = "log"

path: Path


ChannelConfig = Union[
DcConfig, IqMixerConfig, OscillatorConfig, IqConfig, AcquisitionConfig
DcConfig, IqMixerConfig, OscillatorConfig, IqConfig, AcquisitionConfig, LogConfig
]
57 changes: 47 additions & 10 deletions src/qibolab/_core/execution_parameters.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
from enum import Enum, auto
from typing import Any, Optional
from math import prod
from typing import Any, Optional, TypeVar

from pydantic import Field

from qibolab._core.sequence import PulseSequence

from .serialize import Model
from .sweeper import ParallelSweepers
from .sweeper import ParallelSweepers, iteration_length

__all__ = ["AcquisitionType", "AveragingMode"]

NS_TO_SEC = 1e-9


class AcquisitionType(Enum):
"""Data acquisition from hardware."""
Expand Down Expand Up @@ -37,13 +44,24 @@ def average(self) -> bool:
return self is not AveragingMode.SINGLESHOT


ConfigUpdate = dict[str, dict[str, Any]]
Update = dict[str, Any]

ConfigUpdate = dict[str, Update]
"""Update for component configs.

Maps component name to corresponding update, which in turn is a map from
config property name that needs an update to its new value.
"""

# TODO: replace with https://docs.python.org/3/reference/compound_stmts.html#type-params
T = TypeVar("T")


# TODO: lift for general usage in Qibolab
def default(value: Optional[T], default: T) -> T:
"""None replacement shortcut."""
return value if value is not None else default


class ExecutionParameters(Model):
"""Data structure to deal with execution parameters."""
Expand All @@ -65,28 +83,47 @@ class ExecutionParameters(Model):
"""Data acquisition type."""
averaging_mode: AveragingMode = AveragingMode.SINGLESHOT
"""Data averaging mode."""
updates: list[ConfigUpdate] = []
updates: list[ConfigUpdate] = Field(default_factory=list)
"""List of updates for component configs.

Later entries in the list take precedence over earlier ones (if they
happen to update the same thing). These updates will be applied on
top of platform defaults.
"""

def results_shape(
self, sweepers: list[ParallelSweepers], samples: Optional[int] = None
) -> tuple[int, ...]:
"""Compute the expected shape for collected data."""

def bins(self, sweepers: list[ParallelSweepers]) -> tuple[int, ...]:
assert self.nshots is not None
shots = (
(self.nshots,) if self.averaging_mode is AveragingMode.SINGLESHOT else ()
)
sweeps = tuple(
min(len(sweep.values) for sweep in parsweeps) for parsweeps in sweepers
)
return shots + sweeps

def results_shape(
self, sweepers: list[ParallelSweepers], samples: int = -1
) -> tuple[int, ...]:
"""Compute the expected shape for collected data."""
inner = {
AcquisitionType.DISCRIMINATION: (),
AcquisitionType.INTEGRATION: (2,),
AcquisitionType.RAW: (samples, 2),
}[self.acquisition_type]
return shots + sweeps + inner
return self.bins(sweepers) + inner

def estimate_duration(
self,
sequences: list[PulseSequence],
sweepers: list[ParallelSweepers],
) -> float:
"""Estimate experiment duration."""
duration = sum(seq.duration for seq in sequences)
relaxation = default(self.relaxation_time, 0)
nshots = default(self.nshots, 0)
return (
(duration + len(sequences) * relaxation)
* nshots
* NS_TO_SEC
* prod(iteration_length(s) for s in sweepers)
)
3 changes: 3 additions & 0 deletions src/qibolab/_core/instruments/qblox/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import mock

__all__ = ["mock"]
Loading