From 79c627466aa3b479cb9e86dc35af963a5fa60efc Mon Sep 17 00:00:00 2001 From: Dean Poulos Date: Fri, 20 Dec 2024 02:52:57 +1100 Subject: [PATCH] Apply black formatting. --- .../callable_from_qua/_callable_from_qua.py | 9 ++-- .../wirer/instruments/instrument_channel.py | 3 +- .../wirer/instruments/instruments.py | 1 - qualang_tools/wirer/visualizer/layout.py | 2 +- .../wirer/visualizer/port_annotation.py | 2 +- qualang_tools/wirer/wirer/channel_specs.py | 42 ++++++++++--------- qualang_tools/wirer/wirer/wirer.py | 12 ++++-- 7 files changed, 41 insertions(+), 30 deletions(-) diff --git a/qualang_tools/callable_from_qua/_callable_from_qua.py b/qualang_tools/callable_from_qua/_callable_from_qua.py index f524a91d..ec4948f1 100644 --- a/qualang_tools/callable_from_qua/_callable_from_qua.py +++ b/qualang_tools/callable_from_qua/_callable_from_qua.py @@ -79,13 +79,16 @@ def run(self, job: QmJob): class ProgramAddon(ABC): @abstractmethod - def enter_program(self, program: Program): ... # noqa: E704 + def enter_program(self, program: Program): + ... # noqa: E704 @abstractmethod - def exit_program(self, exc_type, exc_val, exc_tb): ... # noqa: E704 + def exit_program(self, exc_type, exc_val, exc_tb): + ... # noqa: E704 @abstractmethod - def execute_program(self, program: Program, quantum_machine: QuantumMachine): ... # noqa: E704 + def execute_program(self, program: Program, quantum_machine: QuantumMachine): + ... # noqa: E704 class QuaCallableEventManager(ProgramAddon): diff --git a/qualang_tools/wirer/instruments/instrument_channel.py b/qualang_tools/wirer/instruments/instrument_channel.py index 8d8f1c3f..71e23bac 100644 --- a/qualang_tools/wirer/instruments/instrument_channel.py +++ b/qualang_tools/wirer/instruments/instrument_channel.py @@ -40,6 +40,8 @@ class InstrumentChannelAnalog: InstrumentIdType = Literal["lf-fem", "mw-fem", "opx+", "octave", "external-mixer"] + + @dataclass(eq=False) class InstrumentChannelLfFem: instrument_id: InstrumentIdType = "lf-fem" @@ -142,7 +144,6 @@ class InstrumentChannelExternalMixerOutput( pass - @dataclass(eq=False) class InstrumentChannelOctaveInput( InstrumentChannelAnalog, InstrumentChannelOctave, InstrumentChannelInput, InstrumentChannel diff --git a/qualang_tools/wirer/instruments/instruments.py b/qualang_tools/wirer/instruments/instruments.py index 0fd2e991..45ff3890 100644 --- a/qualang_tools/wirer/instruments/instruments.py +++ b/qualang_tools/wirer/instruments/instruments.py @@ -43,7 +43,6 @@ def add_external_mixer(self, indices: Union[List[int], int]): channel = InstrumentChannelExternalMixerDigitalInput(con=index, port=1) self.available_channels.add(channel) - def add_octave(self, indices: Union[List[int], int]): if isinstance(indices, int): indices = [indices] diff --git a/qualang_tools/wirer/visualizer/layout.py b/qualang_tools/wirer/visualizer/layout.py index e2b516fc..ac7dbb63 100644 --- a/qualang_tools/wirer/visualizer/layout.py +++ b/qualang_tools/wirer/visualizer/layout.py @@ -4,7 +4,7 @@ "mw-fem": "OPX1000", "opx+": "OPX+", "octave": "Octave", - "external-mixer": "Mixers" + "external-mixer": "Mixers", } # Define the chassis dimensions diff --git a/qualang_tools/wirer/visualizer/port_annotation.py b/qualang_tools/wirer/visualizer/port_annotation.py index 15585f02..c2716e5e 100644 --- a/qualang_tools/wirer/visualizer/port_annotation.py +++ b/qualang_tools/wirer/visualizer/port_annotation.py @@ -58,7 +58,7 @@ def draw(self, ax: Axes): fontsize=8, fontweight="bold", color=outline_colour, - ) + ) bbox = None else: raise NotImplementedError(f"No port-annotation drawing for {self.instrument_id}") diff --git a/qualang_tools/wirer/wirer/channel_specs.py b/qualang_tools/wirer/wirer/channel_specs.py index 1259bf91..a9216672 100644 --- a/qualang_tools/wirer/wirer/channel_specs.py +++ b/qualang_tools/wirer/wirer/channel_specs.py @@ -15,7 +15,7 @@ InstrumentChannelMwFemDigitalOutput, InstrumentChannelLfFemDigitalOutput, InstrumentChannelOctaveDigitalInput, - InstrumentChannelExternalMixerDigitalInput + InstrumentChannelExternalMixerDigitalInput, ) # A channel template is a partially filled InstrumentChannel object @@ -113,16 +113,16 @@ def __init__(self, index: int = None, rf_in: int = None, rf_out: int = None): class ChannelSpecLfFemBasebandAndOctave(ChannelSpec): def __init__( - self, - con: int = None, - slot: int = None, - in_port_i: int = None, - in_port_q: int = None, - out_port_i: int = None, - out_port_q: int = None, - octave_index: int = None, - rf_in: int = None, - rf_out: int = None, + self, + con: int = None, + slot: int = None, + in_port_i: int = None, + in_port_q: int = None, + out_port_i: int = None, + out_port_q: int = None, + octave_index: int = None, + rf_in: int = None, + rf_out: int = None, ): super().__init__() self.channel_templates = [ @@ -134,6 +134,7 @@ def __init__( InstrumentChannelOctaveOutput(con=octave_index, port=rf_out), ] + class ChannelSpecLfFemBasebandAndExternalMixer(ChannelSpec): def __init__( self, @@ -158,15 +159,15 @@ def __init__( class ChannelSpecOpxPlusBasebandAndOctave(ChannelSpec): def __init__( - self, - con: int = None, - in_port_i: int = None, - in_port_q: int = None, - out_port_i: int = None, - out_port_q: int = None, - octave_index: int = None, - rf_in: int = None, - rf_out: int = None, + self, + con: int = None, + in_port_i: int = None, + in_port_q: int = None, + out_port_i: int = None, + out_port_q: int = None, + octave_index: int = None, + rf_in: int = None, + rf_out: int = None, ): super().__init__() self.channel_templates = [ @@ -178,6 +179,7 @@ def __init__( InstrumentChannelOctaveOutput(con=octave_index, port=rf_out), ] + class ChannelSpecOpxPlusBasebandAndExternalMixer(ChannelSpec): def __init__( self, diff --git a/qualang_tools/wirer/wirer/wirer.py b/qualang_tools/wirer/wirer/wirer.py index cbf0ba71..2a2e9be6 100644 --- a/qualang_tools/wirer/wirer/wirer.py +++ b/qualang_tools/wirer/wirer/wirer.py @@ -19,7 +19,7 @@ ChannelSpecLfFemDigital, ChannelSpecOctaveDigital, ChannelSpecOpxPlusDigital, - ChannelSpecExternalMixerDigital + ChannelSpecExternalMixerDigital, ) from .wirer_assign_channels_to_spec import assign_channels_to_spec from .wirer_exceptions import ConstraintsTooStrictException, NotEnoughChannelsException @@ -105,11 +105,17 @@ def allocate_rf_channels(spec: WiringSpec, instruments: Instruments): # LF-FEM I/Q output with Octave for upconversion ChannelSpecLfFemBaseband() & ChannelSpecLfFemDigital() & ChannelSpecOctave() & ChannelSpecOctaveDigital(), # LF-FEM I/Q output with External Mixer for upconversion - ChannelSpecLfFemBaseband() & ChannelSpecLfFemDigital() & ChannelSpecExternalMixer() & ChannelSpecExternalMixerDigital(), + ChannelSpecLfFemBaseband() + & ChannelSpecLfFemDigital() + & ChannelSpecExternalMixer() + & ChannelSpecExternalMixerDigital(), # OPX+ I/Q output with Octave for upconversion ChannelSpecOpxPlusBaseband() & ChannelSpecOpxPlusDigital() & ChannelSpecOctave() & ChannelSpecOctaveDigital(), # OPX+ I/Q output with External Mixer for upconversion - ChannelSpecOpxPlusBaseband() & ChannelSpecOpxPlusDigital() & ChannelSpecExternalMixer() & ChannelSpecExternalMixerDigital(), + ChannelSpecOpxPlusBaseband() + & ChannelSpecOpxPlusDigital() + & ChannelSpecExternalMixer() + & ChannelSpecExternalMixerDigital(), ] allocate_channels(spec, rf_specs, instruments, same_con=True, same_slot=True)