teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

情報の追加

2021/10/26 15:37

投稿

summersault
summersault

スコア1

title CHANGED
@@ -1,1 +1,1 @@
1
- ___ got an unexpected keyword argumentのerror解消
1
+ ___ got an unexpected keyword argument エラーの解消
body CHANGED
@@ -1,6 +1,8 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
3
  PythonのQiskitで論文(https://iopscience.iop.org/article/10.1088/2058-9565/aba404/meta)の再現をしていたところ、何やら論文の関数(cr_pulse_utils.pyの中のcr_designer関数)とqiskitの方の関数(qiskit.schedule)で齟齬が起きているようです。
4
+ 論文で使用されたソースコードは(https://doi.org/10.5281/zenodo.3751565)で公開されています。
5
+
4
6
  Errorを解決したいです。
5
7
  自分はかなりprograming初学者で、必要な情報がここに詰められているかも怪しいので、足りない情報があればリクエストお願いします泣
6
8
  ### 発生している問題・エラーメッセージ

2

情報の追加

2021/10/26 15:36

投稿

summersault
summersault

スコア1

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,6 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- PythonのQiskitで論文の再現をしていたところ、何やら論文自作の関数とqiskitの方の関数で齟齬が起きているようです。
3
+ PythonのQiskitで論文(https://iopscience.iop.org/article/10.1088/2058-9565/aba404/meta)の再現をしていたところ、何やら論文の関数(cr_pulse_utils.pyの中のcr_designer関数)とqiskitの方の関数(qiskit.schedule)で齟齬が起きているようです。
4
4
  Errorを解決したいです。
5
5
  自分はかなりprograming初学者で、必要な情報がここに詰められているかも怪しいので、足りない情報があればリクエストお願いします泣
6
6
  ### 発生している問題・エラーメッセージ
@@ -29,6 +29,99 @@
29
29
  ### 該当のソースコード
30
30
 
31
31
  ```Python
32
+ from copy import deepcopy
33
+ from functools import partial
34
+ import numpy as np
35
+ import matplotlib.pyplot as plt
36
+ import multiprocessing as mp
37
+ import pickle
38
+ import pprint
39
+ import scipy.optimize as opt
40
+
41
+ from qiskit import pulse, transpile, assemble, schedule, IBMQ, quantum_info as qi
42
+ from qiskit.pulse import library as pulse_lib
43
+ from qiskit.pulse.reschedule import align_measures
44
+ from qiskit.ignis.verification import randomized_benchmarking as rb
45
+
46
+ import qiskit
47
+
48
+ # utility for pulse schedule generation
49
+ from MyPythonLibrary.cr_pulse_utils import create_cr_circuit, var_amp, var_phi
50
+
51
+ # utility for quantum process tomography
52
+ from MyPythonLibrary.qpt_utils import create_qpt_experiment, extract_choi_matrix
53
+
54
+ # utility for randomized benchmarking
55
+ from MyPythonLibrary.rb_utils import create_rb_experiment, cache_circuit
56
+
57
+ # utility for analysis
58
+ from MyPythonLibrary.analysis_utils import (cr_3rd_order_perturbation, local_fidelity_optimization,
59
+ optimize_circuit, expectation_val, hamiltonian_reconstruction,
60
+ plot_quantum_channel, ExperimentRunner)
61
+ from google.colab import drive
62
+ drive.mount('/content/drive')
63
+
64
+ # use cache data
65
+ use_cache = True
66
+
67
+ # data data_directory
68
+ data_dir = './data/custom_cnot_experiments'
69
+
70
+ account_provider = IBMQ.load_account()
71
+ hub = 'ibm-q'
72
+ group = 'open'
73
+ project = 'main'
74
+
75
+ # target backend
76
+ backend_name = 'ibmq_manila'
77
+
78
+ provider = IBMQ.get_provider(group = group)
79
+ backend = provider.get_backend(backend_name)
80
+
81
+ ########################
82
+ # #
83
+ # Setup of experiments #
84
+ # #
85
+ ########################
86
+
87
+ # control qubit index
88
+ control = 1
89
+
90
+ # target qubit index
91
+ target = 0
92
+
93
+ # control channel index
94
+ u_index = 1
95
+
96
+ # maximum cross resonance amplitude in this experiment
97
+ max_cr_amplitude = 0.35
98
+
99
+ # sample number restriction
100
+ alignment = 16
101
+
102
+ # initial cross resonance pulse parameters
103
+ cr_params = {'duration': 53 * alignment, 'amp': var_amp, 'phi': var_phi,
104
+ 'sigma': 2 * alignment, 'risefall': 4 * alignment}
105
+
106
+ # backend information
107
+ config = backend.configuration()
108
+ defaults = backend.defaults()
109
+ properties = backend.properties()
110
+
111
+ # sorted list of qubits used in the experiments
112
+ cr_qubits = sorted([control, target])
113
+
114
+ # quantum registers for handling abstracted schedule
115
+ qregs = qiskit.QuantumRegister(config.n_qubits)
116
+
117
+ # channels for visualization
118
+ channels = [pulse.DriveChannel(control), pulse.DriveChannel(target), pulse.ControlChannel(u_index)]
119
+
120
+ shots = 1024
121
+
122
+ # create QuantumCircuit layer abstraction of CR pulse schedule.
123
+ # this technique is useful to incorporate pulse schedule with circuit instruction to
124
+ # program complicated calibration sequence while keeping context of operation.
32
125
  cr_cal_circ, ext_inst_map, ext_basis_gates = create_cr_circuit(
33
126
  cross_resonance_params=cr_params,
34
127
  control=control,
@@ -38,7 +131,6 @@
38
131
  inst_map=defaults.instruction_schedule_map,
39
132
  basis_gates=config.basis_gates,
40
133
  use_echo=True)
41
-
42
134
  cr_amps = np.linspace(-max_cr_amplitude, max_cr_amplitude, 20)
43
135
 
44
136
  # setup CR Rabi experiment with Z measurement
@@ -52,7 +144,9 @@
52
144
  cr_rabi_circs.append(fixed_cr_circ)
53
145
 
54
146
  transpiled_circuits = transpile(cr_rabi_circs, backend, basis_gates=ext_basis_gates, optimization_level=0)
55
- scheds = schedule(transpiled_circuits, backend,ext_inst_map)#ここです
147
+ scheds = schedule(transpiled_circuits, backend,ext_inst_map)##ここです
148
+
149
+ qobj_1_1 = assemble(scheds, backend, meas_level=2, shots=shots)
56
150
  ```
57
151
 
58
152
  ### 試したこと
@@ -121,7 +215,4 @@
121
215
  raise PulseError(_error_message) from ex
122
216
  return function(**binds.arguments)
123
217
  ```
124
- get関数の一番下のソースコードを見るとfunctionに**argを入れているが、cr_designer関数の引数は*argなので悪さが起こっているのかと思って色々試してみたが、知識不足が祟ってerrorが増えるだけだった。
218
+ get関数の一番下のソースコードを見るとfunctionに**argを入れているが、cr_designer関数の引数は*argなので悪さが起こっているのかと思って色々試してみたが、知識不足が祟ってerrorが増えるだけだった。
125
- ### 補足情報(FW/ツールのバージョンなど)
126
-
127
- ここにより詳細な情報を記載してください。

1

情報を付け足した。

2021/10/26 15:28

投稿

summersault
summersault

スコア1

title CHANGED
File without changes
body CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  PythonのQiskitで論文の再現をしていたところ、何やら論文自作の関数とqiskitの方の関数で齟齬が起きているようです。
4
4
  Errorを解決したいです。
5
+ 自分はかなりprograming初学者で、必要な情報がここに詰められているかも怪しいので、足りない情報があればリクエストお願いします泣
5
6
  ### 発生している問題・エラーメッセージ
6
7
 
7
8
  ```