Skip to content

Commit

Permalink
Merge branch 'develop' into parallel_sim
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Mills committed Mar 18, 2024
2 parents 76cfba2 + 40d4946 commit 3359d7a
Show file tree
Hide file tree
Showing 12 changed files with 2,520 additions and 118 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/" # Location of package manifests
schedule:
interval: "daily"
target-branch: "develop"
66 changes: 8 additions & 58 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ on:

jobs:

macos:
name: Build and test (MacOS)
runs-on: macos-latest
run-tests:
name: Build and test
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.10', '3.11', '3.12']
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -24,60 +25,11 @@ jobs:
- name: Build qermit
if: github.event_name == 'pull_request'
run: |
pip install -e . -v
pip list
pip install -e .[tests] -v
- name: Test qermit
if: github.event_name == 'pull_request'
run: |
cd tests
pip install -r test_requirements.txt
pip list
pytest --cov-report term-missing:skip-covered --cov=qermit --durations=10
linux:
name: Build and test (Linux)
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Build qermit
if: github.event_name == 'pull_request'
run: |
pip install -e . -v
- name: Test qermit
if: github.event_name == 'pull_request'
run: |
cd tests
pip install -r test_requirements.txt
pytest --cov-report term-missing:skip-covered --cov=qermit --durations=10
windows:
name: Build and test (Windows)
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Build qermit
if: github.event_name == 'pull_request'
run: |
pip install -e . -v
- name: Test qermit
if: github.event_name == 'pull_request'
run: |
cd tests
pip install -r test_requirements.txt
pytest --cov-report term-missing:skip-covered --cov=qermit --durations=10
build-docs:
Expand All @@ -87,11 +39,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install Qermit
run: pip install .
run: pip install -e .[docs] -v
- name: Build Docs
run: |
cd docs_src
pip install -r requirements.txt
./build_docs.sh
cd ../manual
./build_manual.sh
Expand All @@ -113,9 +64,8 @@ jobs:
uses: actions/checkout@v2
- name: Build qermit
run: |
pip install -e . -v
pip install .[tests]
cd tests
pip install -r test_requirements.txt
- name: Run mypy
if: github.event_name == 'pull_request'
run: mypy -p qermit
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Install Qermit
run: pip install .
run: pip install .[docs]
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build Docs
run: |
cd docs_src
pip install -r requirements.txt
./build_docs.sh
cd ../manual
./build_manual.sh
Expand Down
4 changes: 0 additions & 4 deletions docs_src/requirements.txt

This file was deleted.

2,460 changes: 2,460 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[build-system]
requires = ["poetry", "poetry-core>=1.0.8"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "qermit"
version = "0.5.0"
description = "Python package for quantum error mitigation."
authors = [
"Daniel Mills <[email protected]>",
"Silas Dilkes <[email protected]>",
"Cristina Circsoiu <[email protected]>"
]
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.10, <3.13"
pytket-qiskit = "^0.50.0"
matplotlib = "^3.8.3"

pytest = {version="^8.1.1", optional=true}
mypy = {version="^1.9.0", optional=true}
flake8 = {version="^7.0.0", optional=true}
sphinx = {version="^7.2.6", optional=true}
pytest-cov = {version="^4.1.0", optional=true}
sphinx-book-theme = {version="^1.1.2", optional=true}
qiskit-ibm-provider = {version="^0.10.0", optional=true}
pytket-quantinuum = {version="^0.30.0", optional=true}

[tool.poetry.extras]
tests = ["pytest", "mypy", "flake8", "pytest-cov", "qiskit-ibm-provider", "pytket-quantinuum"]
docs = ["sphinx", "sphinx-book-theme"]
16 changes: 8 additions & 8 deletions qermit/noise_model/mock_quantinuum_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pytket import OpType
from pytket import Circuit
from pytket.backends.resulthandle import ResultHandle
from typing import List, Union
from typing import List, Union, Optional, Sequence
from pytket.backends.backendresult import BackendResult
from .noisy_aer_backend import NoisyAerBackend

Expand Down Expand Up @@ -56,16 +56,16 @@ def __init__(self):
def process_circuit(
self,
circuit: Circuit,
n_shot: int,
n_shots: Optional[int] = None,
valid_check: bool = True,
**kwargs,
) -> ResultHandle:
"""Submit circuit to the backend for running.
:param circuit: Circuit to process on the backend
:type circuit: Circuit
:param n_shot: Number of shots to run per circuit.
:type n_shot: int
:param n_shots: Number of shots to run per circuit.
:type n_shots: int
:param valid_check: Explicitly check that all circuits satisfy all
required predicates to run on the backend, defaults to True
:type valid_check: bool, optional
Expand All @@ -86,15 +86,15 @@ def process_circuit(
self.noisy_backend.noisy_gate_set.union({OpType.Reset, OpType.Barrier})
).verify(cu.circuit)

handle = self.noisy_backend.process_circuit(cu.circuit, n_shot)
handle = self.noisy_backend.process_circuit(cu.circuit, n_shots)
self.handle_cu_dict[handle] = cu

return handle

def process_circuits(
self,
circuits: List[Circuit],
n_shots: Union[List[int], int],
circuits: Sequence[Circuit],
n_shots: Union[Optional[int], Sequence[Optional[int]]] = None,
valid_check: bool = True,
**kwargs,
) -> List[ResultHandle]:
Expand All @@ -111,7 +111,7 @@ def process_circuits(
:return: Handles to results for each input circuit, as an interable in the same order as the circuits.
:rtype: List[ResultHandle]
"""
if isinstance(n_shots, int):
if (isinstance(n_shots, int)) or (n_shots is None):
return [
self.process_circuit(circuit, n_shots, valid_check=valid_check)
for circuit in circuits
Expand Down
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

32 changes: 0 additions & 32 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/pec_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
from pytket.predicates import GateSetPredicate, CliffordCircuitPredicate # type: ignore
from qermit import AnsatzCircuit, ObservableExperiment
from pytket.extensions.qiskit import IBMQEmulatorBackend # type: ignore
from qiskit.providers.ibmq import IBMQFactory
from qiskit_ibm_provider import IBMProvider
import pytest

skip_remote_tests: bool = not IBMQFactory.stored_account()
skip_remote_tests: bool = not IBMProvider.saved_accounts()
REASON = "IBMQ account not configured"


Expand Down
7 changes: 0 additions & 7 deletions tests/test_requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions tests/zne_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from qermit import AnsatzCircuit, ObservableExperiment # type: ignore
import qiskit_aer.noise as noise # type: ignore
from pytket.circuit import OpType # type: ignore
from qiskit.providers.ibmq import IBMQFactory
from qiskit_ibm_provider import IBMProvider
import pytest
from pytket.circuit import Node # type: ignore
from qermit.noise_model import MockQuantinuumBackend # type: ignore
Expand Down Expand Up @@ -71,7 +71,7 @@
noisy_backend = AerBackend(noise_model)


skip_remote_tests: bool = not IBMQFactory.stored_account()
skip_remote_tests: bool = not IBMProvider.saved_accounts()
REASON = "IBMQ account not configured"


Expand Down

0 comments on commit 3359d7a

Please sign in to comment.