Commit Graph

3035 Commits

Author SHA1 Message Date
Ali Javadi-Abhari d6a8953029
releasenotes owned by everyone 2019-09-06 14:57:59 -04:00
Thomas Alexander f62e9a4779 Add scheduling padding method (#2880)
* Added delay command and instruction.

* Added delay to __init__.

* Add delay to schedule assembly

* Add delay too init.

* Add delay too init.

* Split up schedule tests.

* rename command tests.

* Add discriminator test.

* Add delay tests for pulse channels.

* Add pulse schedule delay tests.

* Add conversion method for delay.

* Add delay assembly test.

* Add delay to plot test.

* Add delay docstring.

* Update changelog with delay instruction.

* Added docstrings for delay.

* Linting.

* fix: delay comments.
fix: pulse visualization test removal of file command that was removed.
fix: cleaned up pulse tests.

* Make delay instruction handling more explicit.

* Fix conflict error.

* Add delay to schedule assembly

* Modified timeslots to perform more efficient insertions.

* Modified timeslots to perform more efficient insertions.

* Reorder functions.

* Reset util.

* Redefine intervals by start and stop rather than begin and end.

* Redefine intervals by start and stop rather than begin and end.

* Updated changelog.

* Split up schedule tests.

* rename command tests.

* Update changelog with delay instruction.

* Begin adding complement TimeslotCollection method.

* Added complement method to TimeslotCollection.

* Padded out padding method.

* Update pad test.

* Fix pad test.

* Linting and test updates.

* linting.

* Remove duplicate changelog entry for delay.

* Remove helper method.

* update pad docstring.

* fix bad if statement return in timeslots.'

* Linting.

* Add print statement for azure testing.

* Additional print debug.

* Updated debug.

* Another one

* Updated instruction representation.

* Print update.

* debug print statement.

* Print statement.

* Fix bug in complement timeslot generation.

* Added a reno for pad.

* Update padding reno

* Update pulse init.

* Remove init modificiations of pulse.

* Update releasenotes/notes/schedule-pad-method-a56c952fcfdfbf08.yaml

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Update reno with pulse instead of delay.
2019-09-06 14:28:28 -04:00
Ali Javadi-Abhari 692d618016
Update CODEOWNERS 2019-09-06 13:55:44 -04:00
Matthew Treinish 35abeb9da0 Set an explicit random hashseed for tests in CI (#3072)
* Set an explicit random hashseed for tests in CI

The python hash seed is used to control the seed for the hash() function
for types covered by hash randomization. If we encounter errors around
ordering for things like iterating over dictionaries to reproduce
failures locally it is useful to know what the hash seed was. However,
to ensure the code is robust we still want to have a random value for
the hash seed to make sure things aren't dependent on a single order.
This commit accomplishes this by explicitly selecting a random number
and setting that to the value of PYTHONHASHSEED. This value is then
printed right before we run the tests. This way if we encounter an issue
around ordering we can try and reproduce it locally.

* Use python for random number instead of shuf

* Fix typo
2019-09-05 14:57:45 -04:00
itoko 7e1bcab5bb Change schedule.union not to increase depth of schedule tree (#2885)
* fix #2818; change schedule.union not to increase depth of schedule tree

* Apply suggestions from code review

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* fix timeslots.merged->merge

* keep the implementation out of the docs
2019-09-04 11:54:34 -04:00
gruu 529fdbd695 Fix barrier placement in latex visualization (#2918) (#3052)
* Fix barrier placement in latex visualization (#2918)

* Problem - When barrier op was encountered, barrier command was
  placed in a new column followed by \qw element. Barrier location
  in the circuit drawn depends on the width of the next column. Because
  column width varies depending on the gate type, barrier location
  also varies and it is not always placed in the column space alloted for
  it. Hence for wider gates barrier used to overlap over the gate
  diagram.

* Solution added with this commit - In the new column, only \qw
  element is placed. \barrier command with horizontal offset set as
  0em is added to the previous column. Now barrier command will be
  drawn in the centre of the new column.

* Remove codeblocks relatedi to barrier offset adjustment (#2918)

* These code blocks are not triggered anymore with
  the way barrier is placed in the xy-matrix currently.
2019-09-03 11:38:07 -04:00
Ali Javadi-Abhari be9b0da397 Split mock backends and add new ones (#3050)
* split files for backend mock utilities

* fix coupling maps of new devices

* copyright year

* fake qobj docstring

* graphs with direction

* ourense

* FakePoughkeepsie

* asciiart
2019-08-28 14:35:57 +02:00
Luciano 61656e340a CI should run with mpl backend = ps (#2949)
* new reference files

* drop the not matching files

* inputs

* linux and mac

* another one fails

* new ref file

* do not save

* do not remove

* windows

* different refs for different os

* shorter lines

* remove ref

* new refernces

* udpate ref

* clean the azure conf

* moving the env to Makefile

* azure results

* ref image

* make test_ci

* at import time

* the other test

* clean up and new ref

* save for windows

* new ref

* clean up azure conf

* removing backend selection in qiskit/visualization/matplotlib.py

* add backend selection in testing

* lint

* tight

* backend in ci

* .

* drop

* do not remove and copy

* copy results

* save everything

* new ref

* skip these tests if matplotlib is not installed

* TestGraphDist only if HAS_MATPLOTLIB

* lint

* only under failing condition

* new ref

* rest of the artifacts

* Update azure-pipelines.yml

* twice in the same job

* Fix stray whitespace yaml syntax issue

* display name
2019-08-27 17:38:32 -04:00
Ali Javadi-Abhari 7457aa9fad
Fix mpl conditional drawing (#3032)
* fix conditional drawing in mpl

* changelog

* add ref image

* lint
2019-08-27 12:02:33 -04:00
Ali Javadi-Abhari 7bc44b83aa
remove global codeowners 2019-08-27 09:36:38 -04:00
Matthew Treinish f54f02d151 Make graphviz availability check at runtime (#3041)
Previously the graphivz availablity check was performed at import time.
This meant that everytime anyone imported anything from qiskit.* we'd be
shelling out to try and run 'dot -V' to see if python could find
graphviz in order to run the passmanager drawer. This was based on the
model we used for matplotlib which also does it at import time. However,
unlike matplotlib this isn't a simple python import path check shelling
out and running another program takes a non-negligble amount of time to
any import of qiskit. [1] We shouldn't force this check to run all the
time if graphviz is only needed when running the pass manager
visualizer. This commit address this by switching the graphviz check to
be the first operation that occurs in the pass_manager_drawer() function
instead of at the module level. There is no change in behavior except
for when the check is run. However, since this check was used for
testing and is needed to occur at import time for the test module the
check is duplicated in the test code to ensure we can properly skip
tests if graphviz is not present.

[1] https://qiskit.github.io/qiskit/#import.QiskitImport.time_qiskit_import?commits=2d14c1e3
2019-08-26 20:29:45 +02:00
Lauren Capelluto f22a937a5e Remove deprecated device specs (2 months ago) (#3033)
* Remove deprecated code (2 months ago)

* Remove unused imports

* Update CHANGELOG and release notes

* Add note that device specs was deprecated
2019-08-26 14:06:46 -04:00
Lauren Capelluto c20eb51b20 Remove deprecated schedule ops (#3034)
* Remove deprecated schedule ops (deprecated 2 months)

* Update CHANGELOG and release notes
2019-08-26 10:53:05 -04:00
Luciano 41dfef9437 No random in test_circuit_properties (#2930)
* from unittest.mock import patch

* .

* remove random in test_circuit_properties

* unsed import
2019-08-24 10:16:39 -04:00
Matthew Treinish e1fc918751
Remove jsonschema cap (#3037)
We have had the jsonschema version capped since it was introduced as a
requirement into terra. There is no clear reason for this and it limits
interoperability with other python packages. Especially because
jsonschema is commonly used library across the python ecosystem. The
version we were capping to was also quite old being release 2.5 years
ago. This commit removes the cap so that people can run terra in
environments where newer jsonschema is required.
2019-08-23 15:35:32 -04:00
Ali Javadi-Abhari 3829137e9a
Update CODEOWNERS
Updating to reflect the current state of responsibilities
2019-08-23 12:52:09 -04:00
Matthew Treinish 4bcb84472a Move delay inst release note for better organization (#3036)
The release note for the delay was added right before the release and we
missed moving it into the 0.9 dir. This doesn't actually matter from the
reno perspective because reno uses git to determine which release an
individual note file is associated with. So when reno is used to
generate the rst for the 0.9 release the directory doesn't matter (as
long as it's under releasenotes/notes). However, to keep things better
organized for humans on disk keeping the release notes associated with
particular major release in a release specific directory. This commit
just moves the note into the 0.9 directory so we can keep the
releasenotes/notes directory just for the pending release.
2019-08-23 17:24:48 +02:00
Matthew Treinish d2b15b13e2
Bump version string post release (#3031)
Now that qiskit-terra 0.9.0 is out the door we should bump the version
string on master to show the source version we're installing is newer
than what's been released.
2019-08-22 10:41:40 -04:00
Matthew Treinish 111d774b04 Update changelog and prepare for 0.9 (#3025)
This commit updates the CHANGELOG and prepares for the 0.9 release. This
should be the last commit on master prior to the 0.9 release.
2019-08-22 10:13:39 -04:00
Matthew Treinish 7a23f530c5 Add release notes for new user config features (#3026)
Three new features were added to the user config file in #2366, #2344,
and #2331 but there were no release notes documenting these new
features. This commit corrects the oversight and adds a release note to
document the new features.
2019-08-22 00:02:14 -04:00
Thomas Alexander 5422dad2ac Add delay release note (#3029)
* Add delay release note.

* Update delay instruction text.
2019-08-22 00:01:47 -04:00
Ali Javadi-Abhari 10a0678700
Shorter controlled-hadamard definition (#2837)
* shorter CH gate definition

* changelog

* add ch matrix

* import numpy

* add test

* fix broken test
2019-08-21 22:19:53 -04:00
Paul Nation 1d987e5e7b
remove cx_direction from O3 if symmetric (#3027) 2019-08-21 21:51:49 -04:00
Luciano 40861074c5 if passmanager.draw(raw=true), do not create the png (#3022)
* if raw, do not create the png

* exception

* docstring

* different exception
2019-08-21 18:01:59 -04:00
Matthew Treinish 217fc26cf2 Add release note for plot_error_map (#3024)
In #2965 we added a new visualization function, plot_error_map(), but
that PR was original proposed prior to our adoption of reno to handle
release notes. Therefore it was missing the corresponding release
documentation for the new feature. This commit address that oversignt
and adds a release note for this new feature.
2019-08-21 15:53:21 -04:00
Matthew Treinish 3a08044ebb Remove log_level kwarg from transpile() (#3012)
* Adjust logger used for transpile log_level

When the log_level parameter is set on the transpile() call we use that
to set the level for all the transpiler functions called. To do this we
get an instance of the pass manager logger and set the level of logs
we want. However, the logger we were getting before was too specific,
it was only looking at qiskit.transpiler.passmanager, but log messages
are emitted from passes and other functions in qiskit.transpiler too. So
when a log level was set on transpile() calls it was only partially
respected. This commit fixes this by adjusting the logger we set the
level on to be all of qiskit.transpiler instead of just the passmanager
module.

Fixes #3010

* Remove log_level kwarg and update release notes

The log_level kwarg is rendundant when users can just call
logging.getLogger('qiskit.transpiler').setLevel() from their code
directly just as easily. Since the transpile() signature is a stable
interface this errs on the side of caution and removes this kwarg. If we
have a need for logging related kwargs on transpile() in the future we
can easily add them in a future release. At the same time this updates
the release notes to provide more background on how to use logging.

* Fix lint
2019-08-21 15:29:31 -04:00
Ali Javadi-Abhari 5a3ac84d4a add release note for dag.draw() (#3019) 2019-08-21 18:29:43 +02:00
Kevin Krsulich 1e24d40cd9 Deepcopy all but first instruction when broadcasting. (#3013) 2019-08-21 10:54:40 -04:00
yotamvakninibm 4b9a6ce540 Faster Paulis to Matrix method (#2916)
* faster pauli to spmatrix

* Faster pauli to matrix using bitwise operations

* Correct length operator

* missing self

* Added documentation to _count_set_bits

* count_set_bits

* fast count_set_bits

* bug fix count_set_bits

* trying to fix some of your lint errors

* two more listing errors
2019-08-21 15:42:03 +02:00
Ali Javadi-Abhari 43bfbe57de add dag.draw() method (#3016)
* add dag.draw() method

* changelog
2019-08-21 15:08:54 +02:00
Paul Nation 4c633c3c3c
Adds error_map plot (#2965)
* add error_map

* better alignment

* lint

* fix unused imports

* lint
2019-08-21 03:26:35 -04:00
Thomas Alexander 35d47af838 Add delay instruction (#2869)
* Added delay command and instruction.

* Added delay to __init__.

* Add delay to schedule assembly

* Add delay too init.

* Add delay too init.

* Split up schedule tests.

* rename command tests.

* Add discriminator test.

* Add delay tests for pulse channels.

* Add pulse schedule delay tests.

* Add conversion method for delay.

* Add delay assembly test.

* Add delay to plot test.

* Add delay docstring.

* Update changelog with delay instruction.

* Added docstrings for delay.

* Linting.

* fix: delay comments.
fix: pulse visualization test removal of file command that was removed.
fix: cleaned up pulse tests.

* Make delay instruction handling more explicit.

* Fix conflict error.
2019-08-20 11:09:20 -04:00
nkanazawa bc0fe2d17e Allow for visualizing empty waveform (#3003)
* allow for plotting empty waveform

* add inline comments
2019-08-20 09:16:05 -04:00
Matthew Treinish 709baa8905
Add reno release notes for 0.9 release (#2919)
* Add reno release notes for 0.9 release

This commit starts the process of adding release notes using reno to
qiskit-terra. This notes for several of the user facing changes in the
0.9 release so far. We can continue to modify release notes after the fact
because they're tied to the git history for which release they're
associated with. New release notes can be added with: "reno new $name"
and you can generate rst output using "reno report"

Moving forward the expectation is that we'll require a PR to include
release documentation in the form of a reno release note before we merge
it, if it contains a user facing change. Release notes differ from
changelog in that they provide much more detail to end users on what has
changed, how they can adapt to it, and why it was changed (if
necessary). Accordingly the release notes are free form restructured text
that enables writing as much as needed. While the changelog is just a
record of a change that has potential end user impact and normally
doesn't provide the detail needed by users. Honestly the changelog
creation shouldn't be a manual process it should be automatically
generated using a combination of git and commit msg metadata.

Fixes #2230

* Add more release notes

* Add more release notes for new features

* Add more release notes

* Add more upgrade notes

* Add reno lint check to CI

* Add more notes

* Add release notes for changes that were missing a changelog entry

* Expand incomplete notes

* Fix whitespace

* Add documentation on release notes to CONTRIBUTING.md

* Add qsphere update release notes

* Update diagGate() name to diag_gate()

* Add release notes for pulse samplers

* Add release notes for layout in circuit drawers

* Add upgrade note about new warnings

* Replace stray hardtab with spaces

* Add release note on line magic api change

* Apply suggestions from code review

Co-Authored-By: Luciano <luciano.bello@ibm.com>

* Update CONTRIBUTING.md

Co-Authored-By: Ali Javadi-Abhari <ajavadia@users.noreply.github.com>

* Fix typo
2019-08-19 14:12:55 -04:00
Luciano 9b04dae174 Passmanager.draw() in Jupyter notebooks (#3005)
* .

* support for non-PIL

* changelog

* lint
2019-08-19 13:46:50 -04:00
Luciano 7cfc94cb18 Text drawer supports composite gates with both quantum and classical wires (#2997)
* fix the exception text

* new _set_multibox API

* box shape

* harness to length

* centering the label

* centering!

* lint
2019-08-19 11:47:09 -04:00
bcamorrison 16dcbe259b Fixes #2858 by checking all gates in the subinstruction for registers (#2998)
* Fixes #2858 by checking the entire instruction for classical registers, not just the first gate in it.

* lint decompose.py

* Update unroll_3q_or_more.py

* lint unroller.py
2019-08-19 10:50:56 -04:00
Jay Gambetta de5a2a613a Update README.md (#2999) 2019-08-18 03:31:23 -04:00
Renier Morales fdc7c9d77d Fix passing of kwargs to the compiler assembler (#2996)
* Fix passing of kwargs to the compiler assembler

The use of assemble() from the execute function in
https://github.com/Qiskit/qiskit-terra/blame/master/qiskit/execute.py#L218
passes run_config as a named parameter when assemble expects it as
kwargs. This causes it to be packed into a dict with a single run_config
key that is never unpacked.

* Update assemble function doc to clarify run_config as a kwargs param
2019-08-17 15:04:29 -04:00
Luciano e38e85e536 Latex drawer should allow spaces in custom instruction names (#2992)
* DeprecationWarning removed

* allow spaces in custom instruction names

* Update qiskit/visualization/latex.py
2019-08-16 11:00:51 -04:00
Lauren Capelluto 752b94ab5d Issue 2848 improve schedule performance (#2995)
* Modified timeslots to perform more efficient insertions.

* Reorder functions.

* Reset util.

* Redefine intervals by start and stop rather than begin and end.

* Update docstrings of timeslots.

* Add interval methods to timeslot.

* Update methods to use new timeslot methods rather than underlying interval methods.

* linting.

* Localize timeslotcollection try statement.

* Change dumb way of returning booleans.

* Improve locality check.

* fix bubble vs insertion sort comment

* Remove le,ge and starts_after and stops_after methods.

* Change timeslot collection merging to not use sets.

* Update mergeable method.

* Readd channel start and stop at 0 if no instructions are present

* Simplify logic in _merge_timeslot_collection

* Fix bug: cant set timeslots, need to copy them
2019-08-15 21:40:30 -04:00
Matthew Treinish 2074406bc7 Limit the set of tests run in appveyor (#2989)
* Limit the set of tests run in appveyor

The py37 job run in appveyor isn't meant to actually count, it's
there so appveyor won't leave a pending job sitting in the github
checks list while we have it configured as a wheel building backup
for azure. Right now this job is failing and leaving a red x on commits
(which is at least as bad as leaving patches status as pending) because
of a new pulse test that is sensitive to subtle floating point type
differences between environments. To avoid the bad optics of a red x on
jobs we don't care about this commit switches the set of tests we run in
this job we only configured to make it easy to ignore to just a single
test module that is unlikely to fail unless it fails on all
environments.

* Don't run anything
2019-08-15 08:15:03 -04:00
Diego M. Rodríguez 690e00ca7c Documentation tweaks for qiskit.transpiler.misc (#2961)
* Style updates for passmanager

* Style updates for basepasses
2019-08-14 16:22:06 -04:00
Matthew Treinish aa87701460 Add appveyor config back for building windows wheels (#2979)
* Add appveyor config back for building windows wheels

With the recent instability and unreliability with azure-pipelines
relying on it to build our windows wheels for the upcoming 0.9 release
doesn't seem to be prudent. Especially when considering our ability to
create reliable portable wheels for a windows environment manually
outside of CI is limited (we've had issues trying to do it manually in
the past). This commit adds back our appveyor config for building wheels
which has worked well for past releases. This way even if azure fails
for us we have a fallback available when we push our release tag.

* Do not merge, verifying it still works

* Revert "Do not merge, verifying it still works"

This reverts commit 285bfbb12c.

* Upload artifacts even if build fails

* Add back one job so it doesn't sit pending forever

The appveyor ci system doesn't like a config with 0 jobs configured to
run. If no jobs are configured to run it will sit there forever as
pending state. Since we only want to run the wheel build jobs on tags if
we only had the wheel jobs in the config this would result in an
appveyor entry in the checks on github sitting in a pending state
forever. To avoid this problem this commit adds a normal test job that
will run python 3.7 job so something will come back. We can safetly
ignore this job since it's duplicated with with what we run in azure,
but it will at least mean we're not leaving a PR in the pending state
forever.

* Use ps backend for mpl tests
2019-08-14 15:33:40 -04:00
Maddy Tod 37ef208e4b Updated so that all DAG pred/succ functions return iterators (#2917)
* Updated so that all pred/succ functions return iterators

* Updated more types in the DAG so that they now use Bits
2019-08-14 15:13:44 -04:00
Paul Nation aad92ea7ed Make jupyter progressbar line magic (#2954)
* progressbar to line magic

* updates
2019-08-14 13:52:47 -04:00
Thomas Alexander 326be30c41
Clip pulse samples if within epsilon unit norm (#2796)
* Add samplepulse testing.

* Add test for sample norms.

* Added clipping of pulses if norm slightly exceeds 1.

* Updated changelog.

* linting.

* clip by angle instead of epsilon.
2019-08-14 13:22:59 -04:00
Kevin Krsulich bb2ea373b2 Change Parameter equality from python id() to internal uuid(). (#2947)
Parameters were defined such that they would only ever __eq__ self. That way, 
if a user defined a Parameter('theta') and wanted to compose in a subcircuit 
defined elsewhere which contained a different Parameter('theta'), we would 
be able to detect that the parameter names overlapped and raise an error.

However, if a user sent a Parameter to a different python instance though (say
 through multiprocessing.Pool or qiskit.tools.parallel_map), it would be
instantiated as a different python object and so no longer be considered equal
to the original parameter.

This PR changes Parameter to instead generate a random UUID on
instantiation and use that for equality testing. Unlike id(self), self._uuid will be
preserved across pickling and de-pickling, but should otherwise preserve
Parameter's equality behavior.

Fixes #2429
Fixes #2864
2019-08-14 12:53:08 -04:00
Matthew Treinish 85ec21f6db
Use nprocs concurrency for test running on macOS (#2981)
In #2905 we switched the macOS jobs only use a concurrency of 2 instead
of nprocs for running tests. This was done in an attempt to debug a
segfault (which wasn't easy to diagnose from CI). But as #2793 has shown
the issue isn't the concurrency but instead running on macOS 10.14.
Since we also downgraded the macOS version used for these jobs we
shouldn't need to limit the concurrency anymore and increase it back to
4 workers. This should hopefully improve the test runtime on macOS jobs
slightly since they report having 4 CPUs available.
2019-08-14 12:09:04 -04:00
Matthew Treinish 827ce91a98
Adjust deprecated bit access in latex drawer (#2985)
Right now the latex drawer has a few instances of deprecated bit access
assuming a tuple right now. This results in a deprecation warning when
calling the latex drawer. To avoid emitting a deprecation warning
internally from qiskit this commit fixes this and updates the access
to use the bit class attributes.
2019-08-14 11:25:11 -04:00