Skip to main content

Web-based 3D visualization tools for Cirq.

Project description

This is a development version of cirq-web and may be unstable.

For the latest stable release of cirq-web see here.

Cirq

Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators.

This module is cirq-web, which allows users to take advantage of browser based 3D visualization tools and features in Cirq. cirq-web also provides a development environment for contributors to create and add their own visualizations to the module.

Documentation

Documentation for cirq-web can be found in the README files located in this module’s subdirectories.

Below is a quick example of how to generate a portable 3D rendering of the Bloch sphere using cirq-web:

from cirq_web import BlochSphere

# Prepare a state
zero_state = [1+0j, 0+0j]
state_vector = cirq.to_valid_state_vector(zero_state)

# Create and display the Bloch sphere
sphere = BlochSphere(state_vector=state_vector)
sphere.generate_html_file()

This will create the file in the current working directory. There are additional options to specify the output directory or to open the visualization in a browser for example.

You can also view and interact with a Bloch sphere in a Colab or Jupyter notebook setting with the following:

from cirq_web import BlochSphere

# Prepare a state
zero_state = [1+0j, 0+0j]
state_vector = cirq.to_valid_state_vector(zero_state)

# Create and display the Bloch sphere
sphere = BlochSphere(state_vector=state_vector)
display(sphere)

See the example Jupyter notebook in this directory for more examples on how to use cirq-web.

Installation

Cirq-web is currently in development, and therefore is only available via pre-release.

To install the pre-release version of only cirq-web, use pip install cirq-web –pre.

Note, that this will install both cirq-web and cirq-core.

To get all the optional modules installed as well, you’ll have to use pip install cirq or pip install cirq –pre for the pre-release version.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

cirq_web-0.13.0.dev20210812162815-py3-none-any.whl (328.2 kB view details)

Uploaded Python 3

File details

Details for the file cirq_web-0.13.0.dev20210812162815-py3-none-any.whl.

File metadata

  • Download URL: cirq_web-0.13.0.dev20210812162815-py3-none-any.whl
  • Upload date:
  • Size: 328.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.11

File hashes

Hashes for cirq_web-0.13.0.dev20210812162815-py3-none-any.whl
Algorithm Hash digest
SHA256 c5f5c8e6f4f73723f0f71c786c8135a08b9f8a11cf7228596038e1697a7f4bd8
MD5 1587080ad4d24a160f2dd16f43dc3245
BLAKE2b-256 dba5e41520a51bbda296e7a19ef7957b4466c3b64373445ec1dcd7324889dfc0

See more details on using hashes here.

Provenance

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