Repository: Qiskit/qiskit

Issue:
Multiple warnings when accessing backend
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues -->

### Information

- **Qiskit Terra version**: master
- **Python version**:
- **Operating system**:

### What is the current behavior?

<img width="1025" alt="Screen Shot 2019-10-31 at 9 32 41 AM" src="https://user-images.githubusercontent.com/1249193/67951233-816a5480-fbc1-11e9-8644-6b9df9b40f80.png">


### Steps to reproduce the problem
Load up a backend in Jupyter.


### What is the expected behavior?
No warnings


### Suggested solutions
I am not sure why `dt` has been changed to seconds.  Given the GHz freq. that we use, the natural timescales are nanosec.  This was already a bit funky given that we do T1 and T2 in microsec.  So now we have three different timescales for our parameters.

As a side note, the natural timescale for the simulator is nanosec.   I am not sure how this affects that.




Discussion:
If you load a backend in jupyter by assigning it to `backend`, there should be no warnings. When you execute a cell ending in just `backend`, the output of the `backend`s `__repr__` is printed. The IBMQ backends' repr seem to include a call to `dt`. We can remove the warning by temporarily suppressing warnings within ibmq-provider's repr method, or by accessing the private variable within `__repr__` (until the warning is removed). This would happen outside `terra` (edit: as stated below, this is wrong).

I agree it was funky that there were multiple timescales for the parameters -- this is intended as a small step towards fixing that. The idea is that the units `s` for time and `Hz` for frequency would be the least surprising for users. If it is the most likely assumption, then matching that assumption improves usability. Of course, users who have already gone through the trouble of finding the units would expect `ns`, and that is what the warning is for (I myself had to read the whitepaper on the arxiv to find it, after getting a value that I thought obviously couldn't be seconds).

I also agree that having more than one timescale is not good. I would suggest migrating `GHz` -> `Hz` before the next release as well, at least on the Qiskit terra side. These changes are more pervasive than the change for `dt`, but it should be somewhat (hopefully?) localized to `assemble`. If we decide to go forward with this change, I'll make time to work on it.

Regarding `us`, where are these values of T1 and T2? I am right now only aware of `backend.properties()`. In this, the values for T1 and T2 had their units attached to them (in the `Nduv`). This was a very good thing, because the explicit unit requires no guessing on the part of the user. Also, `t1(qubit)` and `t2(qubit)` have been exposed on the `BackendProperties` as methods, and they *do* return their values in units of `s`.

Ideally, on the long term, we can also migrate the providers to pass terra values in units of `s`, `Hz`, and all the basic SI units. This will remove any ambiguity, but I believe it would require a synced update between providers and terra. I think @mtreinish has started looking into a way to de-couple core terra code from the serialization of objects between providers and terra -- this might not remove the need for the sync, but it could potentially ameliorate it.

On the Aer side, maybe @chriseclectic can tell us if there will be an issue?
I'll see if I can make a PR to `qiskit-ibmq-provider` regarding the warnings (edit: this seems to be the wrong place, but I'm looking into it. edit2: I was very wrong, it is in terra/jupyter stuff)

Resolving patch:
diff --git a/qiskit/providers/models/backendconfiguration.py b/qiskit/providers/models/backendconfiguration.py
--- a/qiskit/providers/models/backendconfiguration.py
+++ b/qiskit/providers/models/backendconfiguration.py
@@ -325,8 +325,6 @@ def __init__(self,
         self.meas_levels = meas_levels
         self.qubit_lo_range = qubit_lo_range
         self.meas_lo_range = meas_lo_range
-        self._dt = dt * 1.e-9  # pylint: disable=invalid-name
-        self._dtm = dtm * 1e-9
         self.rep_times = rep_times
         self.meas_kernels = meas_kernels
         self.discriminators = discriminators
@@ -338,22 +336,11 @@ def __init__(self,
                          open_pulse=open_pulse, memory=memory, max_shots=max_shots,
                          n_uchannels=n_uchannels, u_channel_lo=u_channel_lo,
                          meas_levels=meas_levels, qubit_lo_range=qubit_lo_range,
-                         meas_lo_range=meas_lo_range, dt=dt, dtm=dtm,
+                         meas_lo_range=meas_lo_range,
+                         dt=dt * 1e-9, dtm=dtm * 1e-9,
                          rep_times=rep_times, meas_kernels=meas_kernels,
                          discriminators=discriminators, **kwargs)
 
-    @property
-    def dt(self) -> float:  # pylint: disable=invalid-name
-        """Time delta between samples on the signal channels in seconds."""
-        warnings.warn("The time delta is now returned in units of [s] rather than [ns].")
-        return self._dt
-
-    @property
-    def dtm(self) -> float:
-        """Time delta between samples on the acquisition channels in seconds."""
-        warnings.warn("The time delta is now returned in units of [s] rather than [ns].")
-        return self._dtm
-
     @property
     def sample_rate(self) -> float:
         """Sample rate of the signal channels in Hz (1/dt)."""


Test patch:
diff --git a/test/python/providers/test_backendconfiguration.py b/test/python/providers/test_backendconfiguration.py
--- a/test/python/providers/test_backendconfiguration.py
+++ b/test/python/providers/test_backendconfiguration.py
@@ -14,8 +14,6 @@
 """
 Test that the PulseBackendConfiguration methods work as expected with a mocked Pulse backend.
 """
-import warnings
-
 from qiskit.test import QiskitTestCase
 from qiskit.test.mock import FakeProvider
 
@@ -26,16 +24,6 @@
 class TestBackendConfiguration(QiskitTestCase):
     """Test the methods on the BackendConfiguration class."""
 
-    @classmethod
-    def setUpClass(cls):
-        # TODO: these two class methods can be removed when the warnings
-        # in backend config are removed.
-        warnings.filterwarnings("ignore")
-
-    @classmethod
-    def tearDownClass(cls):
-        warnings.resetwarnings()
-
     def setUp(self):
         self.provider = FakeProvider()
         self.config = self.provider.get_backend('fake_openpulse_2q').configuration()