Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
abbycross
left a comment
There was a problem hiding this comment.
Reads well! I did a copyedit passthrough.
|
Let's also take this opportunity to standardize to postselection (one word, no hyphen) both in this PR and in other instances in the guides where we hyphenate. |
Co-authored-by: abbycross <across@us.ibm.com>
Co-authored-by: abbycross <across@us.ibm.com>
|
I do not understand why the spellcheck is flagging mdash (as part of the |
| "source": [ | ||
| "## Add postselection transpiler passes\n", | ||
| "\n", | ||
| "Next, create a preset pass manager that includes the [`AddPostSelectionMeasures`](https://qiskit.github.io/qiskit-addon-utils/stubs/qiskit_addon_utils.noise_management.post_selection.transpiler.passes.AddSpectatorMeasures.html) and [`AddSpectatorMeasures`](https://qiskit.github.io/qiskit-addon-utils/stubs/qiskit_addon_utils.noise_management.post_selection.transpiler.passes.AddPostSelectionMeasures.html) passes from the [`qiskit-addon-utils`](https://qiskit.github.io/qiskit-addon-utils/index.html) package." |
There was a problem hiding this comment.
It's explained a bit in the intro, but I think it's worth repeating that this step adds a long X pulse (using a series of rx gates) then another set of measurements.
| ")\n", | ||
| "\n", | ||
| "\n", | ||
| "# template_circuit, samplex = build(transpiled_circuit)\n", |
There was a problem hiding this comment.
I assume you meant to delete this line? Since this example doesn't use samplex.
| "# program.append_samplex_item(\n", | ||
| "# template_circuit_ps,\n", | ||
| "# samplex=samplex,\n", | ||
| "# shape=(shape,)\n", | ||
| "# )\n", |
There was a problem hiding this comment.
Same as above, this example doesn't use samplex.
| "id": "6b460888", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "These keys correspond to the active and spectator qubits before the `rx` instructions (`meas` and `spec`) and after the `rx` instructions (`meas_ps` and `spec_ps`). Each of these is an array of arrays based on the number of shots, randomizations, and qubits. In this case, the shape is (1000, 4).\n", |
There was a problem hiding this comment.
There are no randomizations in this example. There was also an unused shots_per_randomization variable in the code block.
| "\n", | ||
| "## Create postselection mask\n", | ||
| "\n", | ||
| "From these measurements, you can create a mask using the `PostSelector` class from `qiskit-addon-utils`. This mask is a boolean array where each shot is marked as either `True` or `False` based on one of two postselection strategies. The first strategy, `node`, uses qubit information to decide whether a measurement shot should be discarded — and the second, `edge`, uses nearest-neighbor connectivity information to make this decision." |
There was a problem hiding this comment.
| "From these measurements, you can create a mask using the `PostSelector` class from `qiskit-addon-utils`. This mask is a boolean array where each shot is marked as either `True` or `False` based on one of two postselection strategies. The first strategy, `node`, uses qubit information to decide whether a measurement shot should be discarded — and the second, `edge`, uses nearest-neighbor connectivity information to make this decision." | |
| "From these measurements, you can create a mask using the [`PostSelector`](https://qiskit.github.io/qiskit-addon-utils/apidocs/qiskit_addon_utils.noise_management.html#qiskit_addon_utils.noise_management.PostSelector) class from `qiskit-addon-utils`. This mask is a boolean array where each shot is marked as either `True` or `False` based on one of two postselection strategies. The first strategy, `node`, uses qubit information to decide whether a measurement shot should be discarded — and the second, `edge`, uses nearest-neighbor connectivity information to make this decision." |
| ], | ||
| "source": [ | ||
| "mask = mask_node & mask_edge\n", | ||
| "print(f\"The combined mask for first twirl instance: {mask[0]}\")\n", |
There was a problem hiding this comment.
You're not doing any twirling here, right?
| "Distance before postselection: 0.94225\n", | ||
| "Distance before after-selection: 0.935374149659864\n" |
There was a problem hiding this comment.
Nit - I think it'd be more impactful to show a graph rather than text. But not required if too much work.
| "## Next steps\n", | ||
| "\n", | ||
| "<Admonition type=\"tip\" title=\"Recommendations\">\n", | ||
| " - Understand how to incorporate [noise learning](/docs/guides/noise-learning) into a quantum workload.\n", | ||
| " - Read through other available [error mitigation and suppression](/docs/guides/error-mitigation-and-suppression-techniques) techniques.\n", |
There was a problem hiding this comment.
I think it's also worth pointing people to this error detection tutorial: https://quantum.cloud.ibm.com/docs/en/tutorials/ghz-spacetime-codes
which does error detection and (implied) post selection, as a different type of post selection.
Closes #4397