Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SimulatorOptions.set_backend method #876

Merged
merged 11 commits into from
Jul 12, 2023

Conversation

ikkoham
Copy link
Collaborator

@ikkoham ikkoham commented May 30, 2023

Summary

This PR proposes the simple method to set the simulator options from backend.

Before

from qiskit.providers.fake_provider import FakeManila
from qiskit_aer.noise import NoiseModel

# Make a noise model
fake_backend = FakeManila()
noise_model = NoiseModel.from_backend(fake_backend)

# Set options to include the noise model
options = Options()
options.simulator = {
    "noise_model": noise_model,
    "basis_gates": fake_backend.configuration().basis_gates,
    "coupling_map": fake_backend.configuration().coupling_map,
    "seed_simulator": 42
}

After

from qiskit.providers.fake_provider import FakeManila
from qiskit_aer.noise import NoiseModel

# Make a noise model
fake_backend = FakeManila()

# Set options to include the noise model
options = Options()
options.simulator.set_backend(fake_backend)
options.simulator.seed_simulator = 42

I opened the PR to discuss. If this direction is ok, I'll finalize the PR.

Details and comments

Fixes #

@ikkoham ikkoham requested a review from jyu00 May 30, 2023 06:59
@kt474 kt474 added this to the 0.10.1 milestone May 30, 2023
@veenaiyuri
Copy link

Thank you for this @ikkoham. As someone involved with teaching, I want to note that simplifying code implementation as proposed in this case may seem small but does make a real difference.

@kt474 kt474 removed this from the 0.10.1 milestone Jun 9, 2023
@ikkoham ikkoham added the Changelog: New Feature Include in the Added section of the changelog label Jun 21, 2023
@ikkoham
Copy link
Collaborator Author

ikkoham commented Jun 21, 2023

Oh... There are no config file for black.

@ikkoham ikkoham changed the title [WIP] Add SimulatorOptions.from_backend method Add SimulatorOptions.set_backend method Jul 4, 2023
@coveralls
Copy link

coveralls commented Jul 4, 2023

Pull Request Test Coverage Report for Build 5533160393

  • 14 of 15 (93.33%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 74.181%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_ibm_runtime/options/simulator_options.py 14 15 93.33%
Totals Coverage Status
Change from base Build 5520615217: 0.08%
Covered Lines: 2422
Relevant Lines: 3265

💛 - Coveralls

@ikkoham ikkoham marked this pull request as ready for review July 4, 2023 01:34
@ikkoham ikkoham requested a review from kt474 July 4, 2023 01:34
Copy link
Member

@kt474 kt474 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this! Mostly looks good - can you also add a release note highlighting this new method?

docs/how_to/noisy_simulators.rst Outdated Show resolved Hide resolved
requirements-dev.txt Show resolved Hide resolved
@kt474 kt474 added this to the 0.11.2 milestone Jul 6, 2023
@kt474 kt474 merged commit 99b8e62 into Qiskit:main Jul 12, 2023
16 checks passed
@ikkoham
Copy link
Collaborator Author

ikkoham commented Jul 13, 2023

@kt474 Thank you very much. If you encounter any problems related to ddt in the future, please assign me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the Added section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants