Skip to content
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

Provider is not copied in the copy method in ExperimentData #1314

Closed
ItamarGoldman opened this issue Nov 6, 2023 · 2 comments
Closed

Provider is not copied in the copy method in ExperimentData #1314

ItamarGoldman opened this issue Nov 6, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ItamarGoldman
Copy link
Contributor

ItamarGoldman commented Nov 6, 2023

Informations

  • Qiskit Experiments version: 0.25.2
  • Python version: 3.11
  • Operating system: Windows 11

What is the current behavior?

When retrieving data, if the provider is None no warning is documented even though no data is retrieved. In addition, The copy() method in ExperimentData class doesn't copy the provider from the original ExperimentData object

Steps to reproduce the problem

from qiskit import QuantumCircuit, QuantumRegister
from qiskit_experiments.framework import ExperimentData
from qiskit_experiments.library import ProcessTomography

from qiskit_ibm_provider import IBMProvider, least_busy

hub = 'ibm-q-internal'
group = 'deployed'
project ='default'

provider = IBMProvider(instance=f"{hub}/{group}/{project}")
backend = provider.get_backend("ibmq_jakarta")

register = QuantumRegister(2, name="q")
target_circuit = QuantumCircuit(register)
a, b = register
target_circuit.h(a)
target_circuit.cnot(a, b)

experiment = ProcessTomography(target_circuit)
device_data = experiment.run(backend, shots=10000)
device_data.save()

Then using the experiment_id (here I used mine)

service = ExperimentData.get_service_from_backend(backend)
data = ExperimentData.load("eb4196fe-4143-4682-8b61-763eca66438d", service, provider=provider)
experiment = ProcessTomography(target_circuit)
data = experiment.analysis.run(data).block_for_results()
print(data.provider)

It will be None.
If provider is not provided in the load method, there will be no indication for the user to know that the data wasn't retrieved.

What is the expected behavior?

We expect that the data will keep information about the provider if given to him.

Suggested solutions

Add warning to the _retrieve_data() method in ExperimentData object and to copy the provider attribute in the copy() method

@ItamarGoldman
Copy link
Contributor Author

#1316 solve this issue by copying the provider.

github-merge-queue bot pushed a commit that referenced this issue Nov 30, 2023
…retrieve_data` (#1316)

### Summary

As said in #1314 , `copy` method in `Experiment Data` class will now
copy the `provider` attribute to the copied instance and warnning if
data isn't retrieved due to `provider=None` .
### Details and comments

Some details that should be in this section include:

- Why this change was necessary
This is a bug that the provider isn't copied. In addition,
`_retrive_data()` method in the `ExperimentData` class doesn;t retirive
data if provider is not provided. Added a warning so the user will know.
@ItamarGoldman
Copy link
Contributor Author

Closing issue.

itoko pushed a commit to itoko/qiskit-experiments that referenced this issue Dec 12, 2023
…retrieve_data` (qiskit-community#1316)

### Summary

As said in qiskit-community#1314 , `copy` method in `Experiment Data` class will now
copy the `provider` attribute to the copied instance and warnning if
data isn't retrieved due to `provider=None` .
### Details and comments

Some details that should be in this section include:

- Why this change was necessary
This is a bug that the provider isn't copied. In addition,
`_retrive_data()` method in the `ExperimentData` class doesn;t retirive
data if provider is not provided. Added a warning so the user will know.
nkanazawa1989 pushed a commit to nkanazawa1989/qiskit-experiments that referenced this issue Jan 17, 2024
…retrieve_data` (qiskit-community#1316)

### Summary

As said in qiskit-community#1314 , `copy` method in `Experiment Data` class will now
copy the `provider` attribute to the copied instance and warnning if
data isn't retrieved due to `provider=None` .
### Details and comments

Some details that should be in this section include:

- Why this change was necessary
This is a bug that the provider isn't copied. In addition,
`_retrive_data()` method in the `ExperimentData` class doesn;t retirive
data if provider is not provided. Added a warning so the user will know.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant