True-Q™ Readme

True-Q™ provides methods to calibrate and optimize the performance of quantum devices. This includes diagnostic tools, which generate quantum circuits that measure noise properties of your device, and runtime solutions, which tailor and reduce noise profiles.

Installation

The simplest way to install True-Q™ is from the remote URL:

pip install --no-cache-dir https://app.quantumbenchmark.com/download_trueq

Note that pip usually caches remote packages. The --no-cache-dir flag is used to disable this behavior and force pip to download the latest version from the remote URL. When prompted for username and password, you can use the username and token found inside qb-token.json.

You can skip the username and password prompt by including them inside the pip command:

pip install --no-cache-dir "https://username:password@app.quantumbenchmark.com/download_trueq"

Replace username and password with your username and password/token and note the use of quotation marks around the URL. This command is useful if you wish to automate pip installation or when you encounter bugs that prevent you from entering the password during the prompt, such as when using Git Bash on Windows.

To install True-Q™ from a local copy, e.g. after downloading and extracting it from https://app.quantumbenchmark.com/download_trueq or from a folder containing setup.py, you can use:

pip install .

which will install it as a package in your current Python environment. Note that you must have your qb-token.json located in the same directory as setup.py in order to perform the installation successfully.

If you want to be able to run tests, view documentation locally, or edit the Python source code, then it is easiest to install True-Q™ in the editable mode using:

pip install -e .

Requirements

To use True-Q™, you must have a 64-bit version of Python 3.6 or above, and you need to meet the following OS-specific requirements:

  • Linux: libstdc++ >= 8.2.1

  • MacOS: libSystem.B >= 1252.250.1 and libc++ >= 400.9.4

  • Windows: Microsoft Visual C++ 2015-2019 Redistributable (x64) >= 14.27.29112 (download it here)

The full list of required Python packages can be found in the requirements.txt file.

Optional dependencies

True-Q™ is capable of interfacing with other Python quantum computing packages, such as Cirq, pyQuil, and Qiskit, out of the box. This functionality is optional and becomes available automatically whenever any of these packages are installed on your machine. The full list of these packages can be found in the requirements_optional.txt file.

Updates

If you installed True-Q™ from the remote URL, then you can update it using:

pip install -U --no-cache-dir https://app.quantumbenchmark.com/download_trueq

If you installed True-Q™ from a local copy, i.e. using pip install . command, then you can update the installed package using:

pip install -U .

If you installed True-Q™ in the develop or editable mode, then you only need to update your local copy:

python setup.py update

Citation

If you wish to cite True-Q™ in your publication, you can visit this page to download a citation in a format of your choice.

Documentation

You can view True-Q™ documentation and examples online at https://trueq.quantumbenchmark.com/.

If you have a local copy of True-Q™, you can open documentation.html in your browser to view it.

Generating documentation

If you want to build the documentation from source, ensure that you have all of the required Python packages installed using:

pip install -r requirements_optional.txt
pip install -r docs/requirements.txt

To build the documentation, execute the following command:

cd docs && make html && cd ..

If successful, the compiled documentation will appear in the docs/build/html folder, which could be accessed via the documentation.html shortcut with your browser.

Testing

Running tests requires the pytest package, which can be installed via:

pip install pytest>=4.4

Once installed, navigate to the folder containing setup.py and run:

pytest

to run tests from the tests folder using the installed version of True-Q™. You can also run tests against the local copy of True-Q™, rather than the installed version, by running:

python -m pytest

Note that many of these tests involve quantum simulation, and therefore it might take a minute or two to run all of them.

Troubleshooting

A troubleshooting script is included that checks True-Q™, its dependencies, and the connection to the server and produces a log file of the results. To run the script from the command line, navigate to the trueq folder and then run:

python troubleshoot.py

from the command line. Make sure to use the same version of Python that you will use with True-Q™ since you may have multiple copies of Python installed, especially if you use Anaconda. This will generate a file called troubleshoot-[date].log.

If you are having trouble running this script via command line, you can also execute it through Jupyter (IPython) Notebook. First, copy the full file path of troubleshoot.py located in your trueq folder, paste it into the code below, and run it. (To get the full path on Windows, hold shift and right click on troubleshoot.py in Explorer and select “Copy as path”. On macOS, right click on troubleshoot.py in Finder, hold down Alt/Option, and select “Copy troubleshoot.py as Pathname”. On Linux, right click on troubleshoot.py in Files and select “Copy”.)

import os
import subprocess
import sys

full_path = "/your/trueq/path/troubleshoot.py"

log_file = os.path.join(os.path.dirname(full_path), "troubleshoot.log")
subprocess.call([sys.executable, full_path, "--filename", log_file])
with open(log_file, "r") as f:
    print(f.read())

If you require assistance generating or interpreting a log file, please email support@quantumbenchmark.com.