* limit in the solver
* cleaning up
* lint
* add no limit for call_limit=None
* add time limit
* adding reason to stop
* but on reason
* limit tests
* remove qasm
* docstring
* Update qiskit/transpiler/passes/mapping/csp_layout.py
Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>
* rename the property CSP_stop_reason
* release notes
* Add python 3.8 support and deprecate python 3.5
This commit adds support for running terra under python 3.8. It does
this by adding the trove classifiers to the package metadata and adding
a test job for python 3.8 (only travis for now this can be expanded in
the future when azure pipelines adds it to their image). At the same
time this commit starts the deprecation window for python 3.5. Python
3.5 goes end of life by upstream python in Sept. 2020. We should give
our users running with python 3.5 (which is about 10% of our users based
on pypi data) fair notice that when upstream python stops supporting it
we do as well.
* Fix lint
* Add back empty cache detection
As part of the refactors the empty stestr timing cache removal code was
removed from the travis config, but the cache wasn't removed. Adding the
python 3.8 job causes a failure because travis has no cached timing data
but still creates the empty directory which triggers
mtreinish/stestr#266. This adds back the empty cache removal to
workaround it so we can use the timing data for scheduling in future
runs.
* Add azure-pipelines python 3.8 jobs too
* Fix python 3.8 dictionary keys changed error
Starting in python 3.8 a new RuntimeError is raised, RuntimeError:
dictionary keys changed during iteration. This is caused by modifying an
iterator while looping over it. We were doing that in the
optimize_swap_before_measure pass. This commit fixes this by wrapping
the iterator in list() to make a copy of it for looping. This way we
don't modify the contents of what we're iterating over in the pass.
* Revert "Add azure-pipelines python 3.8 jobs too"
The missing matplotlib wheels are blockers for windows and osx
environment. Since we do not have the necessary dependencies installed
in those ci envs to compile matplotlib from source. We'll rely on just
travis for 3.8 testing until the matplotlib 3.2.0 release is pushed so
we don't have to compile it.
This reverts commit 40157621b1.
* Add skip for failing matplotlib test
The image comparison tests which are quite flaky are failing with
matplotlib compiled on 3.8. Looking at the image output from these
failures are very subtle (looks like resolution differences) again
questioning the value of these tests. This commit just skips the test
that is failing here to unblock the PR.
* Add azure 3.8 test jobs
* Pin to pre-release mpl for python 3.8
* Add spawn guard for python3.8 osx in examples
When running examples with execute, transpile, or any other calls using
parallel_map() the new default for spawn instead of fork requires that
scripts have a __name__ == "__main__" check in them to function
properly. If not calls to parallel_map fail errors around the
bootstrapping phase. To avoid this in the ci jobs this commit adds the
necessary checks to the example scripts we run in ci as part of
test_examples.
* Remove cryptography pin from constraints file
We pinned the cryptography package version back during the cryptography
2.6 release which broke our ci. It was a temporary step to avoid a
packaging issue in CI that was blocking development. However, when the
issue was resolved we never circled back to fix the issue. Now trying to
enable python 3.8 support to terra cryptography >=2.8 is needed for
python 3.8 on windows (to get a precompiled binary). This commit removes
the unecessary pin to unblock windows 3.8 ci.
* Bump cibuildwheel version to build 3.8 wheels
cibuildwheel 1.0.0 was released in early November [1] and added support
for building python 3.8 wheels. This commit bumps the cibuildwheel
version we use in the wheel build jobs at release time to also build 3.8
wheels for upload to pypi.
* Add skip and release note about macos py38 issues
This commit adds a skip for the failing python 3.8 test on osx and
windows so that we don't block everything over a small issue in the
tests. It also add a release note documenting the limitation with python
3.8 on macos with regardess to parallel_map/multiprocessing. Since this
limitation is new for this release (being the first release with python
3.8 support) we should document it as a known issue in the release
notes, especially since it likely won't be resolved until a python 3.8.1
release.
* Revert "Add spawn guard for python3.8 osx in examples"
While we can fix the tests to work on osx python3.8 by adjusting the
example scripts to only call functions using parallel_map from inside a
block run via if __name__ == '__main__': this unecessarily changes the
scripts for the quirks of a single environment. This commit reverts the
example scripts back to their original form and instead just skips the
unittest that executes them on python 3.8 macOS. We already have
documented this limitation in the release notes. When/if we have an
alternative solution for how we launch additional processes in python
3.8 on macOS that does not require this workaround we can look at
removing the skip.
This reverts commit 76ae197631.
* Apply suggestions from code review
Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>
* Prepare for 0.11.0 release
This commit moves the release notes into a 0.11.0 subdirectory to keep
them separate from development notes post-release. It also adds a
release note to add the prelude section providing the high level
overview of the release. When this merges it should be the commit used
to tag the 0.11.0 release.
* Add more details to prelude about pulse schedule
This commit adds some additional explanation about the pulse scheduler
to the prelude section for 0.11.0.
Co-authored-by: Thomas Alexander <talexander@ibm.com>
* Move new release notes
* Drop python 3.8 and 3.5 from prelude
* Improve existing release notes
This commit goes through all the existing release note files and cleans
up both the content, formatting, and rst/sphinx syntax.
* Move more new release notes
* Add releasenote for no framechange schedule draw
* Move new release notes
* Adjust formatting and content of new releasenotes
* Move last releasenote
* Update releasenotes/notes/0.11/0.11.0-release-95f15c71d993bfcd.yaml
Co-Authored-By: Kevin Krsulich <kevin@krsulich.net>
* Update 0.11.0-release-95f15c71d993bfcd.yaml
* Add helpful methods to defaults. methods previously existed in cmddef. still TODO: replace_pulse and TESTS
Add tests and bonus backend.version() to match backend.name()
Implement replace_pulse. Add more tests. Fixup style.
Add back build_cmd_defaults with deprecation warning. Make qubit/meas_freq_est a list attribute again, and handle related dependencies in assemble.
The example json was incorrect: the acquire commands did not have all the values required to be valid
Ops order isn't meaningful, test same keys instead
Add type hints to file
Fix#2955: improved error messaging for CmdDef
Update __str__ method, fix style
Move replace pulse feature to different branch. Also move base backend work.
Add release notes
Fix bug in assembler due to inconsistent units
Change inputs to assembler tests
Fixup issues in frequency units in assemble and assemble tests. They are still in GHz
Suppress warnings during assemble
Use module name to resolve name conflict between qiskit.validation.fields.List and typing.List
Rename op_qubits to qubits_with_op. Move _to_tuple out of util. Remove unnecessary attributes.
Respond to CR by Naoki
remove deprecation warnings
Remove filterwarnings and fixup repr
* Separate InstructionScheduleMap, give it such a name, give it the ops_def attribute for access. repr->str.
* Fixup rebase error
* Fix tests, fix style
* Improve class initialization. Fix bug where qubit ops wasn't being updated
* Remove outdated raises documentation and unused import
* Remove warning on redefinition
* Fix up removing operations or qubits, raise error if qubits or op are not found, fill in str test
* Rename op/operation to inst/instruction
* Move map to pulse
* Update release note, final style fix
* Add deprecation warning to the CmdDef.
* Added InstructionScheduleMap tests.
* modify instruction schedule to no longer be mutable objects used by internal representation.
* Revert cmd_def changes.
* instruction scheduler map linting.
* Final tests fixup
* rename duplicate test name
* Remove copy, simplify qubit_insts
* rename qubit_insts to qubit_instructions
* rename qubits_with_inst to qubits_with_instruction
* Update qiskit/pulse/instruction_schedule_map.py
* Update qiskit/pulse/instruction_schedule_map.py
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* linting.
* more linting.
* Add to_dict schema validation tests for assembler.
* Fixed bug where enums repr was being stored in to_dict.
* linting.
* Add helpful methods to defaults. methods previously existed in cmddef. still TODO: replace_pulse and TESTS
Add tests and bonus backend.version() to match backend.name()
Implement replace_pulse. Add more tests. Fixup style.
Add back build_cmd_defaults with deprecation warning. Make qubit/meas_freq_est a list attribute again, and handle related dependencies in assemble.
The example json was incorrect: the acquire commands did not have all the values required to be valid
Ops order isn't meaningful, test same keys instead
Add type hints to file
Fix#2955: improved error messaging for CmdDef
Update __str__ method, fix style
Move replace pulse feature to different branch. Also move base backend work.
Add release notes
Fix bug in assembler due to inconsistent units
Change inputs to assembler tests
Fixup issues in frequency units in assemble and assemble tests. They are still in GHz
Suppress warnings during assemble
Use module name to resolve name conflict between qiskit.validation.fields.List and typing.List
Rename op_qubits to qubits_with_op. Move _to_tuple out of util. Remove unnecessary attributes.
Respond to CR by Naoki
remove deprecation warnings
Remove filterwarnings and fixup repr
* Separate InstructionScheduleMap, give it such a name, give it the ops_def attribute for access. repr->str.
* Fixup rebase error
* Fix tests, fix style
* Improve class initialization. Fix bug where qubit ops wasn't being updated
* Remove outdated raises documentation and unused import
* Remove warning on redefinition
* Fix up removing operations or qubits, raise error if qubits or op are not found, fill in str test
* Rename op/operation to inst/instruction
* Move map to pulse
* Update release note, final style fix
* Add deprecation warning to the CmdDef.
* Added InstructionScheduleMap tests.
* modify instruction schedule to no longer be mutable objects used by internal representation.
* Revert cmd_def changes.
* instruction scheduler map linting.
* Final tests fixup
* rename duplicate test name
* Remove copy, simplify qubit_insts
* rename qubit_insts to qubit_instructions
* rename qubits_with_inst to qubits_with_instruction
* Update qiskit/pulse/instruction_schedule_map.py
* Update qiskit/pulse/instruction_schedule_map.py
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* linting.
* more linting.
* Switched cmd_def scheduluer tests to instruction_map and added cmd_def tests to eventually deprecated.
* Renamed InstructionScheduleMap to be InstructionScheduleMapping to be more pythonic and grammatically correct.
* name InstructionScheduleMapping to InstructionScheduleMap and defaults.instruction_schedulues to defaults.circuit_instruction_map
* fix scheduluer test.
* linting fix.
* Deprecate CmdDef in favor of PulseDefaults and migrate tests elsewhere to use defaults
* Update renamed attribute
In recent revisions to PulseDefaults the instruction_schedules attribute
has been renamed circuit_instruction_map. This commit updates outdated
references to the old revision.
* Update deprecation warning too
* Add release note
Fixes:
Fixes#2955 (improved error message for CmdDef.get)
Fixes#2861 (improved repr and str for CmdDef)
Changes:
qubit_freq_est and meas_freq_est now return frequency in Hz. (no warnings)
Replacing CmdDef
CmdDef will be deprecated following this PR. All existing methods are supported by
InstructionScheduleMap (via defaults().ops_def rather than .from_defaults()) with the
following exceptions:
- __init__ should be blank unless provided by the PulseDefaults object being initialized
- add should be used instead of init args by the user
- cmds and cmd_qubits are included with a deprecation message to use ops and
qubits_with_op instead.
New (not in CmdDef):
- qubit_ops(qubits): Return the operations that are defined for the qubit(s)
- assert_has(operation, qubits): Raise a PulseError if the op isn't defined
- remove(operation, qubits)
* Add helpful methods to defaults. methods previously existed in cmddef. still TODO: replace_pulse and TESTS
Add tests and bonus backend.version() to match backend.name()
Implement replace_pulse. Add more tests. Fixup style.
Add back build_cmd_defaults with deprecation warning. Make qubit/meas_freq_est a list attribute again, and handle related dependencies in assemble.
The example json was incorrect: the acquire commands did not have all the values required to be valid
Ops order isn't meaningful, test same keys instead
Add type hints to file
Fix#2955: improved error messaging for CmdDef
Update __str__ method, fix style
Move replace pulse feature to different branch. Also move base backend work.
Add release notes
Fix bug in assembler due to inconsistent units
Change inputs to assembler tests
Fixup issues in frequency units in assemble and assemble tests. They are still in GHz
Suppress warnings during assemble
Use module name to resolve name conflict between qiskit.validation.fields.List and typing.List
Rename op_qubits to qubits_with_op. Move _to_tuple out of util. Remove unnecessary attributes.
Respond to CR by Naoki
remove deprecation warnings
Remove filterwarnings and fixup repr
* Separate InstructionScheduleMap, give it such a name, give it the ops_def attribute for access. repr->str.
* Fixup rebase error
* Fix tests, fix style
* Improve class initialization. Fix bug where qubit ops wasn't being updated
* Remove outdated raises documentation and unused import
* Remove warning on redefinition
* Fix up removing operations or qubits, raise error if qubits or op are not found, fill in str test
* Rename op/operation to inst/instruction
* Move map to pulse
* Update release note, final style fix
* Add deprecation warning to the CmdDef.
* Added InstructionScheduleMap tests.
* modify instruction schedule to no longer be mutable objects used by internal representation.
* Revert cmd_def changes.
* instruction scheduler map linting.
* Final tests fixup
* rename duplicate test name
* Remove copy, simplify qubit_insts
* rename qubit_insts to qubit_instructions
* rename qubits_with_inst to qubits_with_instruction
* Update qiskit/pulse/instruction_schedule_map.py
* Update qiskit/pulse/instruction_schedule_map.py
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* linting.
* more linting.
* Add to_dict schema validation tests for assembler.
* Fixed bug where enums repr was being stored in to_dict.
* linting.
* Add helpful methods to defaults. methods previously existed in cmddef. still TODO: replace_pulse and TESTS
Add tests and bonus backend.version() to match backend.name()
Implement replace_pulse. Add more tests. Fixup style.
Add back build_cmd_defaults with deprecation warning. Make qubit/meas_freq_est a list attribute again, and handle related dependencies in assemble.
The example json was incorrect: the acquire commands did not have all the values required to be valid
Ops order isn't meaningful, test same keys instead
Add type hints to file
Fix#2955: improved error messaging for CmdDef
Update __str__ method, fix style
Move replace pulse feature to different branch. Also move base backend work.
Add release notes
Fix bug in assembler due to inconsistent units
Change inputs to assembler tests
Fixup issues in frequency units in assemble and assemble tests. They are still in GHz
Suppress warnings during assemble
Use module name to resolve name conflict between qiskit.validation.fields.List and typing.List
Rename op_qubits to qubits_with_op. Move _to_tuple out of util. Remove unnecessary attributes.
Respond to CR by Naoki
remove deprecation warnings
Remove filterwarnings and fixup repr
* Separate InstructionScheduleMap, give it such a name, give it the ops_def attribute for access. repr->str.
* Fixup rebase error
* Fix tests, fix style
* Improve class initialization. Fix bug where qubit ops wasn't being updated
* Remove outdated raises documentation and unused import
* Remove warning on redefinition
* Fix up removing operations or qubits, raise error if qubits or op are not found, fill in str test
* Rename op/operation to inst/instruction
* Move map to pulse
* Update release note, final style fix
* Add deprecation warning to the CmdDef.
* Added InstructionScheduleMap tests.
* modify instruction schedule to no longer be mutable objects used by internal representation.
* Revert cmd_def changes.
* instruction scheduler map linting.
* Final tests fixup
* rename duplicate test name
* Remove copy, simplify qubit_insts
* rename qubit_insts to qubit_instructions
* rename qubits_with_inst to qubits_with_instruction
* Update qiskit/pulse/instruction_schedule_map.py
* Update qiskit/pulse/instruction_schedule_map.py
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* Update releasenotes/notes/extend-backend-defaults-4370f983d599a26b.yaml
* linting.
* more linting.
* Switched cmd_def scheduluer tests to instruction_map and added cmd_def tests to eventually deprecated.
* Renamed InstructionScheduleMap to be InstructionScheduleMapping to be more pythonic and grammatically correct.
* name InstructionScheduleMapping to InstructionScheduleMap and defaults.instruction_schedulues to defaults.circuit_instruction_map
* fix scheduluer test.
* linting fix.
* address 3251 by checking backend memory property when memory kwarg passed to execute()
* better python
* fixed circular import
* moved memory check to assemble.py per review by kdk
* change requested in review: fetch backend_name from config
* Test for global scoping of numpy seed in random_unitary
* Test for global scoping of numpy seed in random_density_matrix
* Fix numpy seed effects in random_unitary
* Fix numpy seed effects in __ginibre_matrix
* Fix numpy seed effects in pauli operators
* Release notes, patch issue #2850
* Linting
* Update releasenotes/notes/fix-numpy.random.seed-after-effects-74630974e79b1b7f.yaml
Co-Authored-By: SooluThomas <soolu.elto@gmail.com>
* Update releasenotes/notes/fix-numpy.random.seed-after-effects-74630974e79b1b7f.yaml
Co-Authored-By: SooluThomas <soolu.elto@gmail.com>
* added release notes for controlled gate class (#2862).
Also remove some unused imports in test_controlled_gate.py.
* remove pylint disable
* remove one more unused import
* change q_if to control
in expectation of pr #3455
* update release notes
include imports in release notes.
* Fix for #3422 ... deal with None as return from job.queue_postition()
* release note for queue_position issue
* Update releasenotes/notes/job_queue_position_None-da3e6c2a203bc795.yaml
accept amendment by reviewer.
Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>
* handle queue status of None for jupyter
* Deprate PulseChannelSpec, deprecate Qubit, remove system topology (which was a helper for pulsechannelspec) and migrate tests to use backend.configuration instead
* Continue testt migration from more recent code
Add release notes about PulseChannelSpec deprecation.
Update AcquireInstruction to no longer support Qubit input type (rarely used).
* Fixup bug in test schedule
* added Instruction.is_parameterized()
* Applied new method Instruction.is_parameterized() in obvious places.
Added test case for Instruction.is_parameterized().
* release note for Instruction.is_parameterized
* Cleaned up for linter.
Added typographical style to release note.
* Added bound parameter test to test_is_parameterized()
* Added detail to release note.
* Updated the cases in Collect2qBlocks and CommutationAnalysis
* changed test to bind parameter to instruction in approved fashion
* corrected test
* Add useful methods to PulseBackendConfiguration. This will remove the need for the redundant PulseChannelsSpec class in pulse.
* Add release notes
* Style: Remove unused import
* Remove old test
* Fix issue in test: plot gate map only works with > 5 qubits
* Respond to feedback: Valid + realistic hamiltonian in mocked configuration, releasenotes augmented to alert users of dt/dtm change, hamiltonian methods on config return whole hamiltonian + tests updated to match, and dt/dtm are put it proper units during init rather than access
* Style
* implemented functions to enable slicing and concatenation of PassManagers
* fixed errors, added release notes, added unittests
* resolving conflict
* adapter implementation to new PassManager
* fixes a bug caused by shallow copy
* test name capitalization
* Add dual of mpl mathtext syntax for latex drawer labels
This commit adds a new feature to the latex drawer that adds support for
a similar syntax to matplotlib's mathtext to labels on the latex drawer.
In matplotlib if you specify a string between two dollar signs (for
example $\gamma$) that string will be parsed with mpl's native TeX
expression parser and that will be used to layout and render the string
per the TeX syntax. This uses the same syntax as mathtext, and enables
users to write raw latex syntax as gate labels between a pair of dollar
signs. All characters outside of the dollar signs are treated as utf8
and get encoded by pylatexenc to create valid latex, however all text
inside the dollar signs get passed verbatim to the output latex. This
enables users to mix and match having their unicode encoded for them and
manually passing latex
Fixes#3171
* Fix lint
* Use jupyter-execute instead of describing diagram
* Revert "Use jupyter-execute instead of describing diagram"
This reverts commit ab7bc18c39. Running
the code example in jupyter-execute will require a latex distribution
with qcircuit to be installed. That adds a lot of run time to the doc
build and a non-obvious dependency. To avoid this, we'll just rely on
the code example and a description of the output.
* Add alias for cnot function to cx()
We often call the cx gate a cnot. Especially when giving presentations
or intros to quantum information you have to explain that cx == cnot. To
make this a bit simpler this commit adds a alias to the
QuantumCircuit.cx() function QuantumCircuit.cnot(). This way when doing
code examples we can just say run "cnot".
* Add aliases for other common gate names
Just as with cx and cnot there are other common names used for several
other quantum gates that are often used interchangeably. These alias are
also added:
ccx -> toffoli
cswap -> fredkin
s -> p
sdg -> pdg
* Deprecate qx_color_scheme()
In qiskit.visualization.circuit_drawer there is a qx_color_scheme
function which was used to generate a style dict for the mpl drawer that
has a color scheme which matches the old ibm quantum experience.
However, this color scheme is no longer used by the quantum experience
and this function is not used internally anywhere. This commit
deprecates this function. Post removal if anyone was using this they can
just hardcode the dict returned by the function in their code and use
that as the style dict for mpl visualizations.
* Update circuit_visualization.py
* Remove sympy from everywhere
This commit removes all the sympy usage from qiskit-terra. Sympy is very
slow, not just to perform computations, but also to just import (being
the second slowest import in terra, only behind qiskit.version which
calls git and pip in a subprocess) and doesn't actually provide us any
real advantages inside terra. None of the expressions or calculations
terra is doing need to be done symbolically, and using sympy as just an
output formatter (to get pretty output for things like pi) is overkill.
* Fix lint
* Fixes from running openqasm conformance tests
* Import sympy lazily for circuit Parameters.
* Add back sympy to requirements
While sympy has been removed from most places in the repo as of this
point, it is still used internally in the Parameter and
ParameterExpansion classes. The imports there have been made runtime to
remove the import performance impact and they are self contained in
those classes as of this commit. We can remove sympy from the
requirements in the future when we come up with way to replace the
parameter classes' use of sympy we can remove it from the requirements
lists.
* Make type warning a deprecation warning
* Fix rebase issue (and unnecessary runtime import)
* Update instruction parameter type handling
This commit updates some issues found during code review with the
parameter handling. Now instead of casting string parameters as a float
incorrectly, this uses them to create a new symbolic parameter. Also for
numpy number types that are not caught by the earlier type checks item()
is called as was the previous behavior.
* Revert switch from Node.sym->Node.num()
For ast Node parameter types that were passed as parameters for an
instruction the method call to get the value was incorrectly changed
to num() from sym(), which doesn't exist. This was a sloppy regex find
replace that did it by accident. This commit reverts that mistake and
restores the functionality.
* Deprecate not remove sympy.basic and sympy.matrix params
This commit adds back support, albeit it deprecated form, for passing in
instruction parameters as sympy.basic and sympy.matrix objects. It also
updates the release notes to reflect this change.
* Add deprecation for sympy.Expr instruction param too
* Update release notes
* Remove sympy types usage from unit tests
This commit removes the usage of sympy types from unit tests. There were
several cases of unit tests that were using sympy's pi or similar
constants for no particular reason. Since this usage is now deprecated
it is better to remove this. The only sympy usage that remains in the
tests now are for test cases that are explicitly testing behavior with
sympy. These will remain until the sympy support has been removed since
we need to verify that the deprecated feature still works as is until
removal.
* Update release of deprecation to 0.11.0
* Update changed error exception class
* lint
* Prepare for the 0.10.0 release
This commit moves the release notes into a 0.10.0 subdirectory to keep
them separate from development notes post-release. It also adds a
release note to add the prelude section providing the high level
overview of the release. When this merge it should be the commit used to
tag the 0.10.0 release.
* Actually set twine password for upload
* Move new release notes to 0.10 dir
* Tweak prelude wording
* Rename basis to basis_gates for consistency in MSBasisDecomposer.
* Remove target basis limitation for MSBasisDecomposer.
* Clarify MSBasisDecomposer unrolling requirement.
* Add release note for ion trap support (#3214).
This commit updates some styling and wording issues in the release notes
for the 0.10.0 release so far. The most common issues is the use of
markdown style formatting instead of rst which is what reno uses.
This commit deprecates the option of passing in a circuit parameter of
a qasm.node.Node type. Passing in qasm ast nodes as a parameter is
rarely used and is not actually done anywhere in the qiskit-terra code
or tests. Additionally there is the qiskit ast_to_circuit converter
which will take a program node object (the root node of a qasm ast) and
convert that directly to a circuit object.
* Add ax kwarg to matplotlib visualization functions
This commit adds support for passing a matplotlib axes to visualization
functions. This enables integrating the qiskit visualizations into a
larger matplotlib visualization. When an ax kwarg is set that input will
be used for the output visualization and a new figure will not be
generated or returned.
Fixes#1950
* typo in release note
* Add ax kwarg to matplotlib visualization functions
This commit adds support for passing a matplotlib axes to visualization
functions. This enables integrating the qiskit visualizations into a
larger matplotlib visualization. When an ax kwarg is set that input will
be used for the output visualization and a new figure will not be
generated or returned.
Fixes#1950
* Fix lint and typos
* pylint: disable=invalid-name
* Fix lost lines from rebase
As part of rebasing and cleaning up the branch from several failed merge
attempts a few lines from plot_state_city() were lost. This commit fixes
that mistake and restores the z axis labels which were missing from the
imaginary component subplot.
* Fix rebase typo
* Revert "pylint: disable=invalid-name"
This reverts commit 5566611719.
* Add measure_all, measure_active, remove_final_measurement methods
* Add testing for measure_all, measure_active, remove_final_measurements
* Rename remove_final_measurements to remove_final_measures
* Rename test_remove_final_measurements to test_remove_final_measures
* Fix incorrect method call in test_remove_final_measures
* Fix remove_final_measures to only delete ClassicalRegister if it is unused. Fix measure_active to only check for non-idle qubits instead of non-idle qubits and clbits
* Add test_remove_final_measures_multiple_measures
* Remove 'gates' from docstrings when referring to measurements
* Rename remove_final_measures to remove_final_measurements
* Rework remove_final_measurements to use RemoveFinalMeasurements pass
* Add RemoveFinalMeasurements pass
* Add remove_final_measurements module
* Rework test_remove_final_measurements_multiple_measures to work with new circuit.remove_final_measurements
* Add pylint disable-cyclic-import to remove_final_measurements
* tests
* fix test
* test to avoid name conflict
* avoid code repetition
* Add QuantumCircuit methods to add and remove final measurements
* Add newline at end of file
* Change inst.control to inst.condition
Fixes#2802
qiskit/visualization/utils.py _get_layered_instructions() was erroneous and did not justify left nor right correctly. I have reworked that code which underlies many visual representations of circuits to the user.
* refactored, needs more work on right justification
* Looks like this works for qiskit-terra issue #2802
* May fix first test failure for this pull request, while causing another?
* Draws conditionals on ClassicalRegister correctly now.
* - Occurs check for gate in gates leads to good test results.
- Added a few more self.maxDiff = None while debugging. Should they be pulled out?
* tabs and trailing spaces ;)
* removed the maxDiff's because they make the Style and lint test in Python 3.5 fail
* added tests
modified changelog
* Test case extended to include original issue reported in #2802
* oops, left a maxDiff=None in from testing. Fixed
* changes to utils.py requested by reviewer maddy-tod
* test cases split as requested by reviewer maddy-tod
* added circuit diagrams in comments to new tests
* removed note from changelog and made it a release note per @mtreinish
* made _LayerSpooler a private class
* Revert "Remove changelog and document automated creation (#3109)"
This reverts commit effad1228e.
* Make _LayerSpooler a subclass of list
The _LayerSpooler class was only ever used as list. While the class was
an independent type it basically just wrapped an internal list. THen
there were helper functions to access and manipulate that list. These
methods just duplicated what python already provides and the list class
itself already implements. This commit fixes this so the _LayerSpooler
itself is a subclass of list so when it's initialized you can just treat
it as the output list it was generating.
* Clean up release note, fix only, not prelude
* un reverted my revert of CONTRIBUTING.md
* refactored, needs more work on right justification
* Looks like this works for qiskit-terra issue #2802
* May fix first test failure for this pull request, while causing another?
* Draws conditionals on ClassicalRegister correctly now.
* - Occurs check for gate in gates leads to good test results.
- Added a few more self.maxDiff = None while debugging. Should they be pulled out?
* tabs and trailing spaces ;)
* removed the maxDiff's because they make the Style and lint test in Python 3.5 fail
* added tests
modified changelog
* Test case extended to include original issue reported in #2802
* oops, left a maxDiff=None in from testing. Fixed
* changes to utils.py requested by reviewer maddy-tod
* test cases split as requested by reviewer maddy-tod
* added circuit diagrams in comments to new tests
* removed note from changelog and made it a release note per @mtreinish
* made _LayerSpooler a private class
* Make _LayerSpooler a subclass of list
The _LayerSpooler class was only ever used as list. While the class was
an independent type it basically just wrapped an internal list. THen
there were helper functions to access and manipulate that list. These
methods just duplicated what python already provides and the list class
itself already implements. This commit fixes this so the _LayerSpooler
itself is a subclass of list so when it's initialized you can just treat
it as the output list it was generating.
* Clean up release note, fix only, not prelude
* put back missing section