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

Doc strings and default behavior for pulse simulator #521

Closed
wants to merge 80 commits into from

Conversation

DanPuzzuoli
Copy link
Contributor

Summary

This PR contains both clarification of default behaviors in digest.py, as well as added doc strings for HamiltonianModel, PulseSystemModel, and PulseSimulator. (Both were done at the same time as default behavior influences doc strings.) The doc string for PulseSimulator will likely need to be edited, but this is at least a start, and contains all of the information from the pulse simulator readme.

Closes #501 and #433

Details and comments

Specific changes for digest:

  • Updated default handling of qubit_lo_freq in digest.py
    • First it tries to populate it from the qobj passed by the user
    • If not present, takes it from system_model._qubit_freq_est
    • If this is not present, it automatically computes it from Hamiltonian and uses that
  • Updated the old tests for digest to test for the above behavior.
  • Added a piece of code to digest that allows backend_options to override any key/value in qobj_config.

Changes for doc strings:

  • Updated doc strings for HamiltonianModel and PulseSystemModel
  • Added doc string for PulseSimulator. May need more work, but it at least contains everything from the original readme.

nonhermitian and others added 30 commits March 11, 2019 18:49
Fixing CMake file for pulse simulator
* Add readme and example

* Add qubit whitelist, update example

* Added a frequency to the channels

* Adding frame rotation, doesn't quite work yet

* Fixed bug, now works for general oscillation frequencies

* Added dressed state measurement

* Notebook updated with Rabi and CR

* Update readme.md

* Reorder estates after dressing to original ordering. Uses a very basic routine so won't work at avoided crossings

* Generalize qubit operators, fix transformation error

* Updated notebook with the correct sims

* Fixed some path issues, replaced absolute with relative paths

* Moved example, fixed error for unitary solver in opsolve

* Updated to work with the pulse_simulator backend

* Put header into results so that get_counts will work

* Updated measurement to fix an error in the eigenstate mapper, add measurement level 1 and clean up example

* Fixed hamiltonian issues with noise, fixed measurement, finalized notebook

* Fixed issue with default config in pulse sim backend

* Fix reference to qiskiterror

* Fixed some import errors after merging with paul
atilag and others added 18 commits December 9, 2019 21:50
…supported

Added warning messages for Pulse Simulator untested features
- Changed 'seed' in digest_pulse_obj to be drawn from config_dict_sim instead of config_dict
config_dict_sim pertains to aspects of the simulation, so it is a more natural place for
this option to be drawn from.
- Corrected change in digest.py from last commit for drawing 'seed' from config_dict_sim.
- Updated functions backend_options_1q and backend_options_2q in TestPulseSimulator to also
set a 'seed' to make tests deterministic. Ran tests a few times and verified that the
random results of simulations (e.g. counts) became deterministic.
- Corrected the skipping of 'test_persistent_value' to be done with the '@unittest.skip' decorator.
* Add HamiltonianModel class for pulse simulator

* update digest to use HamiltonianModel

* change statevector pulse tests to use state_fidelity
…ianModel (Qiskit#496)

* added PulseSystemModel to extract information about backend relevant to simulation

* Moved HamiltonianModel.calculate_frequencies to PulseSystemModel.calculate_channel_frequencies

* Modifying constructors for HamiltonianModel to separate object specification from string parsing

* added PulseDefaults object into the pulse_simulator, and changed the default memory_slots setting in digest to be equal to the number of qubits

* changed digest default 'meas_level' to 2
* Calling c++ implementation of the numeric integrator solver function (just a
basic scaffolding)
* Adding C++ and helpers code (still not building)
* Adding tests for the C++ helpers on Python C API
* Adding my ordered_map to guarantee order insertion iteration (ala Python's OrderedDict)
* Adding muparserx library for parsing hamiltonian math expressions
* Now we can use both Cython and C++ func ODE solver depending on a config param: use_cpp_ode_func
* Disabling Pulse simulator related tests for Python 3.5
…mulator (Qiskit#503)

* removed noise_model from digest args, and also sim_config handling

* Changed warnings in digest for persistentValue pulses

* multiplying qubit_lo_freq by 1e9 in digest.py, as assemble divides it by 1e9
…mModel and HamiltonianModel about how values are handled
…ently relevant for qubit_lo_freq determination
…in digest to allow backend_options to override anything in digest
@DanPuzzuoli DanPuzzuoli force-pushed the defaults-and-doc-strings branch from 45f1533 to ddc09c5 Compare January 21, 2020 16:20
@@ -33,19 +33,87 @@

class PulseSimulator(AerBackend):
"""Aer OpenPulse simulator

The `PulseSimulator` simulates pulse `Schedules` on a model of a quantum system, where a model
is specified by a `PulseSystemModel` object, which stores Hamiltonian and control channel
Copy link
Member

Choose a reason for hiding this comment

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

you should be able to link documentation by using sphinx directives. Eg:

:class:`~qiskit.path-to.PulseSystemModel`

**Example of usage**

To use the simulator, `assemble` a `PulseQobj` object from a list of pulse `Schedules`, using
`backend=PulseSimulator()`.
Copy link
Member

Choose a reason for hiding this comment

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

In sphinx you need to use double-ticks for "code" formatting eg:

``backend=PulseSimulator()``.

@chriseclectic chriseclectic changed the base branch from openpulse-sim to master January 24, 2020 19:30
@chriseclectic
Copy link
Member

@DanPuzzuoli can you rebase this PR against master now that the openpulse-sim branch has been merged

@DanPuzzuoli DanPuzzuoli deleted the defaults-and-doc-strings branch June 4, 2020 13:01
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.

Cleanup/clarify pulse simulation defaults behaviour and digest
7 participants