Skip to content

Conversation

@yurekami
Copy link

Summary

Replace deprecated Aer.get_backend() calls with AerSimulator() in test files and examples.

Changes

  • test/measurement/test_measure.py: Use AerSimulator() instead of Aer.get_backend("aer_simulator")
  • test/layers/test_rotgate.py: Use AerSimulator(method='unitary') instead of Aer.get_backend("unitary_simulator")
  • examples/quest/utils/fide_pst.py: Update imports and use AerSimulator() directly

Background

The Aer.get_backend() API was deprecated in qiskit-aer 0.12. AerSimulator is the recommended replacement:

# Before (deprecated)
from qiskit_aer import Aer
backend = Aer.get_backend("aer_simulator")

# After (recommended)
from qiskit_aer import AerSimulator
backend = AerSimulator()

Note

The VQE example (examples/qiskit/vqe.py) also uses deprecated APIs but requires a more comprehensive refactor to update from QuantumInstance to the new Primitives API. That change is out of scope for this PR.

Test plan

  • Test files pass with new AerSimulator usage
  • Run pytest to verify no regressions

Fixes #193

🤖 Generated with Claude Code

Replace deprecated Aer.get_backend() calls with AerSimulator():

- test/measurement/test_measure.py: Use AerSimulator() instead of
  Aer.get_backend("aer_simulator")
- test/layers/test_rotgate.py: Use AerSimulator(method='unitary')
  instead of Aer.get_backend("unitary_simulator")
- examples/quest/utils/fide_pst.py: Update imports and use
  AerSimulator() directly

The Aer.get_backend() API was deprecated in qiskit-aer 0.12 and
AerSimulator is the recommended replacement.

Fixes mit-han-lab#193

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backlog] Fix Deprecation Warnings

1 participant