A spinoff of OSC-Qasm. A simple Socket.io Python interface for executing Qasm code.
Control your soc_qasm.py module directly from the web browser.
Before starting, make sure you have Python 3.7+ in your system.
- when using the installer on windows make sure to select the option
Add Python X to PATH
In order to try our Max patches, make sure you also have Max installed, and The QAC Toolkit Max package available.
Clone or download and unzip this repo.
Open the Terminal (Mac) or Command Prompt (Windows) and navigate to the folder where you saved the repo.
Create a python virtual environment
- on the terminal, type:
python3 -m venv SOCQasm
- depending on your system, you may simply use:
python -m venv SOCQasm
Enter your new python virtual environment
- on mac:
source SOCQasm/bin/activate
- on windows:
SOCQasm\Scripts\activate
At the start of your terminal prompt, it should show (SOCQasm)
, indicating that you're in your new virtual environment.
Update pip and setuptools
pip install --upgrade pip setuptools
- Note: if for some reason you don't have pip, please install it
Install qiskit and python-osc
pip install qiskit python-socketio eventlet
First, open a Terminal (Mac) or Command Prompt (Windows) and start you python environment.
Then run the python module: python soc_qasm.py
Wait until the program outputs the following lines:
================================================
SOC_QASM by OCH @ QuTune (v1.x)
https://iccmr-quantum.github.io
================================================
(xxxxx) wsgi starting up on http://0.0.0.0:PPPP
Now you can open the soc_qasm.maxpat in Max 8 and start sending messages with QuantumCircuits in Qasm, to the SOC-Qasm python module. Note: the first time you open soc_qasm.maxpat you might need to install the nodejs dependencies by clicking the script npm install
message box on the right side. Use the start/stop client
toggle on the left side to enable the node.script object before sending any qasm code.
You can also experiment interacting with your soc_qasm.py instance using a web browser. Open this page for an example. You will notice that, independently of where this page is being hosted, it can still connect with your local soc_qasm.py. The source code for this page can be found in docs/index.html.
When you're done working with soc_qasm.py you can leave the virtual environment with
- on mac & windows:
deactivate
You can also set some additional arguments and flags in front of python soc_qasm.py
:
usage: soc_qasm.py [-h] [--token TOKEN] [--hub HUB] [--group GROUP]
[--project PROJECT]
[port]
positional arguments:
port The port where the soc_qasm.py Server will listen for
incoming messages. Default port is 5000
optional arguments:
-h, --help show this help message and exit
--token TOKEN If you want to run circuits on real quantum hardware, you
need to provide your IBMQ token (see https://quantum-
computing.ibm.com/account)
--hub HUB If you want to run circuits on real quantum hardware, you
need to provide your IBMQ Hub
--group GROUP If you want to run circuits on real quantum hardware, you
need to provide your IBMQ Group
--project PROJECT If you want to run circuits on real quantum hardware, you
need to provide your IBMQ Project
The soc_qasm.maxpat patch also allows some customization using positional arguments. Make sure to check out the p More-options
subpatch to learn more!
In order to access your soc_qasm.py instance from outside your local area network, you might need to either open the corresponding ports on your router (port forwarding), or use a vpn service like hamachi.
Please open a new issue.
Also, please consider learning more about Max here, and Qiskit here, as well as explore the Intro to Quantum Computer Music Tutorial (video recording here) and the other projects in QuTune's Github.
SOC-Qasm is a spinoff of OSC-Qasm which is inspired by Jack Woehr's Qisjob project, and the och.qisjob object.
This repo was created by Omar Costa Hamido as part of the QuTune Project.