qibolab.instruments package

class qibolab.instruments.DummyLocalOscillator(*, address: str, settings: ~qibolab._core.instruments.abstract.InstrumentSettings | None = <factory>, device: ~qibolab._core.instruments.oscillator.Device | None = None, **extra_data: ~typing.Any)[source]

Bases: LocalOscillator

Dummy local oscillator instrument.

Useful for testing the interface defined in qibolab.instruments.oscillator.LocalOscillator.

create()[source]

Create instance of physical device.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class qibolab.instruments.DummyInstrument(*, address: str, settings: ~qibolab._core.instruments.abstract.InstrumentSettings | None = None, bounds: str = 'dummy/bounds', channels: dict[str, ~qibolab._core.components.channels.Channel] = <factory>, **extra_data: ~typing.Any)[source]

Bases: Controller

Dummy instrument that returns random voltage values.

Useful for testing code without requiring access to hardware.

Parameters:
  • name (str) – name of the instrument.

  • address (int) – address to connect to the instrument. Not used since the instrument is dummy, it only exists to keep the same interface with other instruments.

address: str
bounds: str

Estimated limitations of the device memory.

channels: dict[str, Channel]
property sampling_rate: int

Sampling rate of control electronics in giga samples per second (GSps).

connect()[source]

Establish connection to the physical instrument.

disconnect()[source]

Close connection to the physical instrument.

values(options: ExecutionParameters, shape: tuple[int, ...])[source]
play(configs: dict[str, Config], sequences: list[PulseSequence], options: ExecutionParameters, sweepers: list[list[Sweeper]])[source]

Play a pulse sequence and retrieve feedback.

If qibolab.Sweeper objects are passed as arguments, they are executed in real-time. If not possible, an error is raised.

Returns a mapping with the id of the probe pulses used to acquired data.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Submodules

qibolab.instruments.bluefors module

Bluefors drivers.

https://bluefors.com/

class qibolab.instruments.bluefors.TemperatureController(*, address: str, settings: ~qibolab._core.instruments.abstract.InstrumentSettings | None = None, port: int = 8888, client_socket: ~socket.socket = <factory>, **extra_data: ~typing.Any)[source]

Bases: Instrument

Bluefors temperature controller.

Example usage:

if __name__ == "__main__":
    tc = TemperatureController("XLD1000_Temperature_Controller", "192.168.0.114", 8888)
    tc.connect()
    temperature_values = tc.read_data()
    for temperature_value in temperature_values:
        print(temperature_value)
address: str

IP address of the board sending cryo temperature data.

port: int

Port of the board sending cryo temperature data.

client_socket: socket
connect()[source]

Connect to the socket.

disconnect()[source]

Disconnect from the socket.

get_data() dict[str, dict[str, float]][source]

Connect to the socket and get temperature data.

The typical message looks like this:

flange_name: {'temperature':12.345678, 'timestamp':1234567890.123456}

timestamp can be converted to datetime using datetime.fromtimestamp.

Returns:

socket message in this format:

{“flange_name”: {‘temperature’: <value(float)>, ‘timestamp’:<value(float)>}}

Return type:

message (dict[str, dict[str, float]])

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

read_data()[source]

Continously read data from the temperature controller.

qibolab.instruments.dummy module

Dummy drivers.

Define instruments mainly used for testing purposes.

class qibolab.instruments.dummy.DummyLocalOscillator(*, address: str, settings: ~qibolab._core.instruments.abstract.InstrumentSettings | None = <factory>, device: ~qibolab._core.instruments.oscillator.Device | None = None, **extra_data: ~typing.Any)[source]

Bases: LocalOscillator

Dummy local oscillator instrument.

Useful for testing the interface defined in qibolab.instruments.oscillator.LocalOscillator.

create()[source]

Create instance of physical device.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

device: Device | None
settings: InstrumentSettings | None
address: str
class qibolab.instruments.dummy.DummyInstrument(*, address: str, settings: ~qibolab._core.instruments.abstract.InstrumentSettings | None = None, bounds: str = 'dummy/bounds', channels: dict[str, ~qibolab._core.components.channels.Channel] = <factory>, **extra_data: ~typing.Any)[source]

Bases: Controller

Dummy instrument that returns random voltage values.

Useful for testing code without requiring access to hardware.

Parameters:
  • name (str) – name of the instrument.

  • address (int) – address to connect to the instrument. Not used since the instrument is dummy, it only exists to keep the same interface with other instruments.

address: str
bounds: str

Estimated limitations of the device memory.

channels: dict[str, Channel]
property sampling_rate: int

Sampling rate of control electronics in giga samples per second (GSps).

connect()[source]

Establish connection to the physical instrument.

disconnect()[source]

Close connection to the physical instrument.

values(options: ExecutionParameters, shape: tuple[int, ...])[source]
play(configs: dict[str, Config], sequences: list[PulseSequence], options: ExecutionParameters, sweepers: list[list[Sweeper]])[source]

Play a pulse sequence and retrieve feedback.

If qibolab.Sweeper objects are passed as arguments, they are executed in real-time. If not possible, an error is raised.

Returns a mapping with the id of the probe pulses used to acquired data.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

settings: InstrumentSettings | None

qibolab.instruments.emulator module

Emulator engine.

class qibolab.instruments.emulator.EmulatorController(*, address: str, settings: ~qibolab._core.instruments.abstract.InstrumentSettings | None = None, bounds: str = 'emulator/bounds', channels: dict[str, ~qibolab._core.components.channels.Channel] = <factory>, engine: ~qibolab._core.instruments.emulator.engine.abstract.SimulationEngine = QutipEngine(), **extra_data: ~typing.Any)[source]

Bases: Controller

Emulator controller.

engine: SimulationEngine

SimulationEngine. Default is QutipEngine.

bounds: str

Estimated limitations of the device memory.

connect()[source]

Dummy connect method.

disconnect()[source]

Dummy disconnect method.

property sampling_rate

Sampling rate of emulator.

play(configs: dict[str, Config], sequences: list[PulseSequence], options: ExecutionParameters, sweepers: list[list[Sweeper]]) dict[int, ndarray[tuple[Any, ...], dtype[float64]]][source]

Play a pulse sequence and retrieve feedback.

If qibolab.Sweeper objects are passed as arguments, they are executed in real-time. If not possible, an error is raised.

Returns a mapping with the id of the probe pulses used to acquired data.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class qibolab.instruments.emulator.DriveEmulatorConfig(*, kind: Literal['drive-emulator'] = 'drive-emulator', frequency: float, rabi_frequency: float = 1000000000.0, scale_factor: float = 1)[source]

Bases: Config

Configuration for an IQ channel.

kind: Literal['drive-emulator']
frequency: float

Frequency of drive.

rabi_frequency: float

Rabi frequency [Hz]

scale_factor: float

Scaling factor.

static operator(n: int, engine: SimulationEngine) Operator[source]
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class qibolab.instruments.emulator.FluxEmulatorConfig(*, kind: Literal['flux-emulator'] = 'flux-emulator', offset: float, voltage_to_flux: float = 1)[source]

Bases: Config

Configuration for a flux line.

kind: Literal['flux-emulator']
offset: float

DC offset of the channel.

voltage_to_flux: float

Convert voltarget to flux.

static operator(n: int, engine: SimulationEngine) Operator[source]
property flux: float

Returns flux.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class qibolab.instruments.emulator.HamiltonianConfig(*, kind: ~typing.Literal['hamiltonian'] = 'hamiltonian', transmon_levels: int = 2, qubits: dict[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~qibolab._core.instruments.emulator.hamiltonians.Qubit] = <factory>, pairs: dict[~typing.Annotated[tuple[~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], ~typing.Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], ~pydantic.functional_validators.BeforeValidator(func=~qibolab._core.identifier._split, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~qibolab._core.identifier._join, return_type=PydanticUndefined, when_used=always)], ~qibolab._core.instruments.emulator.hamiltonians.CapacitiveCoupling] = <factory>)[source]

Bases: Config

Hamiltonian configuration.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

kind: Literal['hamiltonian']
transmon_levels: int
qubits: dict[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], Qubit]
pairs: dict[Annotated[tuple[Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])], Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]], BeforeValidator(func=_split, json_schema_input_type=PydanticUndefined), PlainSerializer(func=_join, return_type=PydanticUndefined, when_used=always)], CapacitiveCoupling]
property nqubits

Number of qubits.

replace(update: dict[str, Any]) HamiltonianConfig[source]

Update parameters’ values.

initial_state(engine: SimulationEngine) Operator[source]

Initial state as ground state of the system.

hilbert_space_index(qubit: Annotated[int | str, FieldInfo(annotation=NoneType, required=True, metadata=[_PydanticGeneralMetadata(union_mode='left_to_right')])]) int[source]

Return Hilbert space index from qubit id.

property dims: list[int]

Dimensions of the system.

hamiltonian(config: dict, engine: SimulationEngine) Operator[source]

Time independent part of Hamiltonian.

dissipation(engine: SimulationEngine) Operator[source]

Dissipation operators for the hamiltonian.

They are going to be passed to mesolve as collapse operators.

qibolab.instruments.era module

ERA drivers.

http://erainstruments.com/

class qibolab.instruments.era.ERASynth(address, ethernet=True, ref_osc_source=None)[source]

Bases: LocalOscillator

Driver to control the ERAsynth++ local oscillator.

This driver is using: https://qcodes.github.io/Qcodes_contrib_drivers/api/generated/qcodes_contrib_drivers.drivers.ERAInstruments.html#qcodes_contrib_drivers.drivers.ERAInstruments.erasynth.ERASynthPlusPlus

or the custom qibolab.instruments.erasynth.ERASynthEthernet object if we are connected via ethernet.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

create()[source]

Create instance of physical device.

qibolab.instruments.keysight_qcs module

qibolab.instruments.qblox module

qibolab.instruments.qm module

qibolab.instruments.qrng module

Quantum random number generator drivers.

class qibolab.instruments.qrng.QRNG(*, address: str, settings: InstrumentSettings | None = None, baudrate: int = 115200, extractor: Extractor = ShaExtractor(), port: Serial | None = None, bytes_per_number: int = 4, **extra_data: Any)[source]

Bases: Instrument

Driver to sample numbers from a Quantum Random Number Generator (QRNG).

See Quantum Random Number Generator for example usage.

address: str
baudrate: int
extractor: Extractor
port: Serial | None
bytes_per_number: int

Number of bytes to read from serial port to generate one raw sample.

connect()[source]

Establish connection to the physical instrument.

disconnect()[source]

Close connection to the physical instrument.

read(n: int) List[int][source]

Read raw samples from the QRNG device serial output.

In the entropy mode of the device, these typically follow a normal distribution.

Parameters:

n – Number of samples to retrieve.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

random(size: int | Sequence[int] | None = None) ndarray[tuple[Any, ...], dtype[_ScalarT]][source]

Returns random floats following uniform distribution in [0, 1].

Parameters:

size – Shape of the returned array (to behave similarly to np.random.random).

qibolab.instruments.rohde_schwarz module

Rohde & Schwarz drivers.

https://www.rohde-schwarz.com/

class qibolab.instruments.rohde_schwarz.SGS100A(*, address: str, settings: ~qibolab._core.instruments.abstract.InstrumentSettings | None = <factory>, device: ~qibolab._core.instruments.oscillator.Device | None = None, **extra_data: ~typing.Any)[source]

Bases: LocalOscillator

Driver to control the Rohde-Schwarz SGS100A local oscillator.

This driver is using: https://qcodes.github.io/Qcodes/api/generated/qcodes.instrument_drivers.rohde_schwarz.html#module-qcodes.instrument_drivers.rohde_schwarz.SGS100A

create()[source]

Create instance of physical device.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'frozen': False}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].