Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 29, 2024
1 parent faa2d58 commit 2bed40e
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 66 deletions.
1 change: 1 addition & 0 deletions src/qibolab/compilers/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Uses I, Z, RZ, U3, CZ, and M as the set of native gates.
"""

import math

from qibolab.pulses import PulseSequence
Expand Down
6 changes: 3 additions & 3 deletions src/qibolab/instruments/qblox/cluster_qcm_bb.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ def __init__(self, name: str, address: str):
self.channel_map: dict = {}
self._device_num_output_ports = 2
self._device_num_sequencers: int
self._free_sequencers_numbers: list[
int
] = [] # TODO: we can create only list and put three flags: free, used, unused
self._free_sequencers_numbers: list[int] = (
[]
) # TODO: we can create only list and put three flags: free, used, unused
self._used_sequencers_numbers: list[int] = []
self._unused_sequencers_numbers: list[int] = []

Expand Down
12 changes: 6 additions & 6 deletions src/qibolab/instruments/qblox/cluster_qrm_rf.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,9 +989,9 @@ def acquire(self):
if len(sequencer.pulses.ro_pulses) == 1:
pulse = sequencer.pulses.ro_pulses[0]
frequency = self.get_if(pulse)
acquisitions[pulse.qubit] = acquisitions[
pulse.serial
] = AveragedAcquisition(scope, duration, frequency)
acquisitions[pulse.qubit] = acquisitions[pulse.serial] = (
AveragedAcquisition(scope, duration, frequency)
)
else:
raise RuntimeError(
"Software Demodulation only supports one acquisition per channel. "
Expand All @@ -1001,9 +1001,9 @@ def acquire(self):
results = self.device.get_acquisitions(sequencer.number)
for pulse in sequencer.pulses.ro_pulses:
bins = results[pulse.serial]["acquisition"]["bins"]
acquisitions[pulse.qubit] = acquisitions[
pulse.serial
] = DemodulatedAcquisition(bins, duration)
acquisitions[pulse.qubit] = acquisitions[pulse.serial] = (
DemodulatedAcquisition(bins, duration)
)

# Provide Scope Data for verification (assuming memory reseet is being done)
if len(sequencer.pulses.ro_pulses) == 1:
Expand Down
2 changes: 1 addition & 1 deletion src/qibolab/instruments/qblox/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _execute_pulse_sequence(
sequence: PulseSequence,
options: ExecutionParameters,
sweepers: list() = [], # list(Sweeper) = []
**kwargs
**kwargs,
# nshots=None,
# navgs=None,
# relaxation_time=None,
Expand Down
9 changes: 2 additions & 7 deletions src/qibolab/instruments/qblox/sweeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ def __init__(
)
),
QbloxSweeperType.relative_phase: (lambda v: True),
QbloxSweeperType.start: (
lambda v: all((4 <= x and x < 2**16) for x in v)
),
QbloxSweeperType.start: (lambda v: all((4 <= x and x < 2**16) for x in v)),
QbloxSweeperType.duration: (
lambda v: all((0 <= x and x < 2**16) for x in v)
),
Expand Down Expand Up @@ -187,10 +185,7 @@ def __init__(
self._con_step = convert[type](self._abs_step)
self._con_stop = (self._con_start + self._con_step * (self._n) + 1) % 2**32
self._con_values = np.array(
[
(self._con_start + self._con_step * m) % 2**32
for m in range(self._n + 1)
]
[(self._con_start + self._con_step * m) % 2**32 for m in range(self._n + 1)]
)

# log.info(f"Qblox sweeper converted values: {self._con_values}")
Expand Down
1 change: 1 addition & 0 deletions src/qibolab/instruments/rfsoc/convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Convert helper functions for rfsoc driver."""

from dataclasses import asdict
from functools import singledispatch

Expand Down
1 change: 1 addition & 0 deletions src/qibolab/instruments/unrolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
May be reused by different instruments.
"""

from more_itertools import chunked


Expand Down
98 changes: 49 additions & 49 deletions src/qibolab/instruments/zhinst.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,20 +420,20 @@ def register_readout_line(self, qubit, intermediate_frequency, options):
self.signal_map[f"measure{q}"] = self.device_setup.logical_signal_groups[
f"q{q}"
].logical_signals["measure_line"]
self.calibration[
f"/logical_signal_groups/q{q}/measure_line"
] = lo.SignalCalibration(
oscillator=lo.Oscillator(
frequency=intermediate_frequency,
modulation_type=lo.ModulationType.SOFTWARE,
),
local_oscillator=lo.Oscillator(
uid="lo_shfqa_m" + str(q),
frequency=int(qubit.readout.local_oscillator.frequency),
),
range=qubit.readout.power_range,
port_delay=None,
delay_signal=0,
self.calibration[f"/logical_signal_groups/q{q}/measure_line"] = (
lo.SignalCalibration(
oscillator=lo.Oscillator(
frequency=intermediate_frequency,
modulation_type=lo.ModulationType.SOFTWARE,
),
local_oscillator=lo.Oscillator(
uid="lo_shfqa_m" + str(q),
frequency=int(qubit.readout.local_oscillator.frequency),
),
range=qubit.readout.power_range,
port_delay=None,
delay_signal=0,
)
)

self.signal_map[f"acquire{q}"] = self.device_setup.logical_signal_groups[
Expand All @@ -454,13 +454,13 @@ def register_readout_line(self, qubit, intermediate_frequency, options):
# To keep compatibility with angle and threshold discrimination (Remove when possible)
threshold = qubit.threshold

self.calibration[
f"/logical_signal_groups/q{q}/acquire_line"
] = lo.SignalCalibration(
oscillator=oscillator,
range=qubit.feedback.power_range,
port_delay=self.time_of_flight * NANO_TO_SECONDS,
threshold=threshold,
self.calibration[f"/logical_signal_groups/q{q}/acquire_line"] = (
lo.SignalCalibration(
oscillator=oscillator,
range=qubit.feedback.power_range,
port_delay=self.time_of_flight * NANO_TO_SECONDS,
threshold=threshold,
)
)

def register_drive_line(self, qubit, intermediate_frequency):
Expand All @@ -469,20 +469,20 @@ def register_drive_line(self, qubit, intermediate_frequency):
self.signal_map[f"drive{q}"] = self.device_setup.logical_signal_groups[
f"q{q}"
].logical_signals["drive_line"]
self.calibration[
f"/logical_signal_groups/q{q}/drive_line"
] = lo.SignalCalibration(
oscillator=lo.Oscillator(
frequency=intermediate_frequency,
modulation_type=lo.ModulationType.HARDWARE,
),
local_oscillator=lo.Oscillator(
uid="lo_shfqc" + str(q),
frequency=int(qubit.drive.local_oscillator.frequency),
),
range=qubit.drive.power_range,
port_delay=None,
delay_signal=0,
self.calibration[f"/logical_signal_groups/q{q}/drive_line"] = (
lo.SignalCalibration(
oscillator=lo.Oscillator(
frequency=intermediate_frequency,
modulation_type=lo.ModulationType.HARDWARE,
),
local_oscillator=lo.Oscillator(
uid="lo_shfqc" + str(q),
frequency=int(qubit.drive.local_oscillator.frequency),
),
range=qubit.drive.power_range,
port_delay=None,
delay_signal=0,
)
)

def register_flux_line(self, qubit):
Expand All @@ -491,13 +491,13 @@ def register_flux_line(self, qubit):
self.signal_map[f"flux{q}"] = self.device_setup.logical_signal_groups[
f"q{q}"
].logical_signals["flux_line"]
self.calibration[
f"/logical_signal_groups/q{q}/flux_line"
] = lo.SignalCalibration(
range=qubit.flux.power_range,
port_delay=None,
delay_signal=0,
voltage_offset=qubit.flux.offset,
self.calibration[f"/logical_signal_groups/q{q}/flux_line"] = (
lo.SignalCalibration(
range=qubit.flux.power_range,
port_delay=None,
delay_signal=0,
voltage_offset=qubit.flux.offset,
)
)

def register_couplerflux_line(self, coupler):
Expand All @@ -506,13 +506,13 @@ def register_couplerflux_line(self, coupler):
self.signal_map[f"couplerflux{c}"] = self.device_setup.logical_signal_groups[
f"qc{c}"
].logical_signals["flux_line"]
self.calibration[
f"/logical_signal_groups/qc{c}/flux_line"
] = lo.SignalCalibration(
range=coupler.flux.power_range,
port_delay=None,
delay_signal=0,
voltage_offset=coupler.flux.offset,
self.calibration[f"/logical_signal_groups/qc{c}/flux_line"] = (
lo.SignalCalibration(
range=coupler.flux.power_range,
port_delay=None,
delay_signal=0,
voltage_offset=coupler.flux.offset,
)
)

def run_exp(self):
Expand Down
1 change: 1 addition & 0 deletions src/qibolab/pulses.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Pulse and PulseSequence classes."""

import copy
import re
from abc import ABC, abstractmethod
Expand Down
1 change: 1 addition & 0 deletions src/qibolab/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
repository is assumed here. See :ref:`Using runcards <using_runcards>`
example for more details.
"""

import json
from dataclasses import asdict
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_instruments_qmsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
If an error is raised or a waveform is generated for the first time, a plot will also be
created so that the user can check if the waveform looks as expected.
"""

import os

import h5py
Expand Down
1 change: 1 addition & 0 deletions tests/test_platform.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests :class:`qibolab.platforms.multiqubit.MultiqubitPlatform` and
:class:`qibolab.platforms.platform.DesignPlatform`."""

import pathlib
import pickle
import warnings
Expand Down
1 change: 1 addition & 0 deletions tests/test_pulses.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests ``pulses.py``."""

import os
import pathlib

Expand Down
1 change: 1 addition & 0 deletions tests/test_result.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Testing result.py."""

import numpy as np
import pytest

Expand Down

0 comments on commit 2bed40e

Please sign in to comment.