qua-platform / quam

The Quantum Abstract Machine (QuAM) is a comprehensive framework designed to abstract and manage quantum programming environments, providing robust tools for configuring and running quantum operations effectively. It is built over the QUA programming language, offering an organized structure for handling complex quantum components and operations.
http://qua-platform.github.io/quam/
BSD 3-Clause "New" or "Revised" License
4 stars 2 forks source link

bug: DigitalOutputChannel need the port to be instantiated as a tuple #28

Closed TheoLaudatQM closed 2 months ago

TheoLaudatQM commented 4 months ago

@quam_dataclass class DigitalOutputChannel(QuamComponent): """QuAM component for a digital output channel (signal going out of the OPX)

Should be added to `Channel.digital_outputs` so that it's also added to the
respective element in the QUA config.

Args:
    opx_output (Tuple[str, int]): Channel output port from the OPX perspective,
        E.g. ("con1", 1)
    delay (int, optional): Delay in nanoseconds. An intrinsic negative delay of
        136 ns exists by default.
    buffer (int, optional): Digital pulses played to this element will be convolved
        with a digital pulse of value 1 with this length [ns].
    shareable (bool, optional): If True, the digital output can be shared with other
        QM instances. Default is False
    inverted (bool, optional): If True, the digital output is inverted.
        Default is False.
."""

opx_output: Tuple[str, int]
delay: int = None
buffer: int = None

shareable: bool = None
inverted: bool = None

def generate_element_config(self) -> Dict[str, int]:
    """Generates the config entry for a digital channel in the QUA config.

    This config entry goes into:
    config.elements.<element_name>.digitalInputs.<opx_output[1]>

    Returns:
        Dict[str, int]: The digital channel config entry.
            Contains "port", and optionally "delay", "buffer" if specified
    """
    digital_cfg = {"port": tuple(self.opx_output)}  **# TODO: Need tuple here**
    if self.delay is not None:
        digital_cfg["delay"] = self.delay
    if self.buffer is not None:
        digital_cfg["buffer"] = self.buffer
    return digital_cfg
nulinspiratie commented 2 months ago

I believe this has been fixed with the introduction of ports, feel free to reopen if not fixed