Skip to content

Commit

Permalink
Merge branch 'master' into release/0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
terrorfisch committed Mar 28, 2023
2 parents cc60572 + 286f49f commit 90b5821
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythontest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9"]
python-version: ["3.8", "3.9", "3.10"]
time-type: ["fractions", "gmpy2"]
env:
INSTALL_EXTRAS: tests,plotting,zurich-instruments,tektronix,tabor-instruments
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ python -m pip install -e git+https://github.com/qutech/qupulse.git#egg=qupulse[d
which will clone the github repository to `./src/qupulse` and do an editable/development install.

### Requirements and dependencies
qupulse requires at least Python 3.7 and is tested on 3.7, 3.8 and 3.9. It relies on some external Python packages as dependencies.
qupulse requires at least Python 3.8 and is tested on 3.8, 3.9 and 3.10. It relies on some external Python packages as dependencies.
We intentionally did not restrict versions of dependencies in the install scripts to not unnecessarily prevent usage of newer releases of dependencies that might be compatible. However, if qupulse does encounter problems with a particular dependency version please file an issue.

The backend for TaborAWGs requires packages that can be found [here](https://git.rwth-aachen.de/qutech/python-TaborDriver). As a shortcut you can install it from the python interpreter via `qupulse.hardware.awgs.install_requirements('tabor')`.
Expand Down
1 change: 1 addition & 0 deletions changes.d/760.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop support for python version 3.7.
13 changes: 10 additions & 3 deletions qupulse/utils/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@
import sympy


def lcm(a: int, b: int):
"""least common multiple"""
return a * b // gcd(a, b)
try:
from math import lcm
except ImportError:
# python version < 3.9
def lcm(*integers: int):
"""Re-implementation of the least common multiple function that is in the standard library since python 3.9"""
result = 1
for value in integers:
result = result * value // gcd(value, result)
return result


def smallest_factor_ge(n: int, min_factor: int, brute_force: int = 5):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages = find:
package_dir =
qupulse=qupulse
qctoolkit=qctoolkit
python_requires = >=3.7
python_requires = >=3.8
install_requires =
sympy>=1.1.1
numpy
Expand Down
13 changes: 12 additions & 1 deletion tests/utils/numeric_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections import deque
from itertools import islice

from qupulse.utils.numeric import approximate_rational, approximate_double, smallest_factor_ge
from qupulse.utils.numeric import approximate_rational, approximate_double, smallest_factor_ge, lcm


def stern_brocot_sequence() -> Iterator[int]:
Expand Down Expand Up @@ -120,3 +120,14 @@ def test_smallest_factor_ge(self):
self.assertEqual(smallest_factor_ge(45, 4), 5, brute_force)
self.assertEqual(smallest_factor_ge(45, 5), 5, brute_force)
self.assertEqual(smallest_factor_ge(36, 8), 9, brute_force)


class LeastCommonMultipleTests(unittest.TestCase):
def test_few_args(self):
self.assertEqual(1, lcm())
self.assertEqual(5, lcm(5))

def test_multi_args(self):
self.assertEqual(15, lcm(3, 5))
self.assertEqual(0, lcm(3, 0))
self.assertEqual(20, lcm(2, 5, 4, 10))

0 comments on commit 90b5821

Please sign in to comment.