As part of the large refactor adding column justification to the latex
drawer in #1977 the function used to determine the image depth was
greatly simplified since most of the work was offset to the dag
processing prior to the latex drawer. However, one piece of critical
code was removed inadvertently which was used for determining the row
spacing. This section looked at every operation and determined if we
should increase or decrease the row spacing depending on what time of
operations were being drawn. The result of this check end up directly
setting a value in the output latex call to \Qcircuit. Without this code
the calculations which are done to determine the output page size are
off by the spacing factor and result in the output circuit exceeding the
single page size. This causes a blank image to be output since the first
is blank and that leads pdf to png conversion to return a blank image.
This commit fixes this by adding back the previously removed row spacing
check before we determine the image depth. This way we properly set the
output row spacing in the latex and avoid page wraps.
Fixes#2155
Now that terra and other qiskit elements have been released we can
tweak how we install packages in CI for running tests. This commit
updates things so we install terra from source, no longer pin the
ibmq-provider, and removes aer (since there are no tests using it
anymore).
Now that qiskit-terra 0.8.0 is out the door we should bump the version
string on master to show the source verrsion we're installing is newer
than what's been released.
This commit updates the changelog on master to include the intermediate
0.7.x stable releases and also marks the 0.8 release. This should be the
last commit on master prior to the the 0.8 release.
* allow commutation analysis pass to skip over non gates
* rename to CheckCXDirection
* cx direction uses u2 instead of h
* add new preset pass managers
* do not require transformation passes
* reduced_coupling_map
* style
* new headers
* make reduce a CouplingMap method
* get rid of 'backend'
* fix test for python version dependent ordering
* fix idx
* add assembler for schedule (@itoko, @nkanazawa1989)
* update tests
* ensure value is complex
* convert list to tuple before taking lo_range from backend
* add execute assembler to init
* lint
* switch back to original spec about #schedule:#user_lo_dicts
* Add ops module. Begin breaking up schedule operations.
* Add lshift and rshift to schedule.
* Initialize Schedule from Schedules. TimeslotCollection now accepts *slots rather than slots.
* remove default pulse lib from qobj config
* lint
* fix bug when pulse_library is not defined
* Update assembler.py
docstring fix
* Update assembler.py
docstring update.
* Fix docstrings.
* wip schedule draw support
* add pulse backend mock
* rename lo_frequency to lo_freq
* get freq_est from backend.defaults()
* update test
* remove conditioned_schedule
* remove conditioned_schedule
* fix bugs
* update assembler test
* lint
* restructure
* optimize import
* remove empty kernel and discriminator
* update test
* add lo_range check __eq__
* update UserLoDict to check channel type
* remove _replaced_with_user_los
* move converter under qobj
* update test
* add lo converter
* add lo converter
* update docstring
* Change LoDict to LoConfig.
* removed lo_converter as argument and hardcoded instead. This should reduce the complexity of the interface for now. We can always readd.
* Assembler now accepts lo_config as a dictionary (which is then converted to an LoConfig).
* Remove unnecessary return placeholders and commented print statements from tests.
* Renamed LoDictConverter to LoConfigConverter.
* linting
* import linting
* Update LO kwarg documentation
* Remove continuation statements by wrapping with parenthesis.
* Remove lo range and lofreq from output channel identity check.
* Remove dependence of channel hash on frequency.
* Remove lo freq from channel hash.
* Fix test assembler docstrings.
* Remove unnecessary placeholder assignment.
* Restructured assemble_schedules to remove run_config and pass arguments as kwargs.
* renamed lo_configs to schedule_los.
* Change meas_lo_dict to actually return dict.
* Fix test.
* linting.
* Updated changelog.
* remove unnecessary hash.
* wip update channel manager
* Removed __eq__ from output channel.
* update schedule drawer
* wip update drawer
* Add to changelog to force test rerun.
* update drawer
* fix plot range bug
* fix plot range bug
* Remove unneeded raises in docstring.
* remove extra schedule los docstring.
* Fix overrwritten scedule config.
* Add memory/meas_level error messages and handling to schedules.
* Update qobj header docstring.
* Added qobjheader support for dict argument.
* Updated schedule execute and assemble signatures to match. Updated case of meas_level 2 and meas_return, warnings.
* Moved schedule.pulse_schedule to schedule modeule.
* Began shifting to immutable Schedule. Update Timeslots to handle creation from list of timeslots. Can also return time over channels."
* Switched timeslot channels to property.
* reordered schedule methods to go after dunder methods.
* Add insertion method logic.
* Rename occupancies to timeslots. Renamed shifted to shift.
* Switched to ch_start/stop_time methods and start/stop_time properties. All timing is now derived from timeslots.
* update instruction starting times to be handled by timeslots.
* Unify ops between schedule and instruction.
* Update docstring.
* All pulse schedule/instruction/command methods now access attributes through proproperties in order to ensure immutability.
* Remove linebreaks in if statement
* Added schedule operation to ScheduleComponent interface.
* Add schedule composition via timeslots.
* Move pulse.common modules up a level to pulse
* Update schedule flatten generators.
* rename flatten_generator to flatten
* Made schedule methods immutable. Required reworking many of the interfaces.
* More changes to interfaces and bug fixing. Still not passing.
* pulse tests passing.
* Add immutable tests.
* Schedule names are inherited from leftmost child. Fix Instruction naming.
* Fix 0 in timeslots duration.
* Fix 0 in timeslots duration.
* Readd union to schedulecomponent.
* Update tests for latest code.
* Linting.
* Update changelog.
* Fix test formatting.
* Rework pulse instruction converter to no longer use introspection.
* Test fix
* linting.
* disable cyclic import.
* Remove rshift from schedulecomponent.
* Add type hint to pulse schedule.
* Add type hint to sample pulse.
* Switch to style docstring due to cyclic imports.
* Fix channels for pulses.
* Remove individual channel from instructions implementations.
* Update visualization for start times.
* Schedules are now composed of child nodes that track time of children.
* rework instructions.
* Delete extra interface methods.
* Fix typo.
* Added pulse visualization test case.
* added snapshot to visualization
* Remove unused device specification.
* Add visualization to instruction.
* Add plotting to instruction.
* Add instruction plotting test.
* Readd methods to interfaces.
* Add legend.
* Refactor schedule visualization.
* Add acquires to schedule.
* Refactor interpolation module.
* Added reference images and skip image tests again.
* linting.
* fix styling bug.
* Added ability to toggle legend and table.
* Restructure pulse module.
* linting.
* Fix styling defaults.
* Add labels to visualization.
* Add labelling to pulse plots.
* linting
* pulse boundaries are now visualized with lines.
* Update plots
* linting.
* update snapshot location.
* Fix plotting after merge.
* Remove output visualization option.
* Make use of figstyle consistent
* Update pulse scaling and linting.
* Update copyrights
* fix lint
* add space
* I hate the linter
* fix whitespace
* Fix init
* Fix tests.:
* And error check for channel.
* Add type dict.
* Handle edge case in text drawer line length logic
There is an edge case in the initial line length logic for the text
drawer. When it's trying to figure out how long a line should be it
initially tries various methods to determine the length. But, it only
checks for a None response from those initial checks. It's possible a 0
could be returned. Later we check if the value of the line_length is
true, which it won't be for a 0 value. In that case we unconditionally
use the class variable line_length which if not initialized is None. In
this case we'll hit an error further down trying to compare None to an
int. This commit fixes this by checking the value of self.line_length
before using it and defaulting to the value of get_terminal_size() if
it's not true.
* Simplify line length logic
* Use pylatexenc utf8tolatex for gate names in latex drawer
When the latex drawer goes to draw custom gates they can be named and
valid unicode string. That's because the gate name attribute is a
string. However, latex doesn't know how to handle all utf8 characters
and requires escaping or custom libraries to render many of them.
Instead of trying to handle every edge case this commit uses the
pylatexenc lib (which is a MIT licensed lib with no additional
dependencies) which contains a mapping of all the unicode characters
with the latex equivalent. This means that things like '_' in custom
gate names will render properly now.
Partially Addresses #2235
* Fix lint
* Add example for stochastic swap and use to verify wheels
This commit adds a new example to the examples directory for running the
stochastic swap pass. This is then used by the wheel build automation
to verify the built wheel works as expected. The compiled code (and
complexity in the wheel build) is for the stochastic swap pass so
verifying it functions when installed from the built wheel is important.
* Test wheel build with new script
Comment out branch logic and wheel upload to verify the wheel build this
is just for testing and will be reverted before the PR merges.
* Remove prints from example
* Revert "Test wheel build with new script"
This reverts commit f5edc1c777.
* Change two_qubit_kak to use approximate method. Passes current tests
* Move files around and rename two_qubit_kak to cnot_decompose
* Better testing for euler_angles_1q()
* Better testing for euler_angles_1q()
* Better precision for euler_angles_1q
* Better precision for euler_angles_1q
* Better testing for TwoQubitWeylDecomposition
* Testing improvements for quantum_info.synthesis module
* Changelog
* appease the linter. again
* Remove f-strings for python 3.5 compatibility. Change cnot_decompose() to two_qubit_cnot_decompose()
* Handle opaque instructions and identity in qobj_to_circuits
This commit fixes the qobj_to_circuits converter to handle opaque/custom
instructions that aren't decomposed in the qobj. At the same time the
identity gate handling is fixed because it is a special case where the
gate name doesn't match the function name (id vs iden()) and needs to be
handled that way.
* Add test
* Fix lint
* Fix lint and test imports
* Just use getattr for params
* Override getattr for qiskit._util
The backwards compat shim qiskit._util previously emitted a deprecation
in the raw module. This was done for simplicity and so that it would
only be emitted during import. However, since it's in the base namespace
it would be imported every time qiskit was imported, which led to a
deprecation warning always being emitted. To work around this issue,
this commit defines a custom __getattr__ for the module which will emit
the deprecation warning and call qiskit.util. This should limit the
deprecation warnings to just when qiskit._util is accessed.
Fixes#2252
* Remove warning from qiskit._util and rely on a comment
Since the warning was too noisy and gets emitted on every qiskit import
this commit just removes it. The _util module is still deprecated, and
listed as such in the module and in the changelog (and the future
release notes). But, since it was marked as private previously weighing
the noise of advertising the deprecation with a warning against the
potential of an external user using it removing the warning seems the
better option.
* Add changelog
As part of some peoples desire to remove underscores from module names
the qiskit._util module was renamed to qiskit.util. However external
utilities, namely Aer, were using the public function in this module. To
ensure a smooth transition when we release 0.8 this commit adds a compat
shim qiskit._util module that just provides everything from qiskit.util.
But it raises a deprecation warning when imported that it has been
renamed and qiskit._util will be removed for 0.9.
Related to #2074
* Add user config file for local settings
This commit adds the concept of a user config file to set local defaults
when using qiskit-terra. This enables the end user to override the
default values for some commonly used terra functions in their local
environment. Right now this only includes the backend used by the
circuit drawer, but it will be expanded in the future as more settings
with opinionated defaults are exposed. To set a config file you can
either create one in the default location
'~/.config/qiskit/settings.conf' or use the QISKIT_SETTINGS environment
variable to specify an alternative location.
* Updates
* Fix lint issues
* Fix tests on windows
* Fix lint
* Try to fix tests on python <3.7
* More testing updates
* Fix lint
* Skip tempfile tests on windows
Since I can't figure out a reliable way to mock open on python 3.5 and
3.6 (it works fine on 3.7) this commit just skips the tests that used to
use tempfile and sets them to skip on windows environments, since they
don't work on appveyor.
* Remove unused import
These tests haven't run in a long time, they skip (not silently but
among all the test results no one notices) They also don't work
currently even if we fix the original breakage. If we're not
cross-testing terra master on aer and vice versa keep these tests in
terra don't provide value (although travis and appveyor limit how much
we can do there). We can revisit adding them back in the future if
needed.
* Move parameter binding from ParameterTable to QuantumCircuit.
* Add check that parameters are present in circuit before binding.
* Add __repr__ for Parameter.
* Add test for partial parameter binding.
* Add parameter_binds to RunConfig and execute kwargs.
* add Reset before initialize
* The reset in front of initializer should be removed when zero state
* run after unroller
* RemoveResetInZeroState in default_pass_manager
* test.python.circuit.test_initializer.TestInitialize.test_combiner
* unused-import
* - if 'reset' in basis_gates:
* adapting InitializeGate to the Instruction API
* lint
* rename InitializeGate-> Initialize
* no more TODO
* test_initialize_FakeMelbourne
* TODO