Skip to content

Commit

Permalink
Merge branch 'develop' into fix/shared-rcv-chan
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamrow committed Jul 31, 2019
2 parents 1b41286 + 2cffa24 commit a92d52a
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 32 deletions.
2 changes: 1 addition & 1 deletion QGL/Compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def compile_to_hardware(seqs,
'qubits': [c.label for c in channels if isinstance(c, Channels.Qubit)],
'measurements': [c.label for c in channels if isinstance(c, Channels.Measurement)],
'receivers': receiver_measurements,

'edges': [c.label for c in channels if isinstance(c, Channels.Edge)]
}
if extra_meta:
meta.update({'extra_meta': extra_meta})
Expand Down
8 changes: 4 additions & 4 deletions QGL/GSTTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

PYGSTI_PRESENT = False
try:
from pygsti.objects import GateString
from pygsti.objects.circuit import Circuit
PYGSTI_PRESENT = True
except:
pass
Expand All @@ -51,11 +51,11 @@ def gst_map_1Q(gst_list, qubit, qgl_map=gst_gate_map, append_meas=True):
Returns:
QGL sequences, preserving the input list nesting (as a generator)
"""
if isinstance(gst_list, GateString):
if isinstance(gst_list, Circuit):
gst_list = [gst_list]
for item in gst_list:
if isinstance(item, GateString):
mapped = map(lambda x: qgl_map[x](qubit), item.tup)
if isinstance(item, Circuit):
mapped = map(lambda x: qgl_map[str(x)](qubit), item.tup)
if append_meas:
yield list(chain(mapped, [MEAS(qubit)]))
else:
Expand Down
35 changes: 12 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,21 @@ notebook](https://github.com/BBN-Q/QGL/blob/master/doc/QGL-demo.ipynb).
The most straightforward way to get up and running is to use the [Anaconda
Python distribution](http://continuum.io/downloads). This includes nearly all
the dependencies. The remaining dependencies can be installed from the terminal
or Anaconda Command Prompt on Windows.
or Anaconda Command Prompt on Windows. While QGL can be run on windows, our
experiment control software [Auspex](https://github.com/BBN-Q/auspex) relies on linux
when running qubit experiments.

### Python 2.7
### Python 3.6+

```bash
conda install atom future
pip install watchdog
```

### Python 3.4+

```bash
conda install -c ecpy atom
cd QGL/
pip install .
```

For Python 3.6+ you may need to install watchdog from conda forge:
```
conda install -c conda-forge watchdog
conda install -c ecpy atom
cd QGL/
pip install .
Alternatively, if you plan to modify the source code it will be easier to perform a
developer install using:
```bash
pip install -e .
```

If you'd like to use some of the built-in gate-set-tomography functionality,
you can grab the PyGSTi package during the install:
```
Expand All @@ -50,14 +40,13 @@ going to System -> Advanced Settings -> Environment variables. On Mac/Linux
machines add the following line to your .bashrc or .bash_profile: ``` export
PYTHONPATH=/path/to/QGL/repo:$PYTHONPATH```


The QGL config file will be created the first time you run `import QGL` or `from QGL import *`.
## Usage
QGL is designed to be utilized alongside Auspex, and most of the usage example,
including how to define a channel library, can be found in the [Auspex documentation](https://auspex.readthedocs.io/en/develop/qubits.html)

## Dependencies
* Python 2.7 or 3.4+
* Python 3.6+
* Numpy/Scipy
* h5py
* Bokeh 0.11
* networkx 2.0
* iPython/Jupyter 4.0 (only for Jupyter notebooks)
* bbndb
49 changes: 49 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# Usage: dist_pypi [production]
# Uses pypi test unless "production is supplied"

pkg_name=$(python setup.py --name)
version=$(python setup.py --version)
echo "DISTRIBUTING $pkg_name VERSION $version"

[[ $1 == "production" ]] && echo "*** PRODUCTION UPLOAD ***" || echo "*** TEST UPLOAD ***"
read -n 1 -s -r -p "Press any key to continue"

echo "** Removing dist directory **"
rm -rf dist

echo "** Creating source distribution **"
python setup.py sdist

echo "** Creating wheel distribution **"
python setup.py bdist_wheel

echo "** Uploading to test pypi **"
if [[ $1 == "production" ]]; then
twine upload dist/*
else
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
fi

# Test with: pip install --extra-index-url https://test.pypi.org/simple/ bbndb

echo "** Creating conda skeleton **"
rm -rf skeleton
mkdir skeleton && pushd skeleton
if [[ $1 == "production" ]]; then
conda skeleton pypi --version=$version $pkg_name
else
conda skeleton pypi --version=$version --pypi-url https://test.pypi.io/pypi/ $pkg_name
fi
pushd $pkg_name

echo "** Please modify the meta.yaml in skeleton/$pkg_name to include \"noarch: python\" in the build section."
read -n 1 -s -r -p "Press any key to continue"

anaconda login
conda config --set anaconda_upload yes
conda build -c conda-forge .
conda config --set anaconda_upload no

popd && popd
25 changes: 21 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
from setuptools import setup, find_packages

setup(name='QGL',
version='2.1',
url='https://github.com/BBN-Q/QGL',
version='2019.1',
packages=find_packages(exclude=["tests"]),
url='https://github.com/BBN-Q/QGL',
download_url='https://github.com/BBN-Q/QGL',
license="Apache 2.0 License",
install_requires=[
"bbndb >= 0.1",
"bbndb >= 2019.1",
"numpy >= 1.11.1",
"scipy >= 0.17.1",
"networkx >= 1.11",
"bqplot >= 0.11.5",
"sqlalchemy >= 1.2.15"
])
],
description="Quantum Gate Language (QGL) is a domain specific language embedded in python for specifying pulse sequences.",
long_description_content_type='text/markdown',
long_description=open('README.md').read(),
python_requires='>=3.6',
keywords="quantum qubit experiment configuration gate language"
)

# python setup.py sdist
# python setup.py bdist_wheel
# For testing:
# twine upload --repository-url https://test.pypi.org/legacy/ dist/*
# For distribution:
# twine upload dist/*
# Test with:
# pip install --extra-index-url https://test.pypi.org/simple/ qgl

0 comments on commit a92d52a

Please sign in to comment.