Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit 520b414

Browse files
author
knzwnao
committed
update_tutorial
1 parent 5e59572 commit 520b414

1 file changed

Lines changed: 38 additions & 32 deletions

File tree

qiskit/advanced/terra/calibrating_a_qubit.ipynb

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,15 @@
7676
},
7777
"outputs": [],
7878
"source": [
79-
"provider = IBMQ.load_account()\n",
80-
"backend_name = 'ibmq_poughkeepsie'\n",
81-
"backend = provider.get_backend(backend_name)\n",
82-
"\n",
79+
"IBMQ.load_account()\n",
80+
"ibmq_provider = IBMQ.get_provider(\n",
81+
" hub='provide_your_hub_here',\n",
82+
" group='provide_your_group_here',\n",
83+
" project='provide_your_project_here'\n",
84+
")\n",
85+
"backend = ibmq_provider.get_backend(\n",
86+
" 'provide_your_device_name_here'\n",
87+
")\n",
8388
"system = pulse.PulseChannelSpec.from_backend(backend)"
8489
]
8590
},
@@ -108,7 +113,18 @@
108113
}
109114
},
110115
"source": [
111-
"Complex pulse enveropes can be defined by using `pulse.function` decorator. A python function which returns an `array_like` object can create any user-defined pulses. The first argument of the function should be `duration` specifing number of data points. The pulses are sent to an arbitrary waveform generator and applied to a quantum bit after mixed with a microwave signal from local oscillators (LO)."
116+
"User defined pulse can be created by using `pulse.function` decorator. A python function which returns an `array_like` object can be used to create user defined pulses. The first argument of the function should be `duration` specifing number of data points. You are also able to get standard pulse templates from `pulse_lib`, and able to find calibrated pulses provided by backend via `CmdDef`. In this notebook, we use a Gaussian pulse template from `pulse_lib.gaussian` and default measurement pulses from `CmdDef`."
117+
]
118+
},
119+
{
120+
"cell_type": "code",
121+
"execution_count": null,
122+
"metadata": {},
123+
"outputs": [],
124+
"source": [
125+
"cmd_def = pulse.CmdDef.from_defaults(defaults.cmd_def, defaults.pulse_library)\n",
126+
"\n",
127+
"measure = cmd_def.get('measure', qubits=config.meas_map[0])"
112128
]
113129
},
114130
{
@@ -181,12 +197,6 @@
181197
"drive_samples = 128\n",
182198
"drive_sigma = 16\n",
183199
"\n",
184-
"# Measurement pulse\n",
185-
"meas_amp = 0.025\n",
186-
"meas_samples = 1200\n",
187-
"meas_sigma = 4\n",
188-
"meas_risefall = 25\n",
189-
"\n",
190200
"# scaling factor for data returned by system\n",
191201
"scale_factor=1e-10"
192202
]
@@ -199,7 +209,14 @@
199209
}
200210
},
201211
"source": [
202-
"Pulses are registered to `Schedule`s with information of `channel` and `start_time`. The chanel information is provided by `PulseChannelSpec` . `AcquireChannel` is a special type of channels which triggers a digitizer and we cannot add pulses to this type of channels except for `Acquire` commands. Created `Schedule`s can be combined into a single job."
212+
"Pulses commands are registered to `Schedule`s with information of `channel` and `start_time`. The chanel information is provided by `PulseChannelSpec`. You can create your `Schedule` by using syntax sugers: \n",
213+
"\n",
214+
"- `|` (`union`): combine two `Schedule`s in parallel.\n",
215+
"- `+` (`append`): add a `Schedule` right after a `Schedule` to be appended.\n",
216+
"- `<<` (`shift`): shift `start_time` of `Schedule`.\n",
217+
"\n",
218+
"All details are available in [Pulse Schedules](https://github.com/Qiskit/qiskit-tutorials/blob/master/qiskit/advanced/terra/pulse_schedules.ipynb).\n",
219+
"Created `Schedule`s can be combined into a single job."
203220
]
204221
},
205222
{
@@ -212,15 +229,6 @@
212229
},
213230
"outputs": [],
214231
"source": [
215-
"# Measurement pulse (common for all experiment)\n",
216-
"meas_pulse = pulse_lib.gaussian_square(duration=meas_samples, amp=meas_amp,\n",
217-
" sigma=meas_sigma, risefall=meas_risefall, \n",
218-
" name='meas_pulse')\n",
219-
"acq_cmd=pulse.Acquire(duration=meas_samples)\n",
220-
"\n",
221-
"# create measurement schedule\n",
222-
"measure_and_acquire = meas_pulse(system.qubits[qubit].measure) | acq_cmd(system.acquires, system.memoryslots)\n",
223-
"\n",
224232
"# Create schedule\n",
225233
"schedules = []\n",
226234
"for ii, drive_amp in enumerate(drive_amps):\n",
@@ -230,8 +238,8 @@
230238
" # add commands to schedule\n",
231239
" schedule = pulse.Schedule(name='Rabi Experiment at drive amp = %s' % drive_amp)\n",
232240
" \n",
233-
" schedule += rabi_pulse(system.qubits[qubit].drive)\n",
234-
" schedule += measure_and_acquire << schedule.duration\n",
241+
" schedule |= rabi_pulse(system.qubits[qubit].drive)\n",
242+
" schedule |= measure << schedule.duration\n",
235243
" \n",
236244
" schedules.append(schedule)"
237245
]
@@ -512,14 +520,12 @@
512520
" \n",
513521
"# excited\n",
514522
"excited_exp = pulse.Schedule(name='pi_exp')\n",
515-
"excited_exp += rabi_pulse(system.qubits[qubit].drive)\n",
516-
"measure_time = excited_exp.duration\n",
517-
"excited_exp |= measure_and_acquire << measure_time\n",
523+
"excited_exp |= rabi_pulse(system.qubits[qubit].drive)\n",
524+
"excited_exp |= measure << rabi_pulse.duration\n",
518525
"\n",
519526
"# ground\n",
520527
"ground_exp = pulse.Schedule(name='no_pi_exp')\n",
521-
"ground_exp |= pulse.Schedule(name='ground_exp')\n",
522-
"ground_exp |= measure_and_acquire << measure_time \n",
528+
"ground_exp |= measure << rabi_pulse.duration\n",
523529
"\n",
524530
"excited_exp_schedules = [ground_exp, excited_exp]"
525531
]
@@ -674,7 +680,7 @@
674680
"cell_type": "markdown",
675681
"metadata": {},
676682
"source": [
677-
"Previous experiment is performed without specifying LO frequencies of qubit0. In this case, default drive frequencies from the backend configuration are automatically assigned. These values are calibrated to correspond with the qubit resonanse frequencies. In this experiment, we also change the LO frequencies of qubit0 and see what happens."
683+
"Previous experiment is performed without specifying drive frequencies of qubit0. In this case, default drive frequencies from the backend configuration are automatically assigned. These values are calibrated to correspond with the qubit resonanse frequencies. In this experiment, we also change a drive frequencie of qubit0 and see what happens."
678684
]
679685
},
680686
{
@@ -719,8 +725,8 @@
719725
" # add commands to schedule\n",
720726
" schedule = pulse.Schedule(name='Rabi Experiment at drive amp = %s' % drive_amp)\n",
721727
"\n",
722-
" schedule += rabi_pulse(system.qubits[qubit].drive)\n",
723-
" schedule += measure_and_acquire << schedule.duration\n",
728+
" schedule |= rabi_pulse(system.qubits[qubit].drive)\n",
729+
" schedule |= measure << schedule.duration\n",
724730
"\n",
725731
" schedules.append(schedule)\n",
726732
" \n",
@@ -889,7 +895,7 @@
889895
"name": "python",
890896
"nbconvert_exporter": "python",
891897
"pygments_lexer": "ipython3",
892-
"version": "3.7.3"
898+
"version": "3.6.8"
893899
},
894900
"varInspector": {
895901
"cols": {

0 commit comments

Comments
 (0)