Commit Graph

2721 Commits

Author SHA1 Message Date
Matthew Treinish a83ba0ee74 Install twine in wheel build jobs (#2292)
* Install twine in wheel build jobs

The wheel build jobs failed to install twine so when the jobs completed
and went to upload the wheels this failed because the command wasn't
found. This commit fixes the issue by installing twine as part of the
wheel build job set ups so that we can actually upload our built
binaries.

* Pip install -U twine

* Bump cibuildwheel version
2019-05-14 13:23:42 -04:00
Matthew Treinish 48b6792f1a
Add pyproject.toml to declare cython build requirement (#2278)
Right now when you try to build terra >=0.8.0 and you don't have Cython
installed it will fail. This is because we rely on cython being present
to build the stochastic swap code. While we have a setuptools
setup_requires defining this dependency it doesn't work because the
dependency on cython is needed before setuptools can resolve that for
us. PEP518 provides a solution for this problem by adding the concept of
a pyproject.toml file which can be used to outline build requirements
which are build time depdencies needed before the setup.py is run. With
this file present when you run:

pip install git+https://github.com/Qiskit/qiskit-terra

(or running on a local checkout)
and cython isn't installed pip will acquire it and use it for building
the sdist.
2019-05-13 22:13:38 -04:00
Luciano c2fd373d1d preset passmanagers do not run CXDirection if coupling map is symmentric (#2316)
* is_symmetric by matrices

* more testing

* invalidate

* adding a shortcut when self.coupling_map.is_symmetric==True

* adding a shortcut when self.coupling_map.is_symmetric==True

* adding conditional to preset pass managers

* testing!

* lint and docstrings

* abs and 1e-10

* do not invalidate when add_physical_qubit
2019-05-13 14:32:14 -04:00
Diego M. Rodríguez 1ba5d54a05 Remote deprecated qiskit.qiskiterror module (#2399)
* Remote deprecated qiskit.qiskiterror module

* Update CHANGELOG
2019-05-13 11:54:35 -04:00
Diego M. Rodríguez 3b394f8f0b Revert pylint execution to non-parallel behaviour (#2403) 2019-05-13 10:04:50 -04:00
Matthew Treinish a559a22ed7 Add 'auto' mode to user config for circuit_drawer (#2331)
This commit adds a new valid field to the circuit_drawer field in the
user config file. If the value is set to auto the circuit drawer will
determine if matplotlib is installed and if it is will use mpl,
otherwise it'll just revert to using the text backend.
2019-05-12 07:54:19 -04:00
Diego M. Rodríguez 9e4462f109 Fix cycles in several modules (#2401)
* Move cyclic import disable to QuantumCircuit.draw()

* Solve cyclic imports in qiskit.transpiler

* Solve cycle import in lookahead_swap

* Temporarily reintroduce pulse/schedule disable

* Solve cycle in qiskit/qobj/converters
2019-05-11 21:36:22 -04:00
Luciano 2c1bca6470
fix (#2391) 2019-05-11 10:04:49 -04:00
Diego M. Rodríguez 9a15ed12d6 Address more pylint ignores (#2400)
* Remove unneeded pylint warnings

* Remove unused import
2019-05-11 07:58:21 -04:00
Lev Bishop ef04325d17 Remove useless pylint suppressions (#2365)
* Remove useless pylint suppressions

* some of them are necesary
2019-05-10 16:52:08 -04:00
Lev Bishop 315ba5465f Spelling fixes (#2392)
* Spelling fixes

* More spelling fixes

* Fix line-length lint fail due to typo fix

* A few more typos
2019-05-10 16:00:28 -04:00
Thomas Alexander d24bfd2734
Make assemble_schedule kwargs, args (#2351) 2019-05-10 14:00:20 -04:00
Thomas Alexander c9c6d46cae Update expression math sanitization (#2376)
* Add test for pulse issue.

* update test cmd_def strings

* Fix sanitize regex.

* linting.
2019-05-10 11:09:23 -04:00
Luciano 8aa1081515
ast_to_dag support for opaque gates (#2343)
* support for opaque gates

* custom gate

* cleaning up

* remove test_custom_gate

* lint

* lint!

* do not process standard lib
2019-05-10 08:04:25 -04:00
Luciano 43cbe08f71
Fixing spacing in text circuit drawer (#2381)
* test

* fix

* test adjustment

* test

* lint
2019-05-10 07:21:10 -04:00
Ali Javadi-Abhari b4af948109
remove qiskit.tools.logging (#2387) 2019-05-09 20:01:10 -04:00
Matthew Treinish 757ad8a4d3 Add missing optimization level to transpile() docstring (#2367)
This commit adds a docstring for optimization level 3 which was missing
from the docstring for the qiskit.compiler.transpile function.
2019-05-09 13:16:30 -04:00
Matthew Treinish bbb1c8f543 Add stable branch policy to CONTRIBUTING.rst (#2358)
* Add stable branch policy to CONTRIBUTING.rst

This commit documents are policy for the stable branch, how it's used
what we need to evaluate when looking at potential changes, and the
priorities for the stable branch.

Fixes #2352

* Add section about backporting subsets of large PRs

* Update .github/CONTRIBUTING.rst

Co-Authored-By: mtreinish <mtreinish@kortar.org>

* Small tweaks
2019-05-09 10:47:24 -04:00
Lev Bishop 7f0ad7ff30 Remove profile testing loader (#2368) 2019-05-09 10:45:40 +02:00
Diego M. Rodríguez 52fc5f0352
Remove redefined-builtin ignores (#2338)
* Remove redefined-builtin from test

* Remove redefined-builtin from qiskit

* Remove tools.compiler from redefining-builtins
2019-05-09 09:43:06 +02:00
Ali Javadi-Abhari da8fe35859
fix level 0 check (#2370) 2019-05-08 23:48:47 -04:00
Luciano 76e28ea821 Preset passmanager should honor seed_transpiler (#2361)
* fix BasicAer sampling bug (#1624) (#1859)

* fix BasicAer sampling bug (#1624)

* fix BasicAer sampling bug

* changelog

* remove legacysimulator from test_compile

Conflicts:
    CHANGELOG.rst
    test/python/tools/test_compiler.py

The changelog conflicts were inevitable as the stable branch doesn't
have the same history as master. As for the test conflict it was a
difference in the simulator (python vs c++) used, this backport
switches to use the python like on master.

(cherry picked from commit 5f7b2e7fc6)

* Try pinning isort version

* Use constraints from last working version of lint

* Add requirements constraints too

* Bump version and prepare for 0.7.1 release (#1886)

* Bump version and prepare for 0.7.1 release

To prepare for the 0.7.1 bugfix release we need to increase the version
number and update the changelog. This commit takes care of that so we
can tag the release and build it.

* Fix instruction inheritance issues (#1900)

* Addressed issue with instruction.py which prohibited inheritance of QuantumRegisters and ClassicalRegisters

* Updated changelog

* Fixed typo

* Revert "Fix instruction inheritance issues (#1900)" (#1906)

This reverts commit 36d5d5dfac.

* Relax schema validation on backendconfiguration (#2258)

* Relax schema validation on backendconfiguration

The schema validation for backendconfig was set too tightly and it was
rejecting valid responses from the backend API. This potentially causes
issues when running against the api. This commit addresses this by
changing the schema validation to ensure that we properly validate the
response received by the backends and no longer reject valid responses
moving forward.

* Add changelog

* Fix tests and lint

* Bump version and prepare for 0.7.2 release (#2269)

To prepare for the 0.7.2 bugfix release we need to increase the version
number and update the changelog. This commit takes care of that so we
can tag the release and build it.

* Fix typo in changelog (#2270)

This finishes a last minute typo in the changelog to link to the correct
version.

* Install twine in wheel build jobs (#2290)

The wheel build jobs failed to install twine so when the jobs completed
and went to upload the wheels this failed because the command wasn't
found. This commit fixes the issue by installing twine as part of the
wheel build job set ups so that we can actually upload our built
binaries.

* level 2 and 3 honors seed_transpiler

* clean

* clean up!
2019-05-08 21:29:22 -04:00
Luciano 4bfcc5d447 Transpiler add passes that might be out of the default basis (#2357)
* fix BasicAer sampling bug (#1624) (#1859)

* fix BasicAer sampling bug (#1624)

* fix BasicAer sampling bug

* changelog

* remove legacysimulator from test_compile

Conflicts:
    CHANGELOG.rst
    test/python/tools/test_compiler.py

The changelog conflicts were inevitable as the stable branch doesn't
have the same history as master. As for the test conflict it was a
difference in the simulator (python vs c++) used, this backport
switches to use the python like on master.

(cherry picked from commit 5f7b2e7fc6)

* Try pinning isort version

* Use constraints from last working version of lint

* Add requirements constraints too

* Bump version and prepare for 0.7.1 release (#1886)

* Bump version and prepare for 0.7.1 release

To prepare for the 0.7.1 bugfix release we need to increase the version
number and update the changelog. This commit takes care of that so we
can tag the release and build it.

* Fix instruction inheritance issues (#1900)

* Addressed issue with instruction.py which prohibited inheritance of QuantumRegisters and ClassicalRegisters

* Updated changelog

* Fixed typo

* Revert "Fix instruction inheritance issues (#1900)" (#1906)

This reverts commit 36d5d5dfac.

* Relax schema validation on backendconfiguration (#2258)

* Relax schema validation on backendconfiguration

The schema validation for backendconfig was set too tightly and it was
rejecting valid responses from the backend API. This potentially causes
issues when running against the api. This commit addresses this by
changing the schema validation to ensure that we properly validate the
response received by the backends and no longer reject valid responses
moving forward.

* Add changelog

* Fix tests and lint

* Bump version and prepare for 0.7.2 release (#2269)

To prepare for the 0.7.2 bugfix release we need to increase the version
number and update the changelog. This commit takes care of that so we
can tag the release and build it.

* Fix typo in changelog (#2270)

This finishes a last minute typo in the changelog to link to the correct
version.

* Install twine in wheel build jobs (#2290)

The wheel build jobs failed to install twine so when the jobs completed
and went to upload the wheels this failed because the command wasn't
found. This commit fixes the issue by installing twine as part of the
wheel build job set ups so that we can actually upload our built
binaries.

* fix

* check at the end

* undo order flip

* syntax

* DeprecationWarning message (#2350)

* clean up stable
2019-05-08 21:25:01 -04:00
Paul Nation 940d55fc6d
Make colored circuits the default for mpl drawer (#2344)
* colorblind palette

* fix imports

* fix styling

* allow for setting style in settings.conf

* lint

* fix tests
2019-05-08 15:26:33 -04:00
Matthew Treinish b2f112ca68
Cleanup setup.py (#2327)
The setup.py for terra has grown organically as we've added and removed
different functionality from the repo. This has led to some pieces in
there which were out of date, others which weren't actually used, or
some missing metadata. This commit goes through the code in the setup.py
and removes unused or things not needed anymore and updates some of the
metadata for when we push future releases to pypi.
2019-05-07 22:16:51 -04:00
Matthew Treinish 676cd44fcd
Remove the deprecated qiskit._util module (#2329)
The qiskit._util module was left in place as a backwards compat shim and
was intended to be removed in the 0.9 release. Now that 0.8 has been
released and development on 0.9 has opened on master we can remove this,
as this commit does.
2019-05-07 10:22:53 -04:00
Ali Javadi-Abhari ab2632b97a Remove `qiskit.mapper` directory (#2337)
* remove qiskit.mapper folder

* fix seed -> seed_transpiler
2019-05-07 09:07:20 -04:00
Matthew Treinish 571c9ae7fb Match appveyor requirements install to travis (#2332)
* Match appveyor requirements install to travis

In #2328 tests were added that required nxpd to be installed, but it was
merged before waiting for the results from appveyor. These new tests
don't pass appveyor because the requirements installed were different
from what were installed on travis. This commit fixes this so that we
install the same set of requirements on appveyor and travis jobs to
make sure when people take shortcuts in the future there are less
surprises.

* Add tempfile skip for newly enabled test

* Fix windows skip
2019-05-06 22:39:07 -04:00
Luciano d090eca91d
Better error message when Graphviz is not installed (#2328)
* catch and raise

* testing

* lint
2019-05-06 16:55:52 -04:00
Luciano eef0394ca2
Parameter expansion at QuantumCircuit.append level (#2282)
* append_

* expansion methods

* structure

* default is []

* measure

* barrier

* reset

* merge

* test.python.circuit.test_initializer

* test.python.circuit.test_initializer

* custom instruction

* check measure

* reset

* operator

* return an instruction set

* some #1668 cleaning

* argument_expansion for gates

* more #1668 cleaning

* test_measure_slice_raises

* empty argument

* the rest of #1668 cleaning

* len-as-condition

* len-as-condition

* test.python.circuit.test_registerless_circuit.TestGatesOnWires.test_circuit_qwire_out_of_range

* range and slice

* missing-final-newline

* barrier is sooo special

* docstring

* docstring

* docstring

* docstring

* remove prints

* no need for this change

* removing map

* QiskitError text

* spacing

* exception text

* exception text

* operation to instruction sonner

* cannot handle a list of integers

* best effort casting

* long line is not that long

* comments for helping

* Update qiskit/circuit/quantumcircuit.py

Co-Authored-By: 1ucian0 <luciano@debian.org>

* expansion enumaration

* Update qiskit/circuit/quantumcircuit.py

Co-Authored-By: 1ucian0 <luciano@debian.org>

* list in a barrier

* instruction arg expansion

* Update qiskit/extensions/standard/barrier.py

Co-Authored-By: 1ucian0 <luciano@debian.org>

* lint

* flanten instead of zipping

* simpler expansion

* docstring

* ups

* argument_expansion -> argument_conversion

* broadcast_arguments -> argument_expansion

* undo 33e81f9

* docstrings

* message in casting error
2019-05-06 14:36:13 -04:00
Matthew Treinish ddf2312368 Remove deprecated plot_state methods (#2325)
* Remove deprecated plot_state methods

In the 0.7 release we deprecated the plot_state and iplot_state
visualization methods for removal in the 0.9 release. These functions
were made obsolete when we cleaned up and unified the interfaces to each
of the individual plot_state_*() and iplot_state_*() functions. Since
0.8 is released and development on 0.9 started we can remove these
functions.

Fixes #2320

* Update changelog

* Fix lint
2019-05-06 11:32:02 -04:00
Jay Gambetta 50006f1eb8 Removing international language (#2302)
* Removing international language

* Changeling
2019-05-05 07:16:54 -04:00
Jay Gambetta ffb463ae19 removing deprecated code in transpile, assemble, execute and derivatives. (#2301)
* Removing old code.

* Small updates

* Editing changeling

* Edit to changeling
2019-05-04 21:13:16 -04:00
Matthew Treinish 8609f7ae36 Determine row spacing properly (#2299)
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
2019-05-04 19:28:14 -04:00
Luciano 9612b3f66f Register size type error (and casting when possible) (#2288)
*  not isinstance(size, int) or size <= 0

* lint

* lint

* change the strategy, cast first

* docstring

* lint
2019-05-04 08:51:27 -04:00
Matthew Treinish a59a4d6d15
Update CI post release (#2297)
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).
2019-05-03 17:26:23 -04:00
Matthew Treinish a4d22dbe4a Bump version string post release (#2298)
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.
2019-05-03 15:52:31 -04:00
Matthew Treinish e99bce1a25 Update changelog to prepare for 0.8 release (#2283)
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.
2019-05-02 16:49:56 -04:00
Thomas Alexander f0e1b4331b
assemble lo bug fix (#2287)
* assemble lo bug fix.

* fix bug
2019-05-02 15:58:35 -04:00
Thomas Alexander 8d692b3615 Remove buffer from first pulse on channel. (#2280) 2019-05-02 10:00:35 -04:00
Thomas Alexander 07da540051 Pulse assembly bug (#2279)
* small bug

* Add test for bug.
2019-05-02 08:36:01 -04:00
Ali Javadi-Abhari e44d7aebfc Define transpile optimization levels (#2266)
* 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
2019-05-02 12:51:11 +02:00
Paul Nation 25bed6f9f0 Obtain a reduced coupling_map for a subgraph of a device (#2225)
* reduced_coupling_map

* style

* new headers

* make reduce a CouplingMap method

* get rid of 'backend'

* fix test for python version dependent ordering

* fix idx
2019-05-02 05:35:16 -04:00
Lev Bishop 1b4a6976b7 require scipy>=1.0 and go back to scipy.stats.unitary_group for random_unitary() (#2275) 2019-05-02 04:55:45 -04:00
Christopher J. Wood 48659a682f
Fix typo in QuantumChannel init (#2277) 2019-05-01 23:10:13 -04:00
Thomas Alexander 03fb844039 Enforce meas map at assembly (#2276)
* Added meas_map to assemble.

* Add meas_map check.

* Add meas_map tests.

* linting.
2019-05-01 22:32:33 -04:00
Thomas Alexander f8fdfc514b schedule assembly bug. (#2274)
* schedue assembly bug.

* A couple more.

* fix bugs.
2019-05-01 21:55:58 -04:00
Thomas Alexander c869c9c2ac
Openpulse drawer (#2213)
* 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.
2019-05-01 21:21:16 -04:00
Matthew Treinish 99a21bbbb0 Handle edge case in text drawer line length logic (#2253)
* 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
2019-05-01 20:39:04 -04:00
Thomas Alexander ba79de1bdf Move schedule children attribute to private. (#2265) 2019-05-01 18:42:20 -04:00