Repository: Qiskit/qiskit

Issue:
execute gives depreciation warnings
<!-- ⚠️ 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?
```python

from qiskit import *
sim = Aer.get_backend('unitary_simulator')

qr = QuantumRegister(2, name='q')
qc = QuantumCircuit(qr)

execute(qc, sim);
```
gives
```python

/Users/paul/Desktop/Github_repos/qiskit-terra/qiskit/validation/base.py:360: DeprecationWarning: The as_dict() method is deprecated, use to_dict().
  DeprecationWarning)
/Users/paul/Desktop/Github_repos/qiskit-terra/qiskit/validation/base.py:360: DeprecationWarning: The as_dict() method is deprecated, use to_dict().
  DeprecationWarning)
```


### Steps to reproduce the problem



### What is the expected behavior?



### Suggested solutions





Discussion:

Resolving patch:
diff --git a/qiskit/providers/basicaer/qasm_simulator.py b/qiskit/providers/basicaer/qasm_simulator.py
--- a/qiskit/providers/basicaer/qasm_simulator.py
+++ b/qiskit/providers/basicaer/qasm_simulator.py
@@ -436,7 +436,7 @@ def _run_job(self, job_id, qobj):
                   'status': 'COMPLETED',
                   'success': True,
                   'time_taken': (end - start),
-                  'header': qobj.header.as_dict()}
+                  'header': qobj.header.to_dict()}
 
         return Result.from_dict(result)
 
@@ -623,7 +623,7 @@ def run_experiment(self, experiment):
                 'status': 'DONE',
                 'success': True,
                 'time_taken': (end - start),
-                'header': experiment.header.as_dict()}
+                'header': experiment.header.to_dict()}
 
     def _validate(self, qobj):
         """Semantic validations of the qobj which cannot be done via schemas."""
diff --git a/qiskit/providers/basicaer/unitary_simulator.py b/qiskit/providers/basicaer/unitary_simulator.py
--- a/qiskit/providers/basicaer/unitary_simulator.py
+++ b/qiskit/providers/basicaer/unitary_simulator.py
@@ -285,7 +285,7 @@ def _run_job(self, job_id, qobj):
                   'status': 'COMPLETED',
                   'success': True,
                   'time_taken': (end - start),
-                  'header': qobj.header.as_dict()}
+                  'header': qobj.header.to_dict()}
 
         return Result.from_dict(result)
 
@@ -354,7 +354,7 @@ def run_experiment(self, experiment):
                 'status': 'DONE',
                 'success': True,
                 'time_taken': (end - start),
-                'header': experiment.header.as_dict()}
+                'header': experiment.header.to_dict()}
 
     def _validate(self, qobj):
         """Semantic validations of the qobj which cannot be done via schemas.
diff --git a/qiskit/validation/base.py b/qiskit/validation/base.py
--- a/qiskit/validation/base.py
+++ b/qiskit/validation/base.py
@@ -357,7 +357,7 @@ def from_dict(cls, dict_):
     def as_dict(self):
         """Serialize the model into a Python dict of simple types."""
         warnings.warn('The as_dict() method is deprecated, use to_dict().',
-                      DeprecationWarning)
+                      DeprecationWarning, stacklevel=2)
         return self.to_dict()
 
 


Test patch: