Example #1
0
def test_create_program_graphs():
    calib_time = datetime(year=2019, month=2, day=1,
                          hour=0, minute=0, second=0, tzinfo=timezone.utc)
    qubit_list = []
    ro_errors = [0.01, 0.01, 0.01]
    for ro_error in ro_errors:
        qubit_list.append(make_qubit_with_error(ro_error))
    p01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.9)]
    g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1])
    p12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
    g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2])
    gate_list = [g01, g12]

    bprop = BackendProperties(last_update_date=calib_time, backend_name="test_backend",
                              qubits=qubit_list, backend_version="1.0.0", gates=gate_list,
                              general=[])

    circ_list = [random_circuit(2, 10, measure=True), random_circuit(
        4, 10, measure=True), random_circuit(3, 10, measure=True), random_circuit(5, 10, measure=True)]
    dag_list = [circuit_to_dag(circ) for circ in circ_list]

    caml = CrosstalkAdaptiveMultiLayout(bprop)
    num_q = caml._create_program_graphs(dag_list)
    print(num_q)
    heights = []
    for dag in caml.dag_list:
        height = dag.num_qubits()
        heights.append(height)
    print(heights)
 def test_bad_readout(self):
     """Test that the mapper avoids bad readout unit"""
     calib_time = datetime(year=2019, month=2, day=1, hour=0, minute=0, second=0)
     qr = QuantumRegister(2, name="q")
     circuit = QuantumCircuit(qr)
     circuit.cx(qr[0], qr[1])
     dag = circuit_to_dag(circuit)
     qubit_list = []
     ro_errors = [0.01, 0.01, 0.8]
     for ro_error in ro_errors:
         qubit_list.append(make_qubit_with_error(ro_error))
     p01 = [Nduv(date=calib_time, name="gate_error", unit="", value=0.1)]
     g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1])
     p12 = [Nduv(date=calib_time, name="gate_error", unit="", value=0.1)]
     g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2])
     gate_list = [g01, g12]
     bprop = BackendProperties(
         last_update_date=calib_time,
         backend_name="test_backend",
         qubits=qubit_list,
         backend_version="1.0.0",
         gates=gate_list,
         general=[],
     )
     nalayout = NoiseAdaptiveLayout(bprop)
     nalayout.run(dag)
     initial_layout = nalayout.property_set["layout"]
     self.assertNotEqual(initial_layout[qr[0]], 2)
     self.assertNotEqual(initial_layout[qr[1]], 2)
 def test_on_linear_topology(self):
     """
     Test that the mapper identifies the correct gate in a linear topology
     """
     calib_time = datetime(year=2019,
                           month=2,
                           day=1,
                           hour=0,
                           minute=0,
                           second=0)
     qr = QuantumRegister(2, name='q')
     circuit = QuantumCircuit(qr)
     circuit.cx(qr[0], qr[1])
     dag = circuit_to_dag(circuit)
     qubit_list = []
     ro_errors = [0.01, 0.01, 0.01]
     for ro_error in ro_errors:
         qubit_list.append(make_qubit_with_error(ro_error))
     p01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.9)]
     g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1])
     p12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
     g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2])
     gate_list = [g01, g12]
     bprop = BackendProperties(last_update_date=calib_time,
                               backend_name="test_backend",
                               qubits=qubit_list,
                               backend_version="1.0.0",
                               gates=gate_list,
                               general=[])
     nalayout = NoiseAdaptiveLayout(bprop)
     nalayout.run(dag)
     initial_layout = nalayout.property_set['layout']
     self.assertNotEqual(initial_layout[qr[0]], 0)
     self.assertNotEqual(initial_layout[qr[1]], 0)
    def _build_props(self) -> BackendProperties:
        """Build properties for backend."""
        qubits = []
        gates = []

        for (qubit_t1, qubit_t2, freq,
             read_err) in zip(self.qubit_t1, self.qubit_t2,
                              self.qubit_frequency, self.qubit_readout_error):
            qubits.append([
                Nduv(date=self.now, name="T1", unit="µs", value=qubit_t1),
                Nduv(date=self.now, name="T2", unit="µs", value=qubit_t2),
                Nduv(date=self.now, name="frequency", unit="GHz", value=freq),
                Nduv(date=self.now,
                     name="readout_error",
                     unit="",
                     value=read_err),
            ])

        for gate in self.basis_gates:
            parameters = [
                Nduv(date=self.now, name="gate_error", unit="", value=0.01),
                Nduv(date=self.now,
                     name="gate_length",
                     unit="ns",
                     value=4 * self.dt),
            ]

            if gate in self.single_qubit_gates:
                for i in range(self.n_qubits):
                    gates.append(
                        Gate(
                            gate=gate,
                            name=f"{gate}_{i}",
                            qubits=[i],
                            parameters=parameters,
                        ))
            elif gate == "cx":
                for (qubit1, qubit2) in list(
                        itertools.combinations(range(self.n_qubits), 2)):
                    gates.append(
                        Gate(
                            gate=gate,
                            name=f"{gate}{qubit1}_{qubit2}",
                            qubits=[qubit1, qubit2],
                            parameters=parameters,
                        ))
            else:
                raise QiskitError(
                    "{gate} is not supported by fake backend builder."
                    "".format(gate=gate))

        return BackendProperties(
            backend_name=self.name,
            backend_version=self.version,
            last_update_date=self.now,
            qubits=qubits,
            gates=gates,
            general=[],
        )
    def _build_props(self) -> BackendProperties:
        """Build properties for backend."""
        qubits = []
        gates = []

        for (qubit_t1, qubit_t2, freq,
             read_err) in zip(self.qubit_t1, self.qubit_t2,
                              self.qubit_frequency, self.qubit_readout_error):
            qubits.append([
                Nduv(date=self.now, name='T1', unit='µs', value=qubit_t1),
                Nduv(date=self.now, name='T2', unit='µs', value=qubit_t2),
                Nduv(date=self.now, name='frequency', unit='GHz', value=freq),
                Nduv(date=self.now,
                     name='readout_error',
                     unit='',
                     value=read_err)
            ])

        for gate in self.basis_gates:
            parameters = [
                Nduv(date=self.now, name='gate_error', unit='', value=0.01),
                Nduv(date=self.now,
                     name='gate_length',
                     unit='ns',
                     value=4 * self.dt)
            ]

            if gate in self.single_qubit_gates:
                for i in range(self.n_qubits):
                    gates.append(
                        Gate(gate=gate,
                             name="{0}_{1}".format(gate, i),
                             qubits=[i],
                             parameters=parameters))
            elif gate == 'cx':
                for (qubit1, qubit2) in list(
                        itertools.combinations(range(self.n_qubits), 2)):
                    gates.append(
                        Gate(gate=gate,
                             name="{gate}{q1}_{q2}".format(gate=gate,
                                                           q1=qubit1,
                                                           q2=qubit2),
                             qubits=[qubit1, qubit2],
                             parameters=parameters))
            else:
                raise QiskitError(
                    "{gate} is not supported by fake backend builder."
                    "".format(gate=gate))

        return BackendProperties(backend_name=self.name,
                                 backend_version=self.version,
                                 last_update_date=self.now,
                                 qubits=qubits,
                                 gates=gates,
                                 general=[])
Example #6
0
 def __init__(self):
     mock_time = datetime.datetime.now()
     dt = 1.3333
     configuration = BackendProperties(
         backend_name="invalid_t2",
         backend_version="0.0.0",
         num_qubits=1,
         basis_gates=["u3"],
         qubits=[
             [
                 Nduv(date=mock_time, name="T1", unit="µs", value=t1_ns/1000),
                 Nduv(date=mock_time, name="T2", unit="µs", value=invalid_t2_ns/1000),
                 Nduv(date=mock_time, name="frequency", unit="MHz", value=frequency),
             ],
         ],
         gates=[
             Gate(
                 gate="u3",
                 name="u3_0",
                 qubits=[0],
                 parameters=[
                     Nduv(date=mock_time, name="gate_error", unit="", value=0.001),
                     Nduv(date=mock_time, name="gate_length", unit="ns", value=u3_time_ns),
                 ],
             ),
         ],
         last_update_date=mock_time,
         general=[],
     )
     super().__init__(configuration)
Example #7
0
def _parse_backend_properties(backend_properties, backend, num_circuits):
    # try getting backend_properties from user, else backend
    if backend_properties is None:
        if getattr(backend, 'properties', None):
            backend_properties = backend.properties()
            if backend_properties and \
                    (backend_properties.faulty_qubits() or backend_properties.faulty_gates()):
                faulty_qubits = sorted(backend_properties.faulty_qubits(), reverse=True)
                faulty_edges = [gates.qubits for gates in backend_properties.faulty_gates()]
                # remove faulty qubits in backend_properties.qubits
                for faulty_qubit in faulty_qubits:
                    del backend_properties.qubits[faulty_qubit]

                gates = []
                for gate in backend_properties.gates:
                    # remove gates using faulty edges or with faulty qubits (and remap the
                    # gates in terms of faulty_qubits_map)
                    faulty_qubits_map = _create_faulty_qubits_map(backend)
                    if any(faulty_qubits_map[qubits] is not None for qubits in gate.qubits) or \
                            gate.qubits in faulty_edges:
                        continue
                    gate_dict = gate.to_dict()
                    replacement_gate = Gate.from_dict(gate_dict)
                    gate_dict['qubits'] = [faulty_qubits_map[qubit] for qubit in gate.qubits]
                    args = '_'.join([str(qubit) for qubit in gate_dict['qubits']])
                    gate_dict['name'] = "%s%s" % (gate_dict['gate'], args)
                    gates.append(replacement_gate)

                backend_properties.gates = gates
    if not isinstance(backend_properties, list):
        backend_properties = [backend_properties] * num_circuits
    return backend_properties
Example #8
0
 def __init__(self):
     """
       0
     """
     mock_time = datetime.datetime.now()
     dt = 1.3333  # pylint: disable=invalid-name
     configuration = BackendProperties(
         backend_name='fake_1q',
         backend_version='0.0.0',
         n_qubits=1,
         basis_gates=['u1', 'u2', 'u3', 'cx'],
         simulator=False,
         local=True,
         conditional=False,
         memory=False,
         max_shots=1024,
         qubits=[
             [Nduv(date=mock_time, name='T1', unit='µs', value=71.9500421005539),
              Nduv(date=mock_time, name='frequency', unit='MHz', value=4919.96800692)]
         ],
         gates=[
             Gate(gate='u1', name='u1_0', qubits=[0],
                  parameters=[
                      Nduv(date=mock_time, name='gate_error', unit='', value=1.0),
                      Nduv(date=mock_time, name='gate_length', unit='ns', value=0.)]),
             Gate(gate='u3', name='u3_0', qubits=[0],
                  parameters=[
                      Nduv(date=mock_time, name='gate_error', unit='', value=1.0),
                      Nduv(date=mock_time, name='gate_length', unit='ns', value=2 * dt)]),
             Gate(gate='u3', name='u3_1', qubits=[1],
                  parameters=[
                      Nduv(date=mock_time, name='gate_error', unit='', value=1.0),
                      Nduv(date=mock_time, name='gate_length', unit='ns', value=4 * dt)]),
             Gate(gate='cx', name='cx0_1', qubits=[0, 1],
                  parameters=[
                      Nduv(date=mock_time, name='gate_error', unit='', value=1.0),
                      Nduv(date=mock_time, name='gate_length', unit='ns', value=22 * dt)]),
         ],
         coupling_map=None,
         n_registers=1,
         last_update_date=mock_time,
         general=[]
     )
     super().__init__(configuration)
Example #9
0
def test_initialize_backend_prop():

    circ_list = [random_circuit(2, 2) for _ in range(10)]
    dag_list = [circuit_to_dag(circ) for circ in circ_list]

    calib_time = datetime(year=2019, month=2, day=1,
                          hour=0, minute=0, second=0, tzinfo=timezone.utc)
    qubit_list = []
    ro_errors = [0.01, 0.01, 0.01]
    for ro_error in ro_errors:
        qubit_list.append(make_qubit_with_error(ro_error))
    p01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.9)]
    g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1])
    p12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
    g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2])
    gate_list = [g01, g12]

    bprop = BackendProperties(last_update_date=calib_time, backend_name="test_backend",
                              qubits=qubit_list, backend_version="1.0.0", gates=gate_list,
                              general=[])

    caml = CrosstalkAdaptiveMultiLayout(bprop)
    caml._initialize_backend_prop()
Example #10
0
def _parse_backend_properties(backend_properties, backend, num_circuits):
    # try getting backend_properties from user, else backend
    if backend_properties is None:
        backend_version = getattr(backend, "version", None)
        if not isinstance(backend_version, int):
            backend_version = 0
        if backend_version <= 1:
            if getattr(backend, "properties", None):
                backend_properties = backend.properties()
                if backend_properties and (backend_properties.faulty_qubits()
                                           or
                                           backend_properties.faulty_gates()):
                    faulty_qubits = sorted(backend_properties.faulty_qubits(),
                                           reverse=True)
                    faulty_edges = [
                        gates.qubits
                        for gates in backend_properties.faulty_gates()
                    ]
                    # remove faulty qubits in backend_properties.qubits
                    for faulty_qubit in faulty_qubits:
                        del backend_properties.qubits[faulty_qubit]

                    gates = []
                    for gate in backend_properties.gates:
                        # remove gates using faulty edges or with faulty qubits (and remap the
                        # gates in terms of faulty_qubits_map)
                        faulty_qubits_map = _create_faulty_qubits_map(backend)
                        if (any(faulty_qubits_map[qubits] is not None
                                for qubits in gate.qubits)
                                or gate.qubits in faulty_edges):
                            continue
                        gate_dict = gate.to_dict()
                        replacement_gate = Gate.from_dict(gate_dict)
                        gate_dict["qubits"] = [
                            faulty_qubits_map[qubit] for qubit in gate.qubits
                        ]
                        args = "_".join(
                            [str(qubit) for qubit in gate_dict["qubits"]])
                        gate_dict["name"] = "{}{}".format(
                            gate_dict["gate"], args)
                        gates.append(replacement_gate)

                    backend_properties.gates = gates
        else:
            backend_properties = _target_to_backend_properties(backend.target)
    if not isinstance(backend_properties, list):
        backend_properties = [backend_properties] * num_circuits
    return backend_properties
 def test_grid_layout(self):
     """
     Test that the mapper identifies best location for a star-like program graph
     Machine row1: (0, 1, 2)
     Machine row2: (3, 4, 5)
     """
     calib_time = datetime(year=2019,
                           month=2,
                           day=1,
                           hour=0,
                           minute=0,
                           second=0)
     qr = QuantumRegister(4, name='q')
     circuit = QuantumCircuit(qr)
     circuit.cx(qr[0], qr[3])
     circuit.cx(qr[1], qr[3])
     circuit.cx(qr[2], qr[3])
     dag = circuit_to_dag(circuit)
     qubit_list = []
     ro_errors = [0.01] * 6
     for ro_error in ro_errors:
         qubit_list.append(make_qubit_with_error(ro_error))
     p01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)]
     p03 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)]
     p12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)]
     p14 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
     p34 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
     p45 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
     p25 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)]
     g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1])
     g03 = Gate(name="CX0_3", gate="cx", parameters=p03, qubits=[0, 3])
     g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2])
     g14 = Gate(name="CX1_4", gate="cx", parameters=p14, qubits=[1, 4])
     g34 = Gate(name="CX3_4", gate="cx", parameters=p34, qubits=[3, 4])
     g45 = Gate(name="CX4_5", gate="cx", parameters=p45, qubits=[4, 5])
     g25 = Gate(name="CX2_5", gate="cx", parameters=p25, qubits=[2, 5])
     gate_list = [g01, g03, g12, g14, g34, g45, g25]
     bprop = BackendProperties(last_update_date=calib_time,
                               backend_name="test_backend",
                               qubits=qubit_list,
                               backend_version="1.0.0",
                               gates=gate_list,
                               general=[])
     nalayout = NoiseAdaptiveLayout(bprop)
     nalayout.run(dag)
     initial_layout = nalayout.property_set['layout']
     for qid in range(4):
         for qloc in [0, 2]:
             self.assertNotEqual(initial_layout[qr[qid]], qloc)
Example #12
0
def test_run_with_Xtalk():

    calib_time = datetime(year=2019, month=2, day=1,
                          hour=0, minute=0, second=0, tzinfo=timezone.utc)
    qubit_list = []
    ro_errors = [0.01]*6
    for ro_error in ro_errors:
        qubit_list.append(make_qubit_with_error(ro_error))
    p01 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
    p03 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)]
    p12 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)]
    p14 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.2)]
    p35 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.3)]
    p45 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
    p25 = [Nduv(date=calib_time, name='gate_error', unit='', value=0.1)]
    g01 = Gate(name="CX0_1", gate="cx", parameters=p01, qubits=[0, 1])
    g03 = Gate(name="CX0_3", gate="cx", parameters=p03, qubits=[0, 3])
    g12 = Gate(name="CX1_2", gate="cx", parameters=p12, qubits=[1, 2])
    g14 = Gate(name="CX1_4", gate="cx", parameters=p14, qubits=[1, 4])
    g35 = Gate(name="CX3_5", gate="cx", parameters=p35, qubits=[3, 5])
    g45 = Gate(name="CX4_5", gate="cx", parameters=p45, qubits=[4, 5])
    g25 = Gate(name="CX2_5", gate="cx", parameters=p25, qubits=[2, 5])
    gate_list = [g01, g03, g12, g14, g35, g45, g25]
    bprop = BackendProperties(
        last_update_date=calib_time, backend_name="test_backend",
        qubits=qubit_list, backend_version="1.0.0", gates=gate_list,
        general=[])
    xtalk_prop = {(2, 5): {(0, 1): 5},
                  (1, 0): {(2, 5): 5},
                  }

    circ = random_circuit(6, 3, measure=True, seed=1)
    circ = decompose_to_base_gates(circ)
    print(circ)
    dag = circuit_to_dag(circ)

    caml_noXtalk = CrosstalkAdaptiveMultiLayout(bprop)
    caml_noXtalk.run(dag)
    pprint(caml_noXtalk.property_set['layout'])

    caml_Xtalk = CrosstalkAdaptiveMultiLayout(bprop, crosstalk_prop=xtalk_prop)
    caml_Xtalk.run(dag)
    pprint(caml_Xtalk.property_set['layout'])
Example #13
0
def create_fake_machine():
    """Create a 6 qubit machine to test crosstalk adaptive schedules"""
    calib_time = datetime(year=2019,
                          month=2,
                          day=1,
                          hour=0,
                          minute=0,
                          second=0)
    qubit_list = []
    for _ in range(6):
        qubit_list.append(make_noisy_qubit())
    cx01 = [
        Nduv(date=calib_time, name='gate_error', unit='', value=0.05),
        Nduv(date=calib_time, name='gate_length', unit='ns', value=500.0)
    ]
    cx12 = [
        Nduv(date=calib_time, name='gate_error', unit='', value=0.05),
        Nduv(date=calib_time, name='gate_length', unit='ns', value=501.0)
    ]
    cx23 = [
        Nduv(date=calib_time, name='gate_error', unit='', value=0.05),
        Nduv(date=calib_time, name='gate_length', unit='ns', value=502.0)
    ]
    cx34 = [
        Nduv(date=calib_time, name='gate_error', unit='', value=0.05),
        Nduv(date=calib_time, name='gate_length', unit='ns', value=503.0)
    ]
    cx45 = [
        Nduv(date=calib_time, name='gate_error', unit='', value=0.05),
        Nduv(date=calib_time, name='gate_length', unit='ns', value=504.0)
    ]
    gcx01 = Gate(name="CX0_1", gate="cx", parameters=cx01, qubits=[0, 1])
    gcx12 = Gate(name="CX1_2", gate="cx", parameters=cx12, qubits=[1, 2])
    gcx23 = Gate(name="CX2_3", gate="cx", parameters=cx23, qubits=[2, 3])
    gcx34 = Gate(name="CX3_4", gate="cx", parameters=cx34, qubits=[3, 4])
    gcx45 = Gate(name="CX4_5", gate="cx", parameters=cx45, qubits=[4, 5])
    u_1 = [
        Nduv(date=calib_time, name='gate_error', unit='', value=0.001),
        Nduv(date=calib_time, name='gate_length', unit='ns', value=100.0)
    ]
    gu10 = Gate(name="u1_0", gate="u1", parameters=u_1, qubits=[0])
    gu11 = Gate(name="u1_1", gate="u1", parameters=u_1, qubits=[1])
    gu12 = Gate(name="u1_2", gate="u1", parameters=u_1, qubits=[2])
    gu13 = Gate(name="u1_3", gate="u1", parameters=u_1, qubits=[3])
    gu14 = Gate(name="u1_4", gate="u1", parameters=u_1, qubits=[4])
    gu15 = Gate(name="u1_4", gate="u1", parameters=u_1, qubits=[5])
    u_2 = [
        Nduv(date=calib_time, name='gate_error', unit='', value=0.001),
        Nduv(date=calib_time, name='gate_length', unit='ns', value=100.0)
    ]
    gu20 = Gate(name="u2_0", gate="u2", parameters=u_2, qubits=[0])
    gu21 = Gate(name="u2_1", gate="u2", parameters=u_2, qubits=[1])
    gu22 = Gate(name="u2_2", gate="u2", parameters=u_2, qubits=[2])
    gu23 = Gate(name="u2_3", gate="u2", parameters=u_2, qubits=[3])
    gu24 = Gate(name="u2_4", gate="u2", parameters=u_2, qubits=[4])
    gu25 = Gate(name="u2_4", gate="u2", parameters=u_2, qubits=[5])
    u_3 = [
        Nduv(date=calib_time, name='gate_error', unit='', value=0.001),
        Nduv(date=calib_time, name='gate_length', unit='ns', value=100.0)
    ]
    gu30 = Gate(name="u3_0", gate="u3", parameters=u_3, qubits=[0])
    gu31 = Gate(name="u3_1", gate="u3", parameters=u_3, qubits=[1])
    gu32 = Gate(name="u3_2", gate="u3", parameters=u_3, qubits=[2])
    gu33 = Gate(name="u3_3", gate="u3", parameters=u_3, qubits=[3])
    gu34 = Gate(name="u3_4", gate="u3", parameters=u_3, qubits=[4])
    gu35 = Gate(name="u3_5", gate="u3", parameters=u_3, qubits=[5])

    gate_list = [
        gcx01, gcx12, gcx23, gcx34, gcx45, gu10, gu11, gu12, gu13, gu14, gu15,
        gu20, gu21, gu22, gu23, gu24, gu25, gu30, gu31, gu32, gu33, gu34, gu35
    ]

    bprop = BackendProperties(last_update_date=calib_time,
                              backend_name="test_backend",
                              qubits=qubit_list,
                              backend_version="1.0.0",
                              gates=gate_list,
                              general=[])
    return bprop
Example #14
0
 def __init__(self):
     """
     0
     """
     mock_time = datetime.datetime.now()
     dt = 1.3333
     configuration = BackendProperties(
         backend_name="fake_1q",
         backend_version="0.0.0",
         n_qubits=1,
         basis_gates=["u1", "u2", "u3", "cx"],
         simulator=False,
         local=True,
         conditional=False,
         memory=False,
         max_shots=1024,
         qubits=[[
             Nduv(date=mock_time,
                  name="T1",
                  unit="µs",
                  value=71.9500421005539),
             Nduv(date=mock_time,
                  name="frequency",
                  unit="MHz",
                  value=4919.96800692),
         ]],
         gates=[
             Gate(
                 gate="u1",
                 name="u1_0",
                 qubits=[0],
                 parameters=[
                     Nduv(date=mock_time,
                          name="gate_error",
                          unit="",
                          value=1.0),
                     Nduv(date=mock_time,
                          name="gate_length",
                          unit="ns",
                          value=0.0),
                 ],
             ),
             Gate(
                 gate="u3",
                 name="u3_0",
                 qubits=[0],
                 parameters=[
                     Nduv(date=mock_time,
                          name="gate_error",
                          unit="",
                          value=1.0),
                     Nduv(date=mock_time,
                          name="gate_length",
                          unit="ns",
                          value=2 * dt),
                 ],
             ),
             Gate(
                 gate="u3",
                 name="u3_1",
                 qubits=[1],
                 parameters=[
                     Nduv(date=mock_time,
                          name="gate_error",
                          unit="",
                          value=1.0),
                     Nduv(date=mock_time,
                          name="gate_length",
                          unit="ns",
                          value=4 * dt),
                 ],
             ),
             Gate(
                 gate="cx",
                 name="cx0_1",
                 qubits=[0, 1],
                 parameters=[
                     Nduv(date=mock_time,
                          name="gate_error",
                          unit="",
                          value=1.0),
                     Nduv(date=mock_time,
                          name="gate_length",
                          unit="ns",
                          value=22 * dt),
                 ],
             ),
         ],
         coupling_map=None,
         n_registers=1,
         last_update_date=mock_time,
         general=[],
     )
     super().__init__(configuration)
Example #15
0
    def __init__(self):
        configuration = PulseBackendConfiguration(
            backend_name="fake_openpulse_2q",
            backend_version="0.0.0",
            n_qubits=2,
            meas_levels=[0, 1, 2],
            basis_gates=["u1", "u2", "u3", "cx", "id"],
            simulator=False,
            local=True,
            conditional=True,
            open_pulse=True,
            memory=False,
            max_shots=65536,
            gates=[GateConfig(name="TODO", parameters=[], qasm_def="TODO")],
            coupling_map=[[0, 1]],
            n_registers=2,
            n_uchannels=2,
            u_channel_lo=[
                [UchannelLO(q=0, scale=1.0 + 0.0j)],
                [
                    UchannelLO(q=0, scale=-1.0 + 0.0j),
                    UchannelLO(q=1, scale=1.0 + 0.0j)
                ],
            ],
            qubit_lo_range=[[4.5, 5.5], [4.5, 5.5]],
            meas_lo_range=[[6.0, 7.0], [6.0, 7.0]],
            dt=1.3333,
            dtm=10.5,
            rep_times=[100, 250, 500, 1000],
            meas_map=[[0, 1]],
            channel_bandwidth=[
                [-0.2, 0.4],
                [-0.3, 0.3],
                [-0.3, 0.3],
                [-0.02, 0.02],
                [-0.02, 0.02],
                [-0.02, 0.02],
            ],
            meas_kernels=["kernel1"],
            discriminators=["max_1Q_fidelity"],
            acquisition_latency=[[100, 100], [100, 100]],
            conditional_latency=[
                [100, 1000],
                [1000, 100],
                [100, 1000],
                [1000, 100],
                [100, 1000],
                [1000, 100],
            ],
            hamiltonian={
                "h_str": [
                    "np.pi*(2*v0-alpha0)*O0",
                    "np.pi*alpha0*O0*O0",
                    "2*np.pi*r*X0||D0",
                    "2*np.pi*r*X0||U1",
                    "2*np.pi*r*X1||U0",
                    "np.pi*(2*v1-alpha1)*O1",
                    "np.pi*alpha1*O1*O1",
                    "2*np.pi*r*X1||D1",
                    "2*np.pi*j*(Sp0*Sm1+Sm0*Sp1)",
                ],
                "description":
                "A hamiltonian for a mocked 2Q device, with 1Q and 2Q terms.",
                "qub": {
                    "0": 3,
                    "1": 3
                },
                "vars": {
                    "v0": 5.00,
                    "v1": 5.1,
                    "j": 0.01,
                    "r": 0.02,
                    "alpha0": -0.33,
                    "alpha1": -0.33,
                },
            },
            channels={
                "acquire0": {
                    "operates": {
                        "qubits": [0]
                    },
                    "purpose": "acquire",
                    "type": "acquire"
                },
                "acquire1": {
                    "operates": {
                        "qubits": [1]
                    },
                    "purpose": "acquire",
                    "type": "acquire"
                },
                "d0": {
                    "operates": {
                        "qubits": [0]
                    },
                    "purpose": "drive",
                    "type": "drive"
                },
                "d1": {
                    "operates": {
                        "qubits": [1]
                    },
                    "purpose": "drive",
                    "type": "drive"
                },
                "m0": {
                    "type": "measure",
                    "purpose": "measure",
                    "operates": {
                        "qubits": [0]
                    }
                },
                "m1": {
                    "type": "measure",
                    "purpose": "measure",
                    "operates": {
                        "qubits": [1]
                    }
                },
                "u0": {
                    "operates": {
                        "qubits": [0, 1]
                    },
                    "purpose": "cross-resonance",
                    "type": "control",
                },
                "u1": {
                    "operates": {
                        "qubits": [1, 0]
                    },
                    "purpose": "cross-resonance",
                    "type": "control",
                },
            },
            processor_type={
                "family": "Canary",
                "revision": "1.0",
                "segment": "A",
            },
        )

        self._defaults = PulseDefaults.from_dict({
            "qubit_freq_est": [4.9, 5.0],
            "meas_freq_est": [6.5, 6.6],
            "buffer":
            10,
            "pulse_library": [
                {
                    "name": "x90p_d0",
                    "samples": 2 * [0.1 + 0j]
                },
                {
                    "name": "x90p_d1",
                    "samples": 2 * [0.1 + 0j]
                },
                {
                    "name": "x90m_d0",
                    "samples": 2 * [-0.1 + 0j]
                },
                {
                    "name": "x90m_d1",
                    "samples": 2 * [-0.1 + 0j]
                },
                {
                    "name": "y90p_d0",
                    "samples": 2 * [0.1j]
                },
                {
                    "name": "y90p_d1",
                    "samples": 2 * [0.1j]
                },
                {
                    "name": "xp_d0",
                    "samples": 2 * [0.2 + 0j]
                },
                {
                    "name": "ym_d0",
                    "samples": 2 * [-0.2j]
                },
                {
                    "name": "cr90p_u0",
                    "samples": 9 * [0.1 + 0j]
                },
                {
                    "name": "cr90m_u0",
                    "samples": 9 * [-0.1 + 0j]
                },
                {
                    "name": "measure_m0",
                    "samples": 10 * [0.1 + 0j]
                },
                {
                    "name": "measure_m1",
                    "samples": 10 * [0.1 + 0j]
                },
            ],
            "cmd_def": [
                Command.from_dict({
                    "name":
                    "u1",
                    "qubits": [0],
                    "sequence": [
                        PulseQobjInstruction(name="fc",
                                             ch="d0",
                                             t0=0,
                                             phase="-P0").to_dict()
                    ],
                }).to_dict(),
                Command.from_dict({
                    "name":
                    "u1",
                    "qubits": [1],
                    "sequence": [
                        PulseQobjInstruction(name="fc",
                                             ch="d1",
                                             t0=0,
                                             phase="-P0").to_dict()
                    ],
                }).to_dict(),
                Command.from_dict({
                    "name":
                    "u2",
                    "qubits": [0],
                    "sequence": [
                        PulseQobjInstruction(name="fc",
                                             ch="d0",
                                             t0=0,
                                             phase="-P1").to_dict(),
                        PulseQobjInstruction(name="y90p_d0", ch="d0",
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name="fc",
                                             ch="d0",
                                             t0=2,
                                             phase="-P0").to_dict(),
                    ],
                }).to_dict(),
                Command.from_dict({
                    "name":
                    "u2",
                    "qubits": [1],
                    "sequence": [
                        PulseQobjInstruction(name="fc",
                                             ch="d1",
                                             t0=0,
                                             phase="-P1").to_dict(),
                        PulseQobjInstruction(name="y90p_d1", ch="d1",
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name="fc",
                                             ch="d1",
                                             t0=2,
                                             phase="-P0").to_dict(),
                    ],
                }).to_dict(),
                Command.from_dict({
                    "name":
                    "u3",
                    "qubits": [0],
                    "sequence": [
                        PulseQobjInstruction(name="fc",
                                             ch="d0",
                                             t0=0,
                                             phase="-P2").to_dict(),
                        PulseQobjInstruction(name="x90p_d0", ch="d0",
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name="fc",
                                             ch="d0",
                                             t0=2,
                                             phase="-P0").to_dict(),
                        PulseQobjInstruction(name="x90m_d0", ch="d0",
                                             t0=2).to_dict(),
                        PulseQobjInstruction(name="fc",
                                             ch="d0",
                                             t0=4,
                                             phase="-P1").to_dict(),
                    ],
                }).to_dict(),
                Command.from_dict({
                    "name":
                    "u3",
                    "qubits": [1],
                    "sequence": [
                        PulseQobjInstruction(name="fc",
                                             ch="d1",
                                             t0=0,
                                             phase="-P2").to_dict(),
                        PulseQobjInstruction(name="x90p_d1", ch="d1",
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name="fc",
                                             ch="d1",
                                             t0=2,
                                             phase="-P0").to_dict(),
                        PulseQobjInstruction(name="x90m_d1", ch="d1",
                                             t0=2).to_dict(),
                        PulseQobjInstruction(name="fc",
                                             ch="d1",
                                             t0=4,
                                             phase="-P1").to_dict(),
                    ],
                }).to_dict(),
                Command.from_dict({
                    "name":
                    "cx",
                    "qubits": [0, 1],
                    "sequence": [
                        PulseQobjInstruction(name="fc",
                                             ch="d0",
                                             t0=0,
                                             phase=1.57).to_dict(),
                        PulseQobjInstruction(name="ym_d0", ch="d0",
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name="xp_d0", ch="d0",
                                             t0=11).to_dict(),
                        PulseQobjInstruction(name="x90p_d1", ch="d1",
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name="cr90p_u0", ch="u0",
                                             t0=2).to_dict(),
                        PulseQobjInstruction(name="cr90m_u0", ch="u0",
                                             t0=13).to_dict(),
                    ],
                }).to_dict(),
                Command.from_dict({
                    "name":
                    "measure",
                    "qubits": [0, 1],
                    "sequence": [
                        PulseQobjInstruction(name="measure_m0", ch="m0",
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name="measure_m1", ch="m1",
                                             t0=0).to_dict(),
                        PulseQobjInstruction(
                            name="acquire",
                            duration=10,
                            t0=0,
                            qubits=[0, 1],
                            memory_slot=[0, 1],
                        ).to_dict(),
                    ],
                }).to_dict(),
            ],
        })

        mock_time = datetime.datetime.now()
        dt = 1.3333
        self._properties = BackendProperties(
            backend_name="fake_openpulse_2q",
            backend_version="0.0.0",
            last_update_date=mock_time,
            qubits=[
                [
                    Nduv(date=mock_time,
                         name="T1",
                         unit="µs",
                         value=71.9500421005539),
                    Nduv(date=mock_time,
                         name="T2",
                         unit="µs",
                         value=69.4240447362455),
                    Nduv(date=mock_time,
                         name="frequency",
                         unit="MHz",
                         value=4919.96800692),
                    Nduv(date=mock_time,
                         name="readout_error",
                         unit="",
                         value=0.02),
                ],
                [
                    Nduv(date=mock_time,
                         name="T1",
                         unit="µs",
                         value=81.9500421005539),
                    Nduv(date=mock_time,
                         name="T2",
                         unit="µs",
                         value=75.5598482446578),
                    Nduv(date=mock_time,
                         name="frequency",
                         unit="GHz",
                         value=5.01996800692),
                    Nduv(date=mock_time,
                         name="readout_error",
                         unit="",
                         value=0.02),
                ],
            ],
            gates=[
                Gate(
                    gate="u1",
                    qubits=[0],
                    parameters=[
                        Nduv(date=mock_time,
                             name="gate_error",
                             unit="",
                             value=0.06),
                        Nduv(date=mock_time,
                             name="gate_length",
                             unit="ns",
                             value=0.0),
                    ],
                ),
                Gate(
                    gate="u3",
                    qubits=[0],
                    parameters=[
                        Nduv(date=mock_time,
                             name="gate_error",
                             unit="",
                             value=0.06),
                        Nduv(date=mock_time,
                             name="gate_length",
                             unit="ns",
                             value=2 * dt),
                    ],
                ),
                Gate(
                    gate="u3",
                    qubits=[1],
                    parameters=[
                        Nduv(date=mock_time,
                             name="gate_error",
                             unit="",
                             value=0.06),
                        Nduv(date=mock_time,
                             name="gate_length",
                             unit="ns",
                             value=4 * dt),
                    ],
                ),
                Gate(
                    gate="cx",
                    qubits=[0, 1],
                    parameters=[
                        Nduv(date=mock_time,
                             name="gate_error",
                             unit="",
                             value=1.0),
                        Nduv(date=mock_time,
                             name="gate_length",
                             unit="ns",
                             value=22 * dt),
                    ],
                ),
            ],
            general=[],
        )

        super().__init__(configuration)
    def __init__(self):
        configuration = PulseBackendConfiguration(
            backend_name='fake_openpulse_2q',
            backend_version='0.0.0',
            n_qubits=2,
            meas_levels=[0, 1, 2],
            basis_gates=['u1', 'u2', 'u3', 'cx', 'id'],
            simulator=False,
            local=True,
            conditional=True,
            open_pulse=True,
            memory=False,
            max_shots=65536,
            gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')],
            coupling_map=[[0, 1]],
            n_registers=2,
            n_uchannels=2,
            u_channel_lo=[
                [UchannelLO(q=0, scale=1. + 0.j)],
                [UchannelLO(q=0, scale=-1. + 0.j), UchannelLO(q=1, scale=1. + 0.j)]
            ],
            qubit_lo_range=[[4.5, 5.5], [4.5, 5.5]],
            meas_lo_range=[[6.0, 7.0], [6.0, 7.0]],
            dt=1.3333,
            dtm=10.5,
            rep_times=[100, 250, 500, 1000],
            meas_map=[[0, 1]],
            channel_bandwidth=[
                [-0.2, 0.4], [-0.3, 0.3], [-0.3, 0.3],
                [-0.02, 0.02], [-0.02, 0.02], [-0.02, 0.02]
            ],
            meas_kernels=['kernel1'],
            discriminators=['max_1Q_fidelity'],
            acquisition_latency=[[100, 100], [100, 100]],
            conditional_latency=[
                [100, 1000], [1000, 100], [100, 1000],
                [1000, 100], [100, 1000], [1000, 100]
            ],
            hamiltonian={
                'h_str': ["np.pi*(2*v0-alpha0)*O0", "np.pi*alpha0*O0*O0", "2*np.pi*r*X0||D0",
                          "2*np.pi*r*X0||U1", "2*np.pi*r*X1||U0", "np.pi*(2*v1-alpha1)*O1",
                          "np.pi*alpha1*O1*O1", "2*np.pi*r*X1||D1", "2*np.pi*j*(Sp0*Sm1+Sm0*Sp1)"],
                'description': "A hamiltonian for a mocked 2Q device, with 1Q and 2Q terms.",
                'qub': {'0': 3, '1': 3},
                'vars':  {'v0': 5.00,
                          'v1': 5.1,
                          'j': 0.01,
                          'r': 0.02,
                          'alpha0': -0.33,
                          'alpha1': -0.33}
            },
            channels={
                'acquire0': {
                    'operates': {'qubits': [0]},
                    'purpose': 'acquire',
                    'type': 'acquire'
                },
                'acquire1': {
                    'operates': {'qubits': [1]},
                    'purpose': 'acquire',
                    'type': 'acquire'
                },
                'd0': {
                    'operates': {'qubits': [0]},
                    'purpose': 'drive',
                    'type': 'drive'
                },
                'd1': {
                    'operates': {'qubits': [1]},
                    'purpose': 'drive',
                    'type': 'drive'
                },
                'm0': {
                    'type': 'measure',
                    'purpose': 'measure',
                    'operates': {'qubits': [0]}
                },
                'm1': {
                    'type': 'measure',
                    'purpose': 'measure',
                    'operates': {'qubits': [1]}
                },
                'u0': {
                    'operates': {'qubits': [0, 1]},
                    'purpose': 'cross-resonance',
                    'type': 'control'
                },
                'u1': {
                    'operates': {'qubits': [1, 0]},
                    'purpose': 'cross-resonance',
                    'type': 'control'
                }
            }
        )

        self._defaults = PulseDefaults.from_dict({
            'qubit_freq_est': [4.9, 5.0],
            'meas_freq_est': [6.5, 6.6],
            'buffer': 10,
            'pulse_library': [
                {
                    'name': 'test_pulse_1',
                    'samples': [[0.0, 0.0], [0.0, 0.1]]
                },
                {
                    'name': 'test_pulse_2',
                    'samples': [[0.0, 0.0], [0.0, 0.1], [0.0, 1.0]]
                },
                {
                    'name': 'test_pulse_3',
                    'samples': [[0.0, 0.0], [0.0, 0.1], [0.0, 1.0], [0.5, 0.0]]
                },
                {
                    'name': 'test_pulse_4',
                    'samples': 7 * [
                        [0.0, 0.0], [0.0, 0.1], [0.0, 1.0], [0.5, 0.0]
                    ]
                }
            ],
            'cmd_def': [
                Command.from_dict({
                    'name': 'u1',
                    'qubits': [0],
                    'sequence': [
                        PulseQobjInstruction(name='fc', ch='d0',
                                             t0=0, phase='-P0').to_dict()
                    ]}).to_dict(),
                Command.from_dict({
                    'name': 'u1',
                    'qubits': [1],
                    'sequence': [
                        PulseQobjInstruction(name='fc', ch='d1',
                                             t0=0, phase='-P0').to_dict()
                    ]}).to_dict(),
                Command.from_dict({
                    'name': 'u2',
                    'qubits': [0],
                    'sequence': [
                        PulseQobjInstruction(name='fc', ch='d0',
                                             t0=0,
                                             phase='-P1').to_dict(),
                        PulseQobjInstruction(name='test_pulse_4', ch='d0',
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name='fc', ch='d0', t0=0,
                                             phase='-P0').to_dict()
                    ]}).to_dict(),
                Command.from_dict({
                    'name': 'u2',
                    'qubits': [1],
                    'sequence': [
                        PulseQobjInstruction(name='fc', ch='d1', t0=0,
                                             phase='-P1').to_dict(),
                        PulseQobjInstruction(name='test_pulse_4',
                                             ch='d1', t0=0).to_dict(),
                        PulseQobjInstruction(name='fc', ch='d1',
                                             t0=0, phase='-P0').to_dict()
                    ]}).to_dict(),
                Command.from_dict({
                    'name': 'u3',
                    'qubits': [0],
                    'sequence': [
                        PulseQobjInstruction(name='test_pulse_1', ch='d0',
                                             t0=0).to_dict()
                    ]}).to_dict(),
                Command.from_dict({
                    'name': 'u3',
                    'qubits': [1],
                    'sequence': [
                        PulseQobjInstruction(name='test_pulse_3', ch='d1',
                                             t0=0).to_dict()
                    ]}).to_dict(),
                Command.from_dict({
                    'name': 'cx',
                    'qubits': [0, 1],
                    'sequence': [
                        PulseQobjInstruction(name='test_pulse_1', ch='d0',
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name='test_pulse_2', ch='u0',
                                             t0=10).to_dict(),
                        PulseQobjInstruction(name='test_pulse_1', ch='d1',
                                             t0=20).to_dict(),
                        PulseQobjInstruction(name='fc', ch='d1',
                                             t0=20, phase=2.1).to_dict()
                    ]}).to_dict(),
                Command.from_dict({
                    'name': 'ParametrizedGate',
                    'qubits': [0, 1],
                    'sequence': [
                        PulseQobjInstruction(name='test_pulse_1', ch='d0',
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name='test_pulse_2', ch='u0',
                                             t0=10).to_dict(),
                        PulseQobjInstruction(name='pv', ch='d1',
                                             t0=2, val='cos(P2)').to_dict(),
                        PulseQobjInstruction(name='test_pulse_1', ch='d1',
                                             t0=20).to_dict(),
                        PulseQobjInstruction(name='fc', ch='d1',
                                             t0=20, phase=2.1).to_dict()
                    ]}).to_dict(),
                Command.from_dict({
                    'name': 'measure',
                    'qubits': [0, 1],
                    'sequence': [
                        PulseQobjInstruction(name='test_pulse_1', ch='m0',
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name='test_pulse_1', ch='m1',
                                             t0=0).to_dict(),
                        PulseQobjInstruction(name='acquire', duration=10, t0=0,
                                             qubits=[0, 1],
                                             memory_slot=[0, 1]).to_dict()
                    ]}).to_dict()
            ]
        })

        mock_time = datetime.datetime.now()
        dt = 1.3333  # pylint: disable=invalid-name
        self._properties = BackendProperties(
            backend_name='fake_openpulse_2q',
            backend_version='0.0.0',
            last_update_date=mock_time,
            qubits=[
                [Nduv(date=mock_time, name='T1', unit='µs', value=71.9500421005539),
                 Nduv(date=mock_time, name='frequency', unit='MHz', value=4919.96800692)],
                [Nduv(date=mock_time, name='T1', unit='µs', value=81.9500421005539),
                 Nduv(date=mock_time, name='frequency', unit='GHz', value=5.01996800692)]
            ],
            gates=[
                Gate(gate='u1', qubits=[0],
                     parameters=[
                         Nduv(date=mock_time, name='gate_error', unit='', value=0.06),
                         Nduv(date=mock_time, name='gate_length', unit='ns', value=0.)]),
                Gate(gate='u3', qubits=[0],
                     parameters=[
                         Nduv(date=mock_time, name='gate_error', unit='', value=0.06),
                         Nduv(date=mock_time, name='gate_length', unit='ns', value=2 * dt)]),
                Gate(gate='u3', qubits=[1],
                     parameters=[
                         Nduv(date=mock_time, name='gate_error', unit='', value=0.06),
                         Nduv(date=mock_time, name='gate_length', unit='ns', value=4 * dt)]),
                Gate(gate='cx', qubits=[0, 1],
                     parameters=[
                         Nduv(date=mock_time, name='gate_error', unit='', value=1.0),
                         Nduv(date=mock_time, name='gate_length', unit='ns', value=22 * dt)]),
            ],
            general=[]
        )

        super().__init__(configuration)
Example #17
0
    def __init__(self):
        configuration = PulseBackendConfiguration(
            backend_name='fake_openpulse_2q',
            backend_version='0.0.0',
            n_qubits=2,
            meas_levels=[0, 1, 2],
            basis_gates=['u1', 'u2', 'u3', 'cx', 'id'],
            simulator=False,
            local=True,
            conditional=True,
            open_pulse=True,
            memory=False,
            max_shots=65536,
            gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')],
            coupling_map=[[0, 1]],
            n_registers=2,
            n_uchannels=2,
            u_channel_lo=[[UchannelLO(q=0, scale=1. + 0.j)],
                          [
                              UchannelLO(q=0, scale=-1. + 0.j),
                              UchannelLO(q=1, scale=1. + 0.j)
                          ]],
            meas_level=[1, 2],
            qubit_lo_range=[[4.5, 5.5], [4.5, 5.5]],
            meas_lo_range=[[6.0, 7.0], [6.0, 7.0]],
            dt=1.3333,
            dtm=10.5,
            rep_times=[100, 250, 500, 1000],
            meas_map=[[0, 1]],
            channel_bandwidth=[[-0.2, 0.4], [-0.3, 0.3], [-0.3, 0.3],
                               [-0.02, 0.02], [-0.02, 0.02], [-0.02, 0.02]],
            meas_kernels=['kernel1'],
            discriminators=['max_1Q_fidelity'],
            acquisition_latency=[[100, 100], [100, 100]],
            conditional_latency=[[100, 1000], [1000, 100], [100, 1000],
                                 [1000, 100], [100, 1000], [1000, 100]])

        self._defaults = PulseDefaults(
            qubit_freq_est=[4.9, 5.0],
            meas_freq_est=[6.5, 6.6],
            buffer=10,
            pulse_library=[
                PulseLibraryItem(name='test_pulse_1', samples=[0.j, 0.1j]),
                PulseLibraryItem(name='test_pulse_2', samples=[0.j, 0.1j, 1j]),
                PulseLibraryItem(name='test_pulse_3',
                                 samples=[0.j, 0.1j, 1j, 0.5 + 0j]),
                PulseLibraryItem(name='test_pulse_4',
                                 samples=7 * [0.j, 0.1j, 1j, 0.5 + 0j])
            ],
            cmd_def=[
                Command(name='u1',
                        qubits=[0],
                        sequence=[
                            PulseQobjInstruction(name='fc',
                                                 ch='d0',
                                                 t0=0,
                                                 phase='-P1*np.pi')
                        ]),
                Command(name='u1',
                        qubits=[1],
                        sequence=[
                            PulseQobjInstruction(name='fc',
                                                 ch='d1',
                                                 t0=0,
                                                 phase='-P1*np.pi')
                        ]),
                Command(name='u2',
                        qubits=[0],
                        sequence=[
                            PulseQobjInstruction(name='fc',
                                                 ch='d0',
                                                 t0=0,
                                                 phase='-P0*np.pi'),
                            PulseQobjInstruction(name='test_pulse_4',
                                                 ch='d0',
                                                 t0=0),
                            PulseQobjInstruction(name='fc',
                                                 ch='d0',
                                                 t0=0,
                                                 phase='-P1*np.pi')
                        ]),
                Command(name='u2',
                        qubits=[1],
                        sequence=[
                            PulseQobjInstruction(name='fc',
                                                 ch='d1',
                                                 t0=0,
                                                 phase='-P0*np.pi'),
                            PulseQobjInstruction(name='test_pulse_4',
                                                 ch='d1',
                                                 t0=0),
                            PulseQobjInstruction(name='fc',
                                                 ch='d1',
                                                 t0=0,
                                                 phase='-P0*np.pi')
                        ]),
                Command(name='u3',
                        qubits=[0],
                        sequence=[
                            PulseQobjInstruction(name='test_pulse_1',
                                                 ch='d0',
                                                 t0=0)
                        ]),
                Command(name='u3',
                        qubits=[1],
                        sequence=[
                            PulseQobjInstruction(name='test_pulse_3',
                                                 ch='d1',
                                                 t0=0)
                        ]),
                Command(name='cx',
                        qubits=[0, 1],
                        sequence=[
                            PulseQobjInstruction(name='test_pulse_1',
                                                 ch='d0',
                                                 t0=0),
                            PulseQobjInstruction(name='test_pulse_2',
                                                 ch='u0',
                                                 t0=10),
                            PulseQobjInstruction(name='test_pulse_1',
                                                 ch='d1',
                                                 t0=20),
                            PulseQobjInstruction(name='fc',
                                                 ch='d1',
                                                 t0=20,
                                                 phase=2.1)
                        ]),
                Command(name='ParametrizedGate',
                        qubits=[0, 1],
                        sequence=[
                            PulseQobjInstruction(name='test_pulse_1',
                                                 ch='d0',
                                                 t0=0),
                            PulseQobjInstruction(name='test_pulse_2',
                                                 ch='u0',
                                                 t0=10),
                            PulseQobjInstruction(name='pv',
                                                 ch='d1',
                                                 t0=2,
                                                 val='cos(P2)'),
                            PulseQobjInstruction(name='test_pulse_1',
                                                 ch='d1',
                                                 t0=20),
                            PulseQobjInstruction(name='fc',
                                                 ch='d1',
                                                 t0=20,
                                                 phase=2.1)
                        ]),
                Command(name='measure',
                        qubits=[0, 1],
                        sequence=[
                            PulseQobjInstruction(name='test_pulse_1',
                                                 ch='m0',
                                                 t0=0),
                            PulseQobjInstruction(name='test_pulse_1',
                                                 ch='m1',
                                                 t0=0),
                            PulseQobjInstruction(name='acquire',
                                                 duration=10,
                                                 t0=0,
                                                 qubits=[0, 1],
                                                 memory_slot=[0, 1])
                        ])
            ])

        mock_time = datetime.datetime.now()
        dt = 1.3333  # pylint: disable=invalid-name
        self._properties = BackendProperties(
            backend_name='fake_openpulse_2q',
            backend_version='0.0.0',
            last_update_date=mock_time,
            qubits=[[
                Nduv(date=mock_time,
                     name='T1',
                     unit='µs',
                     value=71.9500421005539),
                Nduv(date=mock_time,
                     name='frequency',
                     unit='MHz',
                     value=4919.96800692)
            ],
                    [
                        Nduv(date=mock_time,
                             name='T1',
                             unit='µs',
                             value=81.9500421005539),
                        Nduv(date=mock_time,
                             name='frequency',
                             unit='GHz',
                             value=5.01996800692)
                    ]],
            gates=[
                Gate(gate='u1',
                     name='u1_0',
                     qubits=[0],
                     parameters=[
                         Nduv(date=mock_time,
                              name='gate_error',
                              unit='',
                              value=1.0),
                         Nduv(date=mock_time,
                              name='gate_length',
                              unit='ns',
                              value=0.)
                     ]),
                Gate(gate='u3',
                     name='u3_0',
                     qubits=[0],
                     parameters=[
                         Nduv(date=mock_time,
                              name='gate_error',
                              unit='',
                              value=1.0),
                         Nduv(date=mock_time,
                              name='gate_length',
                              unit='ns',
                              value=2 * dt)
                     ]),
                Gate(gate='u3',
                     name='u3_1',
                     qubits=[1],
                     parameters=[
                         Nduv(date=mock_time,
                              name='gate_error',
                              unit='',
                              value=1.0),
                         Nduv(date=mock_time,
                              name='gate_length',
                              unit='ns',
                              value=4 * dt)
                     ]),
                Gate(gate='cx',
                     name='cx0_1',
                     qubits=[0, 1],
                     parameters=[
                         Nduv(date=mock_time,
                              name='gate_error',
                              unit='',
                              value=1.0),
                         Nduv(date=mock_time,
                              name='gate_length',
                              unit='ns',
                              value=22 * dt)
                     ]),
            ],
            general=[])

        super().__init__(configuration)