示例#1
0
文件: gates.py 项目: flo-maier/c3
 def quick_setup(self,
                 chan,
                 qubit_freq,
                 gate_time,
                 v2hz=1,
                 sideband=None) -> None:
     """
     Initialize this instruction with a default envelope and carrier.
     """
     pi_half_amp = np.pi / 2 / gate_time / v2hz * 2 * np.pi
     env_params = {
         "t_final":
         Quantity(value=gate_time, unit="s"),
         "amp":
         Quantity(value=pi_half_amp,
                  min_val=0.0,
                  max_val=3 * pi_half_amp,
                  unit="V"),
     }
     carrier_freq = qubit_freq
     if sideband:
         env_params["freq_offset"] = Quantity(value=sideband, unit="Hz 2pi")
         carrier_freq -= sideband
     self.comps[chan]["gaussian"] = Envelope("gaussian",
                                             shape=gaussian_nonorm,
                                             params=env_params)
     self.comps[chan]["carrier"] = Carrier(
         "Carr_" + chan,
         params={"freq": Quantity(value=carrier_freq, unit="Hz 2pi")})
示例#2
0
def test_signal_generation() -> None:
    t_final = 7e-9  # Time for single qubit gates
    sideband = 50e6 * 2 * np.pi
    gauss_params_single = {
        'amp':
        Quantity(value=0.5, min_val=0.4, max_val=0.6, unit="V"),
        't_final':
        Quantity(value=t_final,
                 min_val=0.5 * t_final,
                 max_val=1.5 * t_final,
                 unit="s"),
        'sigma':
        Quantity(value=t_final / 4,
                 min_val=t_final / 8,
                 max_val=t_final / 2,
                 unit="s"),
        'xy_angle':
        Quantity(value=0.0,
                 min_val=-0.5 * np.pi,
                 max_val=2.5 * np.pi,
                 unit='rad'),
        'freq_offset':
        Quantity(value=-sideband - 3e6 * 2 * np.pi,
                 min_val=-56 * 1e6 * 2 * np.pi,
                 max_val=-52 * 1e6 * 2 * np.pi,
                 unit='Hz 2pi'),
        'delta':
        Quantity(value=-1, min_val=-5, max_val=3, unit="")
    }
    gauss_env_single = Envelope(name="gauss",
                                desc="Gaussian comp for single-qubit gates",
                                params=gauss_params_single,
                                shape=envelopes['gaussian_nonorm'])

    carrier_parameters = {
        'freq':
        Quantity(value=5e9 * 2 * np.pi,
                 min_val=4.5e9 * 2 * np.pi,
                 max_val=6e9 * 2 * np.pi,
                 unit='Hz 2pi'),
        'framechange':
        Quantity(value=0.0, min_val=-np.pi, max_val=3 * np.pi, unit='rad')
    }
    carr = Carrier(name="carrier",
                   desc="Frequency of the local oscillator",
                   params=carrier_parameters)

    X90p_q1 = Instruction(name="X90p",
                          t_start=0.0,
                          t_end=t_final,
                          channels=["d1"])

    X90p_q1.add_component(gauss_env_single, "d1")
    X90p_q1.add_component(carr, "d1")

    gen.generate_signals(X90p_q1)
示例#3
0
def test_signal_generation() -> None:
    t_final = 7e-9  # Time for single qubit gates
    sideband = 50e6 * 2 * np.pi
    gauss_params_single = {
        "amp": Quantity(value=0.5, min_val=0.4, max_val=0.6, unit="V"),
        "t_final": Quantity(
            value=t_final, min_val=0.5 * t_final, max_val=1.5 * t_final, unit="s"
        ),
        "sigma": Quantity(
            value=t_final / 4, min_val=t_final / 8, max_val=t_final / 2, unit="s"
        ),
        "xy_angle": Quantity(
            value=0.0, min_val=-0.5 * np.pi, max_val=2.5 * np.pi, unit="rad"
        ),
        "freq_offset": Quantity(
            value=-sideband - 3e6 * 2 * np.pi,
            min_val=-56 * 1e6 * 2 * np.pi,
            max_val=-52 * 1e6 * 2 * np.pi,
            unit="Hz 2pi",
        ),
        "delta": Quantity(value=-1, min_val=-5, max_val=3, unit=""),
    }
    gauss_env_single = Envelope(
        name="gauss",
        desc="Gaussian comp for single-qubit gates",
        params=gauss_params_single,
        shape=envelopes["gaussian_nonorm"],
    )

    carrier_parameters = {
        "freq": Quantity(
            value=5e9 * 2 * np.pi,
            min_val=4.5e9 * 2 * np.pi,
            max_val=6e9 * 2 * np.pi,
            unit="Hz 2pi",
        ),
        "framechange": Quantity(
            value=0.0, min_val=-np.pi, max_val=3 * np.pi, unit="rad"
        ),
    }
    carr = Carrier(
        name="carrier",
        desc="Frequency of the local oscillator",
        params=carrier_parameters,
    )

    rx90p_q1 = Instruction(name="rx90p", t_start=0.0, t_end=t_final, channels=["d1"])
    rx90p_q1.add_component(gauss_env_single, "d1")
    rx90p_q1.add_component(carr, "d1")

    gen.generate_signals(rx90p_q1)
示例#4
0
}
gauss_env_single = Envelope(
    name="gauss",
    desc="Gaussian comp for single-qubit gates",
    params=gauss_params_single,
    shape=env_lib.gaussian_nonorm,
)


lo_freq_q1 = 5e9 + sideband
carrier_parameters = {
    "freq": Quantity(value=lo_freq_q1, min_val=4.5e9, max_val=6e9, unit="Hz 2pi"),
    "framechange": Quantity(value=0.0, min_val=-np.pi, max_val=3 * np.pi, unit="rad"),
}
carr = Carrier(
    name="carrier", desc="Frequency of the local oscillator", params=carrier_parameters
)

RX90p_q1 = Instruction(name="RX90p", t_start=0.0, t_end=t_final, channels=["d1"])
RX90p_q1.add_component(gauss_env_single, "d1")
RX90p_q1.add_component(carr, "d1")

tstart = RX90p_q1.t_start
tend = RX90p_q1.t_end
chan = "d1"

with open("test/generator_data.pickle", "rb") as filename:
    data = pickle.load(filename)


@pytest.mark.unit
示例#5
0
def setup_pmap() -> ParameterMap:
    t_final = 7e-9  # Time for single qubit gates
    sideband = 50e6
    lo_freq = 5e9 + sideband

    # ### MAKE GATESET
    gauss_params_single = {
        'amp':
        Quantity(value=0.45, min_val=0.4, max_val=0.6, unit="V"),
        't_final':
        Quantity(value=t_final,
                 min_val=0.5 * t_final,
                 max_val=1.5 * t_final,
                 unit="s"),
        'sigma':
        Quantity(value=t_final / 4,
                 min_val=t_final / 8,
                 max_val=t_final / 2,
                 unit="s"),
        'xy_angle':
        Quantity(value=0.0,
                 min_val=-0.5 * np.pi,
                 max_val=2.5 * np.pi,
                 unit='rad'),
        'freq_offset':
        Quantity(value=-sideband - 0.5e6,
                 min_val=-53 * 1e6,
                 max_val=-47 * 1e6,
                 unit='Hz 2pi'),
        'delta':
        Quantity(value=-1, min_val=-5, max_val=3, unit="")
    }

    gauss_env_single = Envelope(name="gauss",
                                desc="Gaussian comp for single-qubit gates",
                                params=gauss_params_single,
                                shape=envelopes.gaussian_nonorm)
    nodrive_env = Envelope(name="no_drive",
                           params={
                               't_final':
                               Quantity(value=t_final,
                                        min_val=0.5 * t_final,
                                        max_val=1.5 * t_final,
                                        unit="s")
                           },
                           shape=envelopes.no_drive)
    carrier_parameters = {
        'freq':
        Quantity(value=lo_freq, min_val=4.5e9, max_val=6e9, unit='Hz 2pi'),
        'framechange':
        Quantity(value=0.0, min_val=-np.pi, max_val=3 * np.pi, unit='rad')
    }
    carr = Carrier(name="carrier",
                   desc="Frequency of the local oscillator",
                   params=carrier_parameters)

    X90p = Instruction(name="X90p",
                       t_start=0.0,
                       t_end=t_final,
                       channels=["d1"])
    QId = Instruction(name="Id", t_start=0.0, t_end=t_final, channels=["d1"])

    X90p.add_component(gauss_env_single, "d1")
    X90p.add_component(carr, "d1")
    QId.add_component(nodrive_env, "d1")
    QId.add_component(copy.deepcopy(carr), "d1")
    QId.comps['d1']['carrier'].params['framechange'].set_value(
        (-sideband * t_final) % (2 * np.pi))
    Y90p = copy.deepcopy(X90p)
    Y90p.name = "Y90p"
    X90m = copy.deepcopy(X90p)
    X90m.name = "X90m"
    Y90m = copy.deepcopy(X90p)
    Y90m.name = "Y90m"
    Y90p.comps['d1']['gauss'].params['xy_angle'].set_value(0.5 * np.pi)
    X90m.comps['d1']['gauss'].params['xy_angle'].set_value(np.pi)
    Y90m.comps['d1']['gauss'].params['xy_angle'].set_value(1.5 * np.pi)

    parameter_map = ParameterMap(instructions=[QId, X90p, Y90p, X90m, Y90m])

    gateset_opt_map = [[("X90p", "d1", "gauss", "amp"),
                        ("Y90p", "d1", "gauss", "amp"),
                        ("X90m", "d1", "gauss", "amp"),
                        ("Y90m", "d1", "gauss", "amp")],
                       [("X90p", "d1", "gauss", "delta"),
                        ("Y90p", "d1", "gauss", "delta"),
                        ("X90m", "d1", "gauss", "delta"),
                        ("Y90m", "d1", "gauss", "delta")],
                       [("X90p", "d1", "gauss", "freq_offset"),
                        ("Y90p", "d1", "gauss", "freq_offset"),
                        ("X90m", "d1", "gauss", "freq_offset"),
                        ("Y90m", "d1", "gauss", "freq_offset")],
                       [("Id", "d1", "carrier", "framechange")]]

    parameter_map.set_opt_map(gateset_opt_map)

    return parameter_map
示例#6
0
def setup_pmap() -> ParameterMap:
    t_final = 7e-9  # Time for single qubit gates
    sideband = 50e6
    lo_freq = 5e9 + sideband

    # ### MAKE GATESET
    gauss_params_single = {
        "amp":
        Quantity(value=0.45, min_val=0.4, max_val=0.6, unit="V"),
        "t_final":
        Quantity(value=t_final,
                 min_val=0.5 * t_final,
                 max_val=1.5 * t_final,
                 unit="s"),
        "sigma":
        Quantity(value=t_final / 4,
                 min_val=t_final / 8,
                 max_val=t_final / 2,
                 unit="s"),
        "xy_angle":
        Quantity(value=0.0,
                 min_val=-0.5 * np.pi,
                 max_val=2.5 * np.pi,
                 unit="rad"),
        "freq_offset":
        Quantity(value=-sideband - 0.5e6,
                 min_val=-53 * 1e6,
                 max_val=-47 * 1e6,
                 unit="Hz 2pi"),
        "delta":
        Quantity(value=-1, min_val=-5, max_val=3, unit=""),
    }

    gauss_env_single = Envelope(
        name="gauss",
        desc="Gaussian comp for single-qubit gates",
        params=gauss_params_single,
        shape=envelopes.gaussian_nonorm,
    )
    nodrive_env = Envelope(
        name="no_drive",
        params={
            "t_final":
            Quantity(value=t_final,
                     min_val=0.5 * t_final,
                     max_val=1.5 * t_final,
                     unit="s")
        },
        shape=envelopes.no_drive,
    )
    carrier_parameters = {
        "freq":
        Quantity(value=lo_freq, min_val=4.5e9, max_val=6e9, unit="Hz 2pi"),
        "framechange":
        Quantity(value=0.0, min_val=-np.pi, max_val=3 * np.pi, unit="rad"),
    }
    carr = Carrier(
        name="carrier",
        desc="Frequency of the local oscillator",
        params=carrier_parameters,
    )

    RX90p = Instruction(name="RX90p",
                        t_start=0.0,
                        t_end=t_final,
                        channels=["d1"])
    QId = Instruction(name="Id", t_start=0.0, t_end=t_final, channels=["d1"])

    RX90p.add_component(gauss_env_single, "d1")
    RX90p.add_component(carr, "d1")
    QId.add_component(nodrive_env, "d1")
    QId.add_component(copy.deepcopy(carr), "d1")
    QId.comps["d1"]["carrier"].params["framechange"].set_value(
        (-sideband * t_final) % (2 * np.pi))
    RY90p = copy.deepcopy(RX90p)
    RY90p.name = "RY90p"
    RX90m = copy.deepcopy(RX90p)
    RX90m.name = "RX90m"
    RY90m = copy.deepcopy(RX90p)
    RY90m.name = "RY90m"
    RY90p.comps["d1"]["gauss"].params["xy_angle"].set_value(0.5 * np.pi)
    RX90m.comps["d1"]["gauss"].params["xy_angle"].set_value(np.pi)
    RY90m.comps["d1"]["gauss"].params["xy_angle"].set_value(1.5 * np.pi)

    parameter_map = ParameterMap(
        instructions=[QId, RX90p, RY90p, RX90m, RY90m])

    gateset_opt_map = [
        [
            ("RX90p", "d1", "gauss", "amp"),
            ("RY90p", "d1", "gauss", "amp"),
            ("RX90m", "d1", "gauss", "amp"),
            ("RY90m", "d1", "gauss", "amp"),
        ],
        [
            ("RX90p", "d1", "gauss", "delta"),
            ("RY90p", "d1", "gauss", "delta"),
            ("RX90m", "d1", "gauss", "delta"),
            ("RY90m", "d1", "gauss", "delta"),
        ],
        [
            ("RX90p", "d1", "gauss", "freq_offset"),
            ("RY90p", "d1", "gauss", "freq_offset"),
            ("RX90m", "d1", "gauss", "freq_offset"),
            ("RY90m", "d1", "gauss", "freq_offset"),
        ],
        [("Id", "d1", "carrier", "framechange")],
    ]

    parameter_map.set_opt_map(gateset_opt_map)

    return parameter_map