Skip to main content

quantum-viz.js Python tools

Project description

quantum-viz

quantum-viz is the Python package companion of quantum-viz.js, a JavaScript package that supports visualizing any arbitrary quantum gate, classical control logic and collapsed grouped blocks of gates using JSON-formatted input data. quantum-viz contains a Jupyter widget and will also include support for translating quantum circuits written in common quantum programming libraries to JSON using the quantum-viz.js JSON schema.

quantum-viz screenshot

Installation

You can install the quantum-viz.js widget via pip from PyPI:

pip install quantum-viz

Example

To use the quantum-viz widget, run the below example code in a Jupyter notebook cell:

from quantum_viz import Viewer

# Create a quantum circuit that prepares a Bell state
circuit = {
    "qubits": [{ "id": 0 }, { "id": 1, "numChildren": 1 }],
    "operations": [
        {
            "gate": 'H',
            "targets": [{ "qId": 0 }],
        },
        {
            "gate": 'X',
            "isControlled": "True",
            "controls": [{ "qId": 0 }],
            "targets": [{ "qId": 1 }],
        },
        {
            "gate": 'Measure',
            "isMeasurement": "True",
            "controls": [{ "qId": 1 }],
            "targets": [{ "type": 1, "qId": 1, "cId": 0 }],
        },
    ],
}

widget = Viewer(circuit)
widget # Display the widget

quantum-viz example

Contributing

Check out our contributing guidelines to find out how you can contribute to quantum-viz.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quantum-viz-1.0.3.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

quantum_viz-1.0.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file quantum-viz-1.0.3.tar.gz.

File metadata

  • Download URL: quantum-viz-1.0.3.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.8

File hashes

Hashes for quantum-viz-1.0.3.tar.gz
Algorithm Hash digest
SHA256 657bd74aa211ebf9960f699f83a6902fcef68d0cdd7d527dbfda770d2f8a7bc5
MD5 7f516fadfb05abbca2f7bafe9bcfc2b4
BLAKE2b-256 4dce724ad21d860fddbdb0d18e8aab79050302591daada952d2465ea15633962

See more details on using hashes here.

File details

Details for the file quantum_viz-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: quantum_viz-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.8

File hashes

Hashes for quantum_viz-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6597c1ed3523fb623dacca93bc8659a0eaf532d1703bd64400f6c47948a3a384
MD5 c0f83b69635d5c20e5a06356cbff41ce
BLAKE2b-256 72f9ece019c5710ef3816b036be8529e3dc39f4514413f1b14f8c56559db3541

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page