|
259 | 259 | "cell_type": "markdown", |
260 | 260 | "metadata": {}, |
261 | 261 | "source": [ |
262 | | - "It is a matter of style and personal preference whether you use `config.drive(0)` or `DriveChannel(0)`." |
| 262 | + "It is a matter of style and personal preference whether you use `config.drive(0)` or `DriveChannel(0)`.\n", |
| 263 | + "\n", |
| 264 | + "## Properties\n", |
| 265 | + "\n", |
| 266 | + "The `backend` properties contain data that was measured and optionally reported by the provider. Let's see what kind of information is reported for qubit 0." |
263 | 267 | ] |
264 | 268 | }, |
265 | 269 | { |
266 | | - "cell_type": "markdown", |
| 270 | + "cell_type": "code", |
| 271 | + "execution_count": 10, |
267 | 272 | "metadata": {}, |
| 273 | + "outputs": [], |
268 | 274 | "source": [ |
269 | | - "## Properties" |
| 275 | + "props = backend.properties()" |
270 | 276 | ] |
271 | 277 | }, |
272 | 278 | { |
273 | 279 | "cell_type": "code", |
274 | | - "execution_count": 10, |
| 280 | + "execution_count": 11, |
275 | 281 | "metadata": {}, |
276 | | - "outputs": [], |
| 282 | + "outputs": [ |
| 283 | + { |
| 284 | + "name": "stdout", |
| 285 | + "output_type": "stream", |
| 286 | + "text": [ |
| 287 | + "Qubit 0 has a \n", |
| 288 | + " - T1 time of 179.20855318949387 microseconds\n", |
| 289 | + " - T2 time of 207.08071658715147 microseconds\n", |
| 290 | + " - U2 gate error of 0.0006168554137126238\n", |
| 291 | + " - U2 gate duration of 142.22222222222226 nanoseconds\n", |
| 292 | + " - resonant frequency of 4.9742936409604575 GHz\n" |
| 293 | + ] |
| 294 | + } |
| 295 | + ], |
277 | 296 | "source": [ |
278 | | - "# Conversions from standard SI\n", |
279 | | - "us = 1e6\n", |
280 | | - "GHz = 1e-9\n", |
281 | | - "props = backend.properties()\n", |
282 | | - "# Qubit 0 T1 time in microsec\n", |
283 | | - "q0_t1_us = props.t1(0) * us\n", |
284 | | - "# Qubit 0 T2 time in microsec\n", |
285 | | - "q0_t2_us = props.t2(0) * us\n", |
286 | | - "# # Gate error for CNOT on qubits 0, 1\n", |
287 | | - "# cx_error = props.gate_error('cx', (0, 1))\n", |
288 | | - "# Resonant frequency of qubit 0\n", |
289 | | - "q2_freq_ghz = props.frequency(0) * GHz\n", |
290 | | - "# Duration of the X gate on qubit 0\n", |
291 | | - "q1_x_duration_us = props.gate_length('u2', 0) * us" |
| 297 | + "def describe_qubit(qubit, properties):\n", |
| 298 | + " \"\"\"Print a string describing some of reported properties of the given qubit.\"\"\"\n", |
| 299 | + "\n", |
| 300 | + " # Conversion factors from standard SI units\n", |
| 301 | + " us = 1e6\n", |
| 302 | + " ns = 1e9\n", |
| 303 | + " GHz = 1e-9\n", |
| 304 | + "\n", |
| 305 | + " print(f\"Qubit {qubit} has a \\n\"\n", |
| 306 | + " f\" - T1 time of {properties.t1(qubit) * us} microseconds\\n\"\n", |
| 307 | + " f\" - T2 time of {properties.t2(qubit) * us} microseconds\\n\"\n", |
| 308 | + " f\" - U2 gate error of {properties.gate_error('u2', qubit)}\\n\"\n", |
| 309 | + " f\" - U2 gate duration of {properties.gate_length('u2', qubit) * ns} nanoseconds\\n\"\n", |
| 310 | + " f\" - resonant frequency of {properties.frequency(qubit) * GHz} GHz\")\n", |
| 311 | + "\n", |
| 312 | + "describe_qubit(0, props)" |
292 | 313 | ] |
293 | 314 | }, |
294 | 315 | { |
295 | 316 | "cell_type": "markdown", |
296 | 317 | "metadata": {}, |
297 | 318 | "source": [ |
298 | | - "## Defaults" |
| 319 | + "Properties are not guaranteed to be reported, but backends without Pulse access typically also provide this data.\n", |
| 320 | + "\n", |
| 321 | + "## Defaults\n", |
| 322 | + "\n" |
299 | 323 | ] |
300 | 324 | }, |
301 | 325 | { |
302 | 326 | "cell_type": "code", |
303 | | - "execution_count": 11, |
| 327 | + "execution_count": 12, |
304 | 328 | "metadata": {}, |
305 | 329 | "outputs": [ |
306 | 330 | { |
|
0 commit comments