Science Score: 57.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.1%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
OpenQASM 3 + OpenPulse in Python
Basic Info
- Host: GitHub
- Owner: openqasm
- License: apache-2.0
- Language: Python
- Default Branch: main
- Homepage: https://oqpy.readthedocs.io/en/latest/
- Size: 309 KB
Statistics
- Stars: 26
- Watchers: 8
- Forks: 11
- Open Issues: 13
- Releases: 13
Topics
Metadata Files
README.md
OQpy: Generating OpenQASM 3 + OpenPulse in Python
The goal of oqpy ("ock-pie") is to make it easy to generate OpenQASM 3 + OpenPulse in Python. The
oqpy library builds off of the openqasm3 and openpulse packages,
which serve as Python reference implementations of the abstract syntax tree (AST) for the
OpenQASM 3 and OpenPulse grammars.
What are OpenQASM 3 and OpenPulse?
OpenQASM is an imperative programming language designed for near-term quantum computing algorithms
and applications. OpenQASM 3 extends the original specification by adding support
for classical logic, explicit timing, and pulse-level definitions. The latter is enabled via the use
of calibration grammars which allow quantum hardware builders to extend the language
to support hardware-specific directives via cal and defcal blocks. One such grammar is
OpenPulse, which provides the instructions required for pulse-based control of
many common quantum computing architectures (e.g. superconducting qubits).
Installation and Getting Started
OQpy can be installed from PyPI or from source in an environment with Python 3.7 or greater.
To install it from PyPI (via pip), do the following:
pip install oqpy
To instead install OQpy from source, do the following from within the repository after cloning it:
poetry install
Next, check out the following example to get a sense of the kinds of programs we can write with OQpy.
Example: Ramsey Interferometry
A common and useful experiment for qubit characterization is Ramsey interferometry, which can be used for two purposes: performing a careful measurement of a qubit’s resonant frequency, and for investigating how long a qubit retains its coherence. In a typical Ramsey experiment, one varies the length of a delay between the two π/2 pulses, and then measures the state of the qubit. Below, we'll create a Ramsey interferometry experiment in OpenQASM 3 using OQpy. As part of this, we’ll use the OpenPulse grammar to allow this experiment to specify its operation implementations at the calibrated pulse level.
```python import oqpy prog = oqpy.Program() # create a new oqpy program
Declare frames: transmon driving frame and readout receive/transmit frames
xyframe = oqpy.FrameVar(oqpy.PortVar("dac0"), 6.431e9, name="xyframe") rxframe = oqpy.FrameVar(oqpy.PortVar("adc0"), 5.752e9, name="rxframe") txframe = oqpy.FrameVar(oqpy.PortVar("dac1"), 5.752e9, name="txframe")
Declare the type of waveform we are working with
constantwaveform = oqpy.declarewaveformgenerator( "constant", [("length", oqpy.duration), ("amplitude", oqpy.float64)], ) gaussianwaveform = oqpy.declarewaveformgenerator( "gaussian", [("length", oqpy.duration), ("sigma", oqpy.duration), ("amplitude", oqpy.float64)], )
Provide gate / operation definitions as defcals
qubit = oqpy.PhysicalQubits[1] # get physical qubit 1
with oqpy.defcal(prog, qubit, "reset"): prog.delay(1e-3) # reset to ground state by waiting 1 ms
with oqpy.defcal(prog, qubit, "measure"): prog.play(txframe, constantwaveform(2.4e-6, 0.2)) prog.capture(rxframe, constantwaveform(2.4e-6, 1))
with oqpy.defcal(prog, qubit, "x90"): prog.play(xyframe, gaussianwaveform(32e-9, 8e-9, 0.2063))
Loop over shots (i.e. repetitions)
delaytime = oqpy.DurationVar(0, "delaytime") # initialize a duration with oqpy.ForIn(prog, range(100), "shotindex"): prog.set(delaytime, 0) # reset delay time to zero # Loop over delays with oqpy.ForIn(prog, range(101), "delayindex"): (prog.reset(qubit) # prepare in ground state .gate(qubit, "x90") # pi/2 pulse (90° rotation about the x-axis) .delay(delaytime, qubit) # variable delay .gate(qubit, "x90") # pi/2 pulse (90° rotation about the x-axis) .measure(qubit) # final measurement .increment(delay_time, 100e-9)) # increase delay by 100 ns ```
Running print(prog.to_qasm(encal_declarations=True)) generates the following OpenQASM:
qasm3
OPENQASM 3.0;
defcalgrammar "openpulse";
cal {
extern constant(duration, float[64]) -> waveform;
extern gaussian(duration, duration, float[64]) -> waveform;
port dac1;
port adc0;
port dac0;
frame tx_frame = newframe(dac1, 5752000000.0, 0);
frame rx_frame = newframe(adc0, 5752000000.0, 0);
frame xy_frame = newframe(dac0, 6431000000.0, 0);
}
duration delay_time = 0.0ns;
defcal reset $1 {
delay[1000000.0ns];
}
defcal measure $1 {
play(tx_frame, constant(2400.0ns, 0.2));
capture(rx_frame, constant(2400.0ns, 1));
}
defcal x90 $1 {
play(xy_frame, gaussian(32.0ns, 8.0ns, 0.2063));
}
for int shot_index in [0:99] {
delay_time = 0.0ns;
for int delay_index in [0:100] {
reset $1;
x90 $1;
delay[delay_time] $1;
x90 $1;
measure $1;
delay_time += 100.0ns;
}
}
Contributing
We welcome contributions to OQpy including bug fixes, feature requests, etc. To get started, check
out our contributing guidelines. Those who make a nontrivial contribution to the
source code will be added as an author to the CITATION.cff file (see below).
Citation
If you use OQpy in your work or research, please cite it using the metadata in the
CITATION.cff file in the repository (which includes a
Zenodo DOI). You can copy the citation in BibTeX format using the
"Cite this repository" widget in the About section of the
repository page on GitHub.
Owner
- Name: OpenQASM
- Login: openqasm
- Kind: organization
- Website: https://openqasm.com/
- Repositories: 6
- Profile: https://github.com/openqasm
Collection of projects related to the OpenQASM circuit description language.
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it using these metadata."
title: "OQpy: OpenQASM 3 + OpenPulse in Python"
abstract: >
The goal of oqpy ("ock-pie") is to make it easy to generate OpenQASM 3 + OpenPulse
in Python. The oqpy library builds off of the openqasm3 and openpulse packages,
which serve as Python reference implementations of the abstract syntax tree (AST)
for the OpenQASM 3 and OpenPulse grammars.
authors:
- family-names: Reinhold
given-names: Philip
affiliation: "AWS Center for Quantum Computing"
orcid: "https://orcid.org/0000-0002-8141-1842"
- family-names: Teo
given-names: Stephanie
affiliation: "AWS Center for Quantum Computing"
orcid: "https://orcid.org/0000-0002-6762-7313"
- family-names: Jaskula
given-names: Jean-Christophe
affiliation: "AWS Quantum Technologies"
orcid: "https://orcid.org/0000-0002-3379-229X"
- family-names: Chen
given-names: Li
affiliation: "AWS Center for Quantum Computing"
orcid: "https://orcid.org/0000-0002-1700-7503"
- family-names: Thorgrimsson
given-names: Brandur
affiliation: "Atlantic Quantum"
orcid: "https://orcid.org/0000-0002-4491-1717"
- family-names: Mishra
given-names: Anurag
affiliation: "AWS Center for Quantum Computing"
orcid: "https://orcid.org/0000-0003-1325-4387"
- family-names: D'Ewart
given-names: Mitch
affiliation: "AWS Center for Quantum Computing"
orcid: "https://orcid.org/0000-0001-8916-560X"
- family-names: Shaffer
given-names: Ryan
affiliation: "AWS Quantum Technologies"
orcid: "https://orcid.org/0000-0002-3196-4529"
- family-names: Davis
given-names: Erik
affiliation: "AWS Center for Quantum Computing"
orcid: "https://orcid.org/0000-0001-7696-2538"
- family-names: Chen
given-names: Yi-Ting
affiliation: "AWS Quantum Technologies"
orcid: "https://orcid.org/0000-0001-7340-5402"
- family-names: Sivarajah
given-names: Prasahnt
affiliation: "AWS Center for Quantum Computing"
orcid: "https://orcid.org/0000-0002-9383-8624"
- family-names: Karalekas
given-names: Peter
affiliation: "AWS Center for Quantum Computing"
orcid: "https://orcid.org/0000-0001-6031-4800"
license: Apache-2.0
keywords:
- openqasm
- quantum
repository-code: "https://github.com/openqasm/oqpy"
doi: 10.5281/zenodo.7349265
GitHub Events
Total
- Create event: 1
- Issues event: 1
- Release event: 1
- Push event: 2
- Pull request review comment event: 2
- Pull request event: 3
- Pull request review event: 5
Last Year
- Create event: 1
- Issues event: 1
- Release event: 1
- Push event: 2
- Pull request review comment event: 2
- Pull request event: 3
- Pull request review event: 5
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jean-Christophe Jaskula | 9****s | 26 |
| Phil Reinhold | p****n@a****m | 11 |
| Peter Karalekas | p****r@k****m | 10 |
| Anurag Mishra | m****7@g****m | 8 |
| dependabot[bot] | 4****] | 3 |
| Erik Davis | e****s@a****m | 3 |
| Tim (Yi-Ting) | y****n@a****m | 2 |
| jmdewart | m****t@g****m | 1 |
| Ryan Shaffer | 3****r | 1 |
| Cody Wang | s****6@g****m | 1 |
| Brandur Thorgrimsson | 1****t | 1 |
| Bastian Zimmermann | 1****m | 1 |
| Aaron Berdy | b****y@a****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 5 months ago
All Time
- Total issues: 22
- Total pull requests: 77
- Average time to close issues: 4 months
- Average time to close pull requests: 17 days
- Total issue authors: 7
- Total pull request authors: 15
- Average comments per issue: 0.55
- Average comments per pull request: 0.74
- Merged pull requests: 66
- Bot issues: 0
- Bot pull requests: 3
Past Year
- Issues: 2
- Pull requests: 5
- Average time to close issues: N/A
- Average time to close pull requests: 4 days
- Issue authors: 2
- Pull request authors: 3
- Average comments per issue: 0.0
- Average comments per pull request: 0.2
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- PhilReinhold (11)
- jcjaskula-aws (3)
- stephteo (2)
- anuragm (1)
- Swordcat (1)
- yitchen-tim (1)
- braised-babbage (1)
Pull Request Authors
- jcjaskula-aws (31)
- PhilReinhold (10)
- karalekas (8)
- anuragm (8)
- yitchen-tim (4)
- dependabot[bot] (4)
- braised-babbage (4)
- rmshaffer (2)
- ajberdy (2)
- godott (1)
- jmdewart (1)
- Swordcat (1)
- natestemen (1)
- BastianZim (1)
- speller26 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- pypi 97,397 last-month
- Total docker downloads: 218
-
Total dependent packages: 2
(may contain duplicates) -
Total dependent repositories: 2
(may contain duplicates) - Total versions: 15
- Total maintainers: 2
pypi.org: oqpy
Generating OpenQASM 3 + OpenPulse in Python
- Homepage: https://github.com/openqasm/oqpy
- Documentation: https://oqpy.readthedocs.io/
- License: Apache-2.0
-
Latest release: 0.3.7
published about 1 year ago
Rankings
Maintainers (2)
conda-forge.org: oqpy
- Homepage: https://github.com/openqasm/oqpy
- License: Apache-2.0
-
Latest release: 0.1.1
published about 3 years ago
Rankings
Dependencies
- myst-parser >=0.18.1
- openqasm-pygments >=0.1.1
- sphinx >=5.3.0
- sphinx-rtd-theme >=1.0.0
- Babel 2.10.3 develop
- Jinja2 3.1.2 develop
- MarkupSafe 2.1.1 develop
- PyYAML 6.0 develop
- Sphinx 5.3.0 develop
- alabaster 0.7.12 develop
- astroid 2.11.5 develop
- atomicwrites 1.4.0 develop
- attrs 21.4.0 develop
- black 22.3.0 develop
- bleach 5.0.1 develop
- certifi 2022.6.15 develop
- cffi 1.15.1 develop
- charset-normalizer 2.1.0 develop
- click 8.1.3 develop
- colorama 0.4.5 develop
- commonmark 0.9.1 develop
- coverage 6.4.4 develop
- cryptography 37.0.4 develop
- dill 0.3.5.1 develop
- docutils 0.17.1 develop
- idna 3.3 develop
- imagesize 1.4.1 develop
- iniconfig 1.1.1 develop
- isort 5.10.1 develop
- jeepney 0.8.0 develop
- keyring 23.7.0 develop
- lazy-object-proxy 1.7.1 develop
- markdown-it-py 2.1.0 develop
- mccabe 0.7.0 develop
- mdit-py-plugins 0.3.1 develop
- mdurl 0.1.2 develop
- mypy 0.961 develop
- myst-parser 0.18.1 develop
- openqasm-pygments 0.1.1 develop
- packaging 21.3 develop
- pathspec 0.9.0 develop
- pkginfo 1.8.3 develop
- platformdirs 2.5.2 develop
- pluggy 1.0.0 develop
- py 1.11.0 develop
- py-cpuinfo 8.0.0 develop
- pycparser 2.21 develop
- pydocstyle 6.1.1 develop
- pygments 2.12.0 develop
- pylint 2.13.9 develop
- pyparsing 3.0.9 develop
- pytest 6.2.5 develop
- pytest-benchmark 3.4.1 develop
- pytest-cov 3.0.0 develop
- pytz 2022.4 develop
- pywin32-ctypes 0.2.0 develop
- readme-renderer 35.0 develop
- requests 2.28.1 develop
- requests-toolbelt 0.9.1 develop
- rfc3986 2.0.0 develop
- rich 12.5.1 develop
- secretstorage 3.3.2 develop
- setuptools 65.4.1 develop
- six 1.16.0 develop
- snowballstemmer 2.2.0 develop
- sphinx-rtd-theme 1.0.0 develop
- sphinxcontrib-applehelp 1.0.2 develop
- sphinxcontrib-devhelp 1.0.2 develop
- sphinxcontrib-htmlhelp 2.0.0 develop
- sphinxcontrib-jsmath 1.0.1 develop
- sphinxcontrib-qthelp 1.0.3 develop
- sphinxcontrib-serializinghtml 1.1.5 develop
- toml 0.10.2 develop
- tomli 1.2.3 develop
- twine 4.0.1 develop
- typed-ast 1.5.4 develop
- urllib3 1.26.10 develop
- webencodings 0.5.1 develop
- wrapt 1.14.1 develop
- antlr4-python3-runtime 4.11.1
- importlib-metadata 4.12.0
- mypy-extensions 0.4.3
- numpy 1.21.6
- openpulse 0.4.0
- openqasm3 0.4.0
- typing-extensions 4.3.0
- zipp 3.8.1
- mypy-extensions ^0.4.3
- numpy ^1.21.6
- openpulse ^0.4.0
- python >=3.7,<3.11
- typing-extensions ^4.3.0
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite