-
Notifications
You must be signed in to change notification settings - Fork 131
A Test for RB experiment #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A Test for RB experiment #51
Conversation
Changed names of some variables to represent better their content, added return var for experiment results. Added Test to validate the circuit data with the experiment attribute.
Few things were changed: 1. There is a function for each test experiment configuration. 2. Added transpiled circuit check using process_fidelity from qiskit.quantum_info.operators.measures 3. Changed the np.allclose to matrix_equal function to be invariant for global phase.
test/test_rb.py
Outdated
| exp_attributes = { | ||
| "qubits": [1], | ||
| "lengths": [1, 3, 5, 7, 9], | ||
| "num_samples": 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe try also num_samples > 1
|
Thanks for writing the tests! They are very good. I only had a few comments |
Changed some experiment attributes. Added comment why every configuration that return by _exp_data_properties() should raise an exception.
Added decorator to make one function that test for different data (In this case: number of qubits)
Deleted the test for the transpiled circuit since the function doesn't exist anymore
test/test_rb.py
Outdated
| Returns: | ||
| list[dict]: list of dictionaries with experiment properties. | ||
| """ | ||
| exp_data_list = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the most common mistakes are when "lengths" is not strictly increasing, and in particular when the same length appears twice. This can happen if someone generates the length sequence using some function (e.g. a logarithmic function), see for example the discussion here:
qiskit-community/qiskit-ignis#459
I never saw errors when the "qubits" or "length" are non-positive (or non-integers)
Two function that were for the input test were deleted. No need to import QiskitError
* Create test_rb.py * Update test_rb.py * Update test_rb.py * Update test_rb.py * Update test_rb.py * Added Test to validate the circuit data Changed names of some variables to represent better their content, added return var for experiment results. Added Test to validate the circuit data with the experiment attribute. * Lint fixed * Added test for transpiled circuit Few things were changed: 1. There is a function for each test experiment configuration. 2. Added transpiled circuit check using process_fidelity from qiskit.quantum_info.operators.measures 3. Changed the np.allclose to matrix_equal function to be invariant for global phase. * Update test_rb.py * Update test_rb.py * Black and lint * uncommented test * Changes in experiment attributes Changed some experiment attributes. Added comment why every configuration that return by _exp_data_properties() should raise an exception. * Added ddt decorator and use it to decrease the number of functions Added decorator to make one function that test for different data (In this case: number of qubits) * Deleted the test for the transpiled circuit Deleted the test for the transpiled circuit since the function doesn't exist anymore * Ran Black on the code * The test_rb.py passed lint (local) * Update __init__.py * Fixed the test for metadata and run experiment * Run Black * Fixed lint * Deleted - Test for input error hadling Two function that were for the input test were deleted. No need to import QiskitError
Summary
Implemented 2 qubits test for meta data and check circuit functionality is identity.
#34