Repository: Qiskit/qiskit

Issue:
LocalReadoutMitigator.quasi_probabilities incorrectly handles the shots argument
### Environment

- **Qiskit Terra version**: 0.22.2
- **Python version**:  3.10
- **Operating system**:  Windows


### What is happening?

1. The `LocalReadoutMitigator.quasi_probabilities` method has an argument `shots` which is not used in the method (it is overwritten by the output of `counts_probability_vector`)
2. The method returns an object of type `QuasiDistribution`. It would be good to set the number of shots on that method
3. The documentation on the return type of `counts_probability_vector` is incomplete

### How can we reproduce the issue?

-

### What should happen?

The number of shots argument should be used, or removed, or documented to be unused.

### Any suggestions?

_No response_


Discussion:

Resolving patch:
diff --git a/qiskit/result/mitigation/correlated_readout_mitigator.py b/qiskit/result/mitigation/correlated_readout_mitigator.py
--- a/qiskit/result/mitigation/correlated_readout_mitigator.py
+++ b/qiskit/result/mitigation/correlated_readout_mitigator.py
@@ -133,7 +133,7 @@ def quasi_probabilities(
         data: Counts,
         qubits: Optional[List[int]] = None,
         clbits: Optional[List[int]] = None,
-        shots: Optional[bool] = False,
+        shots: Optional[int] = None,
     ) -> QuasiDistribution:
         """Compute mitigated quasi probabilities value.
 
@@ -141,7 +141,8 @@ def quasi_probabilities(
             data: counts object
             qubits: qubits the count bitstrings correspond to.
             clbits: Optional, marginalize counts to just these bits.
-            shots: the number of shots.
+            shots: Optional, the total number of shots, if None shots will
+                be calculated as the sum of all counts.
 
         Returns:
             QuasiDistibution: A dictionary containing pairs of [output, mean] where "output"
@@ -151,9 +152,11 @@ def quasi_probabilities(
         """
         if qubits is None:
             qubits = self._qubits
-        probs_vec, shots = counts_probability_vector(
+        probs_vec, calculated_shots = counts_probability_vector(
             data, qubit_index=self._qubit_index, clbits=clbits, qubits=qubits
         )
+        if shots is None:
+            shots = calculated_shots
 
         # Get qubit mitigation matrix and mitigate probs
         mit_mat = self.mitigation_matrix(qubits)
diff --git a/qiskit/result/mitigation/local_readout_mitigator.py b/qiskit/result/mitigation/local_readout_mitigator.py
--- a/qiskit/result/mitigation/local_readout_mitigator.py
+++ b/qiskit/result/mitigation/local_readout_mitigator.py
@@ -169,7 +169,7 @@ def quasi_probabilities(
         data: Counts,
         qubits: Optional[List[int]] = None,
         clbits: Optional[List[int]] = None,
-        shots: Optional[bool] = False,
+        shots: Optional[int] = None,
     ) -> QuasiDistribution:
         """Compute mitigated quasi probabilities value.
 
@@ -177,7 +177,8 @@ def quasi_probabilities(
             data: counts object
             qubits: qubits the count bitstrings correspond to.
             clbits: Optional, marginalize counts to just these bits.
-            shots: the number of shots.
+            shots: Optional, the total number of shots, if None shots will
+                be calculated as the sum of all counts.
 
         Returns:
             QuasiDistibution: A dictionary containing pairs of [output, mean] where "output"
@@ -193,9 +194,11 @@ def quasi_probabilities(
 
         num_qubits = len(qubits)
 
-        probs_vec, shots = counts_probability_vector(
+        probs_vec, calculated_shots = counts_probability_vector(
             data, qubit_index=self._qubit_index, clbits=clbits, qubits=qubits
         )
+        if shots is None:
+            shots = calculated_shots
 
         # Get qubit mitigation matrix and mitigate probs
         qubit_indices = [self._qubit_index[qubit] for qubit in qubits]
@@ -214,7 +217,7 @@ def quasi_probabilities(
             probs_dict[index] = probs_vec[index]
 
         quasi_dist = QuasiDistribution(
-            probs_dict, stddev_upper_bound=self.stddev_upper_bound(shots, qubits)
+            probs_dict, shots=shots, stddev_upper_bound=self.stddev_upper_bound(shots, qubits)
         )
         return quasi_dist
 
diff --git a/qiskit/result/mitigation/utils.py b/qiskit/result/mitigation/utils.py
--- a/qiskit/result/mitigation/utils.py
+++ b/qiskit/result/mitigation/utils.py
@@ -149,6 +149,7 @@ def counts_probability_vector(
 
     Returns:
         np.ndarray: a probability vector for all count outcomes.
+        int: Number of shots in the counts
     """
     counts = marganalize_counts(counts, qubit_index, qubits, clbits)
     if qubits is not None:


Test patch:
diff --git a/test/python/result/test_mitigators.py b/test/python/result/test_mitigators.py
--- a/test/python/result/test_mitigators.py
+++ b/test/python/result/test_mitigators.py
@@ -442,6 +442,20 @@ def test_expectation_value_endian(self):
             expval, _ = mitigator.expectation_value(counts, diagonal="IZ", qubits=[0, 1])
             self.assertAlmostEqual(expval, -1.0, places=0)
 
+    def test_quasi_probabilities_shots_passing(self):
+        """Test output of LocalReadoutMitigator.quasi_probabilities
+
+        We require the number of shots to be set in the output.
+        """
+        mitigator = LocalReadoutMitigator([np.array([[0.9, 0.1], [0.1, 0.9]])], qubits=[0])
+        counts = Counts({"10": 3, "11": 24, "00": 74, "01": 923})
+        quasi_dist = mitigator.quasi_probabilities(counts)
+        self.assertEqual(quasi_dist.shots, sum(counts.values()))
+
+        # custom number of shots
+        quasi_dist = mitigator.quasi_probabilities(counts, shots=1025)
+        self.assertEqual(quasi_dist.shots, 1025)
+
 
 class TestLocalReadoutMitigation(QiskitTestCase):
     """Tests specific to the local readout mitigator"""