rigetti / pyquil

A Python library for quantum programming using Quil.
http://docs.rigetti.com
Apache License 2.0
1.4k stars 342 forks source link

The `DefFrame` `hardware_object` property is not being serialized correctly. #1711

Closed MarquessV closed 9 months ago

MarquessV commented 9 months ago

The hardware_object property on a DefFrame are not being serialized correctly which causes compilation errors.

Example:

def hardware_object_not_parsed_correctly():
    new_frame_id = FrameIdentifier(
        rf_frame.identifier.name + "_f12", rf_frame.identifier.qubits
    )
    new_initial_frequency = rf_frame.center_frequency - 220e6

    x = DefFrame(
        frame=new_frame_id,
        direction=rf_frame.direction,
        initial_frequency=new_initial_frequency,
        center_frequency=rf_frame.center_frequency,
        hardware_object=rf_frame.hardware_object,
        sample_rate=rf_frame.sample_rate,
    )

    # raises Assertion Error
    assert (
        x.hardware_object == rf_frame.hardware_object
    ), f"HW Objects not the same\nnew_hw_object: {x.hardware_object}\n\old_object:{rf_frame.hardware_object}"