Skip to main content

No project description provided

Project description

Q# widgets

The Q# widgets are Jupyter Widgets built using the AnyWidget package https://anywidget.dev/

Build with ./build.py --widgets.

Install the built wheel via

pip install --force-reinstall ./target/wheels/qsharp_widgets-0.0.0-py2.py3-none-any.whl

For development, perform an 'editable' install with pip install -e ./widgets in the venv used for testing. Any changes made to the package are then immediately reflected.

If developing the web code (JS and CSS), then in the test environment also install pip install watchfiles, and in the ./widgets directory run npm run dev to build in watch mode. This will use AnyWidget's hot module reloading to automatically update the Python package as changes are made. (See https://anywidget.dev/blog/anywidget-02/).

With the above done, use the Q# widgets in you Python test environment via import qsharp_widgets.

Usage

In a notebook, generate the estimates for a program and display the widgets with code such as that shown below:

# Cell-1 : Import the modules and generate some estimates
import qsharp
from qsharp_widgets import SpaceChart, EstimateDetails

with open("sample.qs", "r") as f:
    contents = f.read()
qsharp.eval(contents)
result1 = qsharp.estimate("Sample.Main()")

# Cell-2 : Display the details in table form
EstimateDetails(result1)

# Cell-3 : Display the space chart
SpaceChart(result1)

# Cell-4 : Use the logical counts to get estimates for a different qubit
result2 = qsharp.physical_estimates_from_logical_counts(
    result1.get("logicalCounts"),
    {
        "qubitParams": { "name": "qubit_maj_ns_e6" },
        "qecScheme": { "name": "floquet_code" }
    }
)
SpaceChart(result2)

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

qsharp_widgets-1.9.5.dev0-py2.py3-none-any.whl (170.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file qsharp_widgets-1.9.5.dev0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for qsharp_widgets-1.9.5.dev0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 77e78e8d3e0f59f0b53aec8cefaa4441f73347bb884f916b0ed8e07b6b7c9748
MD5 cf04ab421b275f0ee7f75119cb4fbdd2
BLAKE2b-256 928e10eca3df4f68da032be37c3de97e4580bfedb20125c71e03be59003d2290

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