Skip to content

Commit 02b6779

Browse files
build!: Drop Python 3.9 support and add support up to 3.13 (#319)
Co-authored-by: Li Li <li.li@q-ctrl.com>
1 parent 549cd1d commit 02b6779

File tree

6 files changed

+304
-336
lines changed

6 files changed

+304
-336
lines changed

.github/workflows/on-pull-request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: qctrl/reusable-workflows/.github/workflows/pytest.yaml@master
2525
secrets: inherit
2626
with:
27-
python-versions: '["3.9", "3.10", "3.11"]'
27+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
2828

2929
sphinx_documentation:
3030
# Filter out PRs originating from this repository (triggers on-push.yml instead)

.github/workflows/on-push.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
runs-on: ubuntu-latest
3838
strategy:
3939
matrix:
40-
python: ["3.9", "3.10", "3.11"]
40+
python: ["3.10", "3.11", "3.12", "3.13"]
4141
steps:
4242
- uses: actions/checkout@v4
4343
- name: Install Python dependencies

poetry.lock

Lines changed: 271 additions & 303 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ classifiers = [
4646
"Intended Audience :: Science/Research",
4747
"Natural Language :: English",
4848
"Operating System :: OS Independent",
49-
"Programming Language :: Python :: 3.9",
5049
"Programming Language :: Python :: 3.10",
5150
"Programming Language :: Python :: 3.11",
51+
"Programming Language :: Python :: 3.12",
52+
"Programming Language :: Python :: 3.13",
5253
"Topic :: Internet :: WWW/HTTP",
5354
"Topic :: Scientific/Engineering :: Physics",
5455
"Topic :: Scientific/Engineering :: Visualization",
@@ -60,7 +61,7 @@ packages = [
6061
]
6162

6263
[tool.poetry.dependencies]
63-
python = ">=3.9,<3.12"
64+
python = ">=3.10,<3.14"
6465
numpy = ">=1.25.2"
6566

6667
[tool.poetry.group.dev.dependencies]

qctrlopencontrols/dynamic_decoupling_sequences/predefined.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def new_ramsey_sequence(
181181
offsets = duration * np.array([0.0, 1.0])
182182
rabi_rotations = np.array([np.pi / 2, np.pi / 2])
183183
azimuthal_angles = np.array([0.0, np.pi])
184-
detuning_rotations = np.zeros((2,))
184+
detuning_rotations = np.array([0, 0])
185185
else:
186186
offsets = np.array([])
187187
rabi_rotations = np.array([])
@@ -812,27 +812,27 @@ def new_quadratic_sequence(
812812

813813
# remove the last entry corresponding to the duration
814814
offsets = offsets[:-1]
815-
rabi_rotations = rabi_rotations[:-1]
816-
detuning_rotations = detuning_rotations[:-1]
815+
_rabi_rotations = rabi_rotations[:-1]
816+
_detuning_rotations = detuning_rotations[:-1]
817817

818818
azimuthal_angles = np.zeros(offsets.shape)
819819

820820
if pre_post_rotation:
821821
(
822822
offsets,
823-
rabi_rotations,
823+
_rabi_rotations,
824824
azimuthal_angles,
825-
detuning_rotations,
825+
_detuning_rotations,
826826
) = _add_pre_post_rotations(
827-
duration, offsets, rabi_rotations, azimuthal_angles, detuning_rotations
827+
duration, offsets, _rabi_rotations, azimuthal_angles, _detuning_rotations
828828
)
829829

830830
return DynamicDecouplingSequence(
831831
duration=duration,
832832
offsets=offsets,
833-
rabi_rotations=rabi_rotations,
833+
rabi_rotations=_rabi_rotations,
834834
azimuthal_angles=azimuthal_angles,
835-
detuning_rotations=detuning_rotations,
835+
detuning_rotations=_detuning_rotations,
836836
name=name,
837837
)
838838

tests/test_predefined_dynamical_decoupling.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -393,20 +393,15 @@ def test_quadratic_sequence():
393393
_rabi_rotations[0:outer_offset_count, -1] = np.pi
394394
_detuning_rotations[0 : (outer_offset_count + 1), 0:inner_offset_count] = np.pi
395395

396-
_offsets = np.reshape(_offsets, (-1,))
397-
_rabi_rotations = np.reshape(_rabi_rotations, (-1,))
398-
_detuning_rotations = np.reshape(_detuning_rotations, (-1,))
396+
_reshaped_offsets = np.reshape(_offsets, (-1,))[0:-1]
397+
_reshaped_rabi_rotations = np.reshape(_rabi_rotations, (-1,))[0:-1]
398+
_reshaped_detuning_rotations = np.reshape(_detuning_rotations, (-1,))[0:-1]
399+
_azimuthal_angles = np.zeros(_reshaped_offsets.shape)
399400

400-
_offsets = _offsets[0:-1]
401-
_rabi_rotations = _rabi_rotations[0:-1]
402-
_detuning_rotations = _detuning_rotations[0:-1]
403-
404-
_azimuthal_angles = np.zeros(_offsets.shape)
405-
406-
assert np.allclose(_offsets, sequence.offsets)
407-
assert np.allclose(_rabi_rotations, sequence.rabi_rotations)
401+
assert np.allclose(_reshaped_offsets, sequence.offsets)
402+
assert np.allclose(_reshaped_rabi_rotations, sequence.rabi_rotations)
408403
assert np.allclose(_azimuthal_angles, sequence.azimuthal_angles)
409-
assert np.allclose(_detuning_rotations, sequence.detuning_rotations)
404+
assert np.allclose(_reshaped_detuning_rotations, sequence.detuning_rotations)
410405

411406
sequence = new_quadratic_sequence(
412407
duration=duration,
@@ -415,21 +410,25 @@ def test_quadratic_sequence():
415410
pre_post_rotation=True,
416411
)
417412

418-
_offsets = np.insert(_offsets, [0, _offsets.shape[0]], [0, duration])
419-
_rabi_rotations = np.insert(
420-
_rabi_rotations, [0, _rabi_rotations.shape[0]], [np.pi / 2, np.pi / 2]
413+
_reshaped_offsets = np.insert(
414+
_reshaped_offsets, [0, _reshaped_offsets.shape[0]], [0, duration]
421415
)
422-
_detuning_rotations = np.insert(
423-
_detuning_rotations, [0, _detuning_rotations.shape[0]], [0, 0]
416+
_reshaped_rabi_rotations = np.insert(
417+
_reshaped_rabi_rotations,
418+
[0, _reshaped_rabi_rotations.shape[0]],
419+
[np.pi / 2, np.pi / 2],
420+
)
421+
_reshaped_detuning_rotations = np.insert(
422+
_reshaped_detuning_rotations, [0, _reshaped_detuning_rotations.shape[0]], [0, 0]
424423
)
425424

426-
_azimuthal_angles = np.zeros(_offsets.shape)
425+
_azimuthal_angles = np.zeros(_reshaped_offsets.shape)
427426
_azimuthal_angles[-1] = np.pi
428427

429-
assert np.allclose(_offsets, sequence.offsets)
430-
assert np.allclose(_rabi_rotations, sequence.rabi_rotations)
428+
assert np.allclose(_reshaped_offsets, sequence.offsets)
429+
assert np.allclose(_reshaped_rabi_rotations, sequence.rabi_rotations)
431430
assert np.allclose(_azimuthal_angles, sequence.azimuthal_angles)
432-
assert np.allclose(_detuning_rotations, sequence.detuning_rotations)
431+
assert np.allclose(_reshaped_detuning_rotations, sequence.detuning_rotations)
433432

434433

435434
def test_x_concatenated_sequence():

0 commit comments

Comments
 (0)