From fc6a7008ac0f76adb702d25537f479c4efd19213 Mon Sep 17 00:00:00 2001 From: Nicolas Renaud Date: Tue, 21 May 2024 17:07:08 +0200 Subject: [PATCH] rename get state vector for consistency --- qiskit_tomography_toolbox/base_tomography.py | 4 ++-- qiskit_tomography_toolbox/htree_qst.py | 4 ++-- qiskit_tomography_toolbox/qst.py | 2 +- qiskit_tomography_toolbox/shadow_qst.py | 2 +- qiskit_tomography_toolbox/simulator_qst.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/qiskit_tomography_toolbox/base_tomography.py b/qiskit_tomography_toolbox/base_tomography.py index b2ba906..4200943 100644 --- a/qiskit_tomography_toolbox/base_tomography.py +++ b/qiskit_tomography_toolbox/base_tomography.py @@ -6,7 +6,7 @@ class BaseTomography(ABC): """Abstract base class for the tomography.""" @abstractmethod - def get_statevector(self, parameters: np.ndarray) -> np.ndarray: + def get_state_vector(self, parameters: np.ndarray) -> np.ndarray: """Get the statevector of the circuit Args: @@ -15,7 +15,7 @@ def get_statevector(self, parameters: np.ndarray) -> np.ndarray: Returns: np.ndarray: state vector """ - raise NotImplementedError("Implmenent a get_statevector method") + raise NotImplementedError("Implmenent a get_state_vector method") @abstractmethod def get_density_matrix(self, parameters: np.ndarray) -> np.ndarray: diff --git a/qiskit_tomography_toolbox/htree_qst.py b/qiskit_tomography_toolbox/htree_qst.py index 8ad2b38..7ac7e99 100644 --- a/qiskit_tomography_toolbox/htree_qst.py +++ b/qiskit_tomography_toolbox/htree_qst.py @@ -211,7 +211,7 @@ def get_relative_amplitude_sign(self, parameters: np.ndarray) -> np.ndarray: weights = self.get_weight(samples) return self.get_signs(weights) - def get_statevector(self, parameters: np.ndarray) -> np.ndarray: + def get_state_vector(self, parameters: np.ndarray) -> np.ndarray: """Get the statevector of the circuit Args: @@ -236,5 +236,5 @@ def get_density_matrix(self, parameters: np.ndarray) -> np.ndarray: Returns: np.ndarray: density matrix """ - vector = self.get_statevector(parameters) + vector = self.get_state_vector(parameters) return np.outer(vector, vector) diff --git a/qiskit_tomography_toolbox/qst.py b/qiskit_tomography_toolbox/qst.py index 4fe0087..034779f 100644 --- a/qiskit_tomography_toolbox/qst.py +++ b/qiskit_tomography_toolbox/qst.py @@ -71,7 +71,7 @@ def get_density_matrix(self, parameters: np.ndarray): qstdata1 = qstexp1.run(self.backend, shots=self.shots).block_for_results() return qstdata1.analysis_results("state").value.data.real - def get_statevector(self, parameters: np.ndarray) -> np.ndarray: + def get_state_vector(self, parameters: np.ndarray) -> np.ndarray: """Get the statevector. Args: diff --git a/qiskit_tomography_toolbox/shadow_qst.py b/qiskit_tomography_toolbox/shadow_qst.py index 02d822f..f90db21 100644 --- a/qiskit_tomography_toolbox/shadow_qst.py +++ b/qiskit_tomography_toolbox/shadow_qst.py @@ -222,7 +222,7 @@ def get_amplitudes(self, parameters: np.ndarray) -> np.ndarray: samples.append(proba) return np.sqrt(samples[0]) - def get_statevector( + def get_state_vector( self, parameters: np.ndarray, samples: Optional[Union[List, None]] = None, diff --git a/qiskit_tomography_toolbox/simulator_qst.py b/qiskit_tomography_toolbox/simulator_qst.py index 5efd36a..aa55ebb 100644 --- a/qiskit_tomography_toolbox/simulator_qst.py +++ b/qiskit_tomography_toolbox/simulator_qst.py @@ -31,7 +31,7 @@ def get_relative_amplitude_sign(self, parameters: np.ndarray): ).data.real return np.sign(state_vector) - def get_statevector( + def get_state_vector( self, parameters: np.ndarray, **kwargs ): # pylint: disable=unused-argument """Get the state vector of the circuit. @@ -49,5 +49,5 @@ def get_density_matrix(self, parameters: np.ndarray) -> np.ndarray: Returns: np.ndarray: density matrix """ - vector = self.get_statevector(parameters) + vector = self.get_state_vector(parameters) return np.outer(vector, vector)