Skip to content

Conversation

@ItamarGoldman
Copy link
Contributor

Summary

Implemented 2 qubits test for meta data and check circuit functionality is identity.
#34

@ItamarGoldman ItamarGoldman changed the title [WIP] A Test for RB experimentTest branch main [WIP] A Test for RB experiment May 13, 2021
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,
Copy link
Contributor

@ShellyGarion ShellyGarion May 25, 2021

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

@ShellyGarion
Copy link
Contributor

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.
test/test_rb.py Outdated
Returns:
list[dict]: list of dictionaries with experiment properties.
"""
exp_data_list = [
Copy link
Contributor

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
@ShellyGarion ShellyGarion changed the title [WIP] A Test for RB experiment A Test for RB experiment May 30, 2021
@ShellyGarion ShellyGarion self-requested a review May 30, 2021 10:44
@ShellyGarion ShellyGarion merged commit bc73f5a into qiskit-community:main May 30, 2021
@coruscating coruscating added this to the Release 0.1 milestone Jun 16, 2021
paco-ri pushed a commit to paco-ri/qiskit-experiments that referenced this pull request Jul 11, 2022
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants